Refresh Typeahead Suggestions

var $name = $('#name');
var nameEntered = $name.typeahead('val');
$name.typeahead('val', '').typeahead('val', nameEntered);

This is great if you add an entry behind the scenes and then want it to show up in the list of suggestions without having to re-trigger the suggestion refresh manually.


Override X-editable Value After Save

I wasn’t able to find a way to set an X-editable field to a specific value after a submit. After poking around in the source for X-editable I noticed the following:

//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is useful if you want to change value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
  newValue = res.newValue;

Once I found this, setting the field to the proper value was very straightforward:

  success: function editable_success(response){
    var json_response = JSON.parse(response);
    if(json_response.success) {
      if(json_response.new_value) {
        return {newValue: json_response.new_value};

Git Cherry Pick With X Option In Sourcetree

There were a series of changes to the staging branch that I needed to bring over to the development branch today. After a bit of research online, I wanted to use the -x option of the cherry-pick command. This would put a reference to the original commit-ish in the new commit message for me which can be very helpful for keeping track of where everything comes from.

Since Sourcetree only does a basic git cherry-pick <commit> when you use the “Cherry Pick” command, I decided to create a custom action.

Cherry Pick W X Option Custom Action

Custom Action for “git cherry-pick -x “

Now all I need to do is right click the commit I want to cherry pick and choose Custom Actions > Cherry Pick w/ -x and the original commit-ish is referenced automatically in the commit message.


Reference to the original commit automatically included in the commit message

OS X Mavericks Breaks Apache/PHP

I had some issues with my local Apache/PHP dev sites after installing OS X Mavericks. To get back up and running again I had to do the following.

Re-enable PHP5
Uncomment the PHP5 module in the Apache configuration file httpd.conf. The following line should be uncommented:

LoadModule php5_module libexec/apache2/

Include the Virtual Hosts File
I have my virtual hosts configured using the httpd-vhosts.conf file so I had to uncomment the following line in httpd.conf:

Include /private/etc/apache2/extra/httpd-vhosts.conf

Setup the Directory Restrictions
Instead of tweaking the general settings in httd.conf, I specified what to open up right on my site’s virtual host settings in httpd-vhost.conf:

<VirtualHost *:80>
    DocumentRoot "PATH_TO_SITE
    ServerName site.local
    <Directory "PATH_TO_SITE">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order deny,allow
        Allow from all

Restart Apache

sudo apachectl restart

Shopify Test Transactions

To be able to select the ‘bogus gateway’ in the Classic version of Shopify, you first have to deactivate the Stripe option.

Then you can proceed to select the ‘(for testing) Bogus Gateway’ option under the ‘Accepted Credit Cards’ section as outlined in option 2 of Shopify’s documentation.

Error: ‘weblogic…$EventsRequestWrapper’ does not have the property

Error: The class weblogic.servlet.internal.RequestEventsFilter$EventsRequestWrapper does not have the property ‘requesterName’

Issue: Inadvertantly used the ‘request’ keyword as a datatable var name.


<p:dataTable id="dtNewRequests" var="request" value="#{newRequests.requests}">


<p:dataTable id="dtNewRequests" var="item" value="#{newRequests.requests}">

Summing Union’d Counts

I ran across this funkiness in a MySQL query the other day. If anyone knows why the following is, please comment.

This query doesn’t work:

SELECT SUM(v.vehicle_count) AS total_vehicles FROM (
    SELECT COUNT( AS vehicle_count FROM cars AS c
    SELECT COUNT( AS vehicle_count FROM trucks AS t
) AS v

But including another field in the subqueries, like ‘model’ below, does:

SELECT SUM(v.vehicle_count) AS total_vehicles FROM (
    SELECT COUNT( AS vehicle_count, c.model FROM cars AS c
    SELECT COUNT( AS vehicle_count, t.model FROM trucks AS t
) AS v