Mac OS 10.2.2 SSH Keys Passphrase Help

If you are like me and a few days ago – noticed that you were getting prompted for your passphrase when using your SSH keys (instead of using the keychain) – here is how you can make a small change to no longer enter your password each time: http://apple.stackexchange.com/questions/254468/macos-sierra-doesn-t-seem-to-remember-ssh-keys-between-reboots/264974#264974

Add Bootstrap Button Classes to the WordPress Comment Form

Looking to stylize that WordPress comment button on the WordPress comment form? Adding the correct classes needed to the comment form button are as easy as finding where comment_form() is called in your theme. In my cases – this is within the comments.php file.

Once you find that – you just need to change
comment_form()
to:

$args = array(
'class_submit' => 'btn btn-default',
);
comment_form($args )

There are a number of modifications you can make to the comment form (changing button text, changing labels, adding notes, etc that you can make with the comment_form() function which are worth looking at here: https://codex.wordpress.org/Function_Reference/comment_form

Add Bootstrap Classes to WordPress Widgets

When creating your Bootstrap WordPress themes, you will notice the sidebar widgets (archives, categories, etc) which use dropdowns do not share the Bootstrap styling because there is no place easily accessible to add in the needed classes or CSS.

Considering the options – here are two ways you can turn those default selects into something that matches the rest of your beautiful Bootstrap site.

Add a filter in your functions.php file

This is specific to the category dropdown. I was hoping we could use the same on the widget_categories_dropdown_args filter, but that is not possible as of WordPress 4.6. (see next example to address this). This filter works great if you use the categories widget and no other that display a select.

/**
 * Add CSS class to sidebar category selects.
 */
add_filter( 'widget_categories_dropdown_args', 'lucidity_widget_categories_dropdown_args' );
function lucidity_widget_categories_dropdown_args( $args ) {
    if ( array_key_exists( 'class', $args ) ) {
        $args['class'] .= ' form-control';
    } else {
        $args['class'] = 'form-control';
    }
    return $args;
}

Add some Bootstrap CSS to your style.css file

This works great if you have multiple selects displayed within your widgets. Note: the sidebar in the example has an ID of “sidebar”. This CSS is brought over from the Bootstrap .form-control style.

#sidebar .widget select {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

I hope this helps make your site a bit more cohesive with the Bootstrap styles!

Find Large Files in *NIX

I recently ran into an issue where backups for a project were taking much more space than I thought they should. I figured there was a large error log somewhere – and sure enough I was able to easily find it with the following command:


du -sh *

That command du (disk usage) along with the options -sh (s = summarize, h = human readable) will then output something like this:

7.9M	admin
700K	api
1.4G	delivery
4.0K	error_log
44K	images
4.0K	index.php
4.0K	robots.txt

From there I can then see that the big disk space hog is in the “delivery” directory. Running the command then within that directory then showed there was a huge 1.4G error log which needed addressed.

This command is very useful and will save a lot of time if you run into a similar situation as I did.

Custom Date Sort with jQuery Tablesorter and Bootstrap Table Plugin

In the past week I have dealt with two different needs to sort a table date column (using a custom date format) using a JS plugin jQuery Tablesorter 2.0 and Bootstrap Table. If you use custom date formats – the default sort will not always work. In my case – it was sorting the dates by month name alphabetically and not by date order. Here is how you can use both plugins to sort by date order:

Example date format: Jan 28-Jan 31 (date for this example was a span of dates – in which I wanted to sort by the starting date)

Custom date sort solution in two steps for jQuery Tablesorter and Bootstrap Table:

jQuery Tablesorter

  1. Add data to the table header:
    <th data-sorter="shortDate" data-date-format="yyyymmdd">Date</th>
  2. Add a hidden span before your actual date in the data that then matches the format specificed above:
    <span style="display:none"><?php echo date( "Ymd", strtotime($date) ));?></span> Jan 28-Jan 31

Very similar to the jQuery Tablesorter solution:

Bootstrap Table

  1. Add data to the table header:
    <th data-field="created" data-sortable="true">Created</th>
  2. Add a hidden span before your actual date in the data that then matches the format specificed above:
    <span style="display:none"><?php echo date( "Ymd", strtotime($date) ));?></span> Jan 28-Jan 31

Now you can easily sort any date format using these two plugins so you can format the date however you want and still be able to sort by date on that column.

#1 Rule for Being Productive

Focus on what is really important.

It is that simple. I was reminded this morning that a lot of people are not very productive and overwhelmed because they fail to focus on what is really important. Instead they waste a lot of time and effort on what is not important.

If you find yourself putting a lot of time and energy into something – ask yourself (sometimes multiple times) – “Is this what is really important?”

Example: people will get stuck in the “you said/I said” cycle and spend hours on that all while complaining that they have no time to do the actual task – they just get stuck talking about it. Know when to stop talking about something and actually do something about it.

The action is what is really important – not over talking about the action. Yes – this means you sometimes need to leave your ego at the door because at the end of the day your ego is never more important than what you actually do/accomplish.

How to Empty Trash with Google Drive

Over the last week – I have been trying to clean up my files and delete any non-essential email in order to tidy everything up. After deleting a number of files – I noticed my quota within Google Drive was still showing the same percent full before and after I deleted the files.

After waiting a few days and still not seeing any change in the size in the Google quota – I decided I needed to take some further action. I then realized – that when you delete files in your Google Drive – you then need to “empty the trash” before the files are actually gone.

How to empty the trash:

  1. Log into Google Drive
  2. Click on the trash icon in the left sidebar
  3. At the top of the page – you will now see a Trash menu. Click on that and then choose “Empty Trash”

After you are all done emptying the trash – check out your newly updated storage quota.

Fix for Bluetooth Mouse with Apple Mac OS X Yosemite

“Yesterday I thought I was going to throw my Apple magic mouse out of the window, today we are best friends.”

I wanted to follow up on my recent post: Mac OS X 10.10.x Issues with Bluetooth/WiFi. After a few days of almost acceptable behavior – yesterday my mouse was losing connection, acting very slow, and I could not drag anything across my screen without having to take deep breaths out of frustration.

I thought I had tried everything. I was desperate for a solution and I finally found it. I read the Apple support article: Bluetooth: Unreliable wireless performance may occur when USB 3.0 external devices are close and after moving my Mac Mini away from my external USB 3.0 hard drive (just 6-9 inches instead of being on top of it) – my mouse has worked flawless.

If you still are having a jittery mouse or any problems with Bluetooth devices and have an external USB 3.0 hard drive – try moving it away!

Disable iPhone Calls Ringing in Mac OS X Yosemite

After upgrading one of the three computers in my office from Mac OS X 10.9 to Mac OS 10.10 (Yosemite) I thought to myself – wow – I like the option to answer my phone using my MacBook Pro. A few days later – when I had the other computers upgraded as well – any time I got a phone call – my office sounded like a call center (2 bluetooth cordless phones, 3 computers, and the actual iPhone itself were all ringing at the same time.

facetime

Thankfully – you can easily turn off this feature in the FaceTime app by simply unchecking one thing in the FaceTime preferences (see screenshot). So if you are like me – and do not need this or prefer to not use it – the fix is easy!