Unzip via SSH

I had to unzip a file on a clients server today. Unzipping it locally and then re-uploading it would have been a pain; the unzipped folder was about double the bits of the original ZIP file. Anyways, once terminal’d in, this is how it works on the Media Temple GRID server.

unzip /path/to/file.zip

Pretty simple. Thanks to this resource for the know-how.

Now I’m off to go play in the ocean.

Bookmark and Share
Posted in Hosting | Tagged , , , | Leave a comment

Troubleshooting: Media Temple GRID SFTP Connection Issues

Sometimes I need to change a GRID Server Administrator password over at Media Temple. Once changed, I continually run into SFTP connection issues. It’s goddamn frustrating. And it was just working! I just want to code, not putts around with this crap. Even more annoying is I can connect just fine via FTP on port 21.

So in an attempted to save my sanity (and maybe yours), I’m going to list all the troubleshooting steps I’ve had to deal with every time this happens. Ug… so annoyed.

  • Is your IP address blocked from too many failed login attempts? That’ll do it and drive you crazy. Here’s how to remove an IP ban.
  • Are you connecting with the Server Administrator account or a secondary FTP account that you’ve created? Secondary FTP accounts aren’t allowed to connect via SFTP. So don’t bother. You’ll go mental until you figure this one out. Here’s more info on using FTP and SFTP.
  • Have you tried a different FTP client? I use Coda for FTP (and development) and once I was able to connect via SFTP using FireFTP I narrowed the issue down to Coda. Which leads me to troubleshooting option 4.
  • Have you restarted your FTP client? This is what burned me today. Once I restarted Coda I was able to connect via SFTP. Something was cached or confused. Honestly. You’re killing me Smalls.

Well that was 2 hours well spent wasted.

Bookmark and Share
Posted in Hosting | Tagged , , , | Leave a comment

Launched: Trivial Beersuit (for all your trivia night needs)

Trivial Beersuit Screen GrabFor the past few months I have been working on a subscription-based site that provides monthly custom curated trivia questions to bars and other establishments.

It all began last summer at a friend’s wedding where I met the woman behind the trivia, the trivia girl herself, Katie Christofferson. Since 2010, Katie has been writing trivia questions for a number of bars across Montana, Idaho and Oregon. Initially, her whole business was run by snail mail. Once the trivia questions were written she would mail them on CDs to her clients. As you can imagine, this was a cumbersome process to say the least. If there were any issues or updates, she would have to do the entire snail mail process over again.

Katie’s vision was to develop a user-friendly system where her clients would log in and download a new trivia package each month. Once signed up they would get the first month free, then to maintain monthly access they would need to subscribe to the service.

And that is exactly what we built.

With this system, making updates is a breeze and as easy as uploading a file. If any bar has a problem, Katie can update the affected accounts with new trivia.

So without further adieu Katie and I are pleased to announced we’ve launched her new custom curated trivia service: Trivial Beersuit.

So go forth, click around, check it out. If you’re a bar looking for this service I highly recommend giving Katie a what up!

Bookmark and Share
Posted in Uncategorized | Leave a comment

Solution: Boilerplate Theme for WordPress + Dig Labs Stripe Plugin jQuery Issues

I am currently working on a subscription-based WordPress installation. For this project I am using a theme called Boilerplate. Users signup, pay their monthly fee (recurring or single payment) and get access to a set of restricted documents. After much research I settled on the follow plugins to handle payments and subscriptions.

The Problem
After installing both of them I ran into a problem where both the theme and the plugins were including jQuery at different times and different places and sometimes not at all. This broke jQuery for the entire site. The Stripe plugin payment form didn’t display correctly and you couldn’t submit it to run a payment. Also, some custom jQuery I had written stopped working too.

The Solution
After some back and forth with the Boilerplate theme developer (Thanks Aaron!) he came up with the following solution.

  • In Boilerplate Admin, enable and keep your custom JS (script.js) in the footer. Do this even if you don’t have any custom jQuery.
    Script.js settings for Boilerplate Admin
  • Do not use the Boilerplate jQuery (leave those checkboxes unchecked in the Boilerplate Admin).
    jQuery settings for Boilerplate Admin
  • And instead put the following at the very top of your custom JS file:
    if (!jQuery) {
    	document.write(unescape('%3Cscript src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"%3E%3C/script%3E'));
    }
    if (!jQuery) {
    	document.write(unescape('%3Cscript src="http://your.domain.com/wp-content/themes/boilerplate/js/jquery.js"%3E%3C/script%3E'));
    }
    
    window.$ = $ || jQuery;
    

Explanation
So, by default no jQuery is loaded by the Boilerplate theme. Once the custom JS file is included, it checks to see if jQuery has been defined. If not it loads it from the Google CDN. If that fails then it loads in your local copy. If you are on a page that uses either plugin listed above, then jQuery will have already been included. In this case when your custom JS file loads it checks and will see that jQuery is already loaded and will not include it again.

So that’s about it. I do believe this solution would work for any plugin in general that conflicts with the Boilerplate theme. If you’ve run into similar issues with any plugin please do share your experience in the comments. Happy WordPressing!

Bookmark and Share
Posted in Code | Tagged , , | 3 Comments

Launched: Christine Chaney Creative

Christine Chaney Creative

I was in Ballard. At the Ballard Market, to be exact, food shopping for a summer camping trip. I was in the grocery section—because it’s more than just an isle—and I ran into a friend. We chatted for a few minutes, about, you know, the usual banter: I’m going camping—and I do love your new shoes!

I digress.

During our banter session my friend mentioned that her friend’s friend’s cousin’s (don’t lose me here) former college roommate, a talented artist, needed some web work. Well, ok, it’s actually just my friend’s friend and I like Spaceballs, but not all of this is necessary factual. How about it’s based on a true story? Yeah, we’ll leave it at that.

I saved my friend’s friend’s information and we went our separate ways. The friend’s friend’s name was Christine Chaney. We met and instantly hit it off. We worked together for the last few months building an online presence that fit her style of artistry: bold and mathematical, sparse yet emotional. Her style is only enhanced by the shear number of mediums in which she creates. From architecture to fashion, from wall art to photography. She’ll sew you a dress and design you a building and artwork to match. And then she’ll compile all these connective art pieces into a book, which is yet another art form in itself. Yup. These are the people I love to work with. Anything goes. The sky’s the limit. And inevitably these creative creatures become my friends.

So after many meetings from a chance encounter at my neighborhood market, I am pleased to announced that not 24 hours ago we launched Christine’s new website. It is a sparse, clean and fully responsive experience, so try it out on all your devices. Leave us a comment and let us know what you think. Good day.

Bookmark and Share
Posted in Work | Tagged | Leave a comment

How to Change WordPress JetPack Contact Form Success Messaging

Today I ran into some ugly styling using the Contact Form that comes with the WordPress JetPack plugin. After a quick search on the world wide web I came across this post on the WordPress support forum.

It’s pretty simple to update. Click on the link for more info.

Bookmark and Share
Posted in Uncategorized | Leave a comment

Targeting IE10

Today I was browser testing one of my clients new sites. When I got to IE10 the normal conditional comments didn’t have any effect on it. Strange, I thought. After a quick search I found this StackOverflow question that provides many solutions. Of all the solutions this is the one I chose.

/* ie10 styles */
@media all and (-ms-high-contrast: none) {
...
}

It doesn’t require any jQuery, JavaScript or browser detection. It still is, however, a hack, but whatever.

Bookmark and Share
Posted in Development | Tagged , | Leave a comment

Those Damn Pesky Mac OS X .DS_Store Files on Network Resources

I’m currently working on a project where we’re developing directly on the development server. It’s not my preference to develop this way, but alas it’s necessary for reasons I won’t go into.

I work on a MacBook Pro running OS X 10.8 (Mountain Lion). One problem we’re running into is OS X loves to continually write the .DS_Store files to each folder I view. And I view most every folder on a daily basis. Needless to say it writes a lot of them.

I searched around and found that you can disable this for network resources. Simply open terminal and execute the following command. Make sure to log out or restart your machine for the change to take effect.

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Check out this Apple support article for more info.

Bookmark and Share
Posted in Code, Development | Tagged , , | Leave a comment

C#: Simple .NET Console App To Loop Through CSV, Download Images

I recently had the need to write a .NET console app which opens up a CSV file and does some stuff. This app loops through each row, downloads an image from the URL in column two and saves it with a unique file name provided in column one.

I want to remember this. So here it is.

using System;
using System.IO;
using System.Net;

namespace Download_Images
{
	class Program
	{
		static void Main(string[] args)
		{
			try
			{
				string root = @"C:";
					
				Console.WriteLine("Press any key to start.");
				Console.ReadLine();

				string[] records = File.ReadAllLines(root + "urls.csv");

				string destination = root + @"images";

				foreach (string record in records)
				{
					string[] fields = record.Split(',');
					string guid = fields[0];
					string imageUrl = fields[1];
					WebClient fileReader = new WebClient();
					string newFile = destination + guid + ".jpg";

					Console.WriteLine("Starting download: " + imageUrl);

					try
					{
						if (!File.Exists(newFile))
						{
							fileReader.DownloadFile(imageUrl.Trim(), newFile);
							Console.WriteLine("File saved: " + newFile);
						}
						else
						{
							Console.WriteLine("File exists. Skipping. " + guid + ".jpg");
						}

					}
					catch (Exception ex) {
						Console.WriteLine("Failed: " + ex.Message);
						if (ex.InnerException != null)
						{
							Console.WriteLine("Inner Exception: " + ex.InnerException.Message);
						}
					}

					Console.WriteLine();
				}

				Console.WriteLine("All done. Press any key to exit.");
				Console.ReadLine();
			}
			catch (Exception ex) {
				Console.WriteLine("There was an exception:");
				Console.WriteLine(ex.Message);

			}
		}
	}
}

Bookmark and Share
Posted in Code, Development | Tagged , , | Leave a comment

jQuery: Custom Recursive Blink Function

I recently wrote a recursive function to create a blinking effect on a given div. I’m totally geeking out on it right now. I know this can be done via jQuery UI, but I didn’t want the overhead on my clients site of pulling it in just for this.

So here’s the code. You can customize the delays and colors as you need.

function doBlink(id, count) {
    $(id).animate({ backgroundColor: "#fee3ea" }, {
        duration: 100, 
        complete: function() {

            // reset
            $(id).delay(100).animate({ backgroundColor: "#ffffff" }, {
                duration: 100,
                complete: function() {

                    // maybe call next round
                    if(count > 1) {
                        doBlink(id, --count);
                    }
                }
            });

        }
    });
}

Of course you’ll need the color plugin to get backgroundColor to work with .animate().
https://github.com/jquery/jquery-color

And to provide a bit of context this is how I called it. I needed to scroll the page to my target div and then blink it.

$(window).load(function(){
    $('html,body').animate({
        scrollTop: $(scrollToId).offset().top - 50
    }, {
        duration: 400,
        complete: function() { doBlink(scrollToId, 5); }
    });
});

The site is not live yet or I’d post it. Stay tuned.

Bookmark and Share
Posted in Development | Tagged , , , , | Leave a comment