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 createIterator(array){ | |
var index = -1 | |
var hasNext = function(){ | |
return (index + 1) < array.length | |
} | |
var hasPrev = function(param){ | |
return (index - 1) < array.length && (index - 1) > -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
<!DOCTYPE html> | |
<html lang="es"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>TEST Custom Elements</title> | |
<style>body{text-align: center;}</style> | |
</head> | |
<body> | |
<template id="clickBtn"> |
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 addVirtualProperty(options){ | |
if(!options.obj || typeof options.obj !== 'object'){ | |
throw new Error('Expected `obj`[Object object]') | |
} | |
if(!options.prop){ | |
throw new Error('Expected `prop`') | |
} | |
Object.defineProperty(options.obj, options.prop, { | |
get(){ | |
return options.getter.call(options.obj) |
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
<?php | |
/** | |
* Imprime un array en consola con otro formato | |
* @param array $array | |
* @param integer $lvl | |
* @param integer $keylen | |
* @param integer $actual_spaces | |
*/ | |
function print_array($array, $lvl = 0, $keylen = 0, $actual_spaces = 0){ | |
if($lvl == 0){ |
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 getType(x){ | |
return Object.prototype.toString.call(x).toLowerCase().replace(/\[(.*)\s|\]$/g, '') | |
} | |
// Types (all strings): | |
// | |
// number | |
// string | |
// boolean | |
// date |