Skip to content

Instantly share code, notes, and snippets.

@urielhdz
urielhdz / pares_con_filter.js
Created June 28, 2017 22:06
Pares con filter
let arreglo = [1,2,3,4,5];
let newArreglo = arreglo.filter((numero) => numero % 2 == 0 );
let firstObject = {};
let secondObject = Object.create(firstObject);
function modifcadorDeObjetos(objeto){
let copiaDeObjeto = Object.assign({},objeto);
// Modificamos la copia para respetar el estado del objeto que recibimos
}
let original = {
name: "Uriel",
type: "human"
};
// Esta es una copia, con el atributo name modificado
let anotherHuman = Object.assign({},original,{ name: "Coco" });
class Human{
constructor(name,lastName){
this.name = name;
this.lastName = lastName;
//Asignamos el objeto actual como valor del contexto, y no cambiará
this.fullName = this.fullName.bind(this);
}
fullName(){
let object = {name: "Uriel" };
Object.prototype.hasOwnProperty.call(object, "name"); // Retorna verdadero
Object.prototype.hasOwnProperty.call(object, "lastName"); // Retorna falso porque lastName no es una propiedad de object
let human = {
name: 'Uriel',
lastName: 'Hernandez',
age: 24
}
const {name,age} = human;
// La constante name es igual a 'Uriel'
// La constante age es igual a 24
@urielhdz
urielhdz / ace_builder.go
Created October 24, 2017 15:27
Watches the files from a specified directory to automatically transform .ace files into html files, using a layout.ace file as base
package ace_builder
import(
"log"
"github.com/fsnotify/fsnotify"
"github.com/yosssi/ace"
"strings"
"bufio"
"os"
)
@urielhdz
urielhdz / styles.js
Created February 13, 2018 15:38
Estilos del mapa Proyecto final Desarrollo Web
const blue = "#f5f5f5";
const label = "#2C3E50";
const accentRed = "#ff5972";
const green = "#468c56";
const black = "#1f1f21";
const lightBlue = "#6DBCDB";
const roads = "#eadf8f";
const transit = "#d3ba74";
const styles = [
function debounce(func, wait, immediate) {
self.timeout = self.timeout || null;
return function() {
var context = this, args = arguments;
clearTimeout(self.timeout);
self.timeout = setTimeout(function() {
self.timeout = null;
if (!immediate) func.apply(context, args);
}, wait);
if (immediate && !self.timeout) func.apply(context, args);