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 getFactory(ls) { | |
return function(x, y) { | |
return Array.isArray(ls[y]) ? (ls[y][x] === undefined && [] || [ls[y][x]]) : []; | |
} | |
} | |
function getNeighbors(x, y, ls){ | |
const get = getFactory(ls); | |
return [ | |
get(x-1, y+1), get(x, y+1), get(x+1, y+1), | |
get(x-1, y), get(x, y), get(x+1, y), |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "attach", | |
"name": "Launch attach by process ID", | |
"processId": "${command:PickProcess}" | |
}, |
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
export const curry = ( | |
f, | |
arr = [], | |
length = f.length | |
) => (...args) => ( | |
a => a.length === length && f(...a) || curry(f, a) | |
)([...arr, ...args]); |
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
/** | |
* Check if Promise is pendding to resolve. Use in Asyn-Await | |
* | |
* Example; | |
* | |
* const { isPending } = require('promise.helper') | |
* it('Check if promise is pending', async function () { | |
* const promise = load(path); | |
* console.assert(await isPending(promise)) | |
* await promise; |
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
/** | |
* Create Promise pending to resolve after N milliseconds | |
* Example async-await: | |
* const { sleep } = require('sleep') | |
* //... | |
* it ('Should resolve after 100 millisiconds', async function () { | |
* let Module = load(path) | |
* await sleep(100) | |
* expect (Module.status).to.be.equal('resolved') | |
* }) |
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 deleteFolderRecursive(path) { | |
if(fs.existsSync(path)) { | |
fs.readdirSync(path).forEach(function(file, index) { | |
var curPath = path + '/' + file; | |
if(fs.lstatSync(curPath).isDirectory()) { // recurse | |
deleteFolderRecursive(curPath); | |
} else { // delete file | |
fs.unlinkSync(curPath); | |
} | |
}); |
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
#!/bin/bash | |
# | |
# This file echoes a bunch of color codes to the | |
# terminal to demonstrate what's available. Each | |
# line is the color code of one forground color, | |
# out of 17 (default + 16 escapes), followed by a | |
# test use of that color on all nine background | |
# colors (default + 8 escapes). | |
# | |
# @see https://github.com/mbadolato/iTerm2-Color-Schemes/issues/6 |
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
#!/bin/bash | |
# ffmpeg: | |
# | |
# -y -> sobreescribe archivo de salida | |
# -i ‘videoentrada.avi’ -> archivo de entrada | |
# -threads 2 -> hilos de decodificación | |
# -s 320×240 -> Tamaño de salida | |
# -r 30.00 -> Velocidad de cuadro (fps, cuadros x segundo) | |
# -threads 1 -> hilo de decodificación |
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 lang="en"> | |
<meta charset="utf-8"> | |
<title>Css class name like icon</title> | |
</head> | |
<body> | |
<p class="l__al"> |
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 TrajectoryMarkers = function(map, arrayMarkers, separation){ | |
this.set('markers', arrayMarkers || []); | |
this.set('separation', separation || 50);//pixeles de separación | |
this.setMap(map); | |
} | |
TrajectoryMarkers.prototype = new google.maps.OverlayView(); | |
TrajectoryMarkers.prototype.onAdd = function(){ | |
var self = this; | |
google.maps.event.addListener(this.getMap(), 'zoom_changed', function(){ | |
self.draw(); |
NewerOlder