What I learned in work this week - collegiality, productivity and AST's

Getting Things Done

This week, I attended a workshop on Getting Things Done (GTD) which introduced me to some of the concepts from the book by David Allen. The workshop covered several important points, including:

  • The importance of capturing and organizing all of your tasks and projects in a reliable system.
  • The need to prioritize tasks and projects based on their level of urgency and importance.
  • The "two-minute rule," which suggests that if a task can be completed in two minutes or less, it should be done immediately.
  • The "someday/maybe" list, which is a list of tasks or projects that you want to work on someday but are not currently a priority. I will start doing this in relation to learning. I often come across things I don't have time to learn but look interesting. When I get time to study, I could draw from this list.

GTD workflow

Collegiality

I attended a workshop about communication and work culture where I learned about the importance of knowing the people you work with. The speaker put us on to a TED talk which is very interesting, Margaret Heffernan - "Forget the pecking order at work". As someone who tends to be private by nature, I realized that I need to make a conscious effort to build stronger relationships with my colleagues, as this can lead to more effective collaboration and better outcomes for the team.

Reflecting on my recent work, I realized that trying to overachieve caused me to not seek as much input as I could have from my more experienced teammates, probably slowing the task down and not implementing the optimal solution for the task. Going forward, I hope this will be something I get better at.

AST

An AST is a tree-like representation of code, that compilers and transpilers use. For example, the popular transpiler Babel uses AST to transpile ES6 code into older versions of JavaScript.

This site, Codu, uses a markdown editor called Markdoc for writing blog posts. Markdoc uses AST to transform the blog we write into a valid html. have a look at this AST representation of an anchor tag or link node as its known to markdoc to get an idea.

  "type": "element",
  "tagName": "a",
  "properties": {
    "href": "https://www.mysite.com"
  },
  "children": [
    {
      "type": "text",
      "value": "link"
    }
  ]
}

The transpiler uses this AST representation to output the HTML representation of the anchor tag:

<a href="https://www.mysite.com">link</a>

Here is an example of a custom node which alters how anchor tags are rendered.

import { Tag } from '@markdoc/markdoc';

const link = {
  children: ['text'],
  attributes: {
    href: { type: String, required: true },
    title: { type: String }
  },
  transform(node, config) {
    const attributes = node.transformAttributes(config);
    const children = node.transformChildren(config);
    const href = attributes.href;

    if (!/^(f|ht)tps?:\/\//i.test(href)) {
      attributes.href = 'http://' + href;
    }

    return new Tag(
      'a',
      {
        ...attributes,
        target: '_blank',
        rel: 'noopener'
      },
      children
    );
  }
};

export default link;

In the future, this will hopefully enable Codu articles that use links to open in a new tab.

Speaking of which, Codu is an open-source project and I encourage you very much to contribute to its development. The repo is here: codu repo

All the best,

Daniel.

Avatar for Daniel Callaghan

Written by Daniel Callaghan

Software engineer at Guidewire Software. I like React, next and board games.

Loading

Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.