Mocha Steps fails to work.


mocha-steps, mocha
if mocha-steps fail to work in unit/integration tests, make sure `--require mocha-steps` is the value in "Extra Mocha options:" section.

Fix MySQL Error: 1346

If you’re looking to fix MySQL Error: 1346, try these steps.

1) Locate and open my.ini file, if you’re on Windows use Notepadd++, or if you’re on Mac try TextWrangler.

2) search for “sql-mode”

3) make sure its not set to strict*

Create and delete windows service

Below is how you would create and delete windows service thru the terminal, hope this helps.

Open up terminal and type the following to remove a service.

sc delete "Service Name"

And to create a service, just have your exe located somewhere easy to remember (like in a folder on your desktop), and input into terminal:

sc create "Service Name" binPath= "C:\Users\[computer's user]\desktop\some folder\executable.exe

WordPress woocommerce fix for billing and shipping blank page issue

If you’ve ever ran across the white screen of death using the woocommerce front end billing and shipping editing pages, well i hope this article will come in handy.

Below are a few steps that should help you fix the woocommerce billing and shipping blank page after saving.

1) Copy the “form-edit-address.php” file over to your themes /woocommerce/myaccount directory within your theme.
2) Once you’ve done this add an id to the form, this really can be any naming convention you want. So for this tutorial we’ll call it “edit-address”.
3) After this we’re going to add some jquery to your footer.php page.

    (function($){
        $("#edit-address").submit(function() {
            event.preventDefault();
            return validateForm($(this));
        });

        function validateForm(form){
            var retVal = true,
                re,
                fields = {};

            $.each(form.serializeArray(), function(i, field) {
                var fieldName = field.name;
                var fieldVal = field.value;
                fields[field.name] = field.value;
            });
            var obj = fields;

            var url = window.location.href;
            var postUrl = function(url){
                var someUrl = "";
                if(url.indexOf("billing") > -1) {
                    someUrl = "/my-account/edit-address/billing/";
                } else if (url.indexOf("shipping") > -1) {
                    someUrl = "/my-account/edit-address/shipping/";
                }

                return someUrl;
            };

            $.ajax({
                type: "POST",
                url: postUrl(url),
                data: obj,
                success: function(data) {
                    location.reload();
                },
                error: function() {
                    location.reload();
                },
                dataType: "text/html"
            });
        }
    })(jQuery);

What the above code is doing. The form is being stopped from submitting from the “event.preventDefault();” so we can do what we want with the form. Next the inputs in the form are being created into an object thats going to be sent off to the post later. After we build up the object we then check for wether the page we want to post to is the “billing” or the “shipping” page. Once we get that, we’ll use the new url as the url to post to, and of course the object we built up earlier sends the data to the page. After we’ve sent the data we want to reload the page so we don’t see the blank page.

Thats it, this should fix any problems being had. There is a weird issue with the error property that gets fired off, but it will still save and send the data.

WordPress localhost and server config settings

Here’s a quick way to work with your specified config file locally and on your server. In┬áthe case of working locally, you might have some different creds than your server settings.

1) Make a copy of your config file and call “wp-config-loacl.php” or something.
2) Add this code to the top of your “wp-config.php” file.

if ( file_exists( dirname( __FILE__ ) . '/wp-config-local.php' ) ) {
        include( dirname( __FILE__ ) . '/wp-config-local.php' );
} else {
        define('DB_NAME', 'db_name');
	define('DB_USER', 'db_user');
	define('DB_PASSWORD', 'db_pword');
	define('DB_HOST', 'db_host');
	define('DB_CHARSET', 'utf8');
	define('DB_COLLATE', '');
}

3) Next in your “wp-config-local.php” file you’ll just add the same as your original config file save for the db connections.

And thats how you set up wp config for localhost and server side.

Yelp API Call

This, like the Instagram API calls, it was a bit tricky to figure out at first, but again, with some digging figured out how to use the Yelp API. Here I will show you how to make a simple call to get data through a company. For this example I will be showing the restaurant “Notorious Burgers” who was a recent client of mine. Continue reading “Yelp API Call”