This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to Oh-My-Zsh installation | |
export ZSH="/Users/carlosvega/.oh-my-zsh" | |
# Plugins | |
plugins=(git) | |
source $ZSH/oh-my-zsh.sh | |
PROMPT='$fg[yellow]$(echo "${PWD/$HOME/~}") $fg[cyan]$(git_prompt_info) $fg[magenta]$(node_version) | |
$reset_color$ ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<input/> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>RXJS test</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.5.6/Rx.min.js"></script> | |
</head> | |
<body> | |
<input/> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
const counter = (state = { value: 0 }, action) => { | |
switch (action.type) { | |
case 'INCREMENT': | |
return { value: state.value + 1 }; | |
case 'DECREMENT': | |
return { value: state.value - 1 }; | |
default: | |
return state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//based on https://github.com/krasimir/absurd/blob/master/lib/processors/html/helpers/TemplateEngine.js | |
//Basic | |
var TemplateEngine = function(tpl, data) { | |
var re = /<%(.+?)%>/g, match; | |
while(match = re.exec(tpl)) { | |
tpl = tpl.replace(match[0], data[match[1]]) | |
} | |
return tpl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const add = (list, item) => { | |
return […list, item] | |
} | |
const remove = (list, index) => { | |
return [ | |
…list.slice(0,index), | |
…list.slice(index+1) | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hablar sobre variables(fuerte tipado), | |
luego funciones (como se crean function, var function, arrow function), | |
luego scopes (var, const, let) | |
luego variables como templates | |
Classes, interfaces, herencia (polimorfismo, encapsulamient) | |
luego hablar sobre OOP con classes y extend | |
vs functional programing( fp are verbs, oop is nouns) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Inheritance | |
var Mass = function () {this.material = "rock"; console.log("init Mass")}; | |
var Planet = function (name) {Mass.call(this); this.name = name || "Planet"; console.log("init "+this.name)}; | |
Planet.prototype = Object.create(Mass.prototype); | |
Planet.prototype.constructor = Planet; | |
var earth = new Planet("earth"); | |
// Second Way |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//StackOverflow: | |
//http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb | |
//Solution 1. | |
////////////////////////////////////////////// | |
function rgbToHex(r, g, b) { | |
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); | |
} | |
////////////////////////////////////////////// |