Ruby – Arrays & Hashes

Ruby has a built-in class of Arrays and Hashes. These two classes have large interfaces and will take time to master. Ruby has also a block syntax that lets you encapsulate chunks of code. These blocks can become powerful iterator constructs. Arrays The class Arrays holds a collection of object references. Each object reference occupies


Ruby – Access Control

It is important to consider how much of your class you’ll be exposing to the outside world. Ruby give you three levels of protection. Public methods – can be called by anyone. Methods are public by default. Initialize method is always private. Protected methods – can be invoked by objects of the defining class and


Rails – Quick Setup

Step 1 rails new <appname> This rails command takes as an argument the name of the project. It will create a subdirectory called app in the current working directory. The standard database preconfigured is SQLite. If you wish to configure other databases such as mysql, oracle, postgresql, sqlite2, sqlite3, pass the -d or –database=option to


Ruby – Virtual Attributes

Virtual attributes can be confusing but they help a lot in making things flexible especially when you trying to simplify things while working with Rails. Essentially, we create an attribute that is based on existing attributes. We can also define setter methods for these virtual attributes so that anyone can assign to them, mapping the


Ruby – Variables

Variables are used to keep track of objects. Each variable holds a reference to an object. In Ruby, strings are mutable, unlike Java. Assigning person1 to person2 doesn’t create any new objects. It simply copies person1’s object reference to person2, so that both variables refer to the same object. Duplicating String Objects You can use


Ruby – Accessor Methods

Objects and Attributes We introduce states into an object through the initialize method. Other than creating an object, it is important to also be able to access and manipulate the state of an object. One way to do that is to write accessor methods Getter Function By defining the isbn and price (accessor) method, it



Doctype Meta Character Encoding Syntax and Validation – W3C Validator No need for type= “text/javascript” and type = “text/css” for <script> and <css> tags respectively HTML tags may be written in any letter case <html>, <body> and <head> tags not necessary for validation <br />, <img /> no longer need self-closing slash Most tags so not need closing


Workspaces Design

Follow the Lean Way. Start small & iterate. Make small changes quickly and often. Establish a continuous improvement loop. Make decisions purposefully based on experiments. Design to data, observations, surveys, piloting, focus groups, interviews are the ways to validate any hypothesis. Note that each method has its strengths and pitfalls. Whatever the changes are, they

Best Practices

HTML5 – Backward Compatibility Issues

(1) HTML5 Shim – a modular capability-based polyfill-loading library. It was built on top of jQuery and Modernizer. Loading the Webshims library is just a few lines of code. For more details, refer to HTML Javascript (2) HTML5 Boilerplate templates – These doesn’t use Javascript shimming library. It takes advantage of IE-specific CSS rules to


Ruby – Initialize Method

How do we create a class? Note: Class will start with an uppercase letter and method will start with a lowercase letter To instantiate an object from a class (i.e. create new instance of a class), we use the new method. The problem with the above code is that both instances are identical. There is


Heroku vs AWS

Overview AWS is an IaaS and Heroku is a PaaS. IaaS provides components to build things on top of it. It gives you more flexibility and more power but it also means you must know how to play around with its versatility. PaaS gives your an environment with standard config settings to get your application to run