Topics

All posts

Help! I created too many changes and want to make separate commits – git add interactive, patching and branching

Help! I created too many changes and want to make separate commits – git add interactive, patching and branching

There are cases when you try to add a feature, but before it’s done, a new problem arises and you try to resolve it. At the end of the day you end up with several things solved, but no commits yet. Some people prefer big and messy commits that include all the work for the past week, but I tend to have one issue solved in one commit. What are your options to keep a clean repository in this situation?

Read More Read More

Online mind mapping tools

Online mind mapping tools

I’ve been using mind mapping tools for years for creating plans or elaborating ideas. So far, my favorite offline software was FreeMind. It hasn’t been updated for years, but it is open source and has impressive features, like formatting nodes, icons, good keyboard support, adding links, colorful clouds for branches, and much more. Just take a look at the screenshot in Wikipedia. Today I decided to look for some online alternative for easier access on any device (also mobile) and simplified sharing.

Read More Read More

WordPress – another way to add widgets area (sidebar) below a post

WordPress – another way to add widgets area (sidebar) below a post

Previously I described one method to add custom widgets areas by copying and modifying theme files:

Now I’d like to describe another possibility when it comes to adding widgets area above or below a post or page – by adding the_content filter.

Read More Read More

How I refactored maze generating Python code and used advanced class features

How I refactored maze generating Python code and used advanced class features

Previously, I have created a maze generating code while learning Python. Later I enhanced it with animation and marking special cells. All of it was done in rush, to solve the problem. Now I spent some time improving the quality of the code by encapsulating code into classes, using “private” methods and fields and separating concerns. The exact steps I took can be viewed in the GitHub repository or read here.

Read More Read More

Recursive Backtracker maze – more features and animation with Matplotlib and Python

Recursive Backtracker maze – more features and animation with Matplotlib and Python

In the previous post, I generated a simple maze. I wasn’t sure the algorithm worked as intended unless I debugged or animated it. I chose the second option. I also added marking the beginning and end of the maze quest.

Read More Read More

Maze generation algorithm in Python – drawing and arrays

Maze generation algorithm in Python – drawing and arrays

There are plenty of maze generation algorithms, some are described here and here. I decided to use one to learn some Python. I chose Recursive Backtracker. You can find longer descriptions in both links, but briefly:

  • choose a random cell in the maze
  • walk in a random direction
  • when there is no possibility to walk farther, go back (backtrack) to find the first cell from which it is possible to proceed
  • the algorithm ends when there is no possibility to move from any cell

Read More Read More

My favorite graphing tool – Graphviz

My favorite graphing tool – Graphviz

I used to create many graphs, usually the kind of dependency/hierarchy (see the previous post about Programming paradigms in JavaScript).

A long time ago I discovered a perfect tool for a developer to create and maintain various graphs – Graphviz. You can download it and use offline, but there are also online interpreters for quick experiments, for example:

Read More Read More

Programming paradigms in JavaScript – callbacks, Promise, async/await, promisify, functional Ramda and reactive RxJS

Programming paradigms in JavaScript – callbacks, Promise, async/await, promisify, functional Ramda and reactive RxJS

As a quick exercise, I wanted to read all URLs from my page’s sitemap instead of crawling the site. Just after I added a nested callback I decided to apply the Single Responsibility Principle and convert calls to Promises. Later I experimented with async/await and automatic conversion with Node’s promisify. Finally, I rewrote the solution in functional style using Ramda and reactive using RxJS. Read on to follow the evolution of callbacks in JavaScript.

Read More Read More

CSS – two headers – big and smaller sticky

CSS – two headers – big and smaller sticky

In modern web, you often see pages that have a big fancy header with a menu. It would be impractical to keep that menu visible all the time when scrolling because it would occupy too much of screen space. Therefore those pages often introduce a smaller header just with the navigation and logo that will be displayed as user scrolls down. I will show how to easily create such a header and add some animation to it.

Read More Read More

JavaScript – hoisting, var, let, const

JavaScript – hoisting, var, let, const

This post is a quick summary of the differences in JavaScript variable declaration.

Before ES2015 (previously named ES6), there was only one keyword to declare variables: var. The newer standard introduced two extra useful keywords: let and const.

Briefly:

  • var declares “almost global” variables
  • let declares block variables
  • const declares block read-only variables

Explanation follows.

Read More Read More