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
/********************************************************************** | |
Current Version: unnecessary scope | |
**********************************************************************/ | |
eventOn('load',function(){ | |
transitionSupported = (function(style){ //Surplus | |
var prefixes = ['MozT','WebkitT','OT','msT','KhtmlT','t']; | |
for(var i = 0, prefix; prefix = prefixes[i]; i++){ | |
if(prefix+'ransition' in style) return true; | |
} | |
return false; |
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
/** | |
* HumaneJS | |
* Humanized Messages for Notifications | |
* @example | |
* humane('hello world'); | |
*/ | |
;(function(win,doc){ | |
var eventOn, eventOff; | |
if (win.addEventListener) { |
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
var concatenate = (function(){ | |
var params; | |
//Auxiliares "privados" | |
function hasElements(){return params.length>0;} | |
function createString(){ | |
var res = ""; | |
for(var i=0;i<params.length;i++){ |
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
/* Son objetivos fundamentales: | |
* - Minimizar las funciones ECMAScript utilizadas | |
* - Optimizar en espacio, evitando la creación de arrays transitorios | |
* | |
* Suponemos que no se utilizará esta función con arrays creados | |
* en frames externos, con lo cual instanceof Array es seguro | |
*/ | |
function aplaneitor(soa,acu) { | |
if (soa instanceof Array) { |
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
var phineas = (function(){ | |
function aplaneitor(soa,acu) { | |
if (soa instanceof Array) { | |
for (var j=0, len = soa.length;j<len;j++) { | |
aplaneitor(soa[j],acu); | |
} | |
} | |
else { | |
acu.push(soa); | |
} |
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
/* Abstracción!!! | |
* | |
* En la función aplaneitor de https://gist.github.com/1143902 | |
* podemos apreciar el esquema foldl (reduce) | |
* En esta versión se ha generalizado dicha función | |
* obteniendo una versión de foldl valido para "árboles de arrays" | |
*/ | |
function foldl(f,acu,soa) { | |
if (soa instanceof Array) { |
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 aplaneitor2(arr,sep){ | |
return function step(a){return Array.isArray(a) ? a.map(step).join(sep) : a}(arr); | |
} | |
var test = ["hola", ["soy", ["juan", "fernandez"] ], "y", ["no", "tengo", ["dinero"] ] ]; | |
console.log(aplaneitor2(test,'**')) // -> hola**soy**juan**fernandez**y**no**tengo**dinero |
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
// FUNCIONES AUXILIARES | |
/* | |
* La siguiente función cuenta las propiedades | |
* (tanto propias como hereradas) de un objeto | |
*/ | |
function contarPropiedades(obj) { | |
var recuento = 0; | |
for (propiedad in obj) recuento ++; |
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 esArray(array) { | |
return Object.prototype.toString.call(array) == '[object Array]'); | |
} | |
function desempaqueta(array,index) { | |
Array.prototype.splice.apply(array, [index, 1].concat(array[index])); | |
} | |
function flatten(arr) { | |
arr = arr.concat(); |
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
-- Estrategias para aplanar arboles | |
-- ATENCIÓN: Estas nuevas funciones no han sido probadas | |
-- (No tengo GHC disponible en esta maquina) | |
module Aplaneitor where | |
data Tree a = Leaf a | Trees [Tree a] deriving(Show) | |
cow = Trees [Leaf 1, Trees [ Leaf 2, Leaf 3], Leaf 4] | |
-- Estrategias para aplanar arboles |