<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: James Sessford</title>
    <description>The latest articles on DEV Community by James Sessford (@jamessessford).</description>
    <link>https://dev.to/jamessessford</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F238830%2F90206ad9-8006-49c1-8b01-f2693d7011d3.jpeg</url>
      <title>DEV Community: James Sessford</title>
      <link>https://dev.to/jamessessford</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jamessessford"/>
    <language>en</language>
    <item>
      <title>A published deck of cards</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Thu, 31 Oct 2024 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/a-published-deck-of-cards-45ph</link>
      <guid>https://dev.to/jamessessford/a-published-deck-of-cards-45ph</guid>
      <description>&lt;p&gt;There are some changes to the core functionality described in the last post, but I took the ideas I was working on and created a package to represent the deck of cards for use in a Laravel application using Verbs.&lt;/p&gt;

&lt;p&gt;The source is available &lt;a href="https://github.com/jamessessford/playing-cards" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you're making games with PHP/Laravel/Verbs, I'd love to chat!&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>verbs</category>
    </item>
    <item>
      <title>A deck of cards</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Wed, 30 Oct 2024 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/a-deck-of-cards-8gg</link>
      <guid>https://dev.to/jamessessford/a-deck-of-cards-8gg</guid>
      <description>&lt;p&gt;I've been working lately with &lt;a href="https://verbs.thunk.dev" rel="noopener noreferrer"&gt;Verbs&lt;/a&gt; and &lt;a href="https://livewire.laravel.com" rel="noopener noreferrer"&gt;Livewire&lt;/a&gt; and thought a fun experiment would be to try and create some card games that I enjoy playing.&lt;/p&gt;

&lt;p&gt;To facilate this, I need to define a deck of cards that I can use in any of the projects that I work on after this.&lt;/p&gt;

&lt;p&gt;The deck of cards needs to contain a &lt;code&gt;Card&lt;/code&gt;, &lt;code&gt;Deck&lt;/code&gt; and &lt;code&gt;CardCollection&lt;/code&gt; class. A card should have a suit and a value, and the deck should consist of 52 cards. Because the suits and values are all defined for a deck of cards, I can use Enums for the properties of a card.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;CardCollection&lt;/code&gt; class allows me to store a collection of cards safely in a Verbs state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;// Cards/Enums/Suit.php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Cards\Enums&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;enum&lt;/span&gt; &lt;span class="nc"&gt;Suit&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Clubs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Clubs'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Diamonds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Diamonds'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Hearts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Hearts'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Spades&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Spades'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;// Cards/Enums/Value.php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Cards\Enums&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;enum&lt;/span&gt; &lt;span class="nc"&gt;Value&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Two&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Two'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Three&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Three'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Four&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Four'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Five&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Five'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Six&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Six'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Seven&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Seven'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Eight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Eight'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Nine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Nine'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Ten&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Ten'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Jack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Jack'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Queen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Queen'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;King&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'King'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nc"&gt;Ace&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'Ace'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;// Cards/Card.php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Cards&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Cards\Enums\Suit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Cards\Enums\Value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Card&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;Suit&lt;/span&gt; &lt;span class="nv"&gt;$suit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;Value&lt;/span&gt; &lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;// Cards/CardCollection.php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Cards&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate\Support\Collection&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\Serializer\Normalizer\DenormalizerInterface&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Symfony\Component\Serializer\Normalizer\NormalizerInterface&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Thunk\Verbs\SerializedByVerbs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CardCollection&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Collection&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="nc"&gt;SerializedByVerbs&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;deserializeForVerbs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;mixed&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;DenormalizerInterface&lt;/span&gt; &lt;span class="nv"&gt;$denormalizer&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;static&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$serialized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;Card&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;deserializeForVerbs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$serialized&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$denormalizer&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;serializeForVerbs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;NormalizerInterface&lt;/span&gt; &lt;span class="nv"&gt;$normalizer&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="k"&gt;array&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Card&lt;/span&gt; &lt;span class="nv"&gt;$card&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$card&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;serializeForVerbs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$normalizer&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;toJson&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="c1"&gt;// Cards/Deck.php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kn"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Cards&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Cards\Enums\Suit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Cards\Enums\Value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Deck&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;CardCollection&lt;/span&gt; &lt;span class="nv"&gt;$cards&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cards&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;CardCollection&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;make&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;

        &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;CardSuit&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;cases&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;CardSuit&lt;/span&gt; &lt;span class="nv"&gt;$suit&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nf"&gt;collect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;CardValue&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;cases&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
                    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;CardValue&lt;/span&gt; &lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$suit&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cards&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$suit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$value&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
                    &lt;span class="p"&gt;});&lt;/span&gt;
            &lt;span class="p"&gt;});&lt;/span&gt;

        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;shuffle&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;shuffle&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cards&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cards&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;shuffle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;reverse&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;deal&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;?Card&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cards&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cards&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;remainingCards&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cards&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>php</category>
      <category>laravel</category>
      <category>verbs</category>
    </item>
    <item>
      <title>Ibis Template</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Wed, 19 Oct 2022 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/ibis-template-186p</link>
      <guid>https://dev.to/jamessessford/ibis-template-186p</guid>
      <description>&lt;p&gt;In my last post I described getting started with Ibis and how it was making writing documentation an easier task for me.&lt;/p&gt;

&lt;p&gt;However, as with most tasks, I was looking for a way to improve my workflow with it and speed up the process and so built a template that I can use as the basis for all of the documentation I'm writing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/jamessessford/ibis-template"&gt;https://github.com/jamessessford/ibis-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The main features of the template are the VS Code extension recommendations, allowing me to see the PDF from within VS Code rather than having to open the file in a separate reader, and the auto build task for Ibis when I'm updating content in the document.&lt;/p&gt;

</description>
      <category>documentation</category>
    </item>
    <item>
      <title>Writing better documentation</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Sun, 16 Oct 2022 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/writing-better-documentation-1h6e</link>
      <guid>https://dev.to/jamessessford/writing-better-documentation-1h6e</guid>
      <description>&lt;p&gt;Over the past couple of months I've been asked at work to write more documentation.&lt;/p&gt;

&lt;p&gt;This isn't a bad thing. I think even if you take away the instant benefits for the team/business and focus solely on yourself, it provides a sometimes easier way to refresh yourself on the inner workings of something than source diving a whole project/branch/feature to try and remember something.&lt;/p&gt;

&lt;p&gt;I think the biggest problem I had with writing documentation was consinstency.&lt;/p&gt;

&lt;p&gt;If I was using Word or a program like it, I'd have to remember all of the styles I was using for sections/headings etc and make sure I'd remembered to follow them throughout a sometimes lengthy document and that quite often left me in a state where I didn't want to even start writing, coupled with the fear of having to get a correct table of contents and page numbering right was also crippling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter Ibis
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/themsaid/ibis"&gt;Ibis&lt;/a&gt; is a fantastic tool created by &lt;a href="https://twitter.com/themsaid"&gt;Mohamed Said&lt;/a&gt; that allows you to create a PDF document based on a directory of &lt;a href="https://www.markdownguide.org/basic-syntax/"&gt;Markdown&lt;/a&gt; and image files.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's different?
&lt;/h2&gt;

&lt;p&gt;Now I can write my documentation in an environment I have much more control over - Markdown and CSS.&lt;/p&gt;

&lt;p&gt;As the &lt;a href="https://github.com/themsaid/ibis"&gt;repo&lt;/a&gt; explains, it comes with two themes which are completely editable to the look and feel you wish to go for with your documentation and enforce consistency throughout.&lt;/p&gt;

&lt;p&gt;It also allows you to add a cover image and automatically generates a clickable table of contents for your document, with all pages numbered correctly.&lt;/p&gt;

</description>
      <category>documentation</category>
      <category>php</category>
    </item>
    <item>
      <title>Multiple PHP Pools</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Sun, 10 May 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/multiple-php-pools-2h77</link>
      <guid>https://dev.to/jamessessford/multiple-php-pools-2h77</guid>
      <description>&lt;p&gt;PHP has gotten phenomenal to work with over the last few years.There have been so many improvements - both to the language itself and, in my humble opinion, the developer experience in using the language every day.&lt;/p&gt;

&lt;p&gt;I'm a terrible hypeman for anything but if you're interested in the current state of PHP, I'd highly recommend reading &lt;a href="https://dev.to/brendt/php-in-2020-1nag-temp-slug-1485828"&gt;PHP in 2020&lt;/a&gt; by Brent Roose.&lt;/p&gt;

&lt;p&gt;One of the new features of PHP that I wanted to experiment with was preloading but I had several sites on my Rasperry Pi and they didn't all depend on the same code, so I needed to seperate my instances.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter pools
&lt;/h2&gt;

&lt;p&gt;PHP pools are seperate processes that can each be used to serve a subset of requests. You'll probably already be using the default pool at the moment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    ###

    server_name www.test;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    ###
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Ubuntu, PHP pool configuration is located at &lt;code&gt;/etc/php/7.4/fpm/pool.d/&lt;/code&gt;. I'd start by copying the template that's there for my new pool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /etc/php/7.4/fpm/pool.d
sudo cp www.conf www2eb.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll then want to edit this file and update, at minimum, a setting or two.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano www2eb.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update the name of the pool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www2eb]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to change the user that owns the pool, update the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = poolowner
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, we need to give it a different socket so we can send requests to it via NGINX&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;; Note: This value is mandatory.
listen = /run/php/php7.4-fpm.poolowner.sock
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we've updated the PHP pools, we need to update our NGINX server block to point to the correct socket:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    ###

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.poolowner.sock;
    }

    ###
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We've now made all of the updates that we need, it's time to restart our services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo service nginx restart &amp;amp;&amp;amp; sudo service php-7.4-fpm restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now check that your new PHP pool is working by visiting your site in a browser.&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>development</category>
      <category>php</category>
    </item>
    <item>
      <title>zz</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Fri, 17 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/zz-1c8j</link>
      <guid>https://dev.to/jamessessford/zz-1c8j</guid>
      <description>&lt;p&gt;Mattias Geniar (&lt;a class="mentioned-user" href="https://dev.to/mattiasgeniar"&gt;@mattiasgeniar&lt;/a&gt;) posted a link in the past couple of days that I found really interesting:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leahneukirchen.org/blog/archive/2017/01/zz-a-smart-and-efficient-directory-changer.html"&gt;zz: a smart and efficient directory changer by Leah Neukirchen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Without spoiling the end - the article is definitely worth the read!! - I'm slowly managing to change my workflow to use &lt;code&gt;zz&lt;/code&gt; to get to where I need to be instead of &lt;code&gt;cd ../../../&lt;/code&gt; once I've navigated into a project.&lt;/p&gt;

&lt;p&gt;Thanks Leah!&lt;/p&gt;

</description>
      <category>ubuntu</category>
    </item>
    <item>
      <title>NPM</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/npm-101g</link>
      <guid>https://dev.to/jamessessford/npm-101g</guid>
      <description>&lt;p&gt;I was setting up a Rasperry Pi over the weekend and I'd forgotten how to set up NPM permissions so I don't have to use sudo to install global packages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a relief - sudo npm'ing anything is a terrifying prospect!&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>reminders</category>
      <category>node</category>
      <category>npm</category>
    </item>
    <item>
      <title>NGINX</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Mon, 23 Mar 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/nginx-1enb</link>
      <guid>https://dev.to/jamessessford/nginx-1enb</guid>
      <description>&lt;p&gt;NGINX has been my web server of choice for quite a few years now.There are many approaches for fine tuning but the template below serves as the starting point for a new Laravel project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {

    ## Begin - Server Info
    listen 80;
    index index.html index.php;
    root /home/user/site/deploys/current/public;
    server_name site.test;
    ## End - Server Info

    ## Begin - Index
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    ## End - Index

    ## Begin - PHP
    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root/$fastcgi_script_name;
    }
    ## End - PHP

    ## Begin - Security
    # deny all direct access for these folders
    location ~* /(.git|cache|bin|logs|backups|tests)/.*$ { return 403; }
    # deny running scripts inside core system folders
    location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
    # deny running scripts inside user folder
    location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
    # deny access to specific files in the root folder
    location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
    ## End - Security
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Continuous Delivery
&lt;/h2&gt;

&lt;p&gt;The NGINX setup I'm using above allows me to achieve continuous delivery of my projects; &lt;code&gt;/current/&lt;/code&gt; is symlinked to the correct folder during my deployment process.&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>reminders</category>
      <category>nginx</category>
    </item>
    <item>
      <title>MySQL</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Sun, 08 Mar 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/mysql-2j1c</link>
      <guid>https://dev.to/jamessessford/mysql-2j1c</guid>
      <description>&lt;p&gt;I always forget how to do some MySQL operations, especially the more modern ways to add users.I'm listing them here in hopes of either cementing the information because I've written it downor finding my own blog post when I have to search again :)&lt;/p&gt;

&lt;p&gt;Depening on what environment you're working in, you could be accessing MySQL in a multitude of different ways.I'm currently using DBeaver &amp;amp; MyCLI on my Ubuntu laptop &amp;amp; HeidiSQL at work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Databases
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE DATABASE mydatabase;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Users
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE USER 'mydatabaseuser'@'%' IDENTIFIED WITH mysql_native_password BY 'mydatabasepassword';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Permissions
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GRANT ALL ON mydatabase.* to 'mydatabaseuser'@'%';
FLUSH PRIVILEGES;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Access
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mycli -u mydatabaseuser -p mydatabase
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'll probably update this post with more MySQL things I remember that I forget as time goes on!&lt;/p&gt;

</description>
      <category>ubuntu</category>
      <category>reminders</category>
      <category>mysql</category>
    </item>
    <item>
      <title>The leap year</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Sat, 29 Feb 2020 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/the-leap-year-1fip</link>
      <guid>https://dev.to/jamessessford/the-leap-year-1fip</guid>
      <description>&lt;p&gt;February 29th 2020. A date that will never occur again, as time moves forward butnever back, and a day we won't see again for four more years.&lt;/p&gt;

&lt;p&gt;I've been fairly quiet the last couple of months as I've struggled to find things to write about.&lt;/p&gt;

&lt;p&gt;On my quests from &lt;a href="https://dev.to/blog/i-spent-this-year-as-a-ghost/"&gt;my end of year list&lt;/a&gt;I think I'm making quite steady progress. I've just finished a course of CBT and am trying toput into practice the techniques in how I personally review &amp;amp; engage in the different aspects of my life.&lt;/p&gt;

&lt;p&gt;Yesterday marked my last shift codng for &lt;a href="http://atticusconsultancy.co.uk"&gt;Atticus Consultancy&lt;/a&gt;. It's been a fantastic three years working there and I've got to workon some fantastic projects and make some friends for life along the way!&lt;/p&gt;

&lt;p&gt;Monday will be my first shift coding for &lt;a href="https://preferredmanagement.co.uk"&gt;Preferred Management Solutions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Today, I'm going to code for the joy of discovery.&lt;/p&gt;

</description>
      <category>life</category>
    </item>
    <item>
      <title>I spent this year as a ghost</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Tue, 31 Dec 2019 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/i-spent-this-year-as-a-ghost-1bkg</link>
      <guid>https://dev.to/jamessessford/i-spent-this-year-as-a-ghost-1bkg</guid>
      <description>&lt;p&gt;I'm not one for being able to objectively look back over a period of time and be able to pick out anything I think I've done of value - I recognise this as one of my major failings.&lt;/p&gt;

&lt;p&gt;I've never tried to do a &lt;em&gt;year in review&lt;/em&gt; before, but I see it's all the rage on Twitter so thought I'd give it a shot.&lt;/p&gt;

&lt;h1&gt;
  
  
  Home
&lt;/h1&gt;

&lt;p&gt;I think the only regret I have at home for this year is not taking care of my mental health as much as I should have.&lt;/p&gt;

&lt;p&gt;Home life in general is fantastic, I'm still living happily with my girlfriend and we now have a dog and are finally starting to get the house in order!&lt;/p&gt;

&lt;p&gt;My brother and his family have also moved closer to us which is fantastic as I get to see them a lot more often than I did before.&lt;/p&gt;

&lt;p&gt;Going in to next year, my goals for my personal life would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Prioritise my mental health more
- Set better boundaries for work in my spare time
- Try to budget more and be better with money
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Work
&lt;/h1&gt;

&lt;p&gt;I've had a pretty strange year at work. I spent 60% of my week sub contracted and working on Fight Club - the first rule of Fight Club is you don't talk about Fight Club! - and the other 40% of the time either working from the Atticus office/Client offices or home.&lt;/p&gt;

&lt;p&gt;Fight Club was the best project I've gotten to work on professionally so far. It was the first project I was given complete creative control over my part of it.&lt;/p&gt;

&lt;p&gt;The project was completed in December and handed back over, with further development being handled internally.&lt;/p&gt;

&lt;p&gt;I feel proud to have completed the project but a sadness that I may not be part of the team that helps it grow.&lt;/p&gt;

&lt;p&gt;I think my goal for work for next year is to be less nomadic in the work I'm doing and to stop bringing work home with me.&lt;/p&gt;

&lt;h1&gt;
  
  
  Freelance &amp;amp; Personal work
&lt;/h1&gt;

&lt;p&gt;I didn't take on any freelance work over the last year but did have a few personal moments I'm very happy with:&lt;/p&gt;

&lt;h2&gt;
  
  
  Open source
&lt;/h2&gt;

&lt;p&gt;I started contributing, or attempting to, open source software. I've written a couple of packages in Packagist and NPM and it's been quite exciting having some software out in the wild.&lt;/p&gt;

&lt;p&gt;I didn't get unbelievable download stats but that wasn't really the goal. I put something back into an ecosystem that has given me so much and it's something I plan to carry on into 2020 and beyond.&lt;/p&gt;

&lt;p&gt;Playing in the open source world also let me try out some fantastic services like Style CI, Travis and Coveralls and got more comfortable with testing in PHP and JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Closed source
&lt;/h2&gt;

&lt;p&gt;I've been tinkering with a couple of projects in my spare time over the course of the last year. Nothing that's at release stage yet but I'm confident of beta releases in the early months of the new year.&lt;/p&gt;

&lt;p&gt;It's been great to be able to play with different technologies in my spare time as this has been my primary source for learning new things over the past year, including:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- TypeScript
- Tailwind CSS
- InertiaJS
- Laravel Zero
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusions
&lt;/h1&gt;

&lt;p&gt;Prioritising my mental health and free time has to be the biggest focus of 2020.&lt;/p&gt;

&lt;p&gt;Overall I'd say the past year, on paper at least, has been more of a success than I thought it was but there is room for both personal and professional improvement.&lt;/p&gt;

&lt;p&gt;I'm looking forward to the challenges of the next year!&lt;/p&gt;

</description>
      <category>life</category>
    </item>
    <item>
      <title>Gitting gud</title>
      <dc:creator>James Sessford</dc:creator>
      <pubDate>Thu, 26 Dec 2019 00:00:00 +0000</pubDate>
      <link>https://dev.to/jamessessford/gitting-gud-377</link>
      <guid>https://dev.to/jamessessford/gitting-gud-377</guid>
      <description>&lt;p&gt;Git is now an essential part of my work flow. It's invaluable. I like knowing that even though I may have to dig to find it, I have the history of an entire project at my fingertips.&lt;/p&gt;

&lt;p&gt;Since moving over to Ubuntu, I've made a few optimisations to my environment to help use Git.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keys
&lt;/h2&gt;

&lt;p&gt;I modified this from a Stack Overflow answer, it'll add the desired keys to SSH agent when you load a terminal/login through SSH and destroy the agent when the last thing using it is closed.&lt;/p&gt;

&lt;p&gt;I have this at the bottom of my ~/.zshrc config file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Start ssh-agent to keep you logged in with keys, use `ssh-add` to log in
agent=`pgrep ssh-agent -u $USER` # get only your agents           
if [["$agent" == "" || ! -e ~/.ssh/.agent_env]]; then
    # if no agents or environment file is missing create a new one
    # remove old agents / environment variable files
    if [["$agent" != ""]]; then
    kill $agent;
    fi
    rm -f ~/.ssh/.agent_env 

    # restart
    eval `ssh-agent`
    /usr/bin/ssh-add
    echo 'export SSH_AUTH_SOCK'=$SSH_AUTH_SOCK &amp;gt;&amp;gt; ~/.ssh/.agent_env             
    echo 'export SSH_AGENT_PID'=$SSH_AGENT_PID &amp;gt;&amp;gt; ~/.ssh/.agent_env             
fi

# create our own hardlink to the socket (with random name)           
source ~/.ssh/.agent_env                                                    
MYSOCK=/tmp/ssh_agent.${RANDOM}.sock                                        
ln -T $SSH_AUTH_SOCK $MYSOCK                                                
export SSH_AUTH_SOCK=$MYSOCK                                                

end_agent()                                                                     
{
    # if we are the last holder of a hardlink, then kill the agent
    nhard=`ls -l $SSH_AUTH_SOCK | awk '{print $2}'`                             
    if [["$nhard" -eq 2]]; then                                               
        rm ~/.ssh/.agent_env                                                    
        ssh-agent -k                                                            
    fi                                                                          
    rm $SSH_AUTH_SOCK                                                           
}                                                                               
trap end_agent EXIT 
set +x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Clone via SSH
&lt;/h2&gt;

&lt;p&gt;After setting up injection of my SSH keys, I went around the projects I had on my machine and changed the remote from HTTPS to SSH. Now I can interact with remote repositories without having to enter my username and password every time!&lt;/p&gt;

&lt;h2&gt;
  
  
  WIP &amp;amp; NAH
&lt;/h2&gt;

&lt;p&gt;Earlier this year Dave Hemphill tweeted about the power of WIP. Essentially that's the only commit message you need. That gives us our first alias&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias wip="git add . &amp;amp;&amp;amp; git commit -m 'WIP'"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I wouldn't advocate this behavoiur for team work or a situation where commit messages are necessary but for me to quickly save state and gaurantee that I'm storing project history, it more than works for me.&lt;/p&gt;

&lt;p&gt;The second alias is nah. Nah is a git reset and clean to get your working tree back to the state of the last commit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias nah="git reset --hard &amp;amp;&amp;amp; git clean -df"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GitLens
&lt;/h2&gt;

&lt;p&gt;GitLens gives VSCode super powers. I probably haven't scratched the surface of what this package can do but I can now instantly get the full commit/edit history for any project file from within the editor.&lt;/p&gt;

</description>
      <category>git</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
