NOTE: More coming soon! I will gradually tag articles. š
- js 24
- coding 21
- writing 10
- tdd 7
- hackathon 5
- productivity 5
- side-projects 5
- vim 5
- dev 4
- learning 3
- make 3
- unit-testing 3
- unix 3
- architecture 2
- css 2
- dependencies 2
- grep 2
- peace 2
- scripting 2
- angular 1
- balance 1
- build 1
- clarity 1
- constraints 1
- development 1
- dns 1
- docker 1
- ease-into-it 1
- email 1
- git 1
- google apps script 1
- infrastructure 1
- jekyll 1
- shell-scripting 1
- smtp 1
- tech 1
- ts 1
- webapp 1
js
Transactional tests with Mocha.js
This week, while working on the email change scenario on my side project, I realized that my tests are not transactional, which meant that their changes to the DB could persist across test runs and so tests could influence each other. Hmā¦ I thought I fixed this before.
JS hoisting gotcha
JS finding of the week: event.code
This morning I was working on a DropdownButton
widget:
Testing location change in JS
Every now and then I come across a scenario where I need to unit-test
some code that navigates across pages by directly changing location.
Some time ago I have accidentally stumbled upon a solution: the
location.assign()
function.
Expressive JS:Ā askToConfirm
The other day at my day job I needed to change some buttons to ask for confirmation before executing the actual action.
Thoughts on Redux
Last weekend Iāve watched the free introduction on Redux and I think I got it. Redux has:
Wheel re-inventing: executeInParallel
At my day job we often need to write low-level JS code without any
framework or library handy, and we often end up re-inventing some of the
wheels. executeInParallel
is one of those wheels:
The indexOf problem
I have recently read this article
āDonāt Make Me Remember Thingsā
where the author complains about stringās indexOf
method having
less-than-ideal API. Specifically, about the case when the sought
substring is not found: indexOf
usually returns a nonsense value like
null
or -1
, and the developer has to remember that, which leads to
bugs.
FP-style conditional callbacks
The other day I was putting together a little UI to collect emails: an input and a button. So I wanted the email to be take in when the user clicks the button:
JS promise recursion
The other day I wanted to get some data from an API. The API is giving the information paginated, so I have to fetch it page by page.
OOP and FP nicely mixed in JS
OOP wants together behavior and data that change together. FP wants behavior and data separate so that the behavior can be used with more than one kind of data. JS makes the two collaborate well āfor a greater good.ā
My new old JS module system
A few months ago Iāve switched one of my side projects from CommonJS modules to plain JS namespaces, and in this post Iāll explain why.
My JSĀ enum type
For my PersonSection
widget I needed to have a PERSON_TYPES
constant.
Why I like function hoisting in JS
There is this phenomenon in JS called āfunction hoisting.ā Itās regarded as odd to newcomers but I found it improving code readability and use it every day.
FP vs. OOP: input
I often think about how Functional Programming (FP) compares to Object Oriented Programming (OOP).
Oiling promise chains
When working with asynchronous procedures in Node, I find promise chains help me write pretty readable linear-looking code:
Promises as before filters
The Firebase JS library is callback-based, which feels pretty cumbersome after I got used to promises. So, the other day I wanted to have a FirebaseClient object that given a Firebase URL and credentials would give me a simple way to read and write data to it, something like this:
Timing promises
I have a deeply nested loop of promises that query a remote API, and I had them logging their time by default, like this:
Timing out JS promises
When wrapping an API client I found myself wanting to set a timeout for promise-based methods. I first used setTimeout to reject the deferred promise after a given amount of time, like this:
Fake chain pattern
I have recently read āSmalltalk Best Practice Patternsā and since the idea of pattern is fresh in my mind, I want to share a function naming trick that I use many times.
The promise handler pattern
The common way Iāve seen JS promises being explained is something like this:
Testing promise-based JS code
One tricky thing about testing promises is that they handle errors thrown by their .then() callbacks. So I have a test like this:
On Testable JavaScript
After I watched and shared Mark Trostlerās presentation āTestable JavaScriptā three times, at intervals of about a year. And for me, the experience was like reading one of those books that you find out more each time you re-read it.
My 3 āWhy Angularās
In a previous post I said that I recently went to a JS meet up, and I was left with the impression that the presentations would have been more useful if they were more narrowly focused: maybe take a specific problem and explain how a particular framework helps in solving it. Then I thought, what exactly do I mean by that? So here is what.
coding
Angular tip of the week: parametrized templates
On my 30-th week of Angular, I learned something that I was looking for since the first week: a lightweight way to get a āparametrizedā piece of view. Coming from a couple of years of React, I was used to having function components to abstract away noisy bits of a view, and for some time I thought the only way to get that is to get such a thing.
Simpler third-party integrations
I would like to tell how I have done the third-party service integrations on my side project. Email, file storage, error logging are a few examples.
Speeding up my TypeScript build
I was cleaning up my NPM modules on my side project. Since almost from the beginning, I have had 2 āchildā package.json files, one for the backend and one for the frontend, and the āmainā one in the project root.
Transactional tests with Mocha.js
This week, while working on the email change scenario on my side project, I realized that my tests are not transactional, which meant that their changes to the DB could persist across test runs and so tests could influence each other. Hmā¦ I thought I fixed this before.
Simpler unit testing
The other day while browsing through my side-projectās code I realized that I donāt have unit tests for the shared modules.
Simple indefinite asset caching
In my last post about my side project I have mentioned that I have extracted 2 shared bundles to increase my build speed, and one downside of that is that now have two more requests for every page, and this week I have implemented a small tweak that will compensate to that: indefinite caching.
One reason to prioritize the feature work over tech work
A couple of weeks ago I wrote about the P/PC Balance, and while thinking about it some more, a kind of comic realization stroke me: I realized that one good reason to prioritize feature work above technical work on a project is that the former is finite, while the latter is potentially infinite.
Simpler architecture
On the side-project that Iāve mentioned before, Iām making a priority of 2 things: (1) use the least amount of libraries and frameworks, and (2) organize the code in a way that reflects the logical structure of the app.
Planning tip: P/PC Balance
#user-work vs. #tech-work == P vs. PC
JS hoisting gotcha
Switching from tape to Mocha
I have a side-project where I use tape for testing. A few days ago I stumbled on a test that I thought should fail, but passed.
On testing UIs
I have heard that people resist testing UIs because āthey change oftenā, and my oppinion is that from the perspective of ātests as safety netā UI testing is as valuable as any other kind of testing.
My way to test web UIs
I remember how amazed I was while reading Kent Beckās āTest Driven Development: By Example.ā Automated regression tests sounded very useful. But it was not obvious how to apply that in the context of web UIs.
My explanation of DCI
In the episode 21 of āGiant Robotsā podcast Jim Gay is invited to talk about the DCI concept. The original document explains it with an example about saving accounts. Jim tries to explain it with an app user. I find both examples somewhat unhelpful, and thinking about this subject a little more, I think I found a better one.
Trail maps
I donāt have a CS degree, and most of what I know Iāve learned along the way because I found it interesting or because I needed to solve a problem. It worked pretty well so far, but sometimes I feel like I need a bit of structure around it, usually when Iām trying to make sense of a bigger picture.
Me is back to work
This my first day back to my day-job at Assembla. My plan is to find an hour every day to work on my project.
My own hackathon: day 11
It looks like Iāve caught a cold during my travel. Happy Friday. :- |
My own hackathon: day 8/14
Today I worked on getting the data collection/population of the case entry form.
My own hackathon: day 7/14
Monday. In the morning I have watched the React video course on FrontendMasters, by Ryan Florence. Pretty good. I canāt say I found a ton of new things but itās good to get confirmation that what I know are about the right things, and also give the whole thing a bit of structure in my mind. Fundamental things are well explained. There was a nice quick intro to Flux, which clarified by vague view on it.
My own hackathon: day 5/14
Today itās a different day, itās Saturday: until afternoon I dug channels for our drainage system in the back-yard. I did my best to escape out of there around 16:00 and got to the office.
My new notion of web app
One of my side projects that Iāve been toying with, is a productivity app for bailiffs. And since Iām reading āLean Customer Developmentā by Cindy Alvarez, a few days ago I went with my partner to interview a bailiff ā a former college teammate of his.
writing
Planning tip: P/PC Balance
#user-work vs. #tech-work == P vs. PC
My new use for Workflowy: rambling
I usually keep my project notes in WorkflowyĀ¹ and today I found a new handy thing I can do within it: ramble.
One tip on writing: be concrete
Every now and then, I set out to write an article about some Grand IdeaĀ® that just came to me. It usually happens when I read something dramatic rant on something.
How did I get unstuck this weekend
For the past few weeks I got a bit stuck with one of my side projectās UI. I have had some vision of how that particular form should look like ā which sections there were and how they were positioned, looked quite nice and it worked well so far ā but now Iāve got to a point where I needed something else to fit in, and it wonāt let me. And there I was stuck.
My intentful writing
I have recently shared a link to the one of the recent episodes of āLate Nights with Trav and Losā podcast: āWhy You Should Be A Publisher.ā Iām mentioning this because I find writing is a very interesting subject in how it affects how I understand things, and how I see and understand myself.
My awkward writing
My articles here so far are more awkward than not, and I was a bit confused about why would that be. I was wondering about that because, if I look at my emails, I generally consider them as coherent and well put together, I even take some kind of pride in that.Then how come my articles are not that good? I think I have an answer and itās in a way similar to my theory about why public speaking is generally considered hard.When I write an email, I generally have a clear subject, and a known audienceāa specific personāand I write about a specific aspect about the subject. And I believe these two knowns is what makes it relatively easy to write a clear and coherent message.On the other hand, in case of blogging this is not the case. Although I may know the subject, I donāt know the audience at all, and whether they are interested or not in the specific aspect of the subject that Iām trying to talk about.I think this is what makes it hard: if I donāt know youāre interested to hear about X, I will be reticent speaking about it, and I will probably fall sideways into other things that I guess may be more interesting to you.So my theory is that this is what makes bloggingāor public speakingāhard, and from here I think itāll be easier to find a way out. Yay!
One reason to write
As I mentioned in my previous article, I just finished reading the book āOn Writing Wellā by William Zinsser. I want to clarify a bit why am I so excited about the subject of writing.
On the book āOn writing wellā
I just finished reading āOn Writing Wellā by William Zinsser. I enjoyed most of it. Iāve skipped the chapter on sports writing because sports is not a subject I find particularly interesting (but Iām reading it now). I feel a bit disoriented now: Iāve read a lot of good advice from a such master, and I canāt say that I know the precise next steps to improve my writing. I think I should have took notes.
On Writing Well
This morning I got to the āBusiness Writing: Writing in Your Jobā chapter in the āOn Writing Wellā book by William Zinsser. I found many things I wanted to write down and share, but instead of retelling it I thought I will just quote a good chunk of it and let you enjoy the original. Itās pretty long for a blog article, but itās an easy and pleasant reading. Iāll start with the second paragraph since I think it goes straight to the point. Here it goes.
On blogging
One thing that I found interesting in the āApprenticeship Patternsā book is the emphasis it puts on blogging. Itās not that this surprised me, I have heard about this many times, and I think I understand its benefits, but one notable thing is that it gives ideas on what to write about, and one good reason: to use it as a tool towards a better understanding for yourself.
tdd
Transactional tests with Mocha.js
This week, while working on the email change scenario on my side project, I realized that my tests are not transactional, which meant that their changes to the DB could persist across test runs and so tests could influence each other. Hmā¦ I thought I fixed this before.
Simpler unit testing
The other day while browsing through my side-projectās code I realized that I donāt have unit tests for the shared modules.
Switching from tape to Mocha
I have a side-project where I use tape for testing. A few days ago I stumbled on a test that I thought should fail, but passed.
On testing UIs
I have heard that people resist testing UIs because āthey change oftenā, and my oppinion is that from the perspective of ātests as safety netā UI testing is as valuable as any other kind of testing.
My way to test web UIs
I remember how amazed I was while reading Kent Beckās āTest Driven Development: By Example.ā Automated regression tests sounded very useful. But it was not obvious how to apply that in the context of web UIs.
Me is back to work
This my first day back to my day-job at Assembla. My plan is to find an hour every day to work on my project.
My own hackathon: day 11
It looks like Iāve caught a cold during my travel. Happy Friday. :- |
hackathon
My own hackathon: day 11
It looks like Iāve caught a cold during my travel. Happy Friday. :- |
My own hackathon: day 8/14
Today I worked on getting the data collection/population of the case entry form.
My own hackathon: day 7/14
Monday. In the morning I have watched the React video course on FrontendMasters, by Ryan Florence. Pretty good. I canāt say I found a ton of new things but itās good to get confirmation that what I know are about the right things, and also give the whole thing a bit of structure in my mind. Fundamental things are well explained. There was a nice quick intro to Flux, which clarified by vague view on it.
My own hackathon: day 5/14
Today itās a different day, itās Saturday: until afternoon I dug channels for our drainage system in the back-yard. I did my best to escape out of there around 16:00 and got to the office.
My own hackathon: day 1/14
I wrote about this app for bailiffs that I started to build and failed. I also wrote that some a couple of weeks ago I went with my partner to a former colleague of his ā a bailiff ā to interview him and see how he actually works and if there would be any value in building an app for them.
productivity
Gracefully missing goals
Hi. My name is Vlad and I missed my weekly goals.
One reason to prioritize the feature work over tech work
A couple of weeks ago I wrote about the P/PC Balance, and while thinking about it some more, a kind of comic realization stroke me: I realized that one good reason to prioritize feature work above technical work on a project is that the former is finite, while the latter is potentially infinite.
Planning tip: P/PC Balance
#user-work vs. #tech-work == P vs. PC
My view of motivation
In the last post on Travis Neilsonās mailing list, heās sharing his thoughts about motivation and proposes some solutions.
Two days
This week I had a couple of harsh days.
side-projects
Speeding up my TypeScript build
I was cleaning up my NPM modules on my side project. Since almost from the beginning, I have had 2 āchildā package.json files, one for the backend and one for the frontend, and the āmainā one in the project root.
Transactional tests with Mocha.js
This week, while working on the email change scenario on my side project, I realized that my tests are not transactional, which meant that their changes to the DB could persist across test runs and so tests could influence each other. Hmā¦ I thought I fixed this before.
Simpler unit testing
The other day while browsing through my side-projectās code I realized that I donāt have unit tests for the shared modules.
One reason to prioritize the feature work over tech work
A couple of weeks ago I wrote about the P/PC Balance, and while thinking about it some more, a kind of comic realization stroke me: I realized that one good reason to prioritize feature work above technical work on a project is that the former is finite, while the latter is potentially infinite.
My new notion of web app
One of my side projects that Iāve been toying with, is a productivity app for bailiffs. And since Iām reading āLean Customer Developmentā by Cindy Alvarez, a few days ago I went with my partner to interview a bailiff ā a former college teammate of his.
vim
Vim tip of the day: C-a and C-x
They say that in Ruby if you think āIām wondering if there is a function that does Xā then it probably exists. More and more I find that is true about Vim too.
Vim: recursive iabbrev
TLDR: Although Vim documentation says āAbbreviations are never recursive,ā you can get abbreviations to recurse by escaping to the command mode.
Vim macro of the week
The other day I was putting together an ad-hock eslint
configuration
where I had just one JS file for a prototype page. I was inside a git
repo and I didnāt want to have additional files, so I kind of resisted
the idea to have a .eslintrc
file, but I can have a Makefile
ā I
have that in my ~/.gitignore
, so I can easily add one here and have
all the messy bits hidden inside it:
Input for vim abbrevs
I got into React.js lately, and one thing that I have noticed right away
is the boilerplate that I have to type for every component. For example,
if I have a Button
component, I have to type this:
My practical Vim
Last night I have finished re-reading Drew Neilās āPractical Vimā and I gathered a whole lot of little things that I want to try, and include in my workflow if they fit.
dev
Book review: Practicing Rails
A few days ago I have finished reading āPracticing Railsā by Justin Weiss. I liked it so much that I wanted to write about it.
My todayās view on code
This morning I have finished watching a course on Frontend Masters. Itās called āHardcore Functional Programming in JavaScript.ā Functional programming (FP) is interesting to me. Itās partly because I hear people speaking very passionately about it. Itās like an exotic thing that I donāt completely understand, but Iām curious to find out what it is.
Simple .env
Iāve seen .env being used in Heroku projects, and also in a RubyTapas episode about Dotenv gem, and I kind of liked it. But Iām reticent to add more libraries or tools to my toolset, especially if theyāre language specific like Dotenv.
Keeping secrets in a node app
For some time I was looking for a way to safely store my app secrets like API keys. Environment variables are OK, they work, but I found it cumbersome. I had a Heroku project where this worked with a .env file that looked like this:
learning
Project-based learning
Recently I was discussing with a friend that was thinking about developing some programming skills.
My Git trail map
In my last article I said that I have started a little study by following thoughtbotās trail maps. After Heroku, Iāve picked Git, and today I will write about the things Iāve learned from it.
Trail maps
I donāt have a CS degree, and most of what I know Iāve learned along the way because I found it interesting or because I needed to solve a problem. It worked pretty well so far, but sometimes I feel like I need a bit of structure around it, usually when Iām trying to make sense of a bigger picture.
make
make watch-app
My name Vlad, and I still like to make
things in 2022, as in GNU Make. š
Make is still alive and kicking
I do most of my work in the console, and when I work on a task, I
usually have a task-specific Makefile
.
My make
About a year ago I wanted to jshint only files that have changed since the last run, and with Grunt I had to write custom code to do that. I used to be able to find my way through Makefiles in FreeBSD ports when I was a kid, so decided to try make.
unit-testing
Testing location change in JS
Every now and then I come across a scenario where I need to unit-test
some code that navigates across pages by directly changing location.
Some time ago I have accidentally stumbled upon a solution: the
location.assign()
function.
Testing trumps encapsulation
At some point I have heard Uncle Bob saying that:
Why I code test-after now
On my front-end side-projects I mostly did test-first development and it worked pretty well. But for my new job that I began recently I found myself struggling really hard to do TDD, and eventually gave up and coded test-after.
unix
Make a bot list from access.log and use it
The other day, after playing a bit with GoAccess I found that the numbers didnāt add up with my in-app tracking, and I decided to take a slice of access.log and eyeball it to see whatās going on. What I found was discouraging: lots an lots of bot and crawler requests. As disappointing as it was, it was still good to find this out and adjust my perception to reality.
make watch-app
My name Vlad, and I still like to make
things in 2022, as in GNU Make. š
moreutils ifne run function
There is this lil program in moreutils called ifne
. I use it in shell pipelines, to execute a given command when there is some output. A quick example:
architecture
Simpler third-party integrations
I would like to tell how I have done the third-party service integrations on my side project. Email, file storage, error logging are a few examples.
Simpler architecture
On the side-project that Iāve mentioned before, Iām making a priority of 2 things: (1) use the least amount of libraries and frameworks, and (2) organize the code in a way that reflects the logical structure of the app.
css
On testing UIs
I have heard that people resist testing UIs because āthey change oftenā, and my oppinion is that from the perspective of ātests as safety netā UI testing is as valuable as any other kind of testing.
The āCā in CSS
One of the first things that I learned about CSS is that it cascades. Cascading is a lot like inheritance in OOP. Itās useful for the same reasons, and, for the same reasons leads to CSS fragility when misused.
dependencies
Simpler third-party integrations
I would like to tell how I have done the third-party service integrations on my side project. Email, file storage, error logging are a few examples.
Simpler architecture
On the side-project that Iāve mentioned before, Iām making a priority of 2 things: (1) use the least amount of libraries and frameworks, and (2) organize the code in a way that reflects the logical structure of the app.
grep
Make a bot list from access.log and use it
The other day, after playing a bit with GoAccess I found that the numbers didnāt add up with my in-app tracking, and I decided to take a slice of access.log and eyeball it to see whatās going on. What I found was discouraging: lots an lots of bot and crawler requests. As disappointing as it was, it was still good to find this out and adjust my perception to reality.
moreutils ifne run function
There is this lil program in moreutils called ifne
. I use it in shell pipelines, to execute a given command when there is some output. A quick example:
peace
Choice is a search
From time to time I stumble upon yet another article mentioning that humans are just bad at choices. I think accepting it as a truth is detrimental, and Iād like to disprove it.
My view of motivation
In the last post on Travis Neilsonās mailing list, heās sharing his thoughts about motivation and proposes some solutions.
scripting
Make a bot list from access.log and use it
The other day, after playing a bit with GoAccess I found that the numbers didnāt add up with my in-app tracking, and I decided to take a slice of access.log and eyeball it to see whatās going on. What I found was discouraging: lots an lots of bot and crawler requests. As disappointing as it was, it was still good to find this out and adjust my perception to reality.
moreutils ifne run function
There is this lil program in moreutils called ifne
. I use it in shell pipelines, to execute a given command when there is some output. A quick example:
angular
Angular tip of the week: parametrized templates
On my 30-th week of Angular, I learned something that I was looking for since the first week: a lightweight way to get a āparametrizedā piece of view. Coming from a couple of years of React, I was used to having function components to abstract away noisy bits of a view, and for some time I thought the only way to get that is to get such a thing.
balance
One reason to prioritize the feature work over tech work
A couple of weeks ago I wrote about the P/PC Balance, and while thinking about it some more, a kind of comic realization stroke me: I realized that one good reason to prioritize feature work above technical work on a project is that the former is finite, while the latter is potentially infinite.
build
Speeding up my TypeScript build
I was cleaning up my NPM modules on my side project. Since almost from the beginning, I have had 2 āchildā package.json files, one for the backend and one for the frontend, and the āmainā one in the project root.
clarity
Choice is a search
From time to time I stumble upon yet another article mentioning that humans are just bad at choices. I think accepting it as a truth is detrimental, and Iād like to disprove it.
constraints
My new notion of web app
One of my side projects that Iāve been toying with, is a productivity app for bailiffs. And since Iām reading āLean Customer Developmentā by Cindy Alvarez, a few days ago I went with my partner to interview a bailiff ā a former college teammate of his.
development
My own hackathon: day 1/14
I wrote about this app for bailiffs that I started to build and failed. I also wrote that some a couple of weeks ago I went with my partner to a former colleague of his ā a bailiff ā to interview him and see how he actually works and if there would be any value in building an app for them.
dns
Email server setup with SPF, DKIM, and DMARC
I have recently played with the idea of setting up an SMTP server for a friendās custom domain, and wanted to share the working setup.
docker
Simple log aggregation for Docker containers
The Why
The Docker composition on one of my side projects has recently got to 6 containers: SMTP-in, SMTP-out, app, subscription, website, and certbot. Since I have deployed a 0.1.0
version to DigitalOcean a couple of weeks ago, I caught myself feeling increasingly anxious about losing logs every time I deployed a new version of the container.
ease-into-it
My simple meditation routine
My current meditation practice is a sort of mindfulness meditation: itās intended as a way of training attention, focus, and self-awareness.
MTA of the week: sSMTP
I fiddled with a couple of servers in the past weeks and one of the
things I needed immediately was email. I wanted to allow cron
and the
webapps to send out emails.
git
My Git trail map
In my last article I said that I have started a little study by following thoughtbotās trail maps. After Heroku, Iāve picked Git, and today I will write about the things Iāve learned from it.
google apps script
Google Apps Script
For a while, I was collecting the DMARC reports, just in case I can find something useful in them. I didnāt, but I liked the lil script that I wrote in this Apps Script from Google. Itās like VBA for Microsoft Office ā if you ever heard of it. If not, itās automation for Google apps and services.
infrastructure
Email server setup with SPF, DKIM, and DMARC
I have recently played with the idea of setting up an SMTP server for a friendās custom domain, and wanted to share the working setup.
jekyll
Jekyll post alias
Iāve launched a new Jekyll website recently, and one thing that I wanted to be able to do on the very first days is to be able to have different URLs for a single post. š¤
Use-case: Iāve published an article on the blog, but the topic is one that comes
up frequently enough that I want to have it on the FAQ page, but also have
a simple one- or two-word permalink that I would be able to tell someone on the
phone, for example /socializare
.
shell-scripting
make watch-app
My name Vlad, and I still like to make
things in 2022, as in GNU Make. š
smtp
Email server setup with SPF, DKIM, and DMARC
I have recently played with the idea of setting up an SMTP server for a friendās custom domain, and wanted to share the working setup.
tech
Two days
This week I had a couple of harsh days.
ts
Speeding up my TypeScript build
I was cleaning up my NPM modules on my side project. Since almost from the beginning, I have had 2 āchildā package.json files, one for the backend and one for the frontend, and the āmainā one in the project root.
webapp
My own hackathon: day 1/14
I wrote about this app for bailiffs that I started to build and failed. I also wrote that some a couple of weeks ago I went with my partner to a former colleague of his ā a bailiff ā to interview him and see how he actually works and if there would be any value in building an app for them.