<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Oscar Mwanandimai on Medium]]></title>
        <description><![CDATA[Stories by Oscar Mwanandimai on Medium]]></description>
        <link>https://medium.com/@oscarmwana?source=rss-c4fd4c89766b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dKzE58uDqL04GtJTteoHSg.png</url>
            <title>Stories by Oscar Mwanandimai on Medium</title>
            <link>https://medium.com/@oscarmwana?source=rss-c4fd4c89766b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:00:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@oscarmwana/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Simple PHP web tool to manage .env files]]></title>
            <link>https://medium.com/@oscarmwana/simple-php-tool-to-visually-manage-env-files-d0a590586db2?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0a590586db2</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Thu, 18 Jan 2018 06:09:32 GMT</pubDate>
            <atom:updated>2018-01-19T03:50:21.192Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qFTEJLpomAo3F6iOiLhcgQ.png" /></figure><p>I work largely with Laravel apps and post deployment I have to SSH into different servers to manage .env files as we scale the apps and I have to update configs, so this tool is at this point very biased. I like the visual environment editor <a href="https://envoyer.io/">Laravel’s Envoyer</a> provides per project as well as the Config Variables settings in Heroku. Now I won’t go as far as the Heroku version but the simple Envoyer one is an easy benchmark.</p><h3>Assumptions</h3><ol><li>You use Laravel and <a href="https://laravel.com/docs/5.5/homestead">Laravel Homestead</a></li><li>You understand this is my proof of concept</li><li>An understanding that “simple” = to very little code + a library or two</li></ol><h3>Implementation</h3><p>The implementation requires a few simple tasks to be completed (omitting various validations like the existence of the file etc).</p><ol><li>Tell the app my projects’ root directory</li><li>Structurally store a list of my projects somewhere</li><li>Update the projects’ .env</li></ol><p>Code is available on <a href="https://github.com/httpoz/env-manager-prototype">Github here</a></p><h4>Telling my app where my projects’ root directory is</h4><p>The idea is to somehow offer multiple per installation config options without changing the source code itself, enter the <a href="https://github.com/vlucas/phpdotenv">dotenv library</a>. <strong>Long game:</strong> perhaps as part of adding a project you define a location type, for those of us that have both Xampp and Homestead on our machines, that matches a location config in your .env.</p><pre>// .env</pre><pre>homestead=C:\Users\oscarm\code</pre><h4>Store a list of my projects for the app to reference</h4><p>Enter <a href="https://symfony.com/doc/current/components/yaml.html">Symfony’s Yaml Component</a>, I could have used any other storage option really but I chose controversy. I have always been keen to learn a ton about parsing different file types in PHP/Ruby after I tried to figure out how I could create a web interface for my Homestead.yaml file to manage it and clean it up — it gets messy after a few projects. This package made it simple, with a few lines of code below it read my entire yaml file as an array and back to yaml again.</p><pre>// read the yaml file and return array<br>$sites = Yaml::parseFile($sitesFile);<br></pre><pre>if (isset($_POST[‘site’], $_POST[‘type’])) {</pre><pre>    array_push($sites, [‘name’ =&gt; $_POST[‘site’], ‘type’ =&gt; $_POST[‘type’]]);</pre><pre>    // updated projects array to yaml<br>    $yaml = Yaml::dump($sites);</pre><pre>    file_put_contents($sitesFile, $yaml);</pre><pre>}</pre><h4>Update the projects’ .env</h4><p>This task was dead simple, when I clicked to view the project’s env I loaded a textarea with its content. Now to update the .env I just posted the updated file back and replaced the existing .env with the updated content.</p><pre>if (isset($_POST[&#39;env&#39;], $_POST[&#39;update_site&#39;])) {</pre><pre>    try {</pre><pre>        file_put_contents(getSitePath($_POST[&#39;update_site&#39;]), $_POST[&#39;env&#39;]);</pre><pre>    } catch (\Exception $e) {</pre><pre>        var_dump($e);</pre><pre>    }</pre><pre>    header(&quot;Refresh:0&quot;);</pre><pre>}</pre><h3>Next steps</h3><p>While a simple tool was fun to do and share the complex parts are still uncovered. SSHing into remote servers and updating the .env there, as that is my particular use case. While I have created some prototypes in other languages I have not tackled the challenge in PHP. Adding more configuration features would be handy too, however I would have to play around with a million and one tools to see config patterns used by different frameworks and in other languages too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0a590586db2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating my first Golang app]]></title>
            <link>https://medium.com/@oscarmwana/creating-my-first-golang-app-a81cab992875?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a81cab992875</guid>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Mon, 20 Nov 2017 11:10:11 GMT</pubDate>
            <atom:updated>2017-11-20T11:10:11.240Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m2ax5ZPQNGeTXJOdlR39Nw.png" /><figcaption><a href="https://golang.org/doc/gopher/bumper.png">https://golang.org/doc/gopher/bumper.png</a></figcaption></figure><h3>Problem (Well not really, more like an excuse)</h3><p>As part of my job every now and then I get to spin up a WordPress site. And my process is loosely detailed below:</p><ol><li>Local machine — download WP tarball; extract into vagrant folder; start theme/plugin dev.</li><li>Testing server — download WP tarball; extract into web folder; create theme/plugin folder; [insert deployment workflow].</li><li>Production server — download WP tarball; extract into web folder; create theme/plugin folder; [insert deployment workflow].</li></ol><p>Now apart from the theme folder portion (which I’d like to automate at some point as well), I wanted to make the WP project files setup a one click process and learning Golang felt like the right excuse for this cli app.</p><h3>Solution (ish)</h3><blockquote>All the code that I wrote and borrowed can be found in this repo <a href="https://github.com/httpoz/create-wordpress-app">https://github.com/httpoz/create-wordpress-app</a></blockquote><p>I broke down my solution into the following:</p><ol><li>Accept a flag which tells the app what site folder to create</li><li>Check if the directory already exists and try create it</li><li>Download and extract the WP tarball</li></ol><h3>1. Flags</h3><p>I used a flag library instead of the standard one because it doesn’t support long-flag syntax. Also because when I was going through Go tuts, <a href="https://medium.freecodecamp.org/writing-command-line-applications-in-go-2bc8c0ace79d">Peter said so, I trust Peter</a>.</p><p>Because this is not a Golang primer post, I assume you know basics. I ideally created a flag called site that can be called with either <em>short-flag s or long-flag site.</em></p><pre>import (<br>  ...</pre><pre>  flag &quot;github.com/ogier/pflag&quot;<br>)</pre><pre>// flags</pre><pre>var (<br>  site string<br>)<br></pre><pre>func init() {</pre><pre>  flag.StringVarP(&amp;site, &quot;site&quot;, &quot;s&quot;, &quot;&quot;, &quot;The website&#39;s domain name.&quot;)</pre><pre>}</pre><pre>func main() {<br>  flag.Parse()</pre><pre>  fmt.Println(&quot;Starting app...&quot;)<br>  checkFlags()</pre><pre>  ...<br>}</pre><pre>func checkFlags() {</pre><pre>  if flag.NFlag() == 0 {</pre><pre>    fmt.Println(&quot;Missing arguments.&quot;)<br>    fmt.Println(&quot;Available options:&quot;)<br>    flag.PrintDefaults()<br>    os.Exit(1)</pre><pre>  }</pre><pre>}</pre><h3>2. Scan directory and create folder</h3><p>The goal here was to first check if a directory existed and if it does exit the program. However if it does not exist, create the directory.</p><pre>func setUpDir() {</pre><pre>  if _, err := os.Stat(site); err == nil {</pre><pre>    fmt.Println(site + &quot; already exists. I cannot overwrite directories.&quot;)</pre><pre>    os.Exit(1)</pre><pre>  } else {</pre><pre>  os.Mkdir(site, os.FileMode(0755))</pre><pre>  fmt.Println(&quot;Site folder created.&quot;)</pre><pre> }</pre><pre>}</pre><h3>3. Downloading and Extracting the tarball</h3><p>I used the http package to grab the latest WP tarball and then wrote it to a file with the same name, after which I borrowed the code from the <a href="https://godoc.org/golang.org/x/build/internal/untar">Go Untar internal library</a> and extracted the tarball into the site folder.</p><pre>func downloadAndExtractWordpress() {<br>  fmt.Println(&quot;Downloading WordPress tar ball&quot;)</pre><pre>  // Create the file<br>  out, err := os.Create(&quot;latest.tar.gz&quot;)<br>  <br>  if err != nil {<br>    fmt.Println(err)<br>  }</pre><pre>  defer out.Close()</pre><pre>  // grab WP tarball  <br>  resp, err := http.Get(&quot;https://wordpress.org/latest.tar.gz&quot;)</pre><pre>  if err != nil {<br>    fmt.Println(err)<br>  }<br>  defer resp.Body.Close()</pre><pre>  _, err = io.Copy(out, resp.Body)</pre><pre>  if err != nil {<br>    fmt.Println(err)<br>  }</pre><pre>  f, err := os.Open(&quot;latest.tar.gz&quot;)</pre><pre>  if err != nil {<br>    fmt.Println(err)<br>    os.Exit(1)<br>  }</pre><pre>  defer f.Close()</pre><pre>  fmt.Println(&quot;Unpacking tar ball...&quot;)</pre><pre>  Untar(f, site)</pre><pre>  fmt.Println(&quot;Preparing Site&quot;)</pre><pre>  os.Rename(site+&quot;/wordpress&quot;, site+&quot;/site&quot;)</pre><pre>  fmt.Println(&quot;Done. Enjoy.&quot;)<br>}</pre><p>At the end of it all, after installing it on my computer, I can now:</p><pre>$ create-wordpress-app -s medium.com</pre><pre>// Terminal output</pre><pre>Starting app...<br>Site folder created.<br>Downloading WordPress tar ball<br>Unpacking tar ball...<br>2017/11/20 10:04:16 extracted tarball into medium.com: 1542 files, 141 dirs (6.7976161s)<br>Preparing Site<br>Done. Enjoy.</pre><p>It’s not the cleanest greatest simplest Go app but I learned a lot while creating this. I have already seen a lot of opportunities to improve the code like a progress bar while downloading and a few extra flags and options.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a81cab992875" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preview your notification emails in Laravel 5.4]]></title>
            <link>https://medium.com/@oscarmwana/preview-your-notification-emails-in-laravel-5-4-f30458d6ce4b?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f30458d6ce4b</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[laravel54]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Mon, 21 Aug 2017 13:29:23 GMT</pubDate>
            <atom:updated>2017-08-21T13:30:50.554Z</atom:updated>
            <content:encoded><![CDATA[<p>If you want to preview you mails in browser to see how they would ideally look in the recipient’s inbox you can set that up in a few lines of code in your routes file.</p><h3>Adam Wathan on Twitter</h3><p>🔥 Handy couple of lines for previewing Laravel Notification emails in the browser, great for styling with realistic data 👍🏻</p><p>The solution is a Frankenstein mashup of tips from two different sources. One was a great tip from Adam Wathan(above) and the other a solution by <a href="https://laracasts.com/discuss/channels/laravel/preview-markdown-emails?page=1">TiBian on a Laracast thread</a> because Laravel Notifications are now in markdown by default.</p><p>The snippet below assumes you have created a notification called TestNotification that has no data passed to it.</p><pre>// routes/web.php</pre><pre>$this-&gt;get(‘preview-notification’, function () {<br>    </pre><pre>   $message = (new \App\Notifications\TestNotification())-&gt;toMail(&#39;test@email.com&#39;);<br>    <br>    $markdown = new \Illuminate\Mail\Markdown(view(), config(‘mail.markdown’));</pre><pre>    return $markdown-&gt;render(‘vendor.notifications.email’, $message-&gt;toArray());</pre><pre>});</pre><p>I hope this nudges you in the right direction.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f30458d6ce4b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running PHPUnit Tests in PHPStorm]]></title>
            <link>https://medium.com/@oscarmwana/running-phpunit-tests-in-phpstorm-f0a42a70daa?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0a42a70daa</guid>
            <category><![CDATA[phpunit]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[phpstorm]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Wed, 31 May 2017 10:22:11 GMT</pubDate>
            <atom:updated>2017-05-31T10:22:11.098Z</atom:updated>
            <content:encoded><![CDATA[<p>I have made a few assumptions here:</p><ul><li>You use PHPStorm and know how to get around.</li><li>You know what PHPUnit is.</li><li>Context here is a Laravel app, your setup may differ but you get the idea.</li></ul><h3>Setting up your Run/Debug Configurations</h3><p>All the configuration in this micro-tut will happen in the Run/Debug Configurations Dialog. In your toolbar menu (illustrated below) click on run then Edit Configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ygkv43z6_VZ8lT_10fvsw.gif" /></figure><p>Once the dialog opens you want to click the green plus icon to create a project specific configuration. So the first optional thing you want to do is name the configuration in the case of my application I would name it “Voucher System Tests”.</p><p><strong>Test Runner</strong></p><ul><li>On Test scope option select ‘Defined in the configuration file’.</li><li>Check ‘Use alternative configuration file’ and use the file picker to point to the main phpunit.xml file in your project (found in root in Laravel).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rsTsT5YSATXP04U1sLFxVA.gif" /></figure><p>And that should be it. Now you can run your tests as part of your workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gYzyW8wYu6c6iTeIieMiPA.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0a42a70daa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Toggling Animate.css with jQuery]]></title>
            <link>https://medium.com/@oscarmwana/toggling-animate-css-with-jquery-972415aa0a71?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/972415aa0a71</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Mon, 03 Apr 2017 13:06:32 GMT</pubDate>
            <atom:updated>2017-04-03T13:24:13.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q8zVzOaXfa9ks4ftgVtzYQ.jpeg" /><figcaption><a href="https://unsplash.com/photos/qAShc5SV83M">Unsplash</a></figcaption></figure><p><a href="https://daneden.github.io/animate.css/">Animate.css</a> is my favourite plug and play animation library. Every time I use it, it has to do with the designer’s big idea on how the navigation must make a “grand entrance”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*lHDD6OHPnlNpIx-k0Yyktg.gif" /><figcaption><a href="http://popkey.co/m/KlNW8-emperors+new+groove-grand+entrance">http://popkey.co/m/KlNW8-emperors+new+groove-grand+entrance</a></figcaption></figure><p>I always forget how I did it last time and I do it so far apart, I would have handed the repo over to the owner and I have no point of reference. So this will now serve as my point of reference.</p><h3>The problem</h3><p>What I am trying to accomplish here is to click a button/link and have it use one animation to display an object on the page and another animation to hide the object. Simple enough. I would like to accomplish this without the occasional dead button (click-happy mode) because the first animation hasn’t completed by my <em>nth </em>overzealous<em> </em>click.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fcodepen.io%2Foscarmwana%2Fpen%2FzZbOEo%2F&amp;src=https%3A%2F%2Fcodepen.io%2Foscarmwana%2Fembed%2Fpreview%2FzZbOEo%3Fheight%3D600%26amp%3Bslug-hash%3DzZbOEo%26amp%3Bdefault-tabs%3Djs%2Cresult%26amp%3Bhost%3Dhttp%253A%252F%252Fcodepen.io%26amp%3Bembed-version%3D2&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/54c51c535efac687c92f48ef28bfbfa1/href">https://medium.com/media/54c51c535efac687c92f48ef28bfbfa1/href</a></iframe><h3>The solution</h3><p>The solution is to add the animation class then use<a href="http://api.jquery.com/one/"> jQuery’s .one()</a> method and detect when the CSS3 animation (Animate.css) ends at which point I can remove the class and wait to add another on the next button click event.</p><p>Solution source : <a href="http://stackoverflow.com/a/22674688">yeowoh on SO</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=972415aa0a71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disabling Vue.js Devtools in Production]]></title>
            <link>https://medium.com/front-end-weekly/disabling-vue-js-devtools-in-production-3def11812245?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3def11812245</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[laravel-elixir]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Thu, 19 Jan 2017 08:04:48 GMT</pubDate>
            <atom:updated>2017-01-19T08:04:48.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QxmelmBXyXLBg54W8fEP1w.png" /></figure><p>This solution assumes you are using Vue.js, Laravel and Laravel Elixir, if you are not you may have to play around with file paths to match your build environment.</p><ol><li>Create the environment file in the root of your project -:</li></ol><pre>touch prod.env.js</pre><p>Add the following code in <em>prod.env.js -:</em></p><pre>Vue.<em>config</em>.devtools = <strong>false</strong>;<br>Vue.<em>config</em>.debug = <strong>false</strong>;<br>Vue.<em>config</em>.silent = <strong>true</strong>;</pre><p>2. Update your <em>gulpfile.js</em> to look like this -:</p><pre>elixir((mix) =&gt; {<br>    elixir.config.production ? mix.webpack([&#39;app.js&#39;, &#39;./prod.env.js&#39;], &#39;public/js/app.js&#39;) : mix.webpack(&#39;app.js&#39;);<br>});</pre><p>This change tells elixir that when you are running gulp in production mode like below, append the environment file we created.</p><p>3. Run the following code and deploy :)</p><pre>gulp --production</pre><p>Sources:<br><a href="https://laracasts.com/discuss/channels/elixir/disabling-vue-devtools-in-production">https://laracasts.com/discuss/channels/elixir/disabling-vue-devtools-in-production</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3def11812245" width="1" height="1" alt=""><hr><p><a href="https://medium.com/front-end-weekly/disabling-vue-js-devtools-in-production-3def11812245">Disabling Vue.js Devtools in Production</a> was originally published in <a href="https://medium.com/front-end-weekly">Frontend Weekly</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prepping Laravel for deployment on a shared hosting server]]></title>
            <link>https://medium.com/@oscarmwana/prepping-laravel-for-deployment-on-a-shared-hosting-server-63cc5c87f1eb?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/63cc5c87f1eb</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Thu, 12 May 2016 09:28:37 GMT</pubDate>
            <atom:updated>2016-05-18T08:16:07.314Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ho2gV061-6KckiV1DTr8Vw.jpeg" /><figcaption><a href="http://www.solabs.info/content/images/2014/Aug/laravel_framework.jpg">Source</a></figcaption></figure><p><strong>Background: </strong>So at my place of employment we deploy most of our web apps on shared hosting environments. I won’t get into the cons of that or preferences for Laravel deployment, I do have a push to deploy recipe (<strong>Digital Ocean + Forge + Envoyer + Gitlab</strong>) for my personal projects which is badass btw. Anyway here is how to get around scaffolding your laravel app in development so you work in the context of your deployment environment. This “guide” assumes you have already installed Laravel.<br> <br><em>PS: Current Laravel version is 5.2.31</em></p><h4>Step 1 — Break your app</h4><p>Create a folder (I will call mine <em>emergencyroom</em>) and drag all the files, except the <em>public</em> folder, from the root of your app into <em>emergencyroom. </em>Then drag all the contents of your <em>public </em>folder into the root of your app and feel free to delete the now empty <em>public </em>folder. The root of your app should ideally now look like mine here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xMzeylRAdgrLRRKJnDdVqw.png" /><figcaption>Image 1</figcaption></figure><h4>Step 2 — Tell Laravel where the new Public folder is</h4><p><em>Source: </em><a href="http://stackoverflow.com/questions/30873773/laravel5-chdir-no-such-file-or-directory-errno-2/35047783#35047783">http://stackoverflow.com/questions/30873773/laravel5-chdir-no-such-file-or-directory-errno-2/35047783#35047783</a></p><p><strong>Create emergencyroom/app/Console/Commands/Serve.php file and set the content to this:</strong></p><pre>&lt;?php<br><br>namespace App\Console\Commands;<br><br>use Exception;<br>use Illuminate\Console\Command;<br>use Symfony\Component\Console\Input\InputOption;<br>use Symfony\Component\Process\PhpExecutableFinder;<br>use Symfony\Component\Process\ProcessUtils;<br><br>class Serve extends Command {<br>    /**<br>     * The console command name.<br>     *<br>     * @var string<br>     */<br>    protected $name = &#39;serve&#39;;<br><br>    /**<br>     * The console command description.<br>     *<br>     * @var string<br>     */<br>    protected $description = &#39;Serve the application on the PHP development server&#39;;<br><br>    /**<br>     * Execute the console command.<br>     *<br>     * @return void<br>     *<br>     * @throws \Exception<br>     */<br>    public function fire() {<br>        chdir(&#39;/&#39;);<br><br>        $host = $this-&gt;input-&gt;getOption(&#39;host&#39;);<br><br>        $port = $this-&gt;input-&gt;getOption(&#39;port&#39;);<br><br>        $base = ProcessUtils::escapeArgument($this-&gt;laravel-&gt;basePath());<br><br>        $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)-&gt;find(false));<br><br>        $this-&gt;info(&quot;Laravel development server started on http://{$host}:{$port}/&quot;);<br><br>        if (defined(&#39;HHVM_VERSION&#39;)) {<br>            if (version_compare(HHVM_VERSION, &#39;3.8.0&#39;) &gt;= 0) {<br>                passthru(&quot;{$binary} -m server -v Server.Type=proxygen -v Server.SourceRoot={$base}/ -v Server.IP={$host} -v Server.Port={$port} -v Server.DefaultDocument=server.php -v Server.ErrorDocument404=server.php&quot;);<br>            } else {<br>                throw new Exception(&quot;HHVM&#39;s built-in server requires HHVM &gt;= 3.8.0.&quot;);<br>            }<br>        } else {<br>            passthru(&quot;{$binary} -S {$host}:{$port} {$base}/server.php&quot;);<br>        }<br>    }<br><br>    /**<br>     * Get the console command options.<br>     *<br>     * @return array<br>     */<br>    protected function getOptions() {<br>        return [<br>            [&#39;host&#39;, null, InputOption::VALUE_OPTIONAL, &#39;The host address to serve the application on.&#39;, &#39;localhost&#39;],<br><br>            [&#39;port&#39;, null, InputOption::VALUE_OPTIONAL, &#39;The port to serve the application on.&#39;, 8000],<br>        ];<br>    }<br>}</pre><p><strong>Update the emergencyroom/app/Console/Kernel.php file with this content:</strong></p><pre>&lt;?php<br><br>namespace App\Console;<br><br>use Illuminate\Console\Scheduling\Schedule;<br>use Illuminate\Foundation\Console\Kernel as ConsoleKernel;<br><br>class Kernel extends ConsoleKernel {<br>    /**<br>     * The Artisan commands provided by your application.<br>     *<br>     * @var array<br>     */<br>    protected $commands = [<br>        Commands\Inspire::class,<br>        Commands\Serve::class,<br>    ];<br><br>    /**<br>     * Define the application&#39;s command schedule.<br>     *<br>     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule<br>     * @return void<br>     */<br>    protected function schedule(Schedule $schedule) {<br>        $schedule-&gt;command(&#39;inspire&#39;)<br>            -&gt;hourly();<br>    }<br>}</pre><h4>Step 3 — Tell you index.php file where to find the Laravel files</h4><p>Navigate to <em>index.php</em> in your root and change it’s content to the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4pCMNtgrK2sNFsKxw8IXLw.png" /><figcaption>Image 2</figcaption></figure><h4>Step 4 — update server.php to point to the new location of index.php</h4><p>Go to the file <em>emergencyroom/server.php</em> and update <strong><em>line 21</em></strong> to the following:</p><pre>require_once __DIR__.&#39;/../index.php&#39;;</pre><h4>Step 5— test serve command</h4><p>From now on you will be running artisan commands in the <em>emergencyroom</em> folder. The following command should run without giving any errors:</p><pre>$ php artisan serve</pre><pre>// however to run your site on port 8000 you have to go to the root // of the application and run instead of using artisan serve. (edit // from trial and error)</pre><pre>$ php -S localhost:8000</pre><h4>Step 6— telling gulp where to output styles and scripts</h4><p>Open your gulpfile and add the following line at the after instantiating elixir:</p><pre>elixir.config.publicPath = &#39;../&#39;;</pre><p>It should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DcE3bI_4oGakyPkvsJryhg.png" /></figure><p>That’s about it. If you need clarity or you have any questions, kindly leave a comment and I will edit or improve the article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63cc5c87f1eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make parent link clickable in Bootstrap with Wordpress NavWalker]]></title>
            <link>https://medium.com/@oscarmwana/make-parent-link-clickable-in-bootstrap-wordpress-navigation-walker-61213063a1a0?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/61213063a1a0</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[bootstrap]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Mon, 23 Nov 2015 14:12:32 GMT</pubDate>
            <atom:updated>2017-06-24T05:57:03.847Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ilH-I6N9kZPjcnfh19lQA.jpeg" /><figcaption>Image Credit: <a href="http://wersm.com/wp-content/uploads/2014/04/wordpress-code-image.jpg">http://wersm.com/wp-content/uploads/2014/04/wordpress-code-image.jpg</a></figcaption></figure><h3>Scenario:</h3><p>You are developing a <a href="https://wordpress.org/">Wordpress </a>site and you are using <a href="http://getbootstrap.com/">Bootstrap</a>, I for one use <a href="https://github.com/twittem/wp-bootstrap-navwalker">wp-bootstrap-navwalker</a> by <strong>Edward McIntyre</strong> to take away the heavy lifting when building menus. If, like many of us, you are required for some special reason (life or death) to make the parent link of a drop-down click through to a url instead of revealing the drop-down menu under it — I have found the solution/hack :-).</p><h3>Assumptions:</h3><ul><li>You are developing a Wordpress theme</li><li>You are using the wp-bootstrap-navwalker</li></ul><p><em>You only have to change 2 lines of code in the wp_bootstrap_navwalker.php file.</em></p><h4>Before</h4><pre>On line 85:<br>$atts[&#39;href&#39;] = &#39;#&#39;;</pre><pre>On line 87:<br>$atts[&#39;data-toggle&#39;] = &#39;dropdown&#39;;</pre><h4>After</h4><pre>On line 85:<br>$atts[&#39;href&#39;] = ! <strong>empty</strong>( $item-&gt;url ) ? $item-&gt;url : &#39;&#39;;</pre><pre>On line 87:<br>$atts[&#39;data-hover&#39;] = &#39;dropdown&#39;;</pre><p><strong><em>Voila.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61213063a1a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick Fix: Wordpress & Xampp permissions error on Mac]]></title>
            <link>https://medium.com/@oscarmwana/quick-fix-wordpress-xampp-permissions-error-on-mac-e8cd843ef261?source=rss-c4fd4c89766b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8cd843ef261</guid>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[wordpress-tips]]></category>
            <category><![CDATA[xampp]]></category>
            <dc:creator><![CDATA[Oscar Mwanandimai]]></dc:creator>
            <pubDate>Wed, 10 Jun 2015 07:47:21 GMT</pubDate>
            <atom:updated>2015-06-10T07:52:38.296Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I gave my Mac to another developer, while I created a new user entirely for her, Xampp appeared to be a shared app across every user — permissions, settings and all. So it turned out she couldn’t install plugins on a Wordpress installation on her localhost because <em>Apache</em> still identified my account as the owner.</p><p>The fix is pretty easy:</p><p><strong>Open the file in terminal:</strong></p><pre>sudo subl /Applications/XAMPP/xamppfiles/etc/httpd.conf</pre><p><strong>Change:</strong></p><pre>User nobody<br>Group nogroup</pre><p><strong>To:</strong></p><pre>User <em>your_mac_username</em><br>Group staff</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8cd843ef261" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>