Commit 2c8f5f2e authored by Mike Street's avatar Mike Street
Browse files

Blog updates & new post

parent 2a575909
---
title: My Favourite 5 Books - A smashing story
date: 2012-02-16
updated: 2019-03-27
intro: Recently I've been going through a fad of buying web related books. I love the feel of books, I love reading books.
permalink: "blog/my-favourite-5-books-a-smashing-story/"
tags:
- Web
- General
- Thoughts
---
Recently I've been going through a fad of buying web related books. I love the feel of books, I love reading books. I love sitting on the train reading about web design and development. With a book you're forced to read, rather than skim. With a book you can slide in a bit of paper and bookmark your favourite snippet of code. With a book you can have them sitting pretty on a book shelf. With a book you can pass it to your neighbour, or have it sitting on your desk, giving you something to flick through when you want to rest your eyes from the screen.
With books come magazines. The .net magazine is my bible. I will sit and read it from cover to cover, soaking in the news, the stories, the interviews and the hints and tips. I just love being able to open a page and turn it to my developer. My .net mag gets whored around like a lady of the night in my office and thats because its easy to read and easy to digest. Its not like sitting in front of a computer reading a long article. Web articles never look pretty. Books and magazines look stunning.
The irony is not lost on me that I am writing a blog post about how good books are. I have not lost the fact that I am writing a long piece of ugly text for you to sit and read. The fact i'm merely typing is because I cannot afford to publish my blog posts.
Anyway, I digress. The purpose of my boast was not to ramble on about the greatness of books, but to recommend a few. I would like to start some sort of #bookstobuy club. The idea being that you list your favourite 5 books, or recent web related book or magazine purchases and you explain in a few words why its a good book. Write a blog about it and put the link in the comments. Hopefully this will be good to the world. So onto my list:
_Just a note - you'll find the title of the book and a link, followed by the [publisher] and the {topics} of the book. All I ask is that you follow suit._
1. [.net magazine](http://www.netmagazine.com/) {HTML, CSS, PHP, General Knowledge} - It goes without saying that this magazine has taught me an astonishing amount of things. The greatness it brings to life is good.
2. [jQuery - Novice to Ninja](http://www.sitepoint.com/books/jquery1/) [Sitepoint] {Javascript, jQuery} - this book, on its own, got me into jQuery. Made me realise the most complex of animations and effects are just a .animate() away.
3. [The CSS Anthology](http://www.sitepoint.com/books/cssant3/?historicredirect=cssant1&historicredirect=cssant2) [Sitepoint] {CSS} - A brilliant book that gives you the low down on all the CSS selectors and what they do and cover. An amazing reference book
4. [HTML5 and CSS3 for the real world](http://www.sitepoint.com/books/htmlcss1/) [Sitepoint] {HTML5, CSS3, Semantics} - (seeing a trend here?) This book educated me into the wonders of HTML5\. It is what I have built this site and [written this blog post](https://www.mikestreety.co.uk/blog/html5-explained-briefly). The things I learnt from the book have put me in good stead for the next few years.
5. [The Smashing Magazine Books](https://shop.smashingmagazine.com/) [Smashing Magazine] {Everything} - (I know strictly this is numbers 5 & 6, but they were a bundle!) I bought the bundle (books one and two) and they are absolutely fantastic. Brilliant. They cover tons of topics and give you a good overview of _so_ many topics. I have, in fact, just ordered [the third book](http://www.smashingmagazine.com/2012/02/15/smashing-book-3-preorder/) despite not even being halfway through the first. They are just teasers of topics, which allows you to gauge what that subject is and what you're interests are.
They are my favourite 5 books - what are yours?
---
title: My Media Centre Solution
date: 2013-06-03
updated: 2016-04-08
intro: About a year ago, my nerdiness got upgraded. I purchased a second hand NAS.
permalink: "blog/my-media-centre-solution/"
tags:
- Geekery
- Raspberry Pi
---
About a year ago, my nerdiness got upgraded. I purchased a second hand [NAS](http://www.qnap.com/useng/?lang=en-us&sn=862&c=1697&sc=1698&t=1701&n=6731). This sat behind my TV and stored my music and films and meant we could stream the media to my Xbox and watch it on the big TV rather than crowding round the laptop.
However, it wasn't quite what I wanted. It was noisy and cumbersome and took a while to poll what was on the drives. It was then that I found about about the [Raspberry Pi](http://www.raspberrypi.org/). A tiny, credit card sized computer - originally designed to encourage kids to get into programming, its become a world wide phenomenon and is used for [all sorts of things](http://arstechnica.com/information-technology/2012/12/10-raspberry-pi-creations-that-show-how-amazing-the-tiny-pc-can-be/).
With the HDMI output and the small footprint, its the ideal candidate for a home media centre. I tried all sorts of programs and operation systems, but eventually settled on [Raspbmc](http://www.raspbmc.com/); a brilliant Rasperry Pi specific build of [XBMC](http://xbmc.org/) (A Media Centre OS originally designed for the Xbox hardware).
Using a powered USB hub, I power the Pi and a Western Digital Passport 350gb HDD. The hard drive holds all my media (films, tv shows, music) and feeds Raspbmc which is stored on the 4gb SD card plugged into the PI.
To install, I used the windows Raspbmc installer - letting the Pi do its thing once you plug the SD card in. From there, I followed some instructions on [how to mount a HDD in Raspbmc](http://raspi.tv/2012/how-to-mount-and-use-a-usb-hard-disk-with-the-raspberry-pi).
Once the hardware is set up, I logged into my router to ensure that the Pi always gets the same IP address - this is especially handy for the next bit!
To control the Pi, I either use the web interface that the Raspbmc comes with by navigating to the pre designated IP address or I have the fantastic [Yatse](https://play.google.com/store/apps/details?id=org.leetzone.android.yatsewidgetfree&hl=en) XMBC remote for my android. This is buy _far_ the best android remote.
I now have a silent, small media centre which allows me to watch movies, TV shows and play music back through my television without having to touch a computer. Raspbmc even has the global uPnP (Universal Plug and Play) protocol, which enables seamless integration and playback with my Xbox and WiFi radio.
......@@ -3,6 +3,7 @@ title: Make Anchor CMS work with its files elsewhere
date: 2014-06-06
updated: 2016-04-09
intro: Recently I wanted to tidy up my public_html directory - as the folders were getting too much and I like a clean directory.
permalink: "blog/make-anchor-cms-work-with-its-files-elsewhere/"
tags:
- Web
- CMS
......
---
title: My Local Bike Shop in Brighton
date: 2014-09-22
updated: 2016-04-09
intro: Living in Brighton, there is a huge array of bike shops to choose from. Ask any local cyclist and the phrase "Support your local bike shop" is often muttered
permalink: "blog/my-local-bike-shop-in-brighton/"
tags:
- Cycling
---
Living in Brighton, there is a huge array of [bike shops](https://goo.gl/maps/9PGYL) to choose from. Ask any local cyclist and the phrase _"Support your local bike shop"_ is often muttered - with people suggesting local independent small bike shops. However, if you ask me what my favourite bike shop was my reply would be, controversially, **Evans**.
With Evans being a chain, there are people who don't trust them. You don't have to look very hard to find a bad review about one of their stores online, but for me, they are all I could ask for.
I've had a couple of bad experiences with small bike shops; not being open when they are supposed to, or getting bad customer service because i'm not a regular or a full-on cyclist geek (well, I wasn't at the time!).
With Evans, you walk in and you don't feel intimidated. You can ask any question you want and no-one turns their nose up at you, but if you want to geek out the staff definitely know their stuff.
Anyone in an Evans shirt will bend over backwards for you. I've previously popped in with a gear issue and they were more than happy to take it out for a spin and tweak it and just today they were happy to look at a dodgy tyre. They have no problems with spending time explaining or helping you with queries.
Lastly, Evans Bike shop in Brighton are a shop I can **trust**.
So next time you need something doing on our bike, need a new inner tube or simply some advice on bikes, gears or pedals, don't be so quick to snuff Evans.
---
title: "My Dream: Multi-room audio with Chromecast and central music server"
date: 2016-01-29
updated: 2017-05-04
intro: I have been searching for a solution to my problem for a while now and I have had no luck - so i'm putting it out to the masses to ...
permalink: "blog/my-dream-multi-room-audio-with-chromecast-and-central-music-server/"
tags:
- Geekery
- General
- Thoughts
---
_I have been searching for a solution to my problem for a while now and I have had no luck - so i'm putting it out to the masses to see if anyone can help_
### The problem
I have some wonderful Chromecast Audios, which can be grouped and streamed to simultaneously. To do this, I can open Plex on my phone or iPad, and choose the sources and away I go. I have all my music hosted on a NAS, which Plex pulls from.
The "problem" is I have to carry my device with me to skip tracks or stop playback, if I move to the lounge from the kitchen but leave my phone behind, there is no way of stopping playback without finding the original device.
### The Dream
What I'm after is an internal music server (like [Runeaudio](http://www.runeaudio.com/) or [Moodeaudio](http://moodeaudio.org/)) running on a Raspberry Pi which is web accessible and can stream to a Chromecast. This means I can change the playlist or pause playback from any device with a browser.
### Can you help?
If you know of anything suitable or can point me in the right direction, please [get in touch](https://twitter.com/mikestreety) as I would love to help/know!
### Update 9/4/16:
The only way this currently seems possible is to install [Squeezebox](http://www.mysqueezebox.com/index/Home) on a Raspberry Pi, install Chromecast plugin and access it through a myriad of apps. (Many thanks to [Jim](https://twitter.com/double6jg) for the pointers!).
My main problem is the look. Squeezebox is ugly and even using Peng, it still is slow and complicated (although slowness might be down to the Pi)
**I am still looking** if you find a solution, let me know!
### Update 4/5/17:
I seem to have accidentally fallen into a setup which works for me and ticks most of the boxes.
- Each room has a Chromecast Audio, which is grouped into a "Home" group using the Google Home app.
- I launch Spotify **on my phone** and selected the music/playlist required. You then cast to the "Home" group from Spotify.
- You can then log into Spotify anywhere and as you can only have it playing on one source at a time, you are able to skip/play/change music from any device with your Spotify details
- I've also recently got a FitBit Blaze which allows me to skip tracks (even when casting thanks to a recent iOS/Spotify update)
The only disadvantage this has is that it's not using any of the music I own - but since having Spotify i've not bought any music anyway!
---
title: Making Craft CMS work with Prism JS using pre and code blocks
date: 2016-04-20
updated: 2017-05-03
intro: You may (or may not) have noticed that my site had a massive overhaul. With that overhaul, I changed CMS from Anchor to Craft.
permalink: "blog/making-craft-cms-work-with-prism-js-using-pre-and-code-blocks/"
tags:
- Web
- Javascript
- Front-end Development
---
You may (or may not) have noticed that my site had a massive overhaul. With that overhaul, I changed CMS from Anchor to Craft. Anchor was great, but didn't quite suit my needs. The nice thing about it is that you write your post in Markdown making code blocks quite easy. 
Craft is back to good old fashioned HTML and a WYSIWYG (Redactor) which is great in many ways but it doesn't seem to like having  `<code>`  tags (with a class on) inside `<pre>`  tag (which is how the syntax highlighter [PrismJS](http://prismjs.com/) likes it's HTML). When putting in the code, the WYSIWYG would mangle the HTML blocks.
Instead of trying to rip the editor apart, I came up with a javascript based solution (as the plugin needs JS anyway). What I created was a small bit of JS that which inserts the  `<code>` tags for me, with the correct classes.
Since making this change the code blocks have worked flawlessly. Allowing me to switch and re-edit with ease without worrying about the code messing up.
The below code is pure JS (doesn't require jQuery),
```js
/**
* PrismJS happy <pre> blocks
*/
// Check a pre tag exists
var elements = document.querySelectorAll('pre');
if(elements !== null) {
// For each of the <pre> elements
Array.prototype.forEach.call(elements, function(el, i){
// Get the inner html
var code = el.innerHTML;
// Get the class name on the element
var cssclass = el.className;
// Make the inner html a <code> block with the class and code inside
el.innerHTML = '<code class="' + cssclass + '">' + code + '</code>';
});
}
```
Without the comments, that is 8 lines of (readable) code. I say _readable_ as I'm sure it could be reduced somewhat!
The HTML I now put in Craft CMS is this:
```html
<pre class="language-html">HTML Code here</pre>
```
With the JS, the resulting (colourful) code examples become:
```html
<pre class="language-html">
<code class="language-html">HTML Code here</code>
</pre>
```
---
**Edit:** In fact, while writing this I've spotted a way already and have got it down to 5 lines of (still) readable code!
```js
var elements = document.querySelectorAll('pre');
if(elements !== null)
Array.prototype.forEach.call(elements, function(el, i){
el.innerHTML = '<code class="' + el.className + '">' + el.innerHTML + '</code>';
});
```
......@@ -3,6 +3,7 @@ title: Multiple transition delays
date: 2017-05-03
updated: 2017-05-03
intro: Being able to animate with CSS transitions is great, although there are a few gotchas when using them. This one with transition-delay had me scratching my head for a while.
permalink: "blog/multiple-transition-delay/"
tags:
- Web
- CSS
......@@ -14,7 +15,8 @@ Today I was working with `transition-delay` to make something expand before it g
To give you an example of this, the below code makes the width and height have different transition delays:
<pre class="language-css">div {
```css
div {
width: 50vmin;
height: 50vmin;
background: red;
......@@ -27,9 +29,10 @@ div:hover {
width: 80vmin;
height: 80vmin;
transition-delay: 0.5s, 0s;
}</pre>
}
```
See an example on Codepen:
<p data-height="335" data-theme-id="light" data-slug-hash="jmLLXK" data-default-tab="css,result" data-user="mikestreety" data-embed-version="2" data-pen-title="Transition delay" class="codepen">See the Pen <a href="https://codepen.io/mikestreety/pen/jmLLXK/">Transition delay</a> by mikestreety (<a href="http://codepen.io/mikestreety">@mikestreety</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
\ No newline at end of file
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
---
title: Music obsessions
date: 2018-10-18
updated: 2018-10-19
intro: The table below details what I've been listening to, what I am listening to, or albums I've discovered. There is no shame in this list
permalink: "blog/music-obsessions/"
tags:
- General
- Music
---
The table below details what I've been listening to, what I am listening to, or albums I've discovered. There is no shame in this list, these are things you'll catch me listening to. They are albums I reach for when wanting something comfortable.
I'm always open to recommendations, so let me know if there should be something added to this list.
| Artist | Album | Spotify link |
|---|---|---|
| Various Artists (Playlist) | Top 10 Jazz Albums for People Who Don't Know Shit About Jazz | [Listen](https://open.spotify.com/user/mikestreety/playlist/2D7jJt4hdFFtlla7YbcceF) |
| Bastille (Playlist) | This is Bastille | [Listen](https://open.spotify.com/user/spotify/playlist/37i9dQZF1DZ06evO4xeFWM) |
| Various Artists | The Hamilton Mixtape | [Listen](https://open.spotify.com/album/5AgsHUKFxr5DApRCmulIqJ) |
| Ms. Lauryn Hill | The Miseducation of Lauryn Hill | [Listen](https://open.spotify.com/album/1BZoqf8Zje5nGdwZhOjAtD) |
| Tove Lo | Lady Wood | [Listen](https://open.spotify.com/album/1tuekzsMZQOuiMejKP6t2Y) |
| Various Artists (Playlist) | The 27 greatest hip hop albums ever according to ShortList | [Listen](https://open.spotify.com/user/mikestreety/playlist/7CzMAQvkYowW31BrM1rQn6) |
| Jess Glynne | Always In Between | [Listen](https://open.spotify.com/album/2Uv0SsIwRolyvE76e0CaBM) |
| Anne-Marie | Speak Your Mind | [Listen](https://open.spotify.com/album/7lPoGKpCGgdKFAxpudhAH5) |
| Jill Scott | Golden Moments | [Listen](https://open.spotify.com/album/00cZAqb57SRmKrcpFYWuye) |
| Raleigh Ritchie | You're a Man Now, Boy | [Listen](https://open.spotify.com/album/50EXi4hlRIPF7fLQcWCXyp) |
| Taylor Swift | Reputation | [Listen](https://open.spotify.com/album/4fW1sFeE43nuZlAw2xtmC3) |
| Macklemore | GEMINI | [Listen](https://open.spotify.com/album/72qA6s4fjF8Y2VX1UDMfp2) |
| Lupe Fiasco | Lupe Fiasco's Food & Liquor | [Listen](https://open.spotify.com/album/0TDJRkEr2SrhWTetdkEzED) |
| Foxes | All I Need | [Listen](https://open.spotify.com/album/6fpZzsdzd04nqiDPWnF2iw) |
| Dua Lipa | Dua Lipa | [Listen](https://open.spotify.com/album/4btGe14gIJmTxbcPAQBtqb) |
| Coldplay | A Head Full of Dreams | [Listen](https://open.spotify.com/album/3cfAM8b8KqJRoIzt3zLKqw) |
| OneRepublic | Oh My My | [Listen](https://open.spotify.com/album/30SqWqmSU9ww0Btb1j4rpU) |
| John Legend | Darkness and Light | [Listen](https://open.spotify.com/album/7xMjYDrgPLp1ReFGAOyS1O) |
| Tove Lo | Queen of The Clouds | [Listen](https://open.spotify.com/album/1spbq60PWMBiuvARkJbXBP) |
| Sway | The Deliverance | [Listen](https://open.spotify.com/album/75bKgbIFAJ7tyDpPx7n8e5) |
| Taylor Swift | 1989 | [Listen](https://open.spotify.com/album/3GT1SFfrltwpfWM2FB7zV4) |
I go through phases of _really_ liking an album, searching for it _every time_ I open Spotify and then, a month later, never listening to it again and forgetting about it. With Spotify and the wealth of music available, I feel I latch on as I'm too afraid to venture out.
I thought I would make a note here of the albums I hit hard so I can revisit at some point.
_The post date reflects when this was last updated. Originally made on 1st August 2017_
---
title: Mikestreety's New Clothes
date: 2020-04-15
updated: 2020-12-11
intro: For regular readers, you will notice a fresh new face on the old dog (my first blog post that made the many migrations was from 2009!).
permalink: "blog/mikestreetys-new-clothes/"
tags:
- General
- Ramblings
---
For regular readers, you will notice a fresh new face on the old dog (my first blog post that made the many migrations [was from 2009](/blog/css-the-basics/)!). This has been a long time coming and is a continuation of an actual theme/consistent design I'm beginning to use across all my projects.
For those interested, the site is running on [Craft CMS](https://craftcms.com/), using [Laravel Mix](https://laravel-mix.com/) to compile the SCSS & JS. If you're visiting this site on an older browser, you may not see the colours, or much CSS at all in fact as I am using CSS Variables (custom properties). Looking at my analytics, I can see the visitors are mainly in Chrome/Firefox (I assume mainly developers are visiting) so I made the call to keep these in place (rather than [compiling to raw hex](/blog/css-custom-properties-everyday-applications/) like we do at Liquid Light) and benefit from their flexibility.
With Craft CMS you can have many "Channels", which is exactly what this Blog, the [Notes](/category/notes/) and Projects (found on the homepage) are utilising. Having built [Behind the Source](https://www.behindthesource.co.uk/) in between the original carnation of this Craft CMS blog and this version, I learned a lot about structuring the project and templates, so I took the opportunity to backup the database and files and re-build and restructure locally, before pushing live.
###  A walk down memory lane
With this recent update to my site, I thought I would revisit previous CMS's and (if I can find them) reskins of my site!
- **June 2010** - I started my web presence as **mikestreetmedia**. The site was built with static pages (except for the Wordpress powered blog) and I was trying to build up my internet reputation [View on Internet Archive](https://web.archive.org/web/20100613231449/http://www.mikestreetmedia.com/)
- **February 2011 ** - mikestreetmedia didn't last long (I had the domain name for free for a year) so **mikestreety **was born (yes, I have owned the domain name for [10 years](https://who.is/whois/mikestreety.co.uk)). As for the site, it was the same but got a reskin, and apparently I thought the more social networks you were on, the better. [View on Internet Archive](https://web.archive.org/web/20110210184427/http://www.mikestreety.co.uk/)
- **September 2011** - That site didn't last long (I had a lot of time on my hands) and I reduced the site to a single page, with links to my Twitter, Skype, Email and LinkedIn. That was it. Unfortunately, the internet archive didn't cache the CSS, so the full effect of the site isn't available.
- **January 2012** - Apparently, I couldn't stand not having a blog**, **so 4 months later, once again, my site changed. This time, I went for the "nude" site approach - blogging and posting on a naked site in a bit to force me to write some CSS for it[View on Internet Archive](https://web.archive.org/web/20120128142942/http://www.mikestreety.co.uk/2012/01/whats-up-blog/)
- **July 2012** - It looked like I had added some colour by now, but obviously having a skinny site did nothing for encouraging working on my own site.  In 2012 I was promoted at work and spent a lot of my spare time either working on side-projects or not wanting to be looking at a computer at all. Productivity on my site dwindled.[View on Internet Archive](https://web.archive.org/web/20120701214058/http://www.mikestreety.co.uk/)
- **February 2013** - In February 2013 I decided to remove the Wordpress site and move purely to blogging on [AnchorCMS](https://anchorcms.com/). I decided not to migrate my Wordpress posts, but instead [start again](/blog/starting-afresh-starting-anew/).[View on Internet Archive](https://web.archive.org/web/20130520231347/http://mikestreety.co.uk/)
- **July 2014** - For a year or so I stuck with AnchorCMS themes until I started looking for new job. I figured as a front-end developer I should have a site which was actually coded by me, which was when the new theme came in[View on Internet Archive](https://web.archive.org/web/20140730224035/http://www.mikestreety.co.uk/)
- **April 2016** - That theme stuck around for a while (although evolved somewhat), but in 2016 I changed the CMS that powered my blog to Craft. With the change to Craft I re-imported all of my old Wordpress blogs (more for prosperity then actual content as a lot were out of date). I also wanted to make my blog more personal so I added a bit of info about me and a photo on the homepage.[View on Internet Archive](https://web.archive.org/web/20161221073903/https://www.mikestreety.co.uk/)
- **October 2017** - This was when the homepage got closer to how it is today, with my face in a circle and the short bio still there. In this version I got rid of the projects and combined the local/remote blogs posts into one list. This variation was the one that was replaced this weekend (albeit with some optimisation & performance tweaks).[View on Internet Archive](https://web.archive.org/web/20171022190215/https://www.mikestreety.co.uk/)
......@@ -3,18 +3,19 @@ title: The Git Commit Hash
date: 2020-05-28
updated: 2020-06-11
intro: The magic 40 character string that is attached to every commit you do. What is it, where does it come from and will understanding it help you with Git in the future?
permalink: "blog/the-git-commit-hash/"
tags:
- Web
- Git
---
<pre class="language-bash">commit 13c988d4f15e06bcdd0b0af290086a3079cdadb0
```bash
commit 13c988d4f15e06bcdd0b0af290086a3079cdadb0
Author: Mike Street
Date: Sun Mar 3 16:04:33 2019 +0000
Initial commit
</pre>
```
This might look familiar to you. The sign of a commit which is built up of a few components: the commit hash - a 40 character long string, followed by the author, date and lastly the commit message.
......@@ -28,7 +29,7 @@ Reading this, I assume you have basic knowledge of Git and have at least committ
Before we dive into the git specifics, I thought I would give a very brief overview of what a hash is.
There are many different hashing algorithms - `MD5` and `SHA-1` are examples of these. What a hash allows you to do is take an arbitrary amount of content (be it one word, 100 words or the whole contents of a JavaScript library) and produce a unique fixed string of characters representing that. The length of the string is dependent on which method you choose.
There are many different hashing algorithms - `MD5` and `SHA-1` are examples of these. What a hash allows you to do is take an arbitrary amount of content (be it one word, 100 words or the whole contents of a JavaScript library) and produce a unique fixed string of characters representing that. The length of the string is dependent on which method you choose.
The string (in “theory”) cannot be reverse engineered (e.g. given the hash it is difficult to work out the contents), but would allow you to compare two things to see if they are the same.
......@@ -50,7 +51,7 @@ The git hash is made up of the following:
- The date
- The parent commit hash
When you take all these into consideration, hopefully you will begin to see how various actions might impact how the commit hash is formed.
When you take all these into consideration, hopefully you will begin to see how various actions might impact how the commit hash is formed.
One other thing to note is the Git tree doesn't really "exist" as such - it is constructed by following the parent hash. This may seem like the same thing, but there are some slight nuances.
......@@ -80,7 +81,7 @@ Rebasing one branch onto another will have a similar effect to cherry picking. W
This changes the parent commit of your first commit and so, all of the following commits also need new hashes generating as their parent has changed.
Rebasing can quickly become a mess! It's a hugely powerful tool, but with great power comes great responsibility.
Rebasing can quickly become a mess! It's a hugely powerful tool, but with great power comes great responsibility.
### Squash
......@@ -98,4 +99,4 @@ if you are working in your own, or are confident in how it can affect things you
I hope that has helped further your understanding of Git and that next time something happens, you know why and how! [Let me know](https://twitter.com/mikestreety) if you have any questions, need something expanding or have any other feedback.
If you have enjoyed this post I would really appreciate if you considered [buying me a coffee](https://www.buymeacoffee.com/mikestreety) (or beer!).
\ No newline at end of file
If you have enjoyed this post I would really appreciate if you considered [buying me a coffee](https://www.buymeacoffee.com/mikestreety) (or beer!).
......@@ -3,6 +3,7 @@ title: Making sure you're not doing everything at work
date: 2021-01-14
updated: 2021-01-14
intro: Delegation is hard for people who find themselves in management roles. The trick is to be the overflow, not the gatekeeper.
permalink: "blog/making-sure-youre-not-doing-everything-at-work/"
tags:
- General
- Thoughts
......@@ -24,22 +25,22 @@ When you become a manager through the routes I have, you start to think very hig
The danger with thinking these things is you will get very busy very quickly and you will find yourself always the one the tasks (and normally they are the most boring ones).
Rather than being the gatekeeper of work, i.e. the manager that only passes things on when you are too busy, be the overflow that takes work when your team is too busy. On paper, it seems like if your team is doing all of your work, you will be twiddling your thumbs - but it gives you time to organise and, most importantly, check-in on your team.
Rather than being the gatekeeper of work, i.e. the manager that only passes things on when you are too busy, be the overflow that takes work when your team is too busy. On paper, it seems like if your team is doing all of your work, you will be twiddling your thumbs - but it gives you time to organise and, most importantly, check-in on your team.
**Delegation should be the default state**.
Something I've found asking myself daily, if not hourly, is "Do **I** need to do this?". If the answer is no (and it probably will be), then it gets passed on. If it is the knowledge or skills that are preventing someone else from doing this work then pass it on and train them. You are there to train or assist them in getting the job done so they can do it in future. This also prevents so much reliance on you - what if you're not around to do it next time?
There will always be edge cases where you _do_ need to do the task; time constraints (e.g. it is urgent, or your team doesn't have time), historical knowledge, or, you just simply want to do it yourself because it looks like fun (managers prerogative).
There will always be edge cases where you _do_ need to do the task; time constraints (e.g. it is urgent, or your team doesn't have time), historical knowledge, or, you just simply want to do it yourself because it looks like fun (managers prerogative).
Delegating by default is also a great way of quickly seeing where the gaps are in your team. When the chance arises, I will reassign work which I know is a knowledge gap for one of the developers.
Delegating by default is also a great way of quickly seeing where the gaps are in your team. When the chance arises, I will reassign work which I know is a knowledge gap for one of the developers.
Rather than me picking up the work, I let the developers read through (and they often try to resolve) the task, before coming to me for help. I can then show them when _they_ are in the right mindset. As the manager, I expect my day to be jumping around switching gears - I want the developers to feel comfortable and thinking about the task when we sit down to work it out together. More often then not, the developers either solve the issue without my intervention or need a lot less assistance than I was expecting, which is a win-win and gives you more confidence in your team.
In time, you will find yourself training less and less and being able to pass on more and more of the edge-cases. These not only give you the time to train your team further, but free up more of your time to focus on the wellbeing of your team.
I'm sure this is a mishmash of quotes, but I strongly believe that **you should train your team to be as good as you, and then push them to be better**.
I'm sure this is a mishmash of quotes, but I strongly believe that **you should train your team to be as good as you, and then push them to be better**.
The other quote I often think of is _"What if we train them and they leave? What if we don’t and they stay?"_. You are doing nobody any favours by keeping tasks to yourself. If you don't "trust" the work your team do, then assign the work but get them to check it with you before it leaves the office (but if you don't trust your team, there is something else there...).
So delegate more, check in with your team more. Check your own task list, is there anything that can be passed on? Become the place works gets sent when your team is stacked. Be the type of manager that has the time to train and assist people. Be the kind of person that has capacity to ease someone's workload if the are struggling. Work the same hours as everyone else.
\ No newline at end of file
So delegate more, check in with your team more. Check your own task list, is there anything that can be passed on? Become the place works gets sent when your team is stacked. Be the type of manager that has the time to train and assist people. Be the kind of person that has capacity to ease someone's workload if the are struggling. Work the same hours as everyone else.
......@@ -3,12 +3,13 @@ title: How to migrate your Gitlab instance to a new server
date: 2021-03-08
updated: 2021-02-20
intro: I recently migrated our Gitlab server install from one server to another. With the help of a few tutorials it was fairly painless, however I thought I would outline the steps here
permalink: "blog/migrating-gitlab-from-one-server-to-another/"
tags:
- Web
- DevOps
---
I recently migrated our Gitlab server install from one server to another. With the help of a few tutorials scattered around, it was fairly painless. I thought I would outline the steps here as there were a couple of bits that tripped me up.
I recently migrated our Gitlab server install from one server to another. With the help of a few tutorials scattered around, it was fairly painless. I thought I would outline the steps here as there were a couple of bits that tripped me up.
This tutorial assumes you are running a self-hosted **Omnibus** version of [Gitlab](https://about.gitlab.com/) and are comfortable with the command-line. It also assumes you have SSH access to both the existing server and a new server you wish to migrate too. Lastly, sudo/root access is required on both servers for this process to work.
......@@ -16,11 +17,11 @@ It also goes without saying that you should make sure no-one is utilising your G
### 1. Update your current install
You can only backup & restore to/from Gitlab running the same versions. To avoid having to find an older version for your new server, it makes this process smoother if your current version of Gitlab is up-to-date.
You can only backup & restore to/from Gitlab running the same versions. To avoid having to find an older version for your new server, it makes this process smoother if your current version of Gitlab is up-to-date.
### 2. Set up a new server
All the tutorials tell you to create your backup first, however I found it easier to set the new server up as the first step. **Make sure you are installing the correct version**. I lost a couple of hours after I had followed the [Gitlab tutorial](https://about.gitlab.com/install/) - this sets up the Enterprise Edition as default, however I was running the **community edition**.
All the tutorials tell you to create your backup first, however I found it easier to set the new server up as the first step. **Make sure you are installing the correct version**. I lost a couple of hours after I had followed the [Gitlab tutorial](https://about.gitlab.com/install/) - this sets up the Enterprise Edition as default, however I was running the **community edition**.
I was able to do this by replacing `gitlab-ee` in the documentation with `gitlab-ce`. For example, the Debian install requires a script which is then piped through bash - it can be updated to the following:
......@@ -67,4 +68,4 @@ For example, if the file was `1612726810_2021_02_07_13.8.3_gitlab_backup.tar` yo
## Finished
You should now have a Gitlab instance that walks ands talks like your old one, but on a new server instead.
\ No newline at end of file
You should now have a Gitlab instance that walks ands talks like your old one, but on a new server instead.
......@@ -2,6 +2,7 @@
title: Using a few lines of PHP to programmatically upload an image to Cloudinary
date: 2021-05-03
intro: This quick block post shows how to upload an image to Cloudinary using PHP, using their provided SDK
permalink: "blog/using-php-to-upload-to-cloudinary/"
tags:
- Composer
- PHP
......
......@@ -92,7 +92,7 @@ This is done by adding the following to our `nuxt.config.js`:
```js
router: {
middleware: ['auth']
middleware: ['auth']
}
```
......
---
title: Upload an image to Cloudinary using the Node SDK
intro: Using the Cloudinary Node SDK, we can upload an image in a Javascript application - such as a Netlify function
date: 2021-08-23
permalink: "blog/upload-an-image-to-cloudinary-using-the-node-sdk/"
tags:
- Cloudinary
- Node
---
In a similar vein to [doing it with PHP](/blog/using-php-to-upload-to-cloudinary/), uploading an image to Cloudinary with Javascript can be done in a few lines.
I used this on [Ale House Rock](https://alehouse.rocks/) in a [Netlify function](https://gitlab.com/mikestreety-sites/ale-house-rock/-/blob/master/functions/api/process-beers-and-breweries.js).
Install the library using npm or yarn
```bash
npm install cloudinary --save
```
Next, we need to include and initialise the library - for this code we are going to be using `v2` of the [Node SDK](https://cloudinary.com/documentation/node_integration).
In the example below, I've used the [dotenv](https://www.npmjs.com/package/dotenv) package to avoid having my credentials committed to the repository.
```js
const cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: process.env.cloudinary_cloud_name,
api_key: process.env.cloudinary_api_key,
api_secret: process.env.cloudinary_api_secret,
});
```
To make this more easily portable, I created a [module with my Cloudinary initialisation in](https://gitlab.com/mikestreety-sites/ale-house-rock/-/blob/master/functions/api/cloudinary.js). This allows me to include the following for a ready-to-go Cloudinary API
```js
const cloudinary = require('./cloudinary');
```
With the library loaded, you can upload your image with the path to the file. This can be a remote or local path. The `public_id` is the path where you want the image to be uploaded to.
```js
const cloudinary = require('cloudinary').v2
cloud_image = cloudinary.uploader.upload(
'path/to/image.jpg',
{
secure: true,
public_id: 'custom_path/and/folder.jpg'
},
function() {
}
);
---
title: Build and release Composer packages using a self-hosted Gitlab
intro: When developing with Composer, you may wish to create private packages and host them with Gitlab
date: 2021-09-06
permalink: "blog/build-and-release-composer-packages-using-a-self-hosted-gitlab/"
tags:
- Gitlab
- Composer
---
When building with Composer, it is great to be able to develop and maintain packages and libraries of your own. However it is not always possible or desirable to publish your code to [Packagist](https://packagist.org/).
Instead, you can use your self-hosted Gitlab to host your packages. This will allow you to include either the branches you set or tagged releases of your code.
The concept is using the Gitlab API to publish your package, which can be done with the following command:
```bash
curl --data tag=<tag> "<gitlab url>/api/v4/projects/$CI_PROJECT_ID/packages/composer"
```
You _can_ do this manually, however it is more efficient (and less boring for you) to do it via Gitlab CI. This code assumes you are at least familiar with the concept of CI.
The following uses a basic `curl` image - if you require your CI to perform operations, make sure you use the correct image.
Create a `.gitlab-ci.yml` and use the code below as a base. It features two steps in the `Release` stage, however one only activates on a new tag and the other on a new commit on the `main` branch. The allows you to either include the tag in your local `composer.json` or `dev-main` to get the latest code.
Make sure you have Packages enabled on the repository.
```yml
###
# Gitlab CI
#
# @author Mike Street
# @date 01-2021
#
###
stages:
- Release
# Use custom LL docker image
image: curlimages/curl:latest
release:tag:
stage: Release
script:
- 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=$CI_COMMIT_TAG "<gitlab url>api/v4/projects/$CI_PROJECT_ID/packages/composer"'
only:
- tags
release:branch:
stage: Release
script:
- 'curl --header "Job-Token: $CI_JOB_TOKEN" --data branch=$CI_COMMIT_BRANCH "<gitlab url>api/v4/projects/$CI_PROJECT_ID/packages/composer"'
only:
- main
```