Chris Worfolk's Blog


Basic Anatomy For Yoga Instructors and Everyone In Between

November 19th, 2020 | Books

Basic Anatomy For Yoga Instructors and Everyone In Between is a book by Alecia Croft.

It’s a pretty short read. It is 55 pages on my Kindle, including about ten pages of contents and opening matter and appendices. And most of the page space is taken up by diagrams. As such, you can get through the book in less than half an hour.

Whether you should is a different question. The diagrams are good and there is plenty of information packed into it. So, if you were to take the time to learn and memorise each of the bone and muscle names it would take you much longer. It does feel like a bit of a list most of the time, though, so that is not an inviting prospect. Having learnt this stuff in more detail previously, it was more of a refresher to me.

Yoga for triathletes

November 18th, 2020 | Sport, Video

I’ve been running some yoga classes for the triathlon club. Below, you can find a 46-minute flow class designed to open up your hips: it is great for running, cycling, sport in general or just building some strength and flexibility. There are more classes on the way so drop me a message if you want to join them live.

Islington Anxiety Clinic opens

November 17th, 2020 | News

Two years ago we opened Leeds Anxiety Clinic and it has been a big success. Depending on your value of success. We have been very busy and are inundated with clients, which is a business success, but perhaps not a success for the state of society’s mental health.

We are now expanding and have opened a second branch in London, the Islington Anxiety Clinic. If you are in the London area and are looking for support in managing your anxiety, we’re here to help.

Vitamin D supplements

November 16th, 2020 | Health & Wellbeing

Typically, we only want to supplement when we cannot build a diet that provides enough nutrients. But, in the case of vitamin D, we get it mostly from exposing our skin to the sun, rather than from food, so it is difficult to get additional vitamin D from your diet.

Given that many of us do not get outside enough in normal times and that we’re all inside because of the pandemic and lockdowns, vitamin D deficiency is probably pretty common right now, And there is some evidence that it is a good idea to supplement. So, I thought I would give it a go.

Labelling can often be a little confusing, but a typical adult intake should be around 600 IU (international units) which is 15 µg (micrograms). However, we can safely tolerate up to 4,000 UI (100 µg).

I picked up some vitamin D gummies from Boots. These contain 25 µg per gummy so one per day should provide plenty of vitamin D (and I will still get some from going outside, and a little through diet) and yet be safely within the tolerable limit.

I probably won’t let you know how I get one because I’m not expecting a vitamin D gummy per day to make any noticeable changes. If I don’t report back, assume it went fine (or I’ve exploded).

Yoga teacher training

November 15th, 2020 | Life

I was planning to do yoga teacher training with my local studio. Unfortunately, I held off to see what was happening with COVID as I didn’t really want to do it online, and by the time lockdown ended the course was full. So, I enrolled with the Yoga and Ayurveda Center which was online, but so affordable that I thought if it’s rubbish, I can just do the training with my local studio and I haven’t lost much.

As it happens, the course was great.

They have spent the money in the right places. The video quality isn’t perfected or edited down to a T. But there are about ten hours of contact time with tutors every week. And I would much rather interact, learn and practice teach over Zoom than have fancy transitions and perfect lighting in the video lectures.

In fact, there was so much contact time that I could often pick and choose what type of class I wanted to attend. With the lunch time ones (early morning in the US) I often had one-to-one attention with the tutor, or if I wanted a larger group to practice teach to, I could go to the evening groups.

Steph and her team have put together an excellent programme and it was wonderful to be a part of it.

Anxiety Leeds online trial

November 12th, 2020 | Foundation

Anxiety Leeds has been running face-to-face groups since 2013. However, as we are based at the hospital, our meetings have been suspended since the pandemic arrived to ensure we keep both our clients and vulnerable hospital patients safe (from COVID, not from mental health problems, unfortunately).

So far, we have been referring people to other organisations who are better equipped to handle digital events and services. However, due to high demand, we are now trialling on an online community that allows attendees of Anxiety Leeds to interact digitally, hopefully providing the same level of warmth and support we were able to achieve in the group.

Run coaching

October 29th, 2020 | Sport

I have been coaching triathlon for a while now, but recently I started coaching with the run club, too. The key thing is to remember to take the group photo. Keeping runners alive and injury-free is great, too, once you’ve got the photo.

Upgrading LAC to Slim 4

October 28th, 2020 | Programming

Last month, I published an upgrade guide to Slim 4 covering the changes that most people will need to make.

I recently upgraded the Leeds Anxiety Clinic and this project has some further complexities, so this post will elaborate on all of the changes I made, in case my original blog post did not cover some of the issues that you are also running into.

Things to do in advance

The old service layer calls no longer work:

$db = $this->ci->db;

And need to be updated to:

$db = $this->ci->get('db');

However, Slim 3’s service container already supports this syntax, so you can go ahead and update your code in advance.

If you are passing the container into controller functions, you need to typecast it.

use Psr\Container\ContainerInterface;

class Controller {
    __construct(ContainerInterface $ci) {}
}

If you pull the request out from the service container, you cannot do that in Slim 4. For example, if you have a render helper that relies on the request being in the container, you will have to start manually passing that into your render help from the page route closure.

Dependencies

You will want all of these:

"slim/slim": "4.*",
"slim/psr7": "1.*",
"slim/http": "1.*",
"php-di/php-di": "^6.1",

I did wonder if I could remove my other PSR-7 library that I use for Mailgun, nyholm/psr7, but the answer is no.

Instanciating the app

We now create the container and then the app, and you can recursively pass in the container.

$container = new \DI\Container;

$container->set('serviceA', function() use ($container) {
    return new ServiceA($container->get('serviceB'));
});

\Slim\Factory\AppFactory::setContainer($container);
$app = \Slim\Factory\AppFactory::create();

Throwing not found exceptions

If you manually throw not found exceptions or other HTTP exceptions, Slim 3 has them located here:

Slim\Exception\NotFoundException

Slim 4 moves it to here:

Slim\Exception\HttpNotFoundException

Error handling

If you want Slim 4’s default error handling, you need:

$errorMiddleware = $app->addErrorMiddleware(true, true, true);

And if you want to handle HTTP errors (such as not found), you can use:

$errorMiddleware->setErrorHandler(
    Slim\Exception\HttpNotFoundException::class,
    function (Psr\Http\Message\ServerRequestInterface $request) use ($container) {
        $controller = new App\Controller\ExceptionController($container);
        return $controller->notFound($request);
    });

You can also set your own error handling:

$errorMiddleware->setDefaultErrorHandler(
        function (Psr\Http\Message\ServerRequestInterface $request,
        Throwable $exception) use ($container) {
            $controller = new App\Controller\ExceptionController($container);
            return $controller->error($request, $exception);
        });

This means you will need to create your own response object in any exception controller you use.

public function notFound(Request $request)
{
    $response = new \Slim\Psr7\Response;
    return $this->render($response, 'not-found.html');
}

Custom middleware

The way we pass through middleware has changed. The old way:

public function __invoke($request, $response, $next)
{
    $response = $next($request, $response);
    return $response;
}

The new way:

public function __invoke($request, $handler)
{
    return $handler->handle($request);
}

That change alone probably won’t do what you want it to do out-of-the-box, so you might need to do some reading up and adapt it to your specific middleware depending on function.

Custom middleware wants to go towards the bottom after you define your routes, but before the error middleware.

Birthday meal

October 27th, 2020 | Life

This may be the only meal we have inside a restaurant in 2020, but having a voucher to spend before it expires (or all the restaurants go bust), we decided to brave it and have a birthday meal for two at Gaucho. There was a slight mix up and we ended up with a cake with “happy anniversary” written on it, but it still tasted good! :D.

Best winter cycling socks

October 20th, 2020 | Reviews, Video

How do you keep your feet warm during winter cycling? In this video, I will compare regular socks with the Pactimo wool winter socks and Rapha winter socks, as well as discussing what else I do to keep my feet warm when the temperature gets down towards zero.