While every developer today probably has a working knowledge of common git-commands for everyday life, there are some more obscure commands that fewer people know about and even fewer people use. One of these is git bisect. If you ever had a broken build and a large number of commits that had been pushed since the last known good build, then you will very much appreciate, what git bisect can do.
Bist du selbstständig und suchst nach einer einfachen Möglichkeit, deine E-Rechnungen zu erstellen? Dann bist du bei meiner neuen Mac App SupaRechnung genau richtig!
Using automatic security scans to improve your python code quality
I am a big fan of code scanning tools that help you improve the quality of your code-base. I have already written about import-linter, which helps to adhere to your architecture by validating imports. Another great tool is bandit. It scans your python code for common security problems. When I ran it on MembershipNerd, I got the following warning:
Test results:
>> Issue: [B106:hardcoded_password_funcarg] Possible hardcoded password: 'secret'
Severity: Low Confidence: Medium
Location: ./src/testhelpers/users.py:10
More Info: https://bandit.readthedocs.io/en/latest/plugins/b106_hardcoded_password_funcarg.html
9
10 SUPERUSER = UserCredentials(email="admin@example.com", password="secret")
The scanner identified a problem because hard-coded default value for a parameter called “password” could be a potential security issue. In this case, it is not an issue, because this is only part of a test-suite.
[Read More]Improving your python code quality with automatic architecture contract validation
If you care about code quality you are probably already familiar with linting-tools like flake8 and pylint. These tools automatically check your python code for common code-smells and anti-patterns.
Another excellent tool in this category is import-linter. Import-linter can check that your dependency tree adheres to your chosen architecture. For example, in a Django project, it would be bad practice if your model would import a view or a form. With import-linter, you can specify this as a layer-contract:
What is 'git interpret-trailers?' used for?
git is the de-facto standard for version control these days. As a software developer, you will be comfortable using common git-commands, like init, add, commit etc. However, there are some quite exotic git-commands out there. One of my favorite – that surprisingly few people seem to know about – is git bisect, which can be incredibly useful if you need to identify which commit introduced a breaking change. Especially, if there are a large number of commits that you need to go through.
End-to-end email testing with testmail.app
While working on MembershipNerd I was looking for a very simple service that would let me write automated, end-to-end tests for sending emails. In particular, I wanted to create an automated test for the sign-up process. By “end-to-end test” I mean that I actually want to send an email, with a real SMTP server, verify that the email has been received by the recipient and contains the correct information.
If I simply wanted to verify that the sign-up triggers an email, then I could use the built-in email service of Django’s testing framework.. If your web framework doesn’t such a convenient way to test email, you might want to have a look at MailHog. Be aware it needs more setup though!
[Read More]Writing and publishing a blog-post for 30 days
This is my 30th blog-post in 30 days. A little over thirty days ago I decided that I will finally try to blog daily, at least for a limited amount of time. At the time I thought that it would be really cool to challenge myself to blog for 30 days. At the same time, that seemed like a very tall order.
How to write a daily blog-post for 30 days
The trick is: don’t start with the goal to blog for thirty days!
[Read More]Researching hosting options for small projects
Today I spent most of the day researching small cloud providers and “self-hosted PaaS” technology. This was triggered by a question that had been on my mind for a while: What is the minimum “cost-per-application” for production-quality containerized hosting?
What do I mean by that?
- cost-per-application: How much does it cost to host one application, two applications, etc.? Ideally, I would like to find the minimum price that will scale linearly.
- production-quality hosting: This obviously depends on the availability and performance requirements of the application. I will try to set the bar as low as possible in terms of availability and performance.
- containerized hosting: Basically, I want something like kubernetes, docker swarm etc. I won’t require a multi-node setup, but obviously that option would be nice.
After hours of research I have not found a good answer. But I have found some interesting technologies that seem worth checking out (in no particular order):
[Read More]Collecting payments for your bootstrapped SaaS startup
One of the more confusing subjects for me as a startup-founder was payment collection. How do I charge my customers? What is the difference between services like Stripe, Chargebee, Chargify, Paddle, and Fastspring?
Disclaimer: This article will sound like an advertisement for Paddle and Fastspring. It is not. I am not getting paid to write this. I am writing from my own experience and my own research. I think Stripe is a great service. But if you are a tiny, bootstrapped startup with customers from different countries, you should think long and hard if Stripe is the right service for you.
[Read More]Fixing the Google Search Console error 'Bad escape sequence in string' when using hugo and JSON-LD
If you use JSON Linked Data (JSON-LD) to add Google-friendly structured data to your website, you might have come across the following error in your Google Search Console:
Unparsable structured data
Structured data with syntax errors detected
Bad escape sequence in string
Looking at the search console’s help page for that error reveals the following information:
| Error type | Description |
|---|---|
| Bad escape sequence in string | An invalid escape sequence used in a string value. For example: “description” : “Some \q unknown sequence” |
In my specific case, the single quote character ' in the original text was being transformed into this mess in the JSON-LD description field: \x26rsquo. This is mixture of unicode and HTML entity. :) \x26 is unicode for the &-character. And &rsqou is the HTML entity for the original (right) single quote '-character.
A pure JavaScript cookie-consent-banner for Google Analytics
Disclaimer: I am not a lawyer. This is not legal advice.
Disclaimer: I am also not a JavaScript developer. So don’t take this as JavaScript programming advice. :)
I like to know how many people visit my website, and what articles they are reading. Why? Because I find it can be quite motivating to see these numbers go up.
Because I am located in Germany, I need to provide a way for my site visitors to explicitly give their consent. Since the advent of GDPR and the European Cookie Law, there are many, many companies that offer services to help website owner with this. But I am software developer. I am not going to pay a monthly fee for a simple JavaScript pop-up! (Yes, yes, I know, these companies provide more than that. I am just trying to be funny here.)
[Read More]