Skip to content

Instantly share code, notes, and snippets.

View orioltf's full-sized avatar

Oriol Torrent Florensa orioltf

View GitHub Profile
@orioltf
orioltf / ES5 class.js
Created August 16, 2021 06:40 — forked from apal21/ES5 class.js
Example for blog to show the difference between ES5 and ES6 javascript classes using inheritance and prototypes use cases.
'use strict';
/**
* Person class.
*
* @constructor
* @param {String} name - name of a person.
* @param {Number} age - age of a person.
* @param {String} gender - gender of a person.
*/
@orioltf
orioltf / clone_objects.js
Last active August 29, 2015 14:21
#JS #UTIL Clone objects
/**
* 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++) {
@orioltf
orioltf / cookies.js
Created May 20, 2015 12:53
#JS #UTIL cookies.js
/*\
|*|
|*| :: cookies.js ::
|*|
|*| A complete cookies reader/writer framework with full unicode support.
|*|
|*| Revision #1 - September 4, 2014
|*|
|*| https://developer.mozilla.org/en-US/docs/Web/API/document.cookie
|*| https://developer.mozilla.org/User:fusionchess
@orioltf
orioltf / getHeightIn.js
Last active August 29, 2015 14:21
#JQUERY #UTIL getHeightIn
/**
* 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;
@orioltf
orioltf / equalizeHeights.js
Last active August 29, 2015 14:21
#JQUERY #UTIL equalizeHeights
/**
* 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);
# ---------------------------------------------------------------------------
#
# 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
<!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>
@orioltf
orioltf / introrx.md
Created July 1, 2014 10:26 — forked from staltz/introrx.md
introduction to Reactive Programming

The introduction to Reactive Programming you've been missing

(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.

@orioltf
orioltf / Rating-module.markdown
Last active August 29, 2015 14:01
#MODULE #CODEPEN Rating module. A Pen by orioltf.
@orioltf
orioltf / osx_automount_nfs.md
Created April 29, 2014 15:07 — forked from L422Y/osx_automount_nfs.md
#TERMINAL: OSX automount

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service