Drupal 8 Twig templates comments syntax

As a quick note, the Drupal 8 Twig template comment syntax looks like this:

{# this is a comment #}

The Twig multiline comment syntax uses the same characters:

   This is a comment.
   More comments ...
   Even more comments ...
How to configure Share Buttons by AddToAny with Drupal 8 alvin May 13, 2017 - 6:17pm

As a quick “note to self,” to get the Share Buttons module by AddToAny working in Drupal 8, I followed these steps:

- install the AddToAny module
- configure permissions so i could work with it
    - admin/people/permissions
- configure AddToAny as desired
    - admin/config/services/addtoany
- create a block, add it to a region (such as Content)
    - i actually created a block, then modified
      my theme to show AddToAny between the Contents and
      the Comments

The key to getting AddToAny was knowing to go to admin/structure/block and then selecting “Place Block” to create an AddToAny block. Not knowing that I had to do that slowed me down for quite a while.

Don’t let the programming jerks get you down

In the last two days I saw two more examples where programmers on the internet were being jerks (for lack of a better term). In one case, someone wrote that a project needed to be documented better, and Jerk #1 wrote that in his opinion, the code probably needed to be more clear. Um, no, the first person was talking about documentation for newbies trying to learn about the project. That has nothing to do with code internals.

In the second case, a programmer shared some information that he had worked hard on, and Jerk #2 wrote, “Don’t you know about xzy?” It turned out that the first programmer did know about xyz, but that wasn’t even important. The point was that the jerk could have written his question much more kindly (such as, “Hey, do you know about xyz? If so, how does that fit in with your work?”).

As you can gather from these stories, both of the jerks were actually being lazy, and just fired off their comments without putting any thought or research into their statements, like they were saying, “Hey, I’m having a bad day, or I’m just a jerk, so here’s a thoughtless comment on your work.”

The moral of this little post is that (a) for some reason, some people in the world can be real jerks, and (b) don’t let the jerks get you down.

Good code is its own best documentation (Steve McConnell) alvin July 16, 2016 - 10:30am

“Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’ Improve the code and then document it to make it even clearer.”

~ Steve McConnell, author of several famous programming books, including Code Complete

Markdown comments syntax: Comments that won’t appear in generated output

Markdown FAQ: How do I create comments in Markdown? Especially comments that won’t appear in the generated output.

Part 1 of my answer is that technically there is no way — or at least no standard way — to create comments in Markdown documents, other than to use HTML comments like this:

Insulting comments

It’s crazy how many people write insulting comments when I make a mistake in a blog post. In the most recent example, instead of someone saying something helpful like, “You have a 1 in this function and it should be a 0,” someone wrote something else that I won’t bother to repeat here. Crazy.

Fortunately Mollom has different options where I can report comments like those as “profane,” “low quality,” “taunting,” or “unwanted.” I used to get upset by those comments, but now I just report them to Mollom, hoping it will help blacklist those people from commenting on my site and other sites.