Skip to content

Instantly share code, notes, and snippets.

View jrosadocruz's full-sized avatar

Jose jrosadocruz

View GitHub Profile

Hash

A Hash is like a cabinet full of tagged folders. When you open the cabinet, you can choose the folder at a glance. A Hash stores data in key/value pairs. The new hash is the cabinet (just think about it as the name of the hash), the keys are the tagged folders, and the values are the sheets of paper inside the folder (think of the papers as Strings, Numbers, Arrays, etc).

Key

Hash keys, unlike like Arrays, can be: (1) strings, (2) numbers, (3) symbols and (4) arrays (though i don't see any use for this).

Unlike arrays, theres no need to know the order of the item. Therefore, a Hash is very useful for storing data (models) without any particular order.

Value

Hash values can be any ruby object. E.g: objects, methods, strings, numbers, floats, etc.

@jrosadocruz
jrosadocruz / SassMeister-input-HTML.html
Created February 26, 2015 20:03
Generated by SassMeister.com.
<a class="btn" href="#">Button</a>
<a class="btn btn-primary" href="#">Button</a>
<a class="btn btn-secondary" href="#">Button</a>
<a class="btn btn-success" href="#">Button</a>
<a class="btn btn-info" href="#">Button</a>
<a class="btn btn-alert" href="#">Button</a>
@jrosadocruz
jrosadocruz / SassMeister-input-HTML.html
Last active August 29, 2015 14:16
Generated by SassMeister.com.
<a class="btn" href="#">Button</a>
<a class="btn btn-primary" href="#">Button</a>
<a class="btn btn-secondary" href="#">Button</a>
<a class="btn btn-success" href="#">Button</a>
<a class="btn btn-info" href="#">Button</a>
<a class="btn btn-alert" href="#">Button</a>
@jrosadocruz
jrosadocruz / SassMeister-input.scss
Created February 26, 2015 19:38
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
$px-only : true;
$base-font-size : 16;
$base-spacing-unit: 20px;
$paddings-enable: true;
$margins-enable: true;
@jrosadocruz
jrosadocruz / gist:c1e982eaf8d8b565d896
Last active August 29, 2015 14:10
Jade Snippet: Table iterator
//- table data
- var tableData = [['R1 Col1', 'R1 Col2', 'R1 Col3'], ['R2 Col1', 'R2 Col2', 'R2 Col3'], ['R3 Col1', 'R3 Col2', 'R3 Col3'], ['R4 Col1', 'R4 Col2', 'R4 Col3'], ['R5 Col1', 'R5 Col2', 'R5 Col3']]
//- table markup
table.table
//- table head
tr.t-head
th Name
th Phone
th Status
//- compile and see the output online at below URL
http://jade-lang.com/
//- navigation data
-var navLinks = { 'Home': 'home.html', 'About': 'about.html', 'Services': 'services.html', 'Contact': 'contact.html'};
//- set default selected item (useful for adding active state for current page navigation link in each page)
- var activeLink = 'Home';
nav(role="navigation" aria-label="Primary")