09
Nov 11

jQuery .keyup() vs .change() vs .bind()

I’ve found that using .keyup() in jQuery doesn’t always work like I want. For example, if I want to ensure that a user can’t put a special character into an input field I want to check for that character every time the input changes. Only using .keyup() allows someone to right-click and paste a bad value in.

Instead I use .bind(“change keyup input”) to catch all changes on an input field, regardless of how they are done.

For example:

// detect the change
$('input#myId').bind("change keyup input",function() {
    // if there's a bad value
    if (this.value.match(/[^a-zA-Z0-9\-_\s]/g)) {
        // replace it with nothing
        this.value = this.value.replace(/[^a-zA-Z0-9\-_\s]/g, '');
    }
});

Pretty simple, eh?

If you liked this you should follow me on Twitter where I tweet about startups, code, and other useful things.


26
Oct 11

Google Apps for Startups

I’ve toyed with the idea of this post for a long time. Recent interactions and my time spent with Start-Up Chile have really shown me that it needs to be written. I get too many business cards with @gmail.com email addresses. Give me a break. It costs $10 to register a domain name and Google Apps is free.

If you own a small business, or a startup, then you absolutely need to use Google Apps. Hands down, Google Apps is the best tool to manage your business. There’s a reason over 4 million businesses have switched.

Your role as a startup owner is to run your damn business, not fiddle around with mail servers and worry about document backup. That’s where Google Apps comes in.

Continue reading →


24
Sep 11

Piwik and jqPlot

This took me waaaaaay longer than I wanted it to, so I’m making a point of posting it.

In order to take an API call to Piwik and use the returned JSON to generate a custom graph with jqPlot, do this:

    $.getJSON(url, function(data) {
        var i = 0;
        var line1 = new Array();
        $.each(dates, function(x, y) {
            line1[i] = [x,y];
            i++;
        });

        $.jqplot("chartdiv", [line1],
        {
        // the rest of your jqPlot options
        });
    });

The part that took me a while to wrap my head around was that jqPlot requires an array of arrays for the data points. Hopefully this is helpful to whomever finds it.


20
Aug 11

First Meetup in Viña del Mar

I spoke at a meetup last week. To clarify, a meetup in Chile is considered more of a presentation by one person or group on a specific topic. Back in Canada and the rest of North America I think we consider meetups more of a social gathering around a shared interest in anything from Twitter to Feminism.

Start-Up Chile asked me to speak about my project and entrepreneurship. I figured I could do this. Talk about my background, how I got to Chile, give some good no bullshit advice on being an entrepreneur. Heaven knows there’s enough patting on the back and good-for-you’s going around.

Several things went wrong. Continue reading →


05
Aug 11

Why I’m in Chile

A friend of mine, Sean Collins, as me this morning about why I chose to apply for Start-Up Chile. He asks

“I’m messaging because I’d love to pick your brain a bit about SUP as I’m smack dab in the middle of the fence on applying. I’ve got a few questions that I’d appreciate you taking the time to answer as there really is no other way to get clarity on the situation than to talk to someone on the inside, actually living it.

As with every time I ask for people’s opinions, the most blunt and honest you can be, the better. Continue reading →


Edmonton Computer Repair