Posts

Checking Attribute Status with JQuery

Get Element's Attribute Value or Status

With JQuery, you can do this $('#your-element').hasClass('a-class') to check if the element has a certain class. The problem is that you have to know the class name ahead of time when you use .hasClass. I wanted a general way to know if the class attribute actually exists on the element, so I created the getAttrStat function for JQuery to see if the attribute in question on the element is undefined, empty, or has a value without knowing the attribute value ahead of time.

Categories: #JavaScript
Tags: #jQuery
Nested Divs Spaced Evenly

Get Child Divs to Align Vertically with Spacing

You may find yourself having to align fixed-height divs that are nested within a parent div. For example, you might have images that need equal spacing at the top and the bottom. In order to do this, set a margin-bottom on all the child divs (B, C, D) within the parent div (A).

Categories: #CSS
Ember Routes Redirect

From Index to Another Route

You want your root index route to redirect to another route such as when you are on the index URL (root_url) and you need to get to root_url/#/another_route. This may be useful because you wish to use the model information from another_route on initial page load. A downloadable demo is located below.

Categories: #JavaScript
Tags: #Emberjs
Basic Gemset Management

CRUD for your rvm gemset

Rvm stands for ruby version manager. It is used to manage ruby environments with something called gemsets. More info can be found here. Rvm comes in handy when you're working with Rails because you can isolate ruby environments. Here are some snippets for common tasks when dealing with gemsets.

Categories: #Shell #Ruby
Whole Header Region Clickable

Header Text and Image are Clickable

On the majority the sites out there, the click of the upper-left hand side where logo and text is situated, will take you to the home page. Take for example Trello or PcWorld. However, I do not have a small logo on the upper-left of the site because I want my whole header region to lead to the home page.

Categories: #HTML #CSS
First Official Post

Customizing Octopress Default Theme

Change Default Theme CSS

In your sass/custom/_colors.scss file, define the values for the items below. I'm using the following colors for my theme, but feel free to change them to whatever you want them to be.

Categories: #Ruby
Tags: #octopress