<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Andrew Beeken</title>
	<atom:link href="https://andrewbeeken.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>https://andrewbeeken.co.uk</link>
	<description>Code, Movies, Games and Words</description>
	<lastBuildDate>Sun, 04 Jul 2021 18:35:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='andrewbeeken.co.uk' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://secure.gravatar.com/blavatar/833e62adbda077596f7d24698c552feb3bb5132665132764a12ceb941a57bcb5?s=96&#038;d=https%3A%2F%2Fs0.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Andrew Beeken</title>
		<link>https://andrewbeeken.co.uk</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://andrewbeeken.co.uk/osd.xml" title="Andrew Beeken" />
	<atom:link rel='hub' href='https://andrewbeeken.co.uk/?pushpress=hub'/>
	<item>
		<title>Getting started building web apps with React + Tailwind</title>
		<link>https://andrewbeeken.co.uk/2021/07/04/getting-started-building-web-apps-with-react-tailwind/</link>
					<comments>https://andrewbeeken.co.uk/2021/07/04/getting-started-building-web-apps-with-react-tailwind/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Sun, 04 Jul 2021 18:35:03 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[react]]></category>
		<category><![CDATA[react.js]]></category>
		<category><![CDATA[sass]]></category>
		<category><![CDATA[scss]]></category>
		<category><![CDATA[tailwind]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1713</guid>

					<description><![CDATA[Ah, here we are again. Way back in October 2019 I wrote up some thoughts on front end frameworks, back when they were the hawt thing. I started taking a look at Vue.JS and, thanks to my time tinkering with Gatsby, React. I liked what I saw but never really had a chance to take [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Ah, here we are again. Way back in October 2019 I wrote up <a href="https://andrewbeeken.co.uk/2019/10/31/some-thoughts-on-frontend-frameworks-and-a-little-bit-of-vue-js/">some thoughts on front end frameworks</a>, back when they were the hawt thing. I started taking a look at Vue.JS and, thanks to my time tinkering with Gatsby, React. I liked what I saw but never really had a chance to take it further than &#8220;this is a nice thing that I play around with in my spare time&#8221; and have, for the last year at Laser Red, dove further into WordPress, leaving these front end frameworks in my rear view mirror.</p>



<p>Well, what goes around and all that and I&#8217;m getting back into the idea of front and back end development separation. It&#8217;s still very much hobby coding at present but I&#8217;m starting to delve more and more into it &#8211; <a href="https://andrewbeeken.co.uk/2021/06/27/a-basic-rest-api-starter-using-node-js-and-mongodb/">last week I discussed a starter I&#8217;d put together in Node.JS to build a simple API</a> and this week I&#8217;ve started tentative steps working towards the front end of that with React.</p>



<p>It&#8217;s certainly something I&#8217;m really looking forward to spending some more time with and I&#8217;ve already looked at a couple of tutorials online for ingesting from APIs, passing data back and forth between components, but one of the things I really wanted to do was get myself set up with a good starter project I can take forward to kick off my own projects going forward.</p>



<p>Over the last few months at work we&#8217;ve started using <a href="https://tailwindcss.com/">Tailwind</a> as our go to CSS framework &#8211; it&#8217;s an excellent set of utility classes that hooks into Webpack and it&#8217;s so intuitive it&#8217;s led me to completely abandon the bloatiness of Bootstrap. One of the key reasons for this is the fantastic way that Tailwind prunes any unused styles on build, leaving you with a streamlined and super quick to load stylesheet. To me this felt like the perfect thing to pair with React to start creating some nice quick web apps.</p>



<p>Fortunately Tailwind have a great <a href="https://tailwindcss.com/docs/guides/create-react-app">step-by-step guide on how to get Tailwind working in tandem with the create-react-app environment</a>, but I didn&#8217;t really want to have to go through all that every time I wanted to spin up a new app. So, I built my own starter which not only incorporated Tailwind into the process but also built in node-sass to allow me to code scss stylesheets, as well as moving the default c-r-a set up into a more logical structure that separates components from styles.</p>



<p>You can <a href="https://github.com/abeeken/react-tailwind">grab it from </a>GitHub here and it&#8217;s what I&#8217;m planning to start using to build some tasty React stuff going forwards. Watch this space and shout up in the comments if you find this useful!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2021/07/04/getting-started-building-web-apps-with-react-tailwind/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2021/07/react-tailwind.png" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/07/react-tailwind.png" medium="image">
			<media:title type="html">react-tailwind</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>A basic REST API starter using Node.JS and MongoDB</title>
		<link>https://andrewbeeken.co.uk/2021/06/27/a-basic-rest-api-starter-using-node-js-and-mongodb/</link>
					<comments>https://andrewbeeken.co.uk/2021/06/27/a-basic-rest-api-starter-using-node-js-and-mongodb/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Sun, 27 Jun 2021 17:19:00 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[back end development]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[restful api]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1701</guid>

					<description><![CDATA[Okay, this is something I&#8217;ve been playing around with for a while now, trying to get a better understanding of, and I&#8217;m super pleased to finally be able to publish this. As with most developers, I&#8217;ve worked with APIs for a big chunk of my career &#8211; being able to access third party data in [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Okay, this is something I&#8217;ve been playing around with for a while now, trying to get a better understanding of, and I&#8217;m super pleased to finally be able to publish this.</p>



<p>As with most developers, I&#8217;ve worked with APIs for a big chunk of my career &#8211; being able to access third party data in a secure fashion to use in your own applications is kind of one of the cornerstones of being a good and efficient developer and I&#8217;ve utilised this heavily on projects like <a href="https://andrewbeeken.co.uk/?s=clock">CLOCK</a> and the work I did on the <a href="https://andrewbeeken.co.uk/2015/05/19/modelling-research-data/">University of Lincoln Research Bridge</a>. While I&#8217;ve always been happy to consume data from other parties endpoints, though, I&#8217;ve not often actually written my own; and while I have built my own solutions to allow applications to access data within the systems I&#8217;ve worked with it&#8217;s never been in a &#8220;proper&#8221; REST way.</p>



<p>One of the things I had hoped to do with Research Bridge, before the project itself was suspended several years back (that&#8217;s a story for another post&#8230; maybe&#8230;) was to convert the WordPress based proof of concept we&#8217;d built into something that was more sustainable and modern. While I orbited Laravel and Symfony for a while, one of the constant thoughts I had was to separate the back and front end into separate Node.JS apps &#8211; the back end to handle the data collection and distribution, and the front end to get this data and display it to the user.</p>



<p>As readers of this blog will know, I&#8217;ve been a tinkerer with Node.JS for a number of years and, to me, this seemed like the logical choice to not only simplify the code base, but also to make the core &#8220;bridge&#8221; data easily reusable by other applications. While I never got the opportunity to learn and apply this to the production Research Bridge app, it&#8217;s something that I&#8217;ve returned to over the last couple of weeks, toying with different tutorials and ideas to get to a point where I have what I&#8217;d consider a good foundation for building a RESTful endpoint to act as a backend for an application.</p>



<p><a href="https://github.com/abeeken/api-starter">If you want to take a look, it&#8217;s in this GitHub repository here</a>.</p>



<p>Now, I can&#8217;t fully take credit for the code &#8211; it&#8217;s largely influenced by <a href="https://medium.com/codex/building-a-simple-crud-app-with-node-js-express-js-and-mongodb-6e96d13edae7">this Medium article by Abhijit Roy</a>, however I have made some tweaks such as simplifying down the schema so as not to make it too bulky for a starter project, as well as tweaking the code formatting to match my own. Still, if you want to get a better understanding of what the code is doing, check out that original article.</p>



<p>So, first things first, why MongoDB? Well, again, it was something I&#8217;d wanted to get to grips with for a while, being a SQL focussed developer for my entire career. As with many things, this revolved largely around the requirements of the roles I&#8217;ve been in. The idea of a database that stored its data not as structured SQL but effectively as collections (that&#8217;s what &#8220;tables&#8221; are literally called in MongoDB land) of JSON documents fascinated me.</p>



<p>One of the things that stood out for me when playing around with this, is that, while you&#8217;re learning at least, it&#8217;s far easier to set up your DB environment using the free service at <a href="https://www.mongodb.com/cloud/atlas">MongoDB Atlas</a>. While I got MongoDB up and running on my Mac no problem, it was quite the fiddly process &#8211; for experiments, Atlas will do exactly what you need to and host your data in the cloud.</p>



<p>Also, when you&#8217;re testing your endpoint with <a href="https://www.postman.com/">Postman</a> (which is a fairly essential piece of kit, by the way), don&#8217;t forget to set the body type of your Post requests to Raw and JSON &#8211; I had a fantastic time trying to figure out why my perfectly correctly figured JSON data was being rejected by the insert function and this was the reason&#8230; <img src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f926-200d-2642-fe0f.png" alt="🤦‍♂️" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>Anyway, I hope this helps you if you&#8217;re interested in API development. It&#8217;s definitely something I&#8217;m hoping to be playing around with in the future and the next step is to create a tasty front end (I&#8217;m thinking of using React) to plug onto the API here.</p>



<p>As always, please shout up in the comments!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2021/06/27/a-basic-rest-api-starter-using-node-js-and-mongodb/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/mongo.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/mongo.jpg" medium="image">
			<media:title type="html">mongo</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>My 2021 productivity tech</title>
		<link>https://andrewbeeken.co.uk/2021/06/10/my-2021-productivity-tech/</link>
					<comments>https://andrewbeeken.co.uk/2021/06/10/my-2021-productivity-tech/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Thu, 10 Jun 2021 17:58:06 +0000</pubDate>
				<category><![CDATA[Discussion]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[devices]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[m1]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[MacBook]]></category>
		<category><![CDATA[pixel]]></category>
		<category><![CDATA[pixel 4a5g]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[workflow]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1698</guid>

					<description><![CDATA[I’m always very wary of these kinds of posts as they can easily come across as being boastful with a “look at all this stuff I have” air, however I personally find reading about how other people manage their own lifestyle productivity. For me the last two years have been a real change in how [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>I’m always very wary of these kinds of posts as they can easily come across as being boastful with a “look at all this stuff I have” air, however I personally find reading about how other people manage their own lifestyle productivity.</p>



<p>For me the last two years have been a real change in how I look at this kind of thing, from changing jobs to having to focus my mind a lot more in a personal environment that’s largely gone into stasis, and for a period my personal organisation took a dive. Recently, though, I’ve been trying hard to organise myself, to write more and do more coding exercises on things that I don’t get an opportunity to do outside of work; this has led me to need to be way more organised, and over the last couple of months I’ve realised there’s three devices I use more frequently than anything else for different tasks.</p>



<p>I think what fascinates me most is how interconnected technology has become; when I read back through posts on this site of me lambasting Apple’s walled garden device approach VS the more open tech from Google and Microsoft, then consider the fact I’m writing this post on an iPad, using imagery I took on two different devices that I also back up to a Google Drive account, I realise we live in a far more connected world than we did 10, maybe even 5 years ago. With that, these are the three devices I use most to manage my personal work.</p>



<h2 class="wp-block-heading">MacBook Air</h2>



<p>This is a very recent change based on a year of using a MacBook Pro for work while struggling through trying to do personal coding on a very creaky old Windows machine. Anyone who’s previously read articles on this site will know I’ve long been a Windows user, through my days at the City of Lincoln Council through to my time freelancing and my work at the University of Lincoln.</p>



<p>But the more I started adopting modern ways of coding, the more I realised that the Windows approach wasn’t cutting it any more &#8211; I needed to be able to work more fluently on the command line, not be hamstrung by Windows non-Unix conventions, and when I started with Laser Red moving on to a Mac was the logical solution.</p>



<p>One year on and I picked up one for myself &#8211; an M1 MacBook Air released towards the tail end of 2020 and a very tasty prospect for both productivity and some light gaming. I’ve not quite pushed it as far as I’d like, but as a development machine it’s fast and efficient; I’m planning on doing some video editing soon and it certainly feels like it’s going to hold up well.</p>



<p>The only downside I’ve really found is the Air having two USB C ports over the Pro’s 4, however a decent USB dock has mitigated that and I’ve even rearranged my office set up to allow me to easily hot-swap my work Pro for my personal Air when I need a larger screen to work off or game (gaming on a Mac is an interesting thing, but that’s a whole other article!)</p>



<figure class="wp-block-image size-large"><img width="1024" height="768" data-attachment-id="1699" data-permalink="https://andrewbeeken.co.uk/2021/06/10/my-2021-productivity-tech/img_0402/" data-orig-file="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg" data-orig-size="4032,3024" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}" data-image-title="img_0402" data-image-description="" data-image-caption="" data-medium-file="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=300" data-large-file="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=616" src="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=1024" alt="" class="wp-image-1699" srcset="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=1024 1024w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=2048 2048w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=150 150w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=300 300w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=768 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">iPad Pro</h2>



<p>So,yeah, apparently I’m an Apple person now… Sort of…</p>



<p>I picked up my iPad Pro over a year ago to replace my older iPad (I think it’s a 2012 model?). I predominantly got it to use as a writing device as well as for media consumption but it’s ended up becoming a nice lightweight alternative to a full OS device for productivity. I picked up the keyboard case to go with it and despite having a fairly small footprint, I really enjoy using it for writing.</p>



<p>Yes, I do prefer writing on it over my PC or Mac; the apps I use (this was written entirely in the WordPress app and I also use Google Drive for general writing and Celtx for screenwriting) are light and free from distractions. But it’s also great for low level video editing with LumaFusion, photo editing using Snapseed and sketching in ProCreate using the Apple Pen.</p>



<p>As a media device it’s incredible with good sound and a bright screen, with compatibility across all my digital media and streaming services, and advances in streaming video games mean I can use services like Stadia to play AAA game titles on it.</p>



<p>There’s still one or two niggles I have with it &#8211; iPad OS is a far more open ecosystem than it once was, with a proper file manager and better interactivity between apps overall, but it’s still not the same as a grown up OS &#8211; there are still times when I have to jump through hoops to say transfer audio samples between Hokusai and GarageBand, or get photos from my Google Photos storage into an app.</p>



<p>But it’s small enough to pop open in the dinner table for quick note taking, prop up in the kitchen to watch a film or sit on my lap on the sofa to do some more creative work. Being able to use a USB C hub to connect “proper” devices to it is also a bonus, plus it doubles as a second screen for my Mac thanks to the magic of Apple’s sidecar technology.</p>



<figure class="wp-block-image size-large"><img width="1024" height="768" data-attachment-id="1696" data-permalink="https://andrewbeeken.co.uk/pxl_20210610_161210870_original/" data-orig-file="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg" data-orig-size="4032,3024" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;1.73&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;Pixel 4a (5G)&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1623345130&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;4.38&quot;,&quot;iso&quot;:&quot;132&quot;,&quot;shutter_speed&quot;:&quot;0.042016&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}" data-image-title="pxl_20210610_161210870_original" data-image-description="" data-image-caption="" data-medium-file="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=300" data-large-file="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=616" src="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=1024" alt="" class="wp-image-1696" srcset="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=1024 1024w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=2048 2048w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=150 150w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=300 300w, https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=768 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Pixel 4a with 5g</h2>



<p>Yes, I still use an Android phone.</p>



<p>Despite moving my productivity largely over to Apple devices I still can’t bring myself to get an iPhone. I think that’s largely down to the fact that I still use Google apps primarily and having my phone on me all the time makes it my first point of call for note taking, checking emails and bringing up documents to read on the go.</p>



<p>I also love the camera tech Google builds into their devices. I do dabble in photography &#8211; it’s not really a hobby but it’s something I enjoy and having a camera as good as the one on the Pixel just in my pocket is fantastic. Sure, it’s not THE BEST CAMERA, but it’s excellent for taking good looking photos, the stock app has some reasonable settings and the more open ecosystem on Android means there’s good options for getting more technically advanced camera apps such as Filmic Pro which I use for video.</p>



<p>I can’t see myself moving off an Android handset in the future, but the fact that I can seamlessly go between my Apple devices to it means I’m not particularly bothered &#8211; I’m no fanboy and I’ll take myself where the tech is best to do what I need it to, whether that’s using a device from Google, Apple or Microsoft.</p>



<p>And I guess that’s the purpose of this post, to talk about how we seem to be entering a golden age of tech where everything is working with everything. Walls are being broken down &#8211; Apple tech and apps are appearing on other devices (heck, we can watch Apple TV and iTunes purchased video content on the new Google ChromeCast for goodness sake!) cloud services and standardisations of connection tech via USB C and Bluetooth means that we can transfer data between devices in a cinch and it’s feeling less like an “us and them” mentality towards interoperability.</p>



<p>This can only be a good thing and it opens up opportunities for everyday users and folks with specialist tech requirements to pick up a device knowing that there will generally be a way for them to carry their data and experiences with them regardless of the new tech they’re moving on to. I like it!</p>



<p>So, has the opening up of tech walls helped you make any different decisions on the hardware or software you use? Shout up in the comments!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2021/06/10/my-2021-productivity-tech/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_4946_original.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_4946_original.jpg" medium="image">
			<media:title type="html">img_4946_original</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>

		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/img_0402.jpg?w=1024" medium="image" />

		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210610_161210870_original.jpg?w=1024" medium="image" />
	</item>
		<item>
		<title>Node.JS testing with Mocha and Chai</title>
		<link>https://andrewbeeken.co.uk/2021/06/02/node-js-testing-with-mocha-and-chai/</link>
					<comments>https://andrewbeeken.co.uk/2021/06/02/node-js-testing-with-mocha-and-chai/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Wed, 02 Jun 2021 20:58:24 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[chai]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[mocha]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[testing]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1665</guid>

					<description><![CDATA[Testing in coding is a fairly critical part of any development cycle. The idea of a good test is to catch any issues that your code may generate, from obvious bugs to edge cases. It&#8217;s something that needs considering for both back and front end development and there are various tools at a coders disposal [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Testing in coding is a fairly critical part of any development cycle. The idea of a good test is to catch any issues that your code may generate, from obvious bugs to edge cases. It&#8217;s something that needs considering for both back and front end development and there are various tools at a coders disposal to tackle these tasks.</p>



<p>Now, I&#8217;m going to hold my hands up here and say my testing mojo isn&#8217;t great. It&#8217;s something I keep trying to get right but I often don&#8217;t find myself in a position professionally where I have the time or the right kind of project to set up a decent automated test, so my skills in this area are somewhat underdeveloped. Still, that doesn&#8217;t mean I can&#8217;t take some time out to skill up (a good developer is always learning, imo) so I decided to take a look at how to set up automated testing and indeed test driven development, in Node.JS.</p>



<p>I&#8217;ve set up a really simple Node app which you can <a href="https://github.com/abeeken/sum-it">grab from GitHub</a> that takes arguments from a command line,  performs simple calculations based on those arguments and outputs the result. So, if you launched the app with:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
app.js add 2 2
</pre></div>


<p>The code would ADD 2 TO 2, or 2+2, which would output 4 as the answer. Very straightforward. But to code this I took a different approach. Before jumping right into building the required functions I decided to set up a series of tests that would enssure they were returning the correct calculation.</p>



<h2 class="wp-block-heading">Enter Mocha and Chai</h2>



<p>Mmmm, mocha and chai &#8211; I love a good mocha or chai. In a cup. Of course.</p>



<p>These aren&#8217;t hot drinks, though; Mocha is a testing suite that runs in Node and performs a series of tests on your functions, while Chai is an assertion library &#8211; basically a tool that looks at a value and assesses whether it meets certain criteria. <a href="https://www.chaijs.com/">You can find out more about Chai here</a>.</p>



<p>In your project you&#8217;ll create a folder called tests, and in that folder you&#8217;ll create a series of .js files that contain the rules for each of your tests. Ideally there will be a .js file for each module you plan on writing in your application. A typical test will:</p>



<ul class="wp-block-list"><li>Describe what module it&#8217;s testing</li><li>Describe each test in the module</li><li>Determine what it expects the outcome of the test to be</li></ul>



<p>So, something like this:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
describe("My lovely module", function(){
    it("returns hello world", function(){
        var hello = module.helloworld();
        expect(hello).to.equal("Hello World!);
    });
});
</pre></div>


<p>So in the example above, the test is getting a value returned from a module called helloworld() and checks to see if the value it gets is &#8220;Hello World!&#8221;; if it is, the test passes. If it&#8217;s not, the test fails. That&#8217;s the essence of the Mocha/Chai combo, where Mocha handles the running of the tests and Chai gives you that nice, plain English expect(x).to.equal(y) assertion checking.</p>



<p>So, I started by creating my project, installing these two dependencies and setting up a simple test (I decided to call the project sum-it):</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
mkdir sum-it
cd sum-it
npm init
npm i --save-dev mocha chai
touch test/sum-it.js
</pre></div>


<p>That creates my basic, empty test file. We can run this by typing:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
mocha --reporter spec
</pre></div>


<p>&#8230;or we can add an entry into our package.json:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
"test": "mocha --reporter spec"
</pre></div>


<p>&#8230;which will allow us to run the test simply by typing <em>npm run test</em>.</p>



<p>If we do that now the whole thing will error because, well&#8230; the test doesn&#8217;t really do ANYTHING.</p>



<p>So, we need to define the tests.</p>



<p>I knew my sum-it module needed to have 4 basic functions &#8211; add, subtract, multiply and divide and that each of those would take in two numbers and return the result. Firstly I needed to include these modules (remember, I&#8217;ve not written them yet) and then define the tests for them. Using the basic Mocha/Chai layout, these are the resulting tests:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
var expect = require('chai').expect;
var sumit = require('../app/sum-it');

describe("Sum It Calculator", function(){
    it("adds the numbers", function(){
        var answer = sumit.add(2, 2);
        expect(answer).to.equal(4);
    });
    it("subtracts the numbers", function(){
        var answer = sumit.subtract(4, 2);
        expect(answer).to.equal(2);
    });
    it("multiplies the numbers", function(){
        var answer = sumit.multiply(2, 3);
        expect(answer).to.equal(6);
    });
    it("divides the numbers", function(){
        var answer = sumit.divide(6, 2);
        expect(answer).to.equal(3);
    });
});
</pre></div>


<p>That basic test loads in Chai and the sum-it module, sets up four simple tests and checks to see if the functions are doing what they should.</p>



<p>But, those functions still don&#8217;t exist, so let&#8217;s create them.</p>



<h2 class="wp-block-heading">Adding in the functionality</h2>



<p>Let&#8217;s add in our empty module file:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
touch app/sum-it.js
</pre></div>


<p>&#8230;and put some flesh on the bones of those functions:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
exports.add = function(num1, num2) {
    return num1+num2;
}

exports.subtract = function(num1, num2){
    return num1-num2;
}

exports.divide = function(num1, num2){
    return num1/num2;
}

exports.multiply = function(num1, num2){
    return num1*num2;
}
</pre></div>


<p>One fun thing I learned through this exercise is the exports method you see used above. That allows us to define this file as a module, something we can include elsewhere and run the functions from. You can see it in the test above where we define <em>var sumit = require(&#8216;../app/sum-it&#8217;)</em> and run the individual methods of the module with, for example, <em>var answer = sumit.multiply(2, 3)</em>.</p>



<p>So, now we have our module set up, running <em>npm run test</em> on the command line will fire off Mocha, check all our functions and tell us if they&#8217;re behaving themselves. Cool stuff!</p>



<h2 class="wp-block-heading">Bringing it all together &#8211; and taking it further</h2>



<p><a href="https://github.com/abeeken/sum-it">In the repo for this code on GitHub</a> I&#8217;ve also built an app.js file that takes those command line arguments and fires off the methods as requested:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
var sumit = require('./app/sum-it');
var args = process.argv.slice(2);

var type = args&#91;0];
var num1 = parseInt(args&#91;1]);
var num2 = parseInt(args&#91;2]);

switch(type){
    case 'add':
        console.log(sumit.add(num1, num2));
        break;
    case 'subtract':
        console.log(sumit.subtract(num1, num2));
        break;
    case 'multiply':
        console.log(sumit.multiply(num1, num2));
        break;
    case 'divide':
        console.log(sumit.divide(num1, num2));
        break;
    default:
        console.log('Unknown type');
}
</pre></div>


<p>This all works great, but there&#8217;s more that could be done here &#8211; there&#8217;s an assumption that all the the arguments are as we expect them to be, but we could set up a function to check that before running the sum-it module and, by proxy, we can set up another Mocha test to make sure THAT function is behaving as it should.</p>



<p>Automated testing is cool &#8211; it makes you think more about the application you&#8217;re about to write, how the user is going to interact with it and how it&#8217;s going to interact with itself. It&#8217;s not something I have a huge opportunity to delve into professionally, but it&#8217;s definitely something I&#8217;m going to be introducing a lot more into my personal projects going forward.</p>



<p>As always, if you found any aspects of this article helpful, or if you have anything to add to what I&#8217;ve written here, please feel free to shout up in the comments!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2021/06/02/node-js-testing-with-mocha-and-chai/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210602_202213592.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/06/pxl_20210602_202213592.jpg" medium="image">
			<media:title type="html">PXL_20210602_202213592</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Gitmoji &#8211; making commits fun</title>
		<link>https://andrewbeeken.co.uk/2021/05/23/gitmoji-making-commits-fun/</link>
					<comments>https://andrewbeeken.co.uk/2021/05/23/gitmoji-making-commits-fun/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Sun, 23 May 2021 19:15:05 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[emoji]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git commits]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[gitmoji]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[webdev]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/2021/05/23/gitmoji-making-commits-fun/</guid>

					<description><![CDATA[Just a quick post this week as I’ve not had the time I’d hoped to look at the coding exercise I wanted to blog about &#8211; mainly because I was getting so fed up with my Windows laptop feeling like it was about to fall apart I decided to pull the trigger on an M1 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Just a quick post this week as I’ve not had the time I’d hoped to look at the coding exercise I wanted to blog about &#8211; mainly because I was getting so fed up with my Windows laptop feeling like it was about to fall apart I decided to pull the trigger on an M1 MacBook Air and I’ve been busy setting up my environment on there.</p>



<p>So, what I’m going to talk about is how fun Gitmoji are! What are Gitmoji? Well, they’re basically emoji. Nothing special or new, but the idea of using them in Git commits is as an easily identifiable tag that explains what the commit is. Is it refactoring code, redoing some of the front end HTML or CSS or even something simple as updating some comments or documentation? There’s a recommended emoji for all those scenarios and you can <a href="https://gitmoji.dev/">check them at this handy cheat sheet on gitmoji.dev</a>.</p>



<p>We’ve been using them in our commits at Laser Red for a few weeks now and they’ve not only helped make it clearer what we’re committing but they’ve also made me in particular think about how chunky my commits are &#8211; ideally I like to use only one or two emoji per commit so I’ve really started keeping them lean and to the point, committing little and often to the repo.</p>



<p>It’s something I’ve already started applying to my own github repo’s so it’ll be something you’ll start to see popping up on my own projects that I’ll be discussing here in the future.</p>



<p>If you don’t already tag your commits with Gitmoji, give them a try and, if you do, let me know how you find them in the comments!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2021/05/23/gitmoji-making-commits-fun/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2021/05/img_0398.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/05/img_0398.jpg" medium="image">
			<media:title type="html">img_0398</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Universal Popups with Javascript and CSS</title>
		<link>https://andrewbeeken.co.uk/2021/05/16/universal-popups-with-javascript-and-css/</link>
					<comments>https://andrewbeeken.co.uk/2021/05/16/universal-popups-with-javascript-and-css/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Sun, 16 May 2021 20:02:53 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[modern javascript]]></category>
		<category><![CDATA[vanilla javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[webdev]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1650</guid>

					<description><![CDATA[One of the things I&#8217;m currently trying to improve in my development is moving away from JQuery. I know I&#8217;ve written about JQuery and indeed frameworks like Bootstrap before, even going as far as to bake them into some of the starter projects I&#8217;ve published to GitHub, but the reality I&#8217;ve learned over the last [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>One of the things I&#8217;m currently trying to improve in my development is moving away from JQuery. I know I&#8217;ve written about JQuery and indeed frameworks like Bootstrap before, even going as far as to bake them into some of the starter projects I&#8217;ve published to GitHub, but the reality I&#8217;ve learned over the last year of working in an agency environment is that they are a bloaty crutch.</p>



<p>Sure, I know how to code Javascript and CSS from scratchand for those bits where I can&#8217;t recall things from memory there&#8217;s always a developers first and best tool, good old Google, but relying on libraries like JQuery and chunks of copied code from StackOverflow will only get you so far. Why use Bootstraps built in modals or dropdown menus when you don&#8217;t actually know what the code you&#8217;re implementing is actually doing.</p>



<p>Again, JQuery would, in the past, allow me to repidly implement my own versions of such functions with ease, but as we&#8217;ve already established, it&#8217;s a big library from a time when vanilla JS would have you go round the houses to tackle a simple task. Modern JS is far more user friendly and DOM manipulations can be impemented just as easily as they can in JQuery.</p>



<p>As an exercise, I put together this simple example of a universal function to control show/hide elements in Modern JS:</p>



<figure class="wp-block-embed is-type-rich is-provider-embed wp-block-embed-embed"><div class="wp-block-embed__wrapper">
<div class="embed-codepen"><iframe title="Universal Popouts" id="cp_embed_YzZWOZj" src="https://codepen.io/abeeken/embed/preview/YzZWOZj?default-tabs=html%2Cresult&amp;height=300&amp;host=https%3A%2F%2Fcodepen.io&amp;slug-hash=YzZWOZj" scrolling="no" frameborder="0" height="300" allowtransparency="true" class="cp_embed_iframe" style="width: 100%; overflow: hidden;"></iframe></div>
</div></figure>



<p>As you can see, the results are pretty cool &#8211; with a very straightforward bit of JS and some reserved CSS classes we can control the visibility of elements on the page based on interactions with their respective triggers. This functionality extends from dropdown menus to modals and even a mobile nav menu.</p>



<p>For the latter, the inclusion of a class <strong><em>popout&#8211;static</em></strong> was key, implementing a popout element that wouldn&#8217;t be closed by interactions with other popouts which may be contained within it, only by its own triggers. JS making it simple to check for the existance of this class with <strong><em>classList.contains</em></strong> was the last part of that puzzle, allowing me to make my code as lean as possible.</p>



<p>This is a fairly basic but effective function, but it&#8217;s one that I&#8217;m already planning on expanding with some accessibility considerations for shifting focus into the popout once it&#8217;s triggered, as well as allowing active popouts to be closed using the esc key or by clicking outside of the element itself.</p>



<p>Obviously you can check out the code in the Pen above, but if running things locally is more your flavour, <a href="https://github.com/abeeken/universal_popout">here&#8217;s an Express driven Node.JS project you can grab from GitHub</a>.</p>



<p>Let me know if you find this code useful at all by dropping a comment below!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2021/05/16/universal-popups-with-javascript-and-css/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2021/05/tomy-pop-up-pirate.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/05/tomy-pop-up-pirate.jpg" medium="image">
			<media:title type="html">Tomy-Pop-Up-Pirate</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Mixing it up a bit &#8211; Moving from Gulp to Laravel Mix</title>
		<link>https://andrewbeeken.co.uk/2021/05/10/mixing-it-up-a-bit-moving-from-gulp-to-laravel-mix/</link>
					<comments>https://andrewbeeken.co.uk/2021/05/10/mixing-it-up-a-bit-moving-from-gulp-to-laravel-mix/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Mon, 10 May 2021 18:22:40 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[laravel mix]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[npm]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/2021/05/10/mixing-it-up-a-bit-moving-from-gulp-to-laravel-mix/</guid>

					<description><![CDATA[Well hello there &#8211; it’s been a while, hasn’t it? Checking back through my posts, the last time I wrote about my coding work was back in February of last year, just before all this (gesticulates wildly to the world at large) nonsense kicked off. I’ve been keeping my head low since then for a [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Well hello there &#8211; it’s been a while, hasn’t it? Checking back through my posts, the last time I wrote about my coding work was back in February of last year, just before all this (gesticulates wildly to the world at large) nonsense kicked off.</p>



<p>I’ve been keeping my head low since then for a number of reasons, mainly having to adjust to being at home pretty much 24/7, but also because I’ve been finding my feet in a new role away from the University of Lincoln, working for Lincolnshire based digital agency <a href="http://laser.red">Laser Red</a>. It’s been a bit of a change moving away from the world of research and library information systems, but I’ve been working with some great developers and have picked up some new skills along the way.</p>



<p>One I wanted to chat about today is a change to the way I handle asset building. Yes, yes, I know &#8211; I wrote a whole bunch of posts a couple of years back talking about how to set up Gulp to build JS and CSS for web apps &#8211; well, it’s time to chuck that in the bin and move along because Laravel Mix is now a part of my toolbox and it’s very much here to stay.</p>



<p>Whereas Gulp required a bunch of disparate modules to do simple tasks and could be fiddly to set up, often breaking horribly between versions, Mix is far more lightweight and easy to get up and running in minutes. Now, normally I’d go into more detail with a walkthrough at this point, but the documentation on the Mix website for getting started is so concise there’s really no point. <a href="https://laravel-mix.com/docs/6.0/installation#stand-alone-projects">Go give it a read</a>.</p>



<p>Still want more? <a href="https://github.com/abeeken/mix-starter">Here’s an upgrade to the Node.is project starter I wrote a few years back that uses Mix instead of Gulp as its asset builder</a>. See how more streamlined it is? Using Mix opens up a bunch of opportunities for front end work including compiling specifically for production with ease, as well as implementing modern PostCSS frameworks like Tailwind.</p>



<p>So there we go &#8211; I guess I’m back writing blog posts and not just movie and videogame reviews (although I’ve done a fair few of those over the past year if you want to go and give them a read) &#8211; as always, spark up in the comments if you have any questions and keep your eye on here. I’m planning on doing some regular code tinkering again and will be certainly sharing my work!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2021/05/10/mixing-it-up-a-bit-moving-from-gulp-to-laravel-mix/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2021/05/img_0396.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2021/05/img_0396.jpg" medium="image">
			<media:title type="html">img_0396</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Jamstack isn&#8217;t just about SSG&#8217;s and frameworks&#8230;</title>
		<link>https://andrewbeeken.co.uk/2020/02/13/jamstack-isnt-just-about-ssgs-and-frameworks/</link>
					<comments>https://andrewbeeken.co.uk/2020/02/13/jamstack-isnt-just-about-ssgs-and-frameworks/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Thu, 13 Feb 2020 14:00:17 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jamstack]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[netlify]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[work]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1583</guid>

					<description><![CDATA[After a quick dip into WordPress land in my last post I&#8217;m venturing back to the wilds of Jamstack today with what is a quick but thought provoking post. Did you know that Jamstack isn&#8217;t just about static site generators or the latest hot framework? I kind of did. I mean, it&#8217;s in the name [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>After a quick dip into WordPress land in my last post I&#8217;m venturing back to the wilds of Jamstack today with what is a quick but thought provoking post.</p>



<p>Did you know that Jamstack isn&#8217;t just about static site generators or the latest hot framework?</p>



<p>I kind of did. I mean, it&#8217;s in the name really, isn&#8217;t it? Javascript, API&#8217;s and Markup. At it&#8217;s core that&#8217;s, well, Javascript, some kind of AJAXy thing (maybe) and some HTML/CSS combo to deliver a bunch of content to the browser. The ecosystem also includes version control, continuous integration and hosting via a CDN such as Netlify, but ultimately it&#8217;s all about those core building blocks of the internet and, in theory, you can get there however you want.</p>



<p>So I did.</p>



<p>Early last year I put up a few starter templates on GitHub to help me put projects in motion quicker and one of those was called &#8216;flat_default&#8217;. <a href="https://github.com/abeeken/flat_default">You can check it out here</a>. It&#8217;s fairly rudimentary presenting a Gulp workflow that takes a folder of Pug views, a bunch of JS files and some SCSS, allows for rudimentary and hand coded templating (if you&#8217;re happy with Pug as a HTML pre-processor!) and has a build command that spits everything out into a /dist folder. That&#8217;s everything a Jamstack site needs. So, I thought today, let&#8217;s see what Netlify can do with it.</p>



<p><a href="https://flamboyant-kepler-1da491.netlify.com/">Here you go</a>.</p>



<p>Remarkably painless, easy to get up and running with the simplest learning curve possible &#8211; no learning of a static site builder, no esoteric frameworks or Javascript magic to build pages. Just good, old fashioned HTML and CSS. So it&#8217;s missing things like lazy loading and content sourcing, but these are all plugin&#8217;s I&#8217;ve looked at in Gatsby any way.</p>



<p>Consider a &#8220;simple site&#8221;, one that&#8217;s a handful of pages, some styles, some images; no dynamic content, nothing fancy &#8211; this is where the power of the Jamstack concept comes in. With a straightforward workflow you can pull together the content for this site and host it on Netlify in a matter of minutes. Just point Netlify site at the repository, tell it what build command to run and where it can find the generaqted files.</p>



<p>This is some powerful, game changing stuff.</p>



<p>Feel free to fork the flat_default set up above and let me know if it&#8217;s of any use to you!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2020/02/13/jamstack-isnt-just-about-ssgs-and-frameworks/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2020/02/img_20190422_110748-01.jpeg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2020/02/img_20190422_110748-01.jpeg" medium="image">
			<media:title type="html">IMG_20190422_110748-01</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Classy Templates &#8211; writing better WordPress plugins</title>
		<link>https://andrewbeeken.co.uk/2020/02/06/classy-templates-writing-better-wordpress-plugins/</link>
					<comments>https://andrewbeeken.co.uk/2020/02/06/classy-templates-writing-better-wordpress-plugins/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Thu, 06 Feb 2020 14:30:54 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[object oriented programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[work]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1575</guid>

					<description><![CDATA[Here&#8217;s a confession/admission/realisation (all of the above, tbh) &#8211; a couple of years ago my coding standards slipped. In a desire to simply &#8220;get stuff done&#8221; I lost focus of some of the fundamentals that every good coder should really adhere to; regular readers, however, might recognise that I&#8217;ve been exploring that realisation over the [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Here&#8217;s a confession/admission/realisation (all of the above, tbh) &#8211; a couple of  years ago my coding standards slipped. In a desire to simply &#8220;get stuff done&#8221; I lost focus of some of the fundamentals that every good coder should really adhere to; regular readers, however, might recognise that I&#8217;ve been exploring that realisation over the last year or so as I strive to not only find my mojo again but also pick up on some new skills tha will help me going forwards. One of the things I&#8217;ve known I need to pick back up on is proper Object Oriented coding, something that I feel it&#8217;s easy to get out of a habit of doing when you&#8217;re working in WordPress. My explorations of Symfony led me to touch back on that again, but a conversation with someone last week started me looking at how I could introduce it into my WordPress work.</p>



<p>A days worth of research later and I was set to start building class based designs into my plugins. At first I started looking at one of my old plugins, the <a href="https://github.com/abeeken/custom-field-editor">Custom Field Editor</a>. That plugin basically enables a shortcode based system for building forms on the front end that can then be used to add entries to the post meta for recalling. It was a part of the EPortfolios project that I&#8217;ve mentioned a number of times on here and is really designed to be hidden behind a login. Long story short, trying to turn this into a class model led to a LOT of frustrations, mainly in how PHP classes behave (they <em>technically </em>have to be in one file, not split over multiple files as I normally do) and how they behaved in respect to the idea that the plugin embeds multiple shortcodes within one main one (for some reason the embedded shortcodes broke the rendering of the main one).</p>



<p>So I took a step back and decided to code a very simple class based plugin starter that I could use in future projects. The result is something I&#8217;m hugely pleased with, mainly because it made me realise how easy it is to build WordPress plugins in a class, but also because it allowed me to tick another to-do off my list; split out markup from my PHP functions, in this case with the implementation of a rudimentary templating engine. <a href="https://github.com/abeeken/wp-plugin-starter">You can find the starter class here</a>, so feel free to grab and use it.</p>



<p>What is this doing, then?</p>



<h2 class="wp-block-heading">The plugin</h2>



<p>There&#8217;s a few key things at play here so I&#8217;ll do my best to split them down:</p>



<ul class="wp-block-list"><li>base.php is a &#8220;core&#8221; class file which defines some standard functions and vars that would be usable across any plugin, things like setting the root folder, magic functions and the template renderer (we&#8217;ll get onto that in a bit)</li><li>wp-plugin-starter.php, meanwhile, is the main plugin class. This extends the base class and sets its own vars and logic. In the case of the starter it generates a basic admin screen and shortcode. </li><li>The constructor does most of the heavy lifting with the WordPress API, grabbing settings for the admin and setting up functions that tie into WordPress specific hooks. Because we&#8217;re in scope of the class, we need to reference the callback functions as an array &#8211; array($this, &#8216;function_name&#8217;)</li><li>The shortcode function itself is probably more complex than it needs to be. As I mentioned, I like to split my code down into manageable chunks, but PHP class definitions are required to be in a single file. To get around this, I put the code that sits within the function into another file and included that, keeping the variables in scope. The only gotcha here was that I couldn&#8217;t &#8220;return&#8221; from this file, something essential for WordPress shortcodes.</li><li>Finally, after the class has been defined, the plugin file instantiates the class. This triggers all the API hooks, grabs the data from WordPress and basically makes the plugin &#8220;work&#8221;. As WordPress reinstantiates this every page load, the constructor will always be getting up to date data from any admin settings, so everything operates smoothy and as expected.</li></ul>



<p>This provides a good foundation that can be expanded on to build plugins and will be the way I tackle this going forward.</p>



<h2 class="wp-block-heading">The template engine</h2>



<p>I think template engine is the right term here. It&#8217;s not something like Twig, but it was based on <a href="https://css-tricks.com/php-is-a-ok-for-templating/">a very timely article from Chris Geelhood on CSS-Tricks</a> that explored how to write a simple render_template function for PHP that takes a template name, a bundle of data and pushes something to the screen. I made a couple of modifications to this in context of the class:</p>



<ul class="wp-block-list"><li>The path is made up of the plugin path and view path. At present this view path is hard coded into the base function and is relative to the plugin root (&#8216;/views&#8217;). These values are stored in the object so that they can be easily accessed by all its methods.</li><li>I added a bool flag so that a function can decide whether to render direct to the screen or return the output buffer to the calling function. This was, again, due to the nature of shortcodes needing to return their content to be rendered at the correct place on the page but I can see it potentially having other uses.</li></ul>



<p>I&#8217;ve split this function out into a separate repository so that it can easily be included in other PHP projects and <a href="https://github.com/abeeken/render_view">you can find it here</a>.</p>



<h2 class="wp-block-heading">Final thoughts</h2>



<p>It&#8217;s easy to let your standards slip or at least get into habits that are entirely of your own making when you&#8217;re not part of a fully technical team, but I&#8217;m pleased that not only have I proven to myself that I can pull past knowledge to the fore, I can also add to it in a meaningful way that will make future projects a lot more manageable.</p>



<p>My next goal is to properly refactor the Custom Field Editor plugin &#8211; I&#8217;ve got a great idea as to how I can rework it so that it has a low reliance on shortcodes which I&#8217;m eager to put into place.</p>



<p>I&#8217;m also conscious that the idea of the shortcode is becoming somewhat redundant in the move to Gutenberg, so another future goal will be to look at migrating my knowledge to blocks!</p>



<p>As always, you know where the comments are &#8211; shout up if any of this has been useful for you!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2020/02/06/classy-templates-writing-better-wordpress-plugins/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2020/02/img_20200206_085535.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2020/02/img_20200206_085535.jpg" medium="image">
			<media:title type="html">IMG_20200206_085535</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
		<item>
		<title>Codepen.io &#8211; a fun way to play with frontend development</title>
		<link>https://andrewbeeken.co.uk/2020/01/29/codepen-io-a-fun-way-to-play-with-frontend-development/</link>
					<comments>https://andrewbeeken.co.uk/2020/01/29/codepen-io-a-fun-way-to-play-with-frontend-development/#respond</comments>
		
		<dc:creator><![CDATA[Andrew Beeken]]></dc:creator>
		<pubDate>Wed, 29 Jan 2020 10:01:43 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[codepen]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[webdev]]></category>
		<guid isPermaLink="false">http://andrewbeeken.co.uk/?p=1566</guid>

					<description><![CDATA[Here&#8217;s a quick one &#8211; I&#8217;ve been using Codepen.io for a couple of months now and I think it&#8217;s a fantastic tool for web developers, particularly those with a focus or interest in front end. Not only are there some incredible examples from other members of the community of inventive uses of HTML, CSS and [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Here&#8217;s a quick one &#8211; I&#8217;ve been using Codepen.io for a couple of months now and I think it&#8217;s a fantastic tool for web developers, particularly those with a focus or interest in front end. Not only are there some incredible examples from other members of the community of inventive uses of HTML, CSS and Javascript, it&#8217;s also a great place to show off your portfolio! I personally use it for layout and UI snippets, and it&#8217;s handy to be able to recall them for ease of use in projects &#8211; I&#8217;m definitely of the mindest that anything you build should be easily reusable and Codepen.io definitely embraces that mentality.</p>



<p>One of the things I&#8217;m particularly pleased about is that Codepen.io allows you to fully configure your pens with your favourite pre-processors and frameworks, as well as allowing you to sideload other resources. I&#8217;ve also been using <a href="https://abeeken.github.io/">my (currently) unused Github.io site</a> to serve images to my pens, which has been super handy.</p>



<p><a href="https://codepen.io/abeeken/">Check out some of my work on Codepen.io here</a> and spend some time looking at other folks pens and projects. There&#8217;s some really smart stuff on there and you should totally sign up if you&#8217;ve not already done so!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://andrewbeeken.co.uk/2020/01/29/codepen-io-a-fun-way-to-play-with-frontend-development/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:thumbnail url="https://andrewbeeken.co.uk/wp-content/uploads/2020/01/img_20200129_094441.jpg" />
		<media:content url="https://andrewbeeken.co.uk/wp-content/uploads/2020/01/img_20200129_094441.jpg" medium="image">
			<media:title type="html">IMG_20200129_094441</media:title>
		</media:content>

		<media:content url="https://2.gravatar.com/avatar/85e3923923214578535bf38eb78da431b78908d0594806bd0389bc60fc0f3a4f?s=96&#38;d=https%3A%2F%2F2.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=PG" medium="image">
			<media:title type="html">Andy</media:title>
		</media:content>
	</item>
	</channel>
</rss>
