Rating module, javascript-free for layout.
(by @andrestaltz)
So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).
Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:
Rx.Observable.prototype.flatMapLatest(selector, [thisArg])
Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style> | |
body { font-family: Helvetica; line-height: 1.3em; padding: 1em 10%; } | |
</style> | |
</head> | |
<body> |
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management |
/** | |
* Set the height from every jQuery element to the highest of the elements. | |
* @returns {object} the jquery objects passed in with the new height. | |
*/ | |
$.fn.equalizeHeights = function() { | |
var maxHeight = 0, | |
itemHeight = 0; | |
this.each(function(index, element) { | |
var $element = $(element); |
/** | |
* Gets the height from the provided elements, even if they are hidden | |
* @param {Object} $context - the jQuery DOM element where to append the object so that it gets proper styling | |
* @returns {Number} - the outerHeight value from the passed $element | |
*/ | |
$.fn.getHeightIn = function($context) { | |
var $element = this, | |
$wrap = $('<div />'), | |
$clone, height; |
/** | |
* In JavaScript assigning an Object to a new variable creates a reference to the original object. This means that changes to an element from the original object will be reflected on the new variable too. This util effectively duplicates a given Object/Array. Drawback: this action will increase the memory usage from your application. | |
* @param {Object|Array} source - the source object or Array to be duplicated. | |
* @returns {Object|Array} either the duplicated Object/Array or the original source element if it is neither an Object nor an Array. | |
*/ | |
var clone = function(source) { | |
var copy, i; | |
if (Object.prototype.toString.call(source) === '[object Array]') { | |
copy = []; | |
for (i=0; i<source.length; i++) { |
/** | |
* CSS only visual rich section division | |
*/ | |
body { | |
background-color: #264e86; | |
color: #fff; | |
font-size: 2em; | |
} | |
#main { | |
width: 90%; |
/** | |
* Styling Button Links With CSS3 | |
* Credit: http://www.usabilitypost.com/2012/01/10/pressed-button-state-with-css3/ | |
*/ | |
/* Step 1: the button */ | |
.button-link { | |
padding: 10px 15px; | |
background: #4479BA; | |
color: #FFF; | |
text-decoration: none; |