<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Fortine</title>
  <subtitle>Notes from a custom software studio: how-tos, code snippets, and lessons from the work.</subtitle>
  <link href="https://fortine.dev/feed.xml" rel="self" />
  <link href="https://fortine.dev/" />
  <updated>2020-04-02T00:00:00Z</updated>
  <id>https://fortine.dev/</id>
  <author>
    <name>Zach Johnson</name>
  </author>
  <entry>
    <title>Adding external link indicator with CSS</title>
    <link href="https://fortine.dev/adding-external-link-indicator-with-css/" />
    <updated>2018-10-15T00:00:00Z</updated>
    <id>https://fortine.dev/adding-external-link-indicator-with-css/</id>
    <content type="html">&lt;p&gt;Indicating a link is going to open a new tab, or window, and direct users away from your site is good practice. You can do this with an icon, text, or image.&lt;/p&gt;
&lt;p&gt;Maintaining that icon or image could be tough, especially when doing a redesign.&lt;/p&gt;
&lt;p&gt;There is a very easy solution with CSS.&lt;/p&gt;
&lt;h2&gt;Set up the link&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&amp;quot;http://google.com&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;Google&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is just a basic link with the target set to open in a new tab. No outgoing link icon or text indicator is present.&lt;/p&gt;
&lt;h2&gt;The CSS selector&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;a[target=&amp;quot;_blank&amp;quot;]:after {}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above code targets all links with the target aimed at opening a new tab or window.&lt;/p&gt;
&lt;h2&gt;Adding the icon or text&lt;/h2&gt;
&lt;p&gt;The following CSS code will add simple text indication.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;a[target=&amp;quot;_blank&amp;quot;]:after {
    content: &amp;quot; (external)&amp;quot;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want an image to show after then use the following, replace IMAGEURL with the actual image URL.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;a[target=&amp;quot;_blank&amp;quot;]:after {
    content: url(IMAGEURL);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Using Font Awesome icons&lt;/h2&gt;
&lt;p&gt;If you have &lt;a href=&quot;https://fontawesome.com/icons?d=gallery&amp;amp;q=external&quot;&gt;Font Awesome&lt;/a&gt; installed you can use the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;a[target=&amp;quot;_blank&amp;quot;]:after {
    font-family: &#39;FontAwesome&#39;;
    content: &amp;quot; &#92;f08e&amp;quot;;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;A fool-proof selector&lt;/h2&gt;
&lt;p&gt;The previous selector relies on the target tag. This selector will find all links to domains other than your own. I will use yourdomain.com to demonstrate.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;a:not([href*=&#39;yourdomain.com&#39;]):not([href^=&#39;#&#39;]):not([href^=&#39;/&#39;]):after {}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Logic breakdown: If a link &lt;strong&gt;does not&lt;/strong&gt; contain yourdomain.com then display content after link. Or, if a link &lt;strong&gt;does not&lt;/strong&gt; contain a same-page anchor link then display content after, example: #top) Or, if a link &lt;strong&gt;does not&lt;/strong&gt; contain an internal website like, example: /blog.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Validating a domain on Mailgun with GoDaddy DNS settings</title>
    <link href="https://fortine.dev/validating-a-domain-on-mailgun-with-godaddy-dns-settings/" />
    <updated>2019-02-11T00:00:00Z</updated>
    <id>https://fortine.dev/validating-a-domain-on-mailgun-with-godaddy-dns-settings/</id>
    <content type="html">&lt;p&gt;Using &lt;a href=&quot;https://mailgun.com/&quot;&gt;Mailgun&lt;/a&gt; for sending out transactional emails helps prevent messages from going to spam. This is why we recommend the service to our clients.&lt;/p&gt;
&lt;h2&gt;Signing up for an account&lt;/h2&gt;
&lt;p&gt;The first step is to sign up for a Mailgun account: &lt;a href=&quot;https://signup.mailgun.com/new/signup&quot;&gt;https://signup.mailgun.com/new/signup&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Add a domain to your Mailgun account&lt;/h2&gt;
&lt;p&gt;Once your account has been set up, you’ll need to &lt;a href=&quot;https://app.mailgun.com/app/domains/new&quot;&gt;add your domain&lt;/a&gt;. To prevent interference with your current email hosting, Mailgun suggests using a subdomain instead of your root domain, such as mg.waaz.co versus of waaz.co. Submit the “Add Domain” form and keep the page open, we will need the provided settings to use in GoDaddy’s settings.&lt;/p&gt;
&lt;h2&gt;Add the DNS records to GoDaddy&lt;/h2&gt;
&lt;p&gt;Log into your GoDaddy account and go to the &lt;a href=&quot;https://account.godaddy.com/products&quot;&gt;My Products&lt;/a&gt; page. Scroll to the &lt;strong&gt;Domains&lt;/strong&gt; section and expand it if needed. Find the domain you added to Mailgun and click on the &lt;strong&gt;DNS&lt;/strong&gt; button in its row. Keep this tab open so we can quickly add the records from Mailgun.&lt;/p&gt;
&lt;h3&gt;Adding the TXT records&lt;/h3&gt;
&lt;p&gt;We need to copy the two TXT records over to GoDaddy from the Mailgun tab.&lt;/p&gt;
&lt;h4&gt;Copy over the SPF record&lt;/h4&gt;
&lt;p&gt;Go back to the Mailgun settings tab and copy the first provided value from “Enter This Value” column.&lt;/p&gt;
&lt;p&gt;In GoDaddy’s DNS settings page, scroll to the bottom of the list of DNS records and click the &lt;strong&gt;Add&lt;/strong&gt; button. Select &lt;strong&gt;TXT&lt;/strong&gt; from the dropdown menu in the dialog.&lt;/p&gt;
&lt;p&gt;In our example, we are setting up mg.waaz.co, so “mg” needs to be used for the &lt;strong&gt;Host&lt;/strong&gt; field (make sure you don’t add the full domain to the Host field, just the subdomain portion).&lt;/p&gt;
&lt;p&gt;For the &lt;strong&gt;Time To Live (TTL)&lt;/strong&gt; setting, choose custom, and then in the &lt;strong&gt;Seconds&lt;/strong&gt; field enter 600 and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;h4&gt;Copy over the domain key record&lt;/h4&gt;
&lt;p&gt;Next step is to copy the domain key from Mailgun to GoDaddy. From the Mailgun tab, copy the Enter This Value for the second TXT row.&lt;/p&gt;
&lt;p&gt;Back in the GoDaddy tab, click the &lt;strong&gt;Add&lt;/strong&gt; button in the DNS settings list. For the &lt;strong&gt;Host&lt;/strong&gt; field add “krs._domainkey.mg” (notice the .mg at the end of that value and adjust accordingly). Paste in the value copied from Mailgun into the &lt;strong&gt;TXT Value&lt;/strong&gt; field.&lt;/p&gt;
&lt;h3&gt;Adding the MX records&lt;/h3&gt;
&lt;p&gt;Next up are the two, super-simple MX records. In the DNS settings page for GoDaddy, start the dialog for a new DNS record (click &lt;strong&gt;Add&lt;/strong&gt; at the bottom of the page).&lt;/p&gt;
&lt;p&gt;Choose &lt;strong&gt;MX&lt;/strong&gt; from the dialog dropdown. Enter the following values:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Host&lt;/strong&gt;: mg (adjust according the to subdomain you added to Mailgun)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Points to&lt;/strong&gt;: mxa.mailgun.com&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Priority&lt;/strong&gt;: 10&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TTL&lt;/strong&gt;: Custom&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Seconds&lt;/strong&gt;: 600&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Repeat those same steps for a second MX record, but use &lt;strong&gt;mxb.mailgun.com&lt;/strong&gt; instead of the mxa prefixed value for the &lt;strong&gt;Points to&lt;/strong&gt; field.&lt;/p&gt;
&lt;h3&gt;Add the CNAME record&lt;/h3&gt;
&lt;p&gt;Finally, we are going to add the CNAME record. This setting is optional, but is beneficial for tracking open rates of the emails.&lt;/p&gt;
&lt;p&gt;Start another dialog to add a DNS record in GoDaddy and choose &lt;strong&gt;CNAME&lt;/strong&gt; from the &lt;strong&gt;Type&lt;/strong&gt; dropdown.&lt;/p&gt;
&lt;p&gt;Use the following values for the fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Host&lt;/strong&gt;: email.mg (adjust the “mg” portion as needed)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Points to&lt;/strong&gt;: mailgun.org&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TTL&lt;/strong&gt;: Custom&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Seconds&lt;/strong&gt;: 600&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Finalize the domain validation&lt;/h2&gt;
&lt;p&gt;Now that the DNS records have been added to the domain, we can validate the domain in Mailgun. In the Mailgun tab we have open (with all of the DNS settings to use), scroll to the bottom of the page and click &lt;strong&gt;Get Started Sending&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;On the following page, scroll to the Domain Validation &amp;amp; DNS section and expand it.&lt;/p&gt;
&lt;p&gt;Click on the &lt;strong&gt;Check DNS Records Now&lt;/strong&gt; button. Hopefully everything listed now has a green check box. If not, wait a few more minutes and try again. Typically these settings only take 5-10 minutes to propagate, but could take upwards of 24-48 hours.&lt;/p&gt;
&lt;h2&gt;Bonus: Setting up Mailgun with WordPress&lt;/h2&gt;
&lt;p&gt;After the DNS settings are configured for your domain, setting up WordPress to utilize Mailgun is a breeze.&lt;/p&gt;
&lt;p&gt;In Mailgun, go to the &lt;strong&gt;Domains&lt;/strong&gt; page and click on the domain you added earlier. Copy the &lt;strong&gt;API Key&lt;/strong&gt; near the top of the page.&lt;/p&gt;
&lt;p&gt;Log into your WordPress admin dashboard and go to the plugins page. Click on the &lt;strong&gt;Add New&lt;/strong&gt; button at the top of the page. Type “Mailgun” into the search bar at the top right. Find the plugin named &lt;a href=&quot;https://wordpress.org/plugins/mailgun/&quot;&gt;“Mailgun for WordPress” by Mailgun&lt;/a&gt; and click &lt;strong&gt;Install&lt;/strong&gt;. When it finishes installing click the &lt;strong&gt;Activate&lt;/strong&gt; button.&lt;/p&gt;
&lt;p&gt;When the plugin activates, hover over the &lt;strong&gt;Settings&lt;/strong&gt; menu on the left and click on &lt;strong&gt;Mailgun&lt;/strong&gt;. Scroll down to the &lt;strong&gt;API Key&lt;/strong&gt; setting and paste in the API Key from Mailgun.&lt;/p&gt;
&lt;p&gt;Finally, for the &lt;strong&gt;Mailgun Domain Name&lt;/strong&gt; setting put in the domain you gave during the initial Mailgun configuration.&lt;/p&gt;
&lt;p&gt;Scroll to the bottom of the page and click &lt;strong&gt;Save Changes&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;We’re here to help&lt;/h2&gt;
&lt;p&gt;If you’re struggling with getting Mailgun set up on GoDaddy, feel free to &lt;a href=&quot;https://fortine.dev/contact/&quot;&gt;contact us&lt;/a&gt; and we’ll help you get squared away.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Add multicolored shadows to images with CSS variables</title>
    <link href="https://fortine.dev/add-multicolored-shadows-to-images-with-css-variables/" />
    <updated>2019-02-28T00:00:00Z</updated>
    <id>https://fortine.dev/add-multicolored-shadows-to-images-with-css-variables/</id>
    <content type="html">&lt;p&gt;I was inspired to create multicolored shadows with CSS by a few non-web interfaces. I was able to replicate these color-matching shadows in CSS using pseudo elements, filters, and custom variables.&lt;/p&gt;
&lt;p&gt;First I set up a div with a style attribute to hold the image URL variable and a nested image tag:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&amp;quot;image-shadow&amp;quot; style=&amp;quot;--image: url(https://images.pexels.com/photos/1323550/pexels-photo-1323550.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;dpr=2&amp;amp;h=161&amp;amp;w=250)&amp;quot;&amp;gt;
  &amp;lt;img src=&amp;quot;https://images.pexels.com/photos/1323550/pexels-photo-1323550.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;dpr=2&amp;amp;h=161&amp;amp;w=250&amp;quot; width=&amp;quot;500&amp;quot; height=&amp;quot;322&amp;quot;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then I applied a few styles to the div and a pseudo element:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.image-shadow {
  position: relative;
  
  img {
    display: block;
    margin: 0 auto;
    border-radius: 5px;
  }
  
  &amp;amp;::after {
    content: &amp;quot;&amp;quot;;
    position: absolute;
    top: 1%;
    left: 0.5%;
    width: 99%;
    height: 99%;
    background: var(--image) no-repeat center;
    filter: blur(30px);
    transition: all .4s;
    z-index: -1;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Technically, using CSS variables isn’t required but I was generating the HTML markup with a PHP foreach loop and needed a way to dynamically set the pseudo element’s background image.&lt;/p&gt;
&lt;p&gt;Play around or fork the Codepen &lt;a href=&quot;https://codepen.io/hellozach/pen/GepLPr&quot;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Photo by &lt;a href=&quot;https://www.pexels.com/@8moments/&quot;&gt;Simon Matzinger&lt;/a&gt; on &lt;a href=&quot;https://www.pexels.com/&quot;&gt;Pexels.com&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Adding Microsoft SQL Server support to Laravel Forge</title>
    <link href="https://fortine.dev/adding-microsoft-sql-server-support-to-laravel-forge/" />
    <updated>2020-04-02T00:00:00Z</updated>
    <id>https://fortine.dev/adding-microsoft-sql-server-support-to-laravel-forge/</id>
    <content type="html">&lt;p&gt;We recently had to set up an existing Laravel Forge project to connect to a Microsoft SQL Server, and it was a struggle with all of the differing guides. We have combined all of the steps that worked for us into this helpful guide.&lt;/p&gt;
&lt;p&gt;There are a few key pieces of information you need to set up SQL Server on Laravel Forge:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sudo password&lt;/strong&gt;: This was provided to you once the server was provisioned.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Server IP address&lt;/strong&gt;: This can be found in your Forge dashboard&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Connect to your Forge server via SSH&lt;/h2&gt;
&lt;p&gt;Log into your Forge server with the following command in your terminal:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ssh forge@[your-server-ip-address]
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Installing the Microsoft SQL Server dependencies&lt;/h2&gt;
&lt;p&gt;Run the following commands after connecting to your server via SSH.&lt;/p&gt;
&lt;p&gt;Add Microsoft’s public key to your server:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As &lt;code&gt;root&lt;/code&gt;, add the public key again, and load the dependency source:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list &amp;gt; /etc/apt/sources.list.d/mssql-release.list
exit
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Install the dependencies:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
sudo apt-get install unixodbc-dev
sudo pecl install sqlsrv pdo_sqlsrv
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Activate the dependencies as &lt;code&gt;root&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo su
printf &amp;quot;; priority=20&#92;nextension=sqlsrv.so&#92;n&amp;quot; &amp;gt; /etc/php/7.4/mods-available/sqlsrv.ini
printf &amp;quot;; priority=30&#92;nextension=pdo_sqlsrv.so&#92;n&amp;quot; &amp;gt; /etc/php/7.4/mods-available/pdo_sqlsrv.ini
exit
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As now as the &lt;code&gt;forge&lt;/code&gt; user:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo phpenmod -v 7.4 sqlsrv pdo_sqlsrv
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Restart PHP in Laravel Forge&lt;/h2&gt;
&lt;p&gt;Then in Forge, open the server you installed SQL Server on and restart PHP.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Log into your Laravel Forge account&lt;/li&gt;
&lt;li&gt;Open the server with SQL Server installed&lt;/li&gt;
&lt;li&gt;Scroll to bottom of the page and click on the &lt;strong&gt;Restart&lt;/strong&gt; menu button&lt;/li&gt;
&lt;li&gt;Click on the &lt;strong&gt;Restart PHP&lt;/strong&gt; option&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Sources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15&quot;&gt;https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-ver15&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
</feed>