Tips

Getting Started with the Instagram API

Just started to play around with with jQuery and the Instagram API. Basically I wanted to search for the a user using their username, get their ID and search for their photos using that ID. The following code seemed to do the trick:

var accessToken = '[your-access-token-here]';
var username;
var getUserID;
var limit = 6;
var setSize = "small";
var size;

var instagram = function() {
     return {
          initiate: function() {
                instagram.getUser();
          },
          getUser: function() {
                username = "[your-username-here]"
                 var getUserURL = 'https://api.instagram.com/v1/users/search?q='+ username +'&access_token='+ accessToken + ''
                //console.log(searchURL);
                $.ajax({
                        type: "GET",
                        dataType: "jsonp",
                        cache: false,
                        url: getUserURL,
                        success: function(data) {
                                         //console.log(data.data[0].id);
                                         getUserID = data.data[0].id;
                                         instagram.loadImages(getUserID);
                        }
                    });
          },
          loadImages: function(userID) {
            var getImagesURL = 'https://api.instagram.com/v1/users/' + userID + '/media/recent/?access_token='+ accessToken +''
                $.ajax({
                        type: "GET",
                        dataType: "jsonp",
                        cache: false,
                        url: getImagesURL,
                        success: function(data) {
                                for (var i = 0; i < limit; i++) {
                                        if (setSize == "small"){
                                                size = data.data[i].images.thumbnail.url;
                                        } else if (setSize == "medium"){
                                                size = data.data[i].images.low_resolution.url ;
                                        } else {
                                                size = data.data[i].images.standard_resolution.url;
                                        }

                                                $(".pics").append("<a target='_blank' href='" + data.data[i].link +"'><img src='" + size +"'></img></a>");
                                        }
                        }
                    });
          }
     }
} ();

$(document).ready(function() {
    instagram.initiate();
});

Ruby On Rails – rake db:schema:load

I recently started learning Ruby on Rails via great sites such as railscasts.com. So I started hacking around at some code, learning GIT and before I knew it I had an app running at heroku.com , backed up by beanstalkapp.com. The only thing was my migrations folder was a bit of a mess and rake db:migrate didn’t quite do the trick. I found this post which helped me out, http://stackoverflow.com/questions/1780789/heroku-problem-question. Skipped over the migrations and just pushed the schema I needed to get me on the way.

Creating a custom theme options panel in WordPress

Creating a custom theme options panel in WordPress

Having worked with WordPress for a while, I wanted to have a crack at creating my own theme options panel. These 3 articles combined together helped me to do so:

Alternatively there is Thematic Options Panel if you don’t want to build from scratch.