<?xml version="1.0" encoding="utf-8" ?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:tt="http://teletype.in/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"><title>Viktor Klymentiev</title><subtitle>A software developer, formerly startups co-founder &amp; CTO</subtitle><author><name>Viktor Klymentiev</name></author><id>https://teletype.in/atom/yondertype</id><link rel="self" type="application/atom+xml" href="https://teletype.in/atom/yondertype?offset=0"></link><link rel="alternate" type="text/html" href="https://teletype.in/@yondertype?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=yondertype"></link><link rel="next" type="application/rss+xml" href="https://teletype.in/atom/yondertype?offset=10"></link><link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></link><updated>2026-04-28T21:08:22.058Z</updated><entry><id>yondertype:how-to-remove-and-disable-all-cookies-in-js</id><link rel="alternate" type="text/html" href="https://teletype.in/@yondertype/how-to-remove-and-disable-all-cookies-in-js?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=yondertype"></link><title>In JS, how to remove all cookies and disable them?</title><published>2022-10-24T15:59:51.820Z</published><updated>2022-10-24T16:03:32.369Z</updated><category term="js" label="JS"></category><summary type="html">For situations, like, for example, a user withdraws their consent to use cookies, you can delete all existing cookies:</summary><content type="html">
  &lt;p id=&quot;d0nK&quot;&gt;For situations, like, for example, a user withdraws their consent to use cookies, you can delete all existing cookies:&lt;/p&gt;
  &lt;pre id=&quot;JF0Z&quot;&gt;function deleteCookies() {
    var theCookies = document.cookie.split(&amp;#x27;;&amp;#x27;);
    for (var i = 0 ; i &amp;lt; theCookies.length; i++) {
        document.cookie = theCookies[i].split(&amp;#x27;=&amp;#x27;)[0] + &amp;#x27;=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;&amp;#x27;;
    }
}&lt;/pre&gt;
  &lt;p id=&quot;HpcT&quot;&gt;And then disable them by overriding a getter and setter:&lt;/p&gt;
  &lt;pre id=&quot;c1p6&quot;&gt;if(!document.__defineGetter__) {
Object.defineProperty(document, &amp;#x27;cookie&amp;#x27;, {
    get: function(){return &amp;#x27;&amp;#x27;},
    set: function(){return true},
});
} else {
    document.__defineGetter__(&amp;quot;cookie&amp;quot;, function() { return &amp;#x27;&amp;#x27;;} );
    document.__defineSetter__(&amp;quot;cookie&amp;quot;, function() {} );
}&lt;/pre&gt;

</content></entry><entry><id>yondertype:how-to-stop-or-remove-all-docker-containers</id><link rel="alternate" type="text/html" href="https://teletype.in/@yondertype/how-to-stop-or-remove-all-docker-containers?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=yondertype"></link><title>In console, how to stop or remove all Docker containers?</title><published>2022-01-22T11:08:39.368Z</published><updated>2022-01-22T11:10:04.636Z</updated><category term="docker" label="Docker"></category><tt:hashtag>docker</tt:hashtag><tt:hashtag>howto</tt:hashtag><summary type="html">One-liner to stop or remove all of Docker containers:</summary><content type="html">
  &lt;p id=&quot;IrwZ&quot;&gt;One-liner to stop or remove all of Docker containers:&lt;/p&gt;
  &lt;pre id=&quot;zNLJ&quot;&gt;docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)&lt;/pre&gt;
  &lt;tt-tags id=&quot;wCXT&quot;&gt;
    &lt;tt-tag name=&quot;docker&quot;&gt;#docker&lt;/tt-tag&gt;
    &lt;tt-tag name=&quot;howto&quot;&gt;#howto&lt;/tt-tag&gt;
  &lt;/tt-tags&gt;

</content></entry><entry><id>yondertype:how-to-squash-commits-in-git</id><link rel="alternate" type="text/html" href="https://teletype.in/@yondertype/how-to-squash-commits-in-git?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=yondertype"></link><title>In Git, how to squash commits?</title><published>2021-12-20T10:07:31.296Z</published><updated>2022-01-22T11:23:15.333Z</updated><category term="git-and-github" label="Git &amp;amp; GitHub"></category><tt:hashtag>git</tt:hashtag><tt:hashtag>howto</tt:hashtag><summary type="html">First, let's find out how many commits need to be squashed into one. This command will show you what commits you have added compared to the master branch:</summary><content type="html">
  &lt;p id=&quot;nMa5&quot;&gt;First, let&amp;#x27;s find out how many commits need to be squashed into one. This command will show you what commits you have added compared to the master branch:&lt;/p&gt;
  &lt;pre id=&quot;sJ54&quot;&gt;git cherry -v master&lt;/pre&gt;
  &lt;p id=&quot;8Qnt&quot;&gt;And this one will show you how much of them:&lt;/p&gt;
  &lt;pre id=&quot;KRKD&quot;&gt;git cherry -v master | wc -l&lt;/pre&gt;
  &lt;p id=&quot;nrgH&quot;&gt;For example,&lt;/p&gt;
  &lt;pre id=&quot;bwDl&quot;&gt;&amp;gt; $ git cherry -v master
+ edb880bb972736eebdc86c55a158e659c787b769 check url
+ 16817774ffc4ece00d9a7c75cf26f9a93cd90eda improved readability
+ 8db9d67018394a5a1e1215943ddfe002a25ccc08 tests

&amp;gt; $ git cherry -v master | wc -l
       3&lt;/pre&gt;
  &lt;p id=&quot;CPxj&quot;&gt;Great! I have 3 commits ahead &lt;code&gt;master&lt;/code&gt;. Now I want to rewrite history since &lt;code&gt;HEAD~3&lt;/code&gt;, i.e. from what was 3 commits ago. To do this, I do:&lt;/p&gt;
  &lt;pre id=&quot;Sw0q&quot;&gt;git rebase -i HEAD~3&lt;/pre&gt;
  &lt;p id=&quot;OEf6&quot;&gt;The &lt;code&gt;-i&lt;/code&gt; flag means interactively. I have a file like this:&lt;/p&gt;
  &lt;pre id=&quot;4eXQ&quot;&gt;hint: Waiting for your editor to close the file... 
pick edb880bb check url
pick 16817774 improved readability
pick 8db9d670 tests

# Rebase 10def359..8db9d670 onto 10def359 (3 commands)
#
# Commands:
# p, pick &amp;lt;commit&amp;gt; = use commit
# r, reword &amp;lt;commit&amp;gt; = use commit, but edit the commit message
# e, edit &amp;lt;commit&amp;gt; = use commit, but stop for amending
# s, squash &amp;lt;commit&amp;gt; = use commit, but meld into previous commit
# f, fixup [-C | -c] &amp;lt;commit&amp;gt; = like &amp;quot;squash&amp;quot; but keep only the previous
#                    commit&amp;#x27;s log message, unless -C is used, in which case
#                    keep only this commit&amp;#x27;s message; -c is same as -C but
#                    opens the editor
# x, exec &amp;lt;command&amp;gt; = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with &amp;#x27;git rebase --continue&amp;#x27;)
# d, drop &amp;lt;commit&amp;gt; = remove commit
# l, label &amp;lt;label&amp;gt; = label current HEAD with a name
# t, reset &amp;lt;label&amp;gt; = reset HEAD to a label
# m, merge [-C &amp;lt;commit&amp;gt; | -c &amp;lt;commit&amp;gt;] &amp;lt;label&amp;gt; [# &amp;lt;oneline&amp;gt;]
# .       create a merge commit using the original merge commit&amp;#x27;s
# .       message (or the oneline, if no original merge commit was
# .       specified); use -c &amp;lt;commit&amp;gt; to reword the commit message
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
&lt;/pre&gt;
  &lt;p id=&quot;k2HC&quot;&gt;Here&amp;#x27;s a list of my commits and a big comment on what I can do. From the list of commands, you can see that we can use &lt;code&gt;squash&lt;/code&gt; or &lt;code&gt;fixup&lt;/code&gt; in order to squash commits. The first is useful when you want to change the commit message, and the second when you want to use the commit message of the first. So, to squash all the commits, I do like this:&lt;/p&gt;
  &lt;pre id=&quot;K67h&quot;&gt;hint: Waiting for your editor to close the file... 
pick edb880bb check url
squash 16817774 improved readability
squash 8db9d670 tests

# Rebase 10def359..8db9d670 onto 10def359 (3 commands)
#
# Commands:
# p, pick &amp;lt;commit&amp;gt; = use commit
# r, reword &amp;lt;commit&amp;gt; = use commit, but edit the commit message
# e, edit &amp;lt;commit&amp;gt; = use commit, but stop for amending
# s, squash &amp;lt;commit&amp;gt; = use commit, but meld into previous commit
# f, fixup [-C | -c] &amp;lt;commit&amp;gt; = like &amp;quot;squash&amp;quot; but keep only the previous
#                    commit&amp;#x27;s log message, unless -C is used, in which case
#                    keep only this commit&amp;#x27;s message; -c is same as -C but
#                    opens the editor
# x, exec &amp;lt;command&amp;gt; = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with &amp;#x27;git rebase --continue&amp;#x27;)
# d, drop &amp;lt;commit&amp;gt; = remove commit
# l, label &amp;lt;label&amp;gt; = label current HEAD with a name
# t, reset &amp;lt;label&amp;gt; = reset HEAD to a label
# m, merge [-C &amp;lt;commit&amp;gt; | -c &amp;lt;commit&amp;gt;] &amp;lt;label&amp;gt; [# &amp;lt;oneline&amp;gt;]
# .       create a merge commit using the original merge commit&amp;#x27;s
# .       message (or the oneline, if no original merge commit was
# .       specified); use -c &amp;lt;commit&amp;gt; to reword the commit message
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
&lt;/pre&gt;
  &lt;p id=&quot;grmG&quot;&gt;Then git glues the commits and prompts me to enter the commit message (shows the commit messages of all the merged commits). You can leave it as is or change to whatever you want.&lt;/p&gt;
  &lt;p id=&quot;xQwW&quot;&gt;Finally, save the file and quit the editor. You can now type &lt;code&gt;git log&lt;/code&gt; and see your single commit that contains 3 commits we were squashing.&lt;/p&gt;
  &lt;p id=&quot;ofJY&quot;&gt;Don&amp;#x27;t forget to force-push like you do after any rebase:&lt;/p&gt;
  &lt;pre id=&quot;7i57&quot;&gt;git push -f&lt;/pre&gt;
  &lt;p id=&quot;tS5b&quot;&gt;That&amp;#x27;s it. Enjoy!&lt;/p&gt;
  &lt;tt-tags id=&quot;Jx0I&quot;&gt;
    &lt;tt-tag name=&quot;git&quot;&gt;#git&lt;/tt-tag&gt;
    &lt;tt-tag name=&quot;howto&quot;&gt;#howto&lt;/tt-tag&gt;
  &lt;/tt-tags&gt;

</content></entry><entry><id>yondertype:how-to-change-the-default-editor-in-git</id><link rel="alternate" type="text/html" href="https://teletype.in/@yondertype/how-to-change-the-default-editor-in-git?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=yondertype"></link><title>In Git, how to change the default editor?</title><published>2021-12-19T15:56:17.833Z</published><updated>2021-12-19T16:28:26.828Z</updated><category term="git-and-github" label="Git &amp;amp; GitHub"></category><tt:hashtag>git</tt:hashtag><tt:hashtag>howto</tt:hashtag><summary type="html">As you know, for many specific operations git opens a text editor. On macOS and Linux, this is Vim by default. Not the most beginner-friendly editor I'd say. To make you comfortable, set your favorite editor as the git editor with just one command:</summary><content type="html">
  &lt;p id=&quot;lClb&quot;&gt;As you know, for many specific operations git opens a text editor. On &lt;em&gt;macOS&lt;/em&gt; and &lt;em&gt;Linux&lt;/em&gt;, this is &lt;em&gt;Vim&lt;/em&gt; by default. Not the most beginner-friendly editor I&amp;#x27;d say. To make you comfortable, set your favorite editor as the git editor with just one command:&lt;/p&gt;
  &lt;pre id=&quot;sEED&quot;&gt;git config --global core.editor &amp;quot;path to your editor with params&amp;quot;&lt;/pre&gt;
  &lt;p id=&quot;Ize5&quot;&gt;Then check it by making a commit:&lt;/p&gt;
  &lt;pre id=&quot;1j2p&quot;&gt;git commit --allow-empty&lt;/pre&gt;
  &lt;p id=&quot;vETs&quot;&gt;Your favorite editor should open. Write a commit message, save and close the file. See &lt;code&gt;git log&lt;/code&gt; to look for a commit. Is it there? If yes, you’re awesome.&lt;/p&gt;
  &lt;p id=&quot;VrXc&quot;&gt;&lt;/p&gt;
  &lt;p id=&quot;WslR&quot;&gt;Here are the commands for the popular editors:&lt;/p&gt;
  &lt;h3 id=&quot;7ypY&quot;&gt;VS Code&lt;/h3&gt;
  &lt;p id=&quot;mKnp&quot;&gt;In VS Code press &lt;strong&gt;⌘⇧P&lt;/strong&gt; and select &lt;strong&gt;Shell Command: Install &amp;#x27;code&amp;#x27; command in PATH&lt;/strong&gt; from the list. Then run:&lt;/p&gt;
  &lt;pre id=&quot;PoAS&quot;&gt;git config --global core.editor &amp;quot;code --wait&amp;quot;&lt;/pre&gt;
  &lt;h3 id=&quot;qScZ&quot;&gt;TextEdit&lt;/h3&gt;
  &lt;pre id=&quot;76Ys&quot;&gt;git config --global core.editor &amp;quot;open -W -n&amp;quot;&lt;/pre&gt;
  &lt;h3 id=&quot;GJdQ&quot;&gt;Atom&lt;/h3&gt;
  &lt;pre id=&quot;Bufj&quot;&gt;git config --global core.editor &amp;quot;atom --wait&amp;quot;&lt;/pre&gt;
  &lt;h3 id=&quot;lThP&quot;&gt;Sublime Text 3&lt;/h3&gt;
  &lt;pre id=&quot;7SSx&quot;&gt;git config --global core.editor &amp;#x27;&amp;quot;/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl&amp;quot; -n -w&amp;#x27;&lt;/pre&gt;
  &lt;p id=&quot;tOha&quot;&gt;&lt;/p&gt;
  &lt;tt-tags id=&quot;Zzo3&quot;&gt;
    &lt;tt-tag name=&quot;git&quot;&gt;#git&lt;/tt-tag&gt;
    &lt;tt-tag name=&quot;howto&quot;&gt;#howto&lt;/tt-tag&gt;
  &lt;/tt-tags&gt;

</content></entry><entry><id>yondertype:a-way-to-determine-if-a-module-exists-in-elixir</id><link rel="alternate" type="text/html" href="https://teletype.in/@yondertype/a-way-to-determine-if-a-module-exists-in-elixir?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=yondertype"></link><title>In Elixir, is there a way to determine if a module exists?</title><published>2021-12-18T16:43:03.967Z</published><updated>2021-12-18T16:43:03.967Z</updated><category term="elixir" label="Elixir"></category><tt:hashtag>elixir</tt:hashtag><tt:hashtag>programming</tt:hashtag><tt:hashtag>howto</tt:hashtag><summary type="html">You can use Code.ensure_compiled?/1, but there is a side effect: it will also attempt to load the module if it is not already, which may not be desired (depending on the use-case).</summary><content type="html">
  &lt;p id=&quot;DTRp&quot;&gt;You can use &lt;code&gt;Code.ensure_compiled?/1&lt;/code&gt;, but there is a side effect: it will also attempt to load the module if it is not already, which may not be desired (depending on the use-case).&lt;/p&gt;
  &lt;p id=&quot;NdiC&quot;&gt;Here is an approach that should work without any side effects:&lt;/p&gt;
  &lt;pre id=&quot;vGoU&quot;&gt;iex&amp;gt; function_exported?(String, :__info__, 1)
true

iex&amp;gt; function_exported?(NoModule, :__info__, 1)
false&lt;/pre&gt;
  &lt;p id=&quot;B1f6&quot;&gt;Elixir modules export &lt;code&gt;:__info__/1&lt;/code&gt; so testing for it provides a generic solution.&lt;/p&gt;
  &lt;tt-tags id=&quot;xmxw&quot;&gt;
    &lt;tt-tag name=&quot;elixir&quot;&gt;#elixir&lt;/tt-tag&gt;
    &lt;tt-tag name=&quot;programming&quot;&gt;#programming&lt;/tt-tag&gt;
    &lt;tt-tag name=&quot;howto&quot;&gt;#howto&lt;/tt-tag&gt;
  &lt;/tt-tags&gt;

</content></entry><entry><id>yondertype:SgoDtFC8uM6</id><link rel="alternate" type="text/html" href="https://teletype.in/@yondertype/SgoDtFC8uM6?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=yondertype"></link><title>Okay, Houston, we've had a problem here</title><published>2021-12-13T15:47:06.039Z</published><updated>2021-12-13T15:50:27.599Z</updated><summary type="html">Today I decided to create my own blog to share with you folks some expert advices, tips and tricks I face at my work projects. It wasn't easy. Actually, this is the third attempt to create a blog today. 🤦‍♂️ Something went wrong during previous two tries – my newly created blog has disappeared. Like I never created it before. Hope it doesn't happen again. :)</summary><content type="html">
  &lt;p id=&quot;DH09&quot;&gt;Today I decided to create my own blog to share with you folks some expert advices, tips and tricks I face at my work projects. It wasn&amp;#x27;t easy. Actually, this is the third attempt to create a blog today. 🤦‍♂️ Something went wrong during previous two tries – my newly created blog has disappeared. Like I never created it before. Hope it doesn&amp;#x27;t happen again. :)&lt;/p&gt;
  &lt;p id=&quot;8IBq&quot;&gt;As you already know, not every problem can be easily solved by googling, so I hope this blog will be helpful in that direction. It also should be useful for me, because over time I forget many things that are difficult to recover.&lt;/p&gt;
  &lt;p id=&quot;lfkI&quot;&gt;Well, yay! 🙌 Have a nice day and see you in the next post!&lt;/p&gt;

</content></entry></feed>