Writing on Medium is a great experience that many people love. However, if you are writing code heavy articles pasting in code blocks sort of stinks.
By default, a rendered article doesn’t include syntax highlighting and if you are sharing more than a few lines of code it’s not that easy to follow. Here is an example of a default code block:
public function doSomething()
return 'I did it!';
Jacob Bennett created a new app called MarkdownToMedium that will allow you to write in Markdown, which is converted to a Gist, then any code blocks are then automatically extracted into their own Gist’s and embedded into your article.
Here is how it works. First, authorize with your GitHub account and then paste your markdown in.
Next, continue to step 2 to name your code blocks.
Finally, copy and paste the URL it provides and import into a Medium article. Note: You will need to put your cursor after the included Gist link and hit enter. This is so it will automatically expand and leave you with a nice looking embed like this:
GitFTP-Deploy is a MacOS app that allows you to deploy to sites where you may not have shell access. It can monitor your git repository and pushes only your changes through FTP or SFTP. It also features:
Modern front-end workflows
Run your terminal commands or shell scripts on every deployment. Compile your SASS-files to CSS and push to your server. (SFTP/SSH only)
Talk to your server
Take down your site during deployment or run migration scripts on your server. (SFTP/SSH only)
You can find out more about GitFTP-Deploy on their site and it is free to try and $14.95 to buy.
AlloyEditor is an open source WYSIWYG editor that puts a new spin on an old favorite. Leveraging CKEditor it adds a new UI and you can still use any of the existing CKEditor plugins.
After years of suffering bloated and outdated user interfaces, AlloyEditor will turn any Web editing moment into a peaceful experience. — AlloyEditor team
It includes drag and drop image uploading, tables, Twitter share links, and everything else a typical WYSIWYG ships with. Instead of a typical big toolbar, it does all the editing inline and is invoked when you highlight a word, phrase, or paragraph.
It’s fully skinnable through CSS and here are a few that come included by default:
With the three styles, this should you give you a good starting point to modify and make one match your own site.
Laravel Valet is a new developer environment for the Mac that configures your Mac to always run PHP’s built-in web server in the background when your machine starts.
It automatically maps any .dev domain to your folder structure using DnsMasq. For example, if your project folder is “new-blog-879” then hitting “new-blog-879.dev” in your browser will load this folder.
Valet helps reduce the barrier to entry for running a local PHP web server and runs with a small footprint. Perfect for those old machines with not much RAM.
It’s not meant to be a replacement for a virtual machine like Homestead, Vagrant, or the likes. Instead, it’s opinionated and perfect for spinning up those new ideas quickly.
My computer setup is a work desktop machine that sits in my office and runs Homestead and I use it from 8 AM to 5 PM every weekday. Then at night I play around with side projects or look at new packages on an old Macbook. This is where speed and the time savings that Valet offers is huge. Instead of spending ten minutes setting up a new site through Homestead I can instantly start working. Of course, when I say ten minutes it’s always longer because I easily get sidetracked. Now, however, I have no excuse, the server is ready and waiting for me to start working on my next big idea.
Let’s take a look at how Valet works by spinning up a sample Laravel app and going through the process.
Installation is simple and it does require Homebrew. You’ll need to install that and then install PHP 7:
brew install php70
Note: You may get a warning such as “No similarly named formulae found.” If you hit that install:
brew install homebrew/php/php70
Next install Valet from composer:
composer global require laravel/valet
Finally, run the installer:
The install only has to run once and it sets Valet’s daemon to launch when your system starts.
Your first Valet site
Now that Valet is installed, it’s time to test out our first site. I created a new folder to hold all my sites at “~/Sites”. cd into this directory:
Next run the Valet park command:
The park command tells Valet this is the location where all your sites are and it then maps the URL to folders in this directory. To show you an example create a new Laravel app:
laravel new todoapp
Once it finishes installing visit todoapp.dev in the browser and you should be greeted with the Laravel 5 placeholder page.
Now any new sites added are automatically picked up by Valet and you change the URL in your browser.
Not everyone keeps all their projects in a single folder and you can “park” multiple folders. Just “cd” to another one and run park again to add additional.
Sharing Sites with Laravel Valet
There are times when you are working locally that you would like to share what you see with others. If you are not in the same location this can be troublesome.
Valet ships with a tool called ngrok so you can share with anyone in the world. Here is all that is required to share your site:
After running the command it automatically adds a URL to your clipboard to share with others and shows you an overview of Tunnel Status and HTTP requests:
By sharing sites this gives you an added bonus of being able to use the share URL to test webhooks from services like Stripe, Mailgun, etc. Perfect for local development when testing webhooks are usually tricky.
Sites outside of your parked directory
If you have sites in other places on your file system you can still utilize Valet but utilizing it’s “link” command.
valet link zonda
Now you can hit zonda.dev in the browser and this site will load.
If you ever want to see a list of linked sites Valet offers the following command:
Then if you ever want to remove one:
valet unlink zonda
Securing a Laravel Valet site with SSL
Valet uses plain HTTP by default and with the release of 1.1.9 you can now easily serve sites over HTTPS by running:
valet secure zonda
Then to revert back to HTTP:
valet unsecure zonda
This is all managed through Caddy Server.
Laravel Valet with MySQL or MariaDB
Of course, almost every project you build is going to need to utilize a database. The database setup is outside the scope of Valet but it’s simple to get started. The documentation recommends MariaDB and currently it is a drop in replacement for MySQL. So let’s set that up and just note that MySQL would be installed basically the same way.
Using homebrew run the following:
brew install mariadb
Then start the service:
Finally, connect through Sequal Pro or your tool of choice:
The settings are as follows:
Password: (leave empty)
Laravel Valet Drivers
Drivers are a unique feature that let you run any type of PHP app. This is needed because different apps require different URL rewriting rules. Valet comes preinstalled with drivers for Laravel, Lumen, Statamic, WordPress, and CraftCMS.
If you are wanting to run a different app then you will need to create a new driver. The documentation is going to be the place to look for deeper instructions on this as each app is unique in their requirements.
Learning more about Laravel Valet
As I said earlier I’m very excited about Laravel Valet. It solves a legitimate pain point for a lot of developers and is simple to use. With the release of Valet, I’ve been able to ditch Mamp and get everything running quickly.
No more worrying about vhosts, fiddling with YAML files, or anything else. Stop the configuration madness and start developing as soon as the inspiration hits.