Blog

Binary Search Tree - Finding the Minimum Value

Aug 2, 2018
binary search tree swift xcode
During my revision of the Binary Search Tree, it seemed certain youtube videos did not cover this well enough. After a certain time, juggling different conditions, it didn't seem their implementation worked for all cases, only covering specific ones. This lead me to move to wiki to search for their approach which was t...

Read more

Swift Optionals and Unwrapping

Aug 1, 2018
swift unwrapping optionals binding
Optionals is a Swift type. The key thing to remember is it can hold a value or no value. We append ? to any type to declare it as an optional



var beer: String? = “Atomic”

Optional definition

enum Optional {
case none
case some(T)
}




Under the hood we can see t...

Read more

Vuejs - data: or data()?

Jul 30, 2018
vuejs laravel data option undefined
Do you get an undefined value when printing the data from a component? Spent a few hours debugging this on a codepen I’m working on for my portfolio. As I’m passing an array to a child component I was outputting an undefined array for the child’s property - xValues/yValues.

As it so happens, there’s difference betwe...

Read more

Delegate Pattern - Swift Programming

Feb 12, 2018
delegates swift programming macosx
In many of the guides and tutorials I came across, many of them suggested a one to one usage. Here I’ll use multiple delegates to update the StatusBarItem title and a NSTextfield.

First off what are Delegates. It’s a programming paradigm allowing one object to pass data to another object at any point within the prog...

Read more

MVC Pattern

Feb 2, 2018
mvc software paradigm model view controller
MVC is a well known software architecture paradigm use to organise code in a manner that is understandable and relatable between any person reading the code. Software patterns are a great method to avoid spaghetti code as the code increases. At MVC’s core there are 3 main objects to consider when one uses this pattern....

Read more

Neo Blockchain Price Alert

Oct 2, 2017
neo blockchain decentralised alert
Over the past month, of China's involvement in blockchain technology, they singlehandedly wiped $40 billion off the market. I made this app to keep us up to date with Neo, tracking the rise and fall of the Neo price against Coinmarket cap's API throughout the day in 5 minute intervals.

Built with Laravel, the task s...

Read more

iOS 11 finally killed my game I made in 2011

Sep 20, 2017
ios11 squiz trivia objectivec
I spent about a good year making my first iOS game along with my brother beginning in 2011 during the app 'gold rush'. It was an enormous effort for such a small game. At the time I wasn't satisfied even after launch but looking back and opening the game now and then I'm proud of what we made - sQuiz Reel Trivia.

T...

Read more

China - The age of virtual currency is over?

Sep 9, 2017
cryptocurrency china exchanges ico ban virtual
https://www.youtube.com/watch?v=427netuOvEM

A quick break down of the video above. Rough week for cryptocurrency as another rough storm from China. First it was the ICO ban, now rumor has it that they will ban exchanges. But nothing from official sources and won't be anything till Monday, as Chinese officials do not...

Read more

Mac Mini (late 2012) with Ultrawide is possible

Sep 9, 2017
ultrawide macmini 2012 apple 2k 4k
That is the 34" ultrawide with 3440x1440 resolution! Yes it works with a display port cable.

The specs on everymac.com mention the max resolution for the HDMI and Mini Display Port are 1920x1200 and 2560x1200...

Read more

How to add cryptocurrency to my wordpress website

Sep 5, 2017
wordpress woocommerce cryptocurrency bitcoin altcoin litecoin cryptowoo
So I was wondering if it was possible to accept Bitcoin on one of my woocommerce websites. Bitcoin and the Blockchain has been around close to a decade now. Yet mainstream adoption has recently been popular in the ecommerce space. One of the first Gateway adopters of bitcoin is Stripe. But there was a problem, Stripe o...

Read more

Authorisation/Authentication features in Laravel Part 3 - Middleware

Jun 26, 2017
laravel middleware routes authorisation
Think of it as rules for a single or many routes; it is also possible to group an assortment of routes, mainly to keep the code much more readable. Their use is to direct users from entering pages or areas of a website, somewhat like directing traffic.

As an example if a guest user tries to enter an a page for admi...

Read more

Authorisation/Authentication features in Laravel Part 2 - Guards

Jun 25, 2017
guards laravel authentication php admin multiauthentication user
Guards define how the application retrieves and sends information about the user; whether it’d be by the class method of cookies or api tokens. Guards are slightly more technical but using guards allows us to have multiple authentication. So imagine we have a web app with a customer and an admin. At first thought we co...

Read more

Authorisation/Authentication features in Laravel Part 1 - Gates/Policies

Jun 24, 2017
gates policies laravel authorisation authenticaion part1 php
Gates, Policies, Guards and Middleware. When you first use them, they all seem very similar. But in fact each have a use for a specific area of authorisation and settings rules throughout your website.

If you’re new or confused with Laravel’s authorisation/authentication with how various authorisation features work...

Read more

Creating registration emails upon registration

Jun 23, 2017
email laravel error registration


protected function create(array $data)
{
//create confirmation code
$confirmation_code = str_random(30);

//main bulk of user creation
$user = User::create([
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],...

Read more

Ending an infinite animation loop smoothly with javascript and css

Jun 1, 2017
javascript css animation infinite loop
If you want end an animation smoothly here’s how.

I wanted to end an infinite looping animation that gradually fades from 1 to 0 opacity over a period of time. Most solutions would end immediately mid frame before the animation loop has completed.

There are three event listeners that can be attached to an eleme...

Read more

Event and Queue Debugging

Apr 26, 2017
laravel queue event debug
Coming back to the event that sends emails for a personal project, it came to the point to re-test the event and expectedly it didn’t work. It’s harder to find the issue with queues as they don’t print the stack trace in the browser, as it runs in the background and even worse is having the event work the night before....

Read more

Console.log and its' variations

Apr 24, 2017
console javascript printing debugging
Discovered a few months ago, that console.log isn't the only method to print out values. To make distinctions between each print, you may also use .info(), .debug(), .warn() and .error().

Each browser handles these slightly differently - mainly colors and icons but they do work across the board....

Read more

CSRF Token

Apr 9, 2017
csrf laravel blade head
A short blog post but I’ve also realised that the CSRF token isn’t required to be within a form. It can be placed within your tags. Generally I think in future cases I won’t add additional token tags as they do produce the same token despite having two tags in different locations on the same page.

Example hea...

Read more

SQL Raw Queries In Laravel

Mar 23, 2017
sql laravel raw query

Learn to love it. I find it much more concise than using the Eloquent that helpers and Query Builder that have been provided. Eloquent is definitely great and easy to use but I feel I don't need another syntax I need to follow as SQL queries are much more familiar to me. Additionally (I'm not aware of the full detai...

Read more

AJAX Errors - Success but failure

Mar 22, 2017
ajax success failure error laravel csrf response
Spending time on errors are extremely time consuming. I’m not sure what the best ways are to speed this up but some ways are to check the basics and read the errors. Sometimes it’s like stepping in the shoes of Sherlock Holmes but usually most of the clues are in front of you.

In this instance I was missing a column...

Read more

Redirection On Login

Feb 16, 2017
redirection laravel php login
If we’d like to provide an admin area and a standard user area, this can be done in the file Auth/LoginController.php in the function authenticated() which you must include yourself, to override the method



protected function authenticated(Request $request, User $user)
{
// redirect t...

Read more

Ajax In Vanilla Javascript

Jan 31, 2017
ajax vanilla javascript jquery
I was sending in a request via jQuery for my new project and was curious what the code was to do it in vanilla javascript. So here it is below.

Vanilla Javascript



var data = JSON.stringify({lat: parseFloat(latCoord), lng:parseFloat(longCoord)});
var xhr = new XMLHttpRequest();
var url =...

Read more

Setting Up Wordpress with Underscores and Gulp

Nov 21, 2016
underscores wordpress gulp sass
Let’s get a fresh install of Wordpress running with a bare bones theme called Underscores. We’ll use this as theme - if you like to build a clean and less bloated website for your portfolio or ecommerce store and we’ll also set up SASS with Gulp. I’m also be using MAMP as my local server environment.

Download the la...

Read more

A new whizbang.

Nov 21, 2016
new whizbang plans cinemagraphs
Over the last week or so I've spent configuring the approach of my email (forwarding or email hosting - paid) and working to restore this website to its' former glory, everyone's doing reboots anyway!

I've opted for a clean black and white design. The side bar width has been reduced and no longer is there a sand co...

Read more

Illustrio for Non-designers

Nov 21, 2016
design colour logo illutrio
If you're looking for some quick prototyping for your next logo or colour scheme or just aren't that great with graphics, check out this web app

https://app.illustrio.com...

Read more

Let's Encrypt - Free SSL for your website

Nov 21, 2016
ssl letsencrypt encryption https security
Yes my website is now encrypted! Recently released was an open source encryption that offers free https for your website. It garnered increased attention in early December 2015 and it’s great news for everyone looking for excellent security for their E-Commerce store but as you will notice that this site now has a SSL...

Read more

Abot an AI Framework

Nov 21, 2016
ai abot open-source framework
An interesting project on github that was listed on Product Hunt. It's the early stages but it's a great start to a new A.I. framework that anyone can build on or create their own assistant.

From the site:

Abot (pronounced Eh-Bot, like the Canadians) is a digital assistant framework that enables anyone to easily...

Read more

Artisan Tinker With Laravel

Nov 21, 2016
database php laravel artisan tinker
A neat tool to literally tinker/interact with your website. It's new to me at the moment but I currently use it to test relationships between models and fiddle with the database.

To use Tinker, bring up the command line interface and we'll move to the directory with artisan. All you have to type is

php artisan ti...

Read more

Twitter For Laravel Part 2

Nov 21, 2016
twitter laravel tutorial api php
Following on from Part 1, in this short tutorial we’ll post tweets to your account and also add hashtags. I won’t be going over how to retrieve hashtags from the blog, that is something that won’t be covered in this tutorial but you can always grab what I’ve done so far to my website via Github.

The main wrapper/API...

Read more

Getting Your Tweets Twitter For Laravel Tutorial Part 1

Nov 21, 2016
twitter tweet api laravel tutorial
It seems the majority of Twitter tutorials for Laravel (in particular) focus on logging the user in, adding their credentials to the database and then posting tweets to the user account. We’re going to skip the majority of that because I know you don’t have to log in to twitter but you can just supply your API keys to...

Read more

Many to Many Relationship - View

Nov 21, 2016
manytomany relationships migration database schema view
In Part 1 we looked at preparing the database relationships, Part 2 involved reflecting those relations in our models in order to obtain the data we need via the methods. Now we have access to the information in the database, this chapter will outline what we need to do to output the information onto a page, which is f...

Read more

Many to Many Relationship - Models

Nov 21, 2016
manytomany relationships migration database schema
Previously we set up our migrations for our database in Part 1. Now these migrations need to be reflected within our model so once we query our model we can retrieve the information from the database.

Reference
https://laravel.com/docs/5.1/eloquent-relationships

class Post extends...

Read more

Many to Many Relationship - Migrations

Nov 21, 2016
migration manytomany database relationships
The basis of this tutorial is to establish a ‘many to many’ relationship in a database and the eloquent model. A common situation where this would occur could be on a blog where posts have associated tags. The reason being is – a post can have many Tags and a tag can have many posts. What wouldn’t be a ‘many to many’ r...

Read more

Simple Night Shift Mode Fo Websites

Nov 21, 2016
hue javascript nighshift
I spent an afternoon going over how I would emulate the Night Shift mode made by Apple who they were inspired from https://justgetflux.com/ or was it someone else.. There’s an app on the app store that does the same thing. This javascript plugin I made quickly is for websites. Currently it changes the colour of the bod...

Read more

PHP artisan returned with error

Nov 21, 2016
php error artisan
I've been trying to get a Twitter wrapper working for this website to display my latest tweets. During this my site suddenly crashed. Nothing showed up.

Scouring the internet I came across a post at https://laracasts.com/discuss/channels/laravel/error-on-composerphar-update-on-deployment-server. I followed danmatthe...

Read more

Simple feedback form

Mar 13, 2016
laravel feedback form simple email blade
Today we'll make a feedback form so users can contact you. It's not too difficult and it'll involve the use of setting up a new route, using the Mail class, forms, configuring the settings for our mail server and using the blade templating engine to setup the body of our email.

For our reference you may open up the...

Read more

Slugs for URLs tutorial

Mar 8, 2016
laravel slugs php url
For those wondering how one can change the default 'id' endpoint URL format to a slug look no further. What this post will be going over is removing the 'id' in the URL with a user friendly URL (SEO friendly) from scratch but I will be skipping over the blog post creation process. With that said I will assume you have...

Read more

My very first blog post!

Mar 7, 2016
blog laravel first intro
Actually it's not, I had to make other posts to test it with first.

This blog serves as a way for me to document the struggles I've come across in new programming languages and examples so that other developers or new developers can also learn from my new findings, hopefully saving them hours of time! It's always th...

Read more