I checked out Hugo – a fast static site generator. Why use a static site generator? Because why would the server have to rebuild the page for every visitor instead of building it once? Especially, if content doesn’t change often. A static site generator compiles the website once and it’s served much faster to visitors.
Anyways, while Hugo seems like a great product, there’s one downside:
As of beginning of 2017, there is no support for removing trailing slashes from URLs, because every page generated by Hugo is a folder with an
mod_rewrite or anything.
Continue reading Static site generator Hugo doesn’t allow URLs without trailing slashes
I have one requirement for my new Ionic 2 app: The core needs to work without Ionic 2. It will be released as native apps for Android and iOS, but also as a Single-Page-App (SPA).
Ionic 2 is optimized for iOS and Android and not made for Web apps. Thus, I need to separate as much logic as possible from Ionic 2 and create a core application that can be interacted with through an Ionic 2 layer or an SPA.
This requirement forces me to think about a clean architecture when writing Ionic 2 apps.
I haven’t found the perfect solution yet, but stumbled across a few interesting ideas, concepts and articles that I want to share with you.
Even if you won’t make a Web-app, I hope you can take a few ideas from this post.
Continue reading Towards A Clean Architecture for Ionic 2 Apps
I use iA Writer for almost all writing. Three reasons:
- iA Writer feels right. This is the most important point. I like the interface, the font, the simplicity.
- iA Writer works with raw text files. This lets me process files with Marked 2 or any other Markdown editor. It’s especially important if you run a blog with Jekyll or some other blog engine that converts Markdown to HTML itself.
- Auto-saves all files in its library, so nothing is lost. Although sometimes my files get a bit unorganized.
Continue reading iA Writer 4 – Why use it?
The other day I read on Hacker News something like:
I wanted to get into Web Development. Is it really that ugly, hard, and annoying?
I thought: What’s the problem? It ain’t that bad, but to be honest, it really is quite difficult.
Since I decided to make the new version of my app entirely hybrid, I’m intrigued by Ionic 2, Angular 2 and TypeScript.
Sure, you can punch out a stupid small app in no time with Ionic 2, but something with a bit more complexity requires a few more brain cycles. Obviously, my new app has to be maintainable, needs sync across devices, I want a web UI in addition to the mobile apps and all of a sudden, I find myself in the same mess as the guy who asked on Hacker News.
Doing a hybrid mobile app in 2016 means to learn:
Continue reading Hybrid app development is complicated
Two ways to get 1px wide sharp and crisp lines for retina displays:
- Scale the canvas to twice the size (
context.scale(2,2);) and then draw a 1px wide line like so:
- Use all device pixels and draw the image twice the size. This is the approach I focus on in this blog post.
Here is how to draw super sharp lines on an HTML5 canvas for retina displays: Continue reading How to Draw Sharp Lines on a HTML5 Canvas for Retina Displays
A basic layout for HTML5 files, a minimal version and a version for social-enabled websites. I use them often, so they are here for my personal reference.
I just started to give React Native a try. I followed the tutorial, changed
localhost to my MacBook’s IP address, but for some reason, I couldn’t connect my device (iPhone 5) to the React packager server, which I started via
npm start in the React project’s root directory.
The error in Xcode was a timeout:
2016-06-22 17:03:37.615 [error][tid:main][RCTWebSocketManager.m:84] WebSocket connection failed with error Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out"
I noticed that I couldn’t open the packager server from Safari on the device as well (
http://192.168.1.5:8081), which I found odd.
Then I tried to find a solution for the search term
ios safari connect local webserver and this is the answer:
If your iOS device can’t connect to the React Native packager server, although everything is set up flawlessly, JUST DISABLE AND ENABLE YOUR MAC’S WIFI.
Stupid thing, but it works. I just wasted an hour on this 😤
My other post talked about how to implement Value Objects in Laravel with Eloquent. While it’s possible technically, I don’t think Value Objects are useful in Laravel at all.
Continue reading Why I Don’t Use Value Objects in Laravel Anymore
I spend a few days creating a Telegram bot for my SaaS. It serves as a convenient way for my users to enter data. The bot isn’t smart at all, but at its core is a regex pattern matcher which allows entering various health-related data points.
While the Telegram docs try to give you an easy start, I found them lacking. With this article, I want to fill some gaps.
Continue reading Let’s make a Telegram Bot with PHP
Update April 25th, 2016: I don’t use Value Objects in Laravel anymore. Here’s why.
One idea of Value Objects is to restrict what a programmer can do within the model. For example, an EmailAddress value object cannot be set to an invalid email address.
The advantage is: Validation and consistency of the domain model.
With Laravel however, there are a few things to think about and it took me a while to figure out a good solution.
- Use a Mutator to enforce the type of a Value Object
- Store your Value Object as native value in your Eloquent model
- Use an Accessor to create a Value Object from the native value
__toString() in your Value Object to allow
- Use the
JsonSerializable interface to allow
- Plus: Do all of this automatically without Mutators and Accessors
Continue reading Value Objects in Laravel 5 with Eloquent Done Right