Random Primate

Web Design and Development

Lexical Frequency Distribution

Posted on April 26th, 2015

Grabbing Frequency distribution of a text.

from nltk import FreqDist
fdist = FreqDist(tok_text)

Adding a Custom Corpus

Posted on April 26th, 2015

For this article we’ll be adding a custom corpus for NLTK to recognise and process.


RSpec Introduction

Posted on September 21st, 2014


RSpec is a behaviour driven development (BDD) framework for Ruby, which means that with RSpec we can develop tests for our Ruby code and RoR applications. Wait but Rails comes with a testing framework why choose RSpec? Main difference is that Unit Testing is based on a Test Driven Development (TDD) principle while RSpec is BDD which makes for a sort of continued development of TDD. So lets take a look at it a bit more.


Random number within range

Posted on August 14th, 2014

Lets say you want to use the random method in javascript but the result has to be within a given range. If you’re not using a framework or library then you’ll have to create your own function or prototype, but if you can use one then I’d recommend taking a look at Underscore js. This is a lightweight library that’s really helpful and it also paves the way to Backbone js which is an awesome framework.


Accidentally Deleted Files?

Posted on July 8th, 2014

Holy crash, my files are missing!

Getting back the files:

First we will need Ubuntu, we can proceed by installing ubuntu or just trying it through the live image you download.


Can’t connect to local MySQL server through socket

Posted on March 29th, 2014

This error has many possibilities but most are very easy to solve. Let’s check out some of them and let me know if they didn’t solve your problem and we’ll look into it. We’ll make sure the mysql daemon is turned on, fix your path variable and look at the predefined socket directory.


CSS Centering

Posted on February 24th, 2014

This is a quick post to share some basic strategies for element centering with CSS. One of the first things I’m asked when teaching this stuff is how to center things in the document. So here are some quick methods for both inline and block elements.


this isn’t working?

Posted on January 31st, 2014

So you’ve got your code ready and you run it but lo and behold an infamous Undefined error of sorts. Ok, this might be your case. Lets say we’re adding an event listener and reference a property from a containing function or object like the following example:


SVG animated badge with JQuery.

Posted on September 22nd, 2013

This tutorial will focus on coding some animated behaviour for an SVG UI element. You can see the result in the following pen and the code will also be available from Codepen and Github. I have applied it on the Random Primate landing site where you can see it in action.

See the Pen SVG Animated Badge by Jose Torres (@Random-Primate) on CodePen.