Author Archives: Laura

CRUD with Active Record

Say you’re creating a blog. A blog has many posts, and a post belongs to a blog. I’ll use the “Post” class for these examples, however these can be substituted with any class name (capital and singular!). Create There’s essentially a couple of ways to create a new record. One way of doing it: p...
Read More

Classes in Javascript

For all of those who usually code in OO languages, there’s actually a pretty similar approach in JS. A “class” in JS will have the properties / attributes of the object, along with any methods that might relate to that object. It’s like a template that can be used to create many objects with similar...
Read More

Objects in Javascript

Declaring an object in Javascript can be done in various ways. Object Literal Notation This creates a single object. Initiating an object with literal notation goes like this: var anne = { name: "Anne", age: 32 // adding functions speak: function () { // code; }; }; where the properties are given as a hash...
Read More

Inheritance with Ruby

Inheritance, in a nutshell, is exactly what it sounds like. There’s a “superclass”, which has all the basic functionality and attributes that everyone inheriting from it will have. There’s the inheritors, which will be able to obtain all the methods of their superclass simply by calling “super”. So basically when creating a superclass, you must always think that it has to be generic enough that many other classes can use it, and try to limit the things you put in it (attributes and methods) to things that will be shared by every other class.

Read More

Starting a RoR app – in 15 minutes

Creating a Rails app from scratch is pretty easy thanks to its awesome generators. This is assuming that all the installation is done.  This is all done through the handy ol’ command line. 1. Create a new app. rails new RailsAppName # This goes in CamelCase! This will create a bare app in the RailsAppName...
Read More

Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.

Martin Golding