This file contains hidden or 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
Show hidden characters
{ | |
// Define region highlight styles | |
"bracket_styles": { | |
"default": { | |
"icon": "dot", | |
"color": "brackethighlighter.default", | |
"style": "underline" | |
}, | |
"unmatched": { | |
"icon": "question", |
This file contains hidden or 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
{ | |
"bold_folder_labels": true, | |
"caret_extra_bottom": 2, | |
"caret_extra_top": 2, | |
"caret_extra_width": 3, | |
"caret_style": "phase", | |
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme", | |
"font_face": "Operator Mono", | |
"font_size": 16, | |
"highlight_line": true, |
This file contains hidden or 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
[ | |
{ "keys": ["super+v"], "command": "paste_and_indent" }, | |
{ "keys": ["super+shift+v"], "command": "paste" }, | |
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } }, | |
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } } | |
] |
This file contains hidden or 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 rot13(str) { | |
var num = 0, str2 = ""; // declaro las variables vacias | |
for (var i = 0; i < str.length; i++) { // ciclo para recorrer el string | |
num = str.charCodeAt(i); // asigno el numero de caracter unicode a num | |
if (num >= 65) { // si variable es mayor que A Unicode sumo + 13 | |
num += 13; | |
} | |
if (num > 90) { // si variable es mayor que 90 Z Unicode resto 26 (-13 * 2) | |
num -= 26; | |
} |
This file contains hidden or 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 getIndexToIns(arr, num) { | |
arr.push(num); // agrego el numero al array | |
var newArr = arr.sort(function (a, b) {return a - b; }); // con el metodo .sort() ordeno el array de forma ASC | |
return newArr.indexOf(num); // obtengo el index del elemento num | |
} | |
getIndexToIns([2, 5, 10], 15); // obtengo 3 |
This file contains hidden or 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 destroyer(arr) { | |
var temp = []; // Creo un array temporal vacio | |
for (var i = 1; i < arguments.length; i++) // ciclo para recorrer el array | |
temp.push(arguments[i]); // traspado valores al array temporal | |
return arr.filter( function(remove) { // funcion filter filtra el array original con un callback | |
return temp.indexOf(remove) < 0; // devuelve true o false si el valor en el indice corresponde | |
}); | |
} | |
destroyer([1, 2, 3, 1, 2, 3], 2, 3); // [1, 1] |
This file contains hidden or 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 bouncer(arr) { | |
//Solo devuelve los valores evaluados como verdadero dentro del array. | |
return arr.filter(function(value){ | |
if (value){ | |
return (value); | |
} | |
}); | |
} |
This file contains hidden or 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 mutation(arr) { | |
var arr1 = arr[0].toLowerCase().split(''); // seconvierten los strings a minusculas y se separan con split() | |
var arr2 = arr[1].toLowerCase().split(''); // primer array es la base, segundo array la palabra a buscar | |
for (var i = 0; i < arr2.length; i++) // ciclo for que reccorre el array | |
if (arr1.indexOf(arr2[i]) == -1) // compara si el indice del array uno con el del 2 son distintos -1 | |
return console.log('false'); // retorna false si no lo son | |
return console.log('true'); // true si lo son | |
} |
This file contains hidden or 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 slasher(arr, howMany) { | |
if (howMany === 0) // compara si el parametro de corte es cero | |
return arr; // retorna el array completo | |
else if (howMany > arr.length) // si el parametro de corte es mayor al largo del array | |
return []; // devuelve vacio, ya que es no es un valor valido | |
else | |
return arr.splice(howMany); // caso contrario devuelve el array con el elemento cortado howMany | |
} | |
slasher([1, 2, 3], 2); // [3] |
This file contains hidden or 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
// array.prototype.push() | |
// array.prototype.slice(); | |
function chunckArrayInGroups(arr, size) { | |
var chunk = [], i; // declara array vacio e indice de for | |
for (i = 0; i <= arr.length; i+= size) // loop que recorre el array | |
chunk.push(arr.slice(i, i + size)); // push al array el tramo desde el indice del loop hasta el valor size + el indicador | |
return chunk; | |
} |