Jekyll2018-01-02T19:48:50+00:00http://mattclements.co.uk/Matt ClementsWeb Developer from Milton Keynes2018 Goals2018-01-01T20:01:18+00:002018-01-01T20:01:18+00:00http://mattclements.co.uk/2018/01/01/2018-goals<h3 id="2017-review">2017 Review</h3>
<p>2017 was a good year for me.</p>
<ul>
<li>I strived to adjust my previously <em>broken</em> work-life balance, and succeeded at times.</li>
<li>I took up a new hobby of running, and completed <a href="https://2017.strava.com/en-gb/videos/07848a6f25b9dad2f9445a30b08de9dba4687215/">961.5km during the year</a>, including a fair few races.</li>
<li>I began budgeting properly, instead of impulse spending. This included reviewing our monthly spending, and reducing where we could. I didn’t always stick to it, but it made me think twice!</li>
<li>I cut the cord on Sky TV! With 2 young children watching Youtube &amp; Netflix, and in the evening watching BBC or Netflix it was a massive cost that we just didn’t need.</li>
<li>My wonderful family flourished, including the eldest taking up trumpet, and the youngest starting school. My wife returned to work in a job that follows the saying <a href="https://www.brainyquote.com/quotes/confucius_134717">“choose a job you love, and you will never have to work a day in your life.”</a></li>
</ul>
<h3 id="welcome-to-2018">Welcome to 2018!</h3>
<p>I feel like 2018 is going to be a good year. And I have set a few goals rather than resolutions this year. I will update this post as the year progresses</p>
<ul>
<li>Run 1500km during the year - <a href="http://en-gb.smashrun.com/mattclements/overview/2018">Track Progress</a></li>
<li>Complete my first <a href="http://mkmarathon.com">Marathon</a>, and <a href="https://www.racetothestones.com">Ultra Marathon</a> (already booked)</li>
<li>Improve (further) my work-life balance, and also look to improve my work-hobby-family time balance</li>
<li>Start to say <strong>“no”</strong> a bit more. I have always been one to help, and say “yes” at every opportunity, which often causes me stress and worry over not managing to do everything I have promised.</li>
<li>Read more! 12 books is my initial goal, one a month, surely I can manage that!</li>
<li><del>Redevelop/tweak my website (again)! With not doing so much freelance work (and almost all for established clients) I want to turn this more to a update blog.</del></li>
<li>Swim/Bike more - in preparation for my (hopeful) 2019 goal to complete an Ironman</li>
<li>Run every day of the year - runs must be at least 15 minutes long, and must be run outside - <a href="http://en-gb.smashrun.com/mattclements/overview/2018">Track Progress</a></li>
</ul>
<p>Thats all for now. I will keep everyone updated on my progress.</p>2017 ReviewAmazon Dash Doorbell2017-01-08T09:01:11+00:002017-01-08T09:01:11+00:00http://mattclements.co.uk/2017/01/08/amazon-dash-doorbell<p>So, my weekend hack project came to me in the form of a tweet. Thanks to <a href="http://freelancegeek.co.uk">Christian Hambly</a> for the idea:</p>
<blockquote class="twitter-tweet" data-cards="hidden" data-lang="en-gb"><p lang="en" dir="ltr">My weekend project set, silent doorbell! : <a href="https://t.co/rbvz34P4As">https://t.co/rbvz34P4As</a><br /><br />Cc <a href="https://twitter.com/mattclementsuk">@mattclementsuk</a> <a href="https://twitter.com/bseymour">@bseymour</a></p>&mdash; Christian Hambly (@ChristianHambly) <a href="https://twitter.com/ChristianHambly/status/817626090919301120">7 January 2017</a></blockquote>
<script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<p>Myself and my eldest set about installing Node, developing the required code <a href="https://github.com/initialstate/silent-doorbell/wiki">mainly based upon the original article</a>, and working with <a href="https://pushover.net">Pushover</a> which I have already used previously for notifications, the final code looks as follows:</p>
<figure class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">function</span> <span class="nx">send_pushover_notification</span><span class="p">()</span> <span class="p">{</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /> <span class="kd">var</span> <span class="nx">push</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span> <span class="s1">'pushover-notifications'</span> <span class="p">);</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /> <span class="kd">var</span> <span class="nx">p</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">push</span><span class="p">(</span> <span class="p">{</span><br data-jekyll-commonmark-ghpages="" /> <span class="na">user</span><span class="p">:</span> <span class="s2">"xxxx"</span><span class="p">,</span><br data-jekyll-commonmark-ghpages="" /> <span class="na">token</span><span class="p">:</span> <span class="s2">"xxxx"</span><br data-jekyll-commonmark-ghpages="" /> <span class="p">});</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /> <span class="kd">var</span> <span class="nx">msg</span> <span class="o">=</span> <span class="p">{</span><br data-jekyll-commonmark-ghpages="" /> <span class="na">message</span><span class="p">:</span> <span class="s2">"Somebody is at the door!"</span><span class="p">,</span><br data-jekyll-commonmark-ghpages="" /> <span class="na">title</span><span class="p">:</span> <span class="s2">"Doorbell"</span><span class="p">,</span><br data-jekyll-commonmark-ghpages="" /> <span class="na">sound</span><span class="p">:</span> <span class="s1">'pushover'</span><span class="p">,</span><br data-jekyll-commonmark-ghpages="" /> <span class="na">priority</span><span class="p">:</span> <span class="mi">1</span><br data-jekyll-commonmark-ghpages="" /> <span class="p">};</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /> <span class="nx">p</span><span class="p">.</span><span class="nx">send</span><span class="p">(</span> <span class="nx">msg</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span> <span class="nx">err</span><span class="p">,</span> <span class="nx">result</span> <span class="p">)</span> <span class="p">{</span><br data-jekyll-commonmark-ghpages="" /> <span class="k">if</span> <span class="p">(</span> <span class="nx">err</span> <span class="p">)</span> <span class="p">{</span><br data-jekyll-commonmark-ghpages="" /> <span class="k">return</span> <span class="kc">false</span><span class="p">;</span><br data-jekyll-commonmark-ghpages="" /> <span class="p">}</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /> <span class="k">if</span><span class="p">(</span><span class="nx">result</span><span class="p">.</span><span class="nx">status</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span><br data-jekyll-commonmark-ghpages="" /> <span class="k">return</span> <span class="kc">true</span><span class="p">;</span><br data-jekyll-commonmark-ghpages="" /> <span class="p">}</span><br data-jekyll-commonmark-ghpages="" /> <span class="p">});</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /> <span class="k">return</span> <span class="kc">false</span><span class="p">;</span><br data-jekyll-commonmark-ghpages="" /><span class="p">}</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /><span class="kd">var</span> <span class="nx">dash_button</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'node-dash-button'</span><span class="p">),</span><br data-jekyll-commonmark-ghpages="" /> <span class="nx">dash</span> <span class="o">=</span> <span class="nx">dash_button</span><span class="p">(</span><span class="s1">'xx:xx:xx:xx:xx:xx'</span><span class="p">),</span><br data-jekyll-commonmark-ghpages="" /> <span class="nx">exec</span> <span class="o">=</span> <span class="nx">require</span><span class="p">(</span><span class="s1">'child_process'</span><span class="p">).</span><span class="nx">exec</span><span class="p">;</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /><span class="nx">dash</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'detected'</span><span class="p">,</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span><br data-jekyll-commonmark-ghpages="" /> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Button pushed!'</span><span class="p">);</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /> <span class="nx">send_pushover_notification</span><span class="p">();</span><br data-jekyll-commonmark-ghpages="" /><span class="p">});</span><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /><br data-jekyll-commonmark-ghpages="" /><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Ready'</span><span class="p">);</span></code></pre></figure>
<p>We have a server fitted in the loft which I installed Node onto, then <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04#install-pm2">installed PM2</a> in order to run the application as a service.</p>
<p>The eldest installed <a href="https://pushover.net">Pushover</a> on his iPod Touch which means he knows exactly when the doorbell rings!</p>
<p>The final result:</p>
<p><img src="/assets/img/2017/01/doorbell.jpg" alt="Doorbell" /></p>
<p>Also worth considering when it comes out in the UK <a href="https://www.amazon.com/dp/B01C7WE5WM">Amazon IOT Button</a></p>So, my weekend hack project came to me in the form of a tweet. Thanks to Christian Hambly for the idea:Apple Energy2016-06-10T05:58:35+00:002016-06-10T05:58:35+00:00http://mattclements.co.uk/2016/06/10/apple-energy<p>Seth Weintraub, 9to5Mac:</p>
<blockquote>
<p>Apple has quietly created an energy subsidiary, “Apple Energy” LLC, registered in Delaware but run from its Cupertino headquarters. The company was seemingly formed to allow it to sell excess electricity generated by its solar farms in Cupertino and Nevada, with plans to sell electricity across the whole of the US.</p>
</blockquote>
<p>I guess it makes sense, to cover their own needs and sell any excess back. It will be interesting to see what rolls out across the rest of the world (if anything).</p>
<p>And who says that Apple aren’t a services company…?</p>Seth Weintraub, 9to5Mac:New Apple Store designs2016-05-22T07:18:03+00:002016-05-22T07:18:03+00:00http://mattclements.co.uk/2016/05/22/new-apple-store-designs<p>I love the new design planned, would like to see these worldwide</p>
<p><img src="/assets/img/2016/05/image.jpeg" alt="" /></p>
<p><a href="http://www.theverge.com/2016/5/19/11715726/apple-flagship-store-opening-san-francisco-photos">Photos from The Verge</a></p>I love the new design planned, would like to see these worldwideCascading soft deletes with Eloquent2016-05-14T11:15:57+00:002016-05-14T11:15:57+00:00http://mattclements.co.uk/2016/05/14/post-post<p>I can see an awesome use for this <a href="https://dyrynda.com.au/blog/cascading-soft-deletes-with-laravel-and-eloquent">Laravel Package</a></p>I can see an awesome use for this Laravel PackageLaravel bypassing CSRF for certain routes2015-06-17T22:09:59+00:002015-06-17T22:09:59+00:00http://mattclements.co.uk/2015/06/17/laravel-bypass-csrf<blockquote>
<p>Laravel has CSRF enabled by default for all requests that come through your app. This is included and handled automatically to make life easier.</p>
<p>However, one issue that comes up is when you are using external services where you do not have the ability to set a token. An example of this is with web hooks from third parties.</p>
<p><a href="https://laravel-news.com/2015/06/excluding-routes-from-the-csrf-middleware/">Read more at Laravel News</a></p>
</blockquote>
<p>What an awesome addition to Laravel</p>Laravel has CSRF enabled by default for all requests that come through your app. This is included and handled automatically to make life easier. However, one issue that comes up is when you are using external services where you do not have the ability to set a token. An example of this is with web hooks from third parties. Read more at Laravel NewsLadies and gentlemen, I shit you not: Phil Schiller2015-06-16T22:13:39+00:002015-06-16T22:13:39+00:00http://mattclements.co.uk/2015/06/16/the-talk-show-wwdc-2015<p>An absolutely brilliant episode of <a href="http://daringfireball.net/thetalkshow/">The Talk Show</a> by <a href="http://daringfireball.net/">John Gruber</a></p>
<ul>
<li><a href="http://daringfireball.net/thetalkshow/2015/06/09/ep-123">Podcast &amp; Video</a></li>
<li><a href="http://www.imore.com/gruber-and-schiller-our-full-transcript-talk-show-wwdc">Transcript</a></li>
</ul>An absolutely brilliant episode of The Talk Show by John GruberTesting within Laravel 5.12015-06-16T21:04:03+00:002015-06-16T21:04:03+00:00http://mattclements.co.uk/2015/06/16/testing-within-laravel-5-1<blockquote>
<p>Jeffrey Way’s fantastic Integrated package has given integration tests in Laravel superpowers for a while now, and it’s now a part of the Laravel core.</p>
<p><a href="https://mattstauffer.co/blog/better-integration-testing-in-laravel-5.1-powerful-integration-tests-in-a-few-lines">Matt Stauffer</a></p>
</blockquote>
<p>Awesome to see this land within Laravel 5.1 and nice to see Laravel lowering the barrier to entry for testing.</p>Jeffrey Way’s fantastic Integrated package has given integration tests in Laravel superpowers for a while now, and it’s now a part of the Laravel core. Matt StaufferSwitching a team to a framework2015-05-31T21:57:30+00:002015-05-31T21:57:30+00:00http://mattclements.co.uk/2015/05/31/switching-a-team-to-a-framework<p>We recently embarked on a project where we new that things were a little different than our normal project:</p>
<ol>
<li>The project needed some rapid development to push it into production as soon as possible</li>
<li>Whilst rapid development was necessary, the project was going to be maintained ongoing by our small team</li>
<li>We had only a very small number of external dependancies such as other codebases to interface with</li>
<li>We had no external database administrators to maintain</li>
</ol>
<p>Previously we as a team had not used a “full-stack” framework within a team, writing mainly vanilla PHP code, often stemming back to PHP4 era; it was time for change!</p>
<hr />
<p>From a long hard review at the myriad of frameworks available we settled on <a href="http://laravel.com/">Laravel</a>, primarily due to the LTS that is coming with <a href="https://laravel-news.com/2015/05/laravel-announces-v5-1-will-be-lts/">Version 5.1</a> and the huge support from the community that Laravel is currently receiving.</p>
<p>We are building a large scale CRUD application, with a number of external applications hooking into this application (most of which are under our control) to follow our business needs.</p>
<h2 id="writing-less-code-to-do-more">Writing less code to do more</h2>
<p>We found that using Laravel meant that we wrote less code overall to achieve more. Our application is built around 2 main models which are very similar to each other, but with minor differences in their relationships with other models. Using a framework has allowed us to build reusable parts of our application which can be shared across these 2 models.</p>
<h2 id="improving-our-coding-quality">Improving our Coding Quality</h2>
<p>Using Laravel (or generally a framework) has massively improved our teams coding quality. Whilst using a framework does not instantly mean that the code is good quality, it requires you to think a little more about where your code sits in the stack, how it interacts with other parts of the application, and the chance for reusability and whether this is likely to be required and therefore should abstracted. We found this extra time to think, along with the ability to write less code meaning that our application is far better quality than it would have otherwise been.</p>
<h2 id="better-source-control">Better Source Control</h2>
<p>We have always struggled with keeping code maintainable, and managing our application in source control (especially as previously we had not kept the database in source control, and had to rely on diff-ing database exports to compare changes).</p>
<p>With using <a href="http://laravel.com/docs/5.0/migrations">Migrations</a> within Laravel we are now able to keep our Local, Staging &amp; Production environments correctly up to date, and manage any changes across a team.</p>
<h2 id="packages">Packages</h2>
<p>Having the huge number of packages available from the community both in the form of <a href="https://packagist.org/">“normal” composer packages</a> and <a href="http://packalyst.com/">Laravel specific composer packages</a> has meant that we can often use community provided code (and spend our time helping with these rather than re-developing our own) and rapidly develop our application.</p>
<hr />
<p>Overall the use of a framework (and specifically Laravel) has meant that our team has improved code quality, provided us with better management over our application and massively helped us rapidly develop our latest application!</p>We recently embarked on a project where we new that things were a little different than our normal project:Your Tradebase2014-12-08T13:39:34+00:002014-12-08T13:39:34+00:00http://mattclements.co.uk/2014/12/08/your-tradebase<p>Front-End Development Project</p>
<p><img src="/assets/img/2014/12/Screen-Shot-2014-12-08-at-13-38-37-1.png" alt="Your Tradebase" /></p>
<p>Site: <a href="https://www.yourtradebase.com/">Your Tradebase</a>
Client: <a href="https://www.yourtradebase.com/">Your Tradebase</a>
Skills: Ruby on Rails, HTML5, CSS3, jQuery</p>Front-End Development Project