When playing around with service workers in order to make a site a progressive web app I had to test it on my local dev environment. As service workers need to run on https and I use a self-signed certificate for development. This gave me the following error in the console in Chrome
ServiceWorker registration failed: DOMException: Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script.
The solution is to tell Chrome to accept the certificate even though it is insecure from Chrome’s point of view.
During a course on Coursera I wanted to keep the Jupyter Notebook content for later reference and download it with all files to my own computer.
There are a lot of suggestions on how to download Jupyter Notbooks and files online but none of them really helped for this course as there were a lot of symbolic links that I wanted to download as well. For most of the solutions I found online the content for the symbolic links in the Jupyter Notebooks simply downloaded as references and not the files themselves.
I am using Trellis for my WordPress development and when updating to the latest version it required a newer version of Ansible. When I try to run the normal command on macOS High Sierra it fails as there is a package that cannot be uninstalled. However, if you ignore that package using the –ignore-installed flag you should be able to upgrade ansible to the latest version
sudo pip install ansible --upgrade --ignore-installed six
This should do it and the install should run normally.
When I create new sites in WordPress I usually start of by installing Bedrock by Roots. This is a great development stack that makes it easier to manage dependencies while keeping a clear structure. However, I often use Advanced Custom Fields PRO which is not available on wpackagist.org as it is a paid plugin. So I made a search on Google and found the solution to add the package via Composer.
On a project I’m working on the client wanted to show only posts from a custom post type that belonged to a specific custom taxonomy. I did a search on Google and didn’t really find any complete solution.
$post_type = 'project'; $taxonomy = 'skill'; $taxonomy_term_id = 5; $projects = new WP_Query([ 'post_type' => $post_type, 'numberposts' => - 1, 'posts_per_page' => - 1, 'tax_query' => [ [ 'taxonomy' => 'skill', 'field' => 'id', 'terms' => $taxonomy_term_id , 'include_children' => false ] ] ]);
This will get all posts of custom post type ‘project’ that has a custom taxonomy ‘skill’ and where that skill contains the skill term with id 5.
It is really easy to ad more databases in Laravel Homested. Simply edit the Homestead.yaml file (in Windows under C:Usersyour-username.homesteadHomestead.yaml)
Under databases add your databases like this:
# content above omitted databases: - homestead - my_new_database - another_database # content below omitted
If you virtual machine is already running navigate to your Homestead folder and run the command vagrant provision to create the new database(s). If it is not running simply run vagrant up.