http://wlkns.co/Ghost 0.11Thu, 17 Aug 2017 18:00:22 GMT60Self explanatory title, I was playing with Electron but couldn't find a good way of re-loading the entire application completely when I made a code change.

]]>http://wlkns.co/auto-reload-your-electron-app-completely-using-nodemon/163f463a-ead6-45ca-b163-ae45cbe6f1b8Thu, 17 Aug 2017 15:02:53 GMTSelf explanatory title, I was playing with Electron but couldn't find a good way of re-loading the entire application completely when I made a code change.

Sure there are components like Electron Connect and Electron-reload which will reload the windows and files used within an application but not the entire application — you should check these out, they may meet your needs.

However, these did not work for me, as I needed the application to restart completely. Fortunately, a small tool which I already use with most of my NodeJS projects called Nodemon did!

]]>http://wlkns.co/allow-users-to-login-with-phone-or-email/5601c7e9-6bd7-4772-bc5a-c6bf29ad7d8fMon, 03 Jul 2017 12:31:58 GMTAllow your users to authenticate with their phone or email or any other fields you might want to allow.

The example below a single field that can contain email address or phone number.

]]>Whoops, looks like something went wrong.
1/1
RuntimeException in Encrypter.php line 43:
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

Solve this by either running php artisan key:generate or setting APP_KEY in your .env file.

]]>http://wlkns.co/solving-laravel-2/66f5ff69-9250-40c6-afde-93dda5149596Fri, 31 Mar 2017 11:44:29 GMTWhoops, looks like something went wrong.
1/1
RuntimeException in Encrypter.php line 43:
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.

Solve this by either running php artisan key:generate or setting APP_KEY in your .env file.

]]>This has to be the simplest, yet unknown, bit of code ever.

Place the following wherever you would like to inspect code.

debugger;

Chrome then interprets it, and pauses the Javascript run-time at the debugger statement.

]]>http://wlkns.co/how-to-set-your-mac-up-for-a-web-developer/2327ca7e-1717-416f-91c9-75a0452c8589Sun, 08 May 2016 14:52:33 GMTThe SSD hard drive in my iMac died recently, so I thought'd I'd write up a list of all the applications I use as a full stack (primarily PHP & Javascript) web developer.

Some of these may be useful for me only, but it's worth checking them all out.

]]>You have to edit the sudoers file, for which there will be an entry for you.

sudo nano /etc/sudoers

To allow all users of the group admin to use the sudo command without a password, add the following:

%admin ALL=(ALL) NOPASSWD: ALL

If you want to restrict it

]]>http://wlkns.co/stop-terminal-from-asking-for-a-sudo-password/1f47b90f-0619-40c3-8227-0e994a78cdceSun, 08 May 2016 14:48:21 GMTYou have to edit the sudoers file, for which there will be an entry for you.

sudo nano /etc/sudoers

To allow all users of the group admin to use the sudo command without a password, add the following:

%admin ALL=(ALL) NOPASSWD: ALL

If you want to restrict it to a single user such as Jak, use this instead of %admin.

MySQL

We'll start with MySQL, as it's the easiest.

brew install mysql

This will install the latest version of MySQL and the command-line tools to connect. By default this installs MySQL server with no root password but locks it to localhost (so only local users can access it anyway), I deem this secure enough for my local environment. If you do want to secure it further, you can run mysql_secure_installation, provided by brew after installation.

To test this is working you can then type

mysql -u root -e 'STATUS'

NOTE: Add -p to the end of the command if you did setup root with a password.

Note: You will also be alerted that the certificate is insecure, and have to click Advanced > Proceed to yoursite.dev, this is the only caveat with self signed certificates, and not really avoidable on development environments.

Ok let's check the nginx config and then launch. (we have to launch nginx as root so that it can use port 80.)

]]>Ran into an issue recently, needed to install sendmail on a server and even with PHP configured correct, absolutely no emails were going through.

A quick tip, check /var/log/syslog, it usually contains information on the error.

The error in this case was that the hostname was not configured

]]>http://wlkns.co/php-sendmail-not-working-on-ubuntu-16-04-php-7-0-with-test-script/5fab4e37-f22e-4776-8d90-80c48e2f0e30Wed, 27 Apr 2016 13:17:34 GMTRan into an issue recently, needed to install sendmail on a server and even with PHP configured correct, absolutely no emails were going through.

A quick tip, check /var/log/syslog, it usually contains information on the error.

The error in this case was that the hostname was not configured to a FQDN e.g. the contents of /etc/hostname was example not example.com.

It can be run from the commandline using php test.php or in the browser by accessing the URL.

]]>Collections have been around since the start in Laravel. In the early days they could be used on any Eloquent Model, but now they can be instantiated from almost any object/array data.

In this example, I'll show how they can be useful in an invoicing system.

Lets say we

]]>http://wlkns.co/working-with-collections-in-laravel-invoice-example/af3fbcf0-cd44-4272-b98e-72f97e211eeeTue, 26 Apr 2016 11:53:07 GMTCollections have been around since the start in Laravel. In the early days they could be used on any Eloquent Model, but now they can be instantiated from almost any object/array data.

In this example, I'll show how they can be useful in an invoicing system.

Lets say we have the following POST data of the items to be added to the invoice. (demonstrated as an Array of Arrays)

]]>http://wlkns.co/audit-logging-differences-on-a-eloquent-model-laravel/0d81a9ad-5356-4e88-b223-34d1cd8a311fThu, 21 Apr 2016 14:55:20 GMTWant to log the unique changes to an eloquent model in Laravel, it's simpler than I first thought.

A complete locale list can be found on Github, alternatively you can create your own provider.

]]>This will mark the third relaunch of wlkns.co, a site dedicated to posting personal writings and opinions of all things relating to web development and the internet.]]>http://wlkns.co/welcome-to-ghost/4b821a49-386d-41df-ab15-893f137ba0e9Wed, 20 Apr 2016 15:39:20 GMTThis will mark the third relaunch of wlkns.co, a site dedicated to posting personal writings and opinions of all things relating to web development and the internet.]]>