The ATOM editor

ATOM Editor

When I ran with the unwashed (ms windows) I used notepad++, then I moved to sublime when I started using a mac. I had used it for several years, then I decided to look for alternatives one day. I can’t remember why I was unhappy with sublime. I tried Brackets, Komodo, Aptana Studio and a few others but they didn’t feel right. Then I found ATOM, and that felt right. Maybe because it was so similar to sublime, that’s probably it. But it is so much more. It has many plugins you can well, plugin. You can make it just like sublime (but its better), and that may help with the transition. Fuck notepad++ that shit is old news and windows only, and windows fucking sucks. ATOM is cross-platform. Even if I had to do it all over again I would choose mac or Linux over windows, except for gaming (I bought a PS4, yeah fuck xboxes too). That is the only thing you can do with windows that makes sense, but then it doesn’t even really make sense. Everything about windows is wrong but that’s for another story all together.

So, https://atom.io/.

READ THIS or at least skim through it https://www.shopify.com/partners/blog/best-atom-packages-2017.

One of the most helpful plugins I have found is atom-beautify which is the reason I decided to write this post. Because it was such a pain in the ass to get this running. But in the end it wasn’t. It was a ID10T issue. I didn’t understand what exactly it was supposed to do, exactly. But now I do and knowing is half the battle! What is a beautifier? Well it takes all that horribly formatted code and makes it all nice and pretty to work with and look at. Its so fucking helpful.

I had installed atom-beautify and its sub component php-cs-fixer. Upon opening a php file I received an error that php-cs-fixer could not be found. So it looks like I need to install it. Well the ATOM websites directions for installing php-cs-fixer on a mac are wrong. You need to visit FriendsOfPHP at Github. Those directions there do work.

I did a few things to try to get it to work, these are probably not the correct steps, but they got me there. In the end I am thinking one may be able to use the compose install and run with that, omitting the manual/curl install. Remember, I am on a mac (latest OS as of this writing).

I tried the composer install first.

But when I tried which php-cs-fixer I got nothing. Now I know I was using the wrong paths in hind-sight. If I were you I would try installing via composer then using the proper composer path in the settings. If that doesn’t work and you still get the error then you know you need to do the manual install as well. But I am thinking not.

Then I tried the homebrew, at first it was producing errors for read/write permissions on a folder. Persistence paid off and it eventually just installed without any errors. Go figure. But alas, doing which php-cs-fixer  produced nothing once again. So I tried the manual installation, as the others did not produce any positive results. From a terminal do this:

then:

Turns out this comment also explains the same thing on how to install it.

Then, just run which php-cs-fixer, and it should hopefully give you good news (a path). I copied that path, and pasted it in the config settings for atom-beautify and php-cs-fixer. But that also produced the same errors from atom-beautify/php-cs-fixer. Then I found this https://github.com/pfefferle/atom-php-cs-fixer/issues/31#issuecomment-239443397. In that picture lied my salvation. I was using the wrong path this whole time and didn’t know it. As soon as I changed the path for php-cs-fixer I was good to go. That path was:

/Users/yourusername/.composer/vendor/bin/php-cs-fixer

Also of note, no matter what I did I was not able to get php php-cs-fixer  to work, never. I saw it posted all over but it never worked for me. So I did get it working, but I still thought it wasn’t working. Because it wasn’t doing anything (or so I thought). I was running the beautifier on all kinds of pages and I didn’t see any code change, I would even remove all indents and nothing! What the fuck dude? So I tried some html pages, and some JavaScript files. Those all worked just fine. It was just the php pages that were not working. Well as it turns out it was working just not how I though it should, which it should. All of the files I have that are php are intermixed php with html, for websites. I rarely have pages that are pure php. Well this plugin doesn’t structure html, at all. Or even call to the html formatter, as I think it should. It just formats pure php. So if you change the page type to html and run the beautifier it works just fine. I was expecting it to restructure all the contents of the php file, not just the actual php code. My mistake.

TLDR; php-cs-fixer just formats/indents pure php code, not php code intermixed with another language like html.. Also you need to update php5.6 to 7+ and I would install php-cs-fixer via composer, check your paths.

View Post

I am not responsible for anything that you fuck up or that goes wrong. Take these steps at your own risk. You have been warned.

OS X and transferring files (with Transmit)

In my last post I mentioned how one of my server hard drives died and I ended up purchasing a replacement. I had done some thinking on what I wanted to do with regards on how to utilize the new drive, and that ClearOS 7 was now available. I decided to use the new 3TB drive as added storage, and migrate some files. I wanted to merge my Plex media to one source instead of being spread over three drives like it was. To do this was very easy, just time consuming due to the amount of movies I needed to move, somewhere around 450GB worth. I didn’t even think of using the terminal and issuing a “mv” command as I am sure it would have been faster and this issue wouldn’t have occurred. I fired up Transmit FTP and opened two windows. One window was the old drive and the other the new. I simply drag and dropped the files, copying them, and let it run while I went to sleep. I awoke the next day to an error of no free disk space on my Mac Pro. WTF? Upon investigation I found that Transmit was caching the file transfers locally on my Mac. Thats just fucking stupid. So I’m assuming that you cannot transfer more files than you have free disk space, because apparently it will run your drive down and crash your shit.

A reboot will clear the cache (for Transmit) or you can manually delete the cache. Its located at:
~/Library/Cache

There is a ton of other crap in there as well. Most of it should be safe to delete, it is just cache right?