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
| <!DOCTYPE html> | |
| <html lang="es"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <title>Mapa Mundial con Proyección Miller y Geodésicas</title> | |
| <script src="https://d3js.org/d3.v7.min.js"></script> | |
| <script src= "https://d3js.org/d3-geo-projection.v2.min.js"></script> | |
| <style> | |
| body { margin: 0; overflow: hidden; } | |
| svg { background: #e0f7fa; } |
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
| async function getTodosList() { | |
| const response = await fetch('https://jsonplaceholder.typicode.com/todos'); //fetch es await function. Podemos llamarlo con await y esperará aquí | |
| const data = await response.json(); //.json es método async, podemos llamarlo con await y esperará aquí. | |
| return data; //el return lo hará cuando la línea anterior acabe, después de esperar la conversión a json de la response | |
| } | |
| async function countCompletedTodosTitleLength(){ | |
| const todos = await getTodosList(); //Llamamos a getTodosList y esperamos aquí hasta que acabe. | |
| console.log(todos |
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
| /*receives a function and an integer between 1 and 60. Executes the function every N minutes at even hour divisions*/ | |
| const executeEveryNMinutes = (callback, minutes)=>{ | |
| if (!(Number.isInteger(minutes) && minutes>0 && minutes<60 && typeof(callback) == "function")){ | |
| return false; | |
| } | |
| const now = new Date(); | |
| const nextTime = new Date(now.getTime() + minutes * 60 * 1000 + 1); | |
| const nextTimeRound = new Date(nextTime | |
| .setMinutes(minutes*(Math.floor((nextTime.getMinutes() / 60) * (60/minutes))))) |
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
| //Superseded by https://gist.github.com/dei-biz/112c3825b5752c76dcb0a915b49bca47 | |
| executeNext15 = (callback)=>{ | |
| const now = new Date(); | |
| const nextTime = new Date(now.getTime() + 15 * 60 * 1000 + 1); | |
| const nextTimeRound = new Date(nextTime | |
| .setMinutes(15*(Math.floor((nextTime.getMinutes() / 60) * 4)))) //every 15 minutes/4 times an hour | |
| .setSeconds(0) | |
| const timeout = nextTimeRound - now; |
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
| import pandas as pd | |
| host = 'HOST' | |
| port = 3306 | |
| user = 'USER' | |
| password = 'PASS' | |
| database = 'DATABASE' | |
| writer = pd.ExcelWriter(database+'.xlsx') |
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
| { | |
| "query" : { | |
| "bool" : { | |
| "should" : [{ | |
| "multi_match" : { | |
| "type" : "best_fields", | |
| "fields" : ["campo_importante^3", "campo_menos_importante^2", "campo_poco_importante"], | |
| "query" : "QUERY" | |
| } | |
| }, { |
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
| var scaleCanvas = function(canvas, bb){ | |
| var retina = window.devicePixelRatio; | |
| var width = canvas.width; | |
| var height = canvas.height; | |
| var newWidth = bb.xMax - bb.xMin; | |
| var newHeight = bb.yMax - bb.yMin; | |
| var aspectCanvas = width/height; | |
| var aspectBB = newWidth/newHeight; | |
| var offsetX = 0; | |
| var offsetY = 0; |
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
| var findBB = function(canvas){ | |
| var width = canvas.width; | |
| var height = canvas.height; | |
| var imageData = canvas.getContext('2d').getImageData(0,0,width,height); | |
| var data = imageData.data; | |
| var bounds = { | |
| xMax : 0, | |
| xMin : width, | |
| yMax : 0, |
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
| <policy domain="coder" rights="none" pattern="EPHEMERAL" /> | |
| <policy domain="coder" rights="none" pattern="HTTPS" /> | |
| <policy domain="coder" rights="none" pattern="HTTP" /> | |
| <policy domain="coder" rights="none" pattern="URL" /> | |
| <policy domain="coder" rights="none" pattern="FTP" /> | |
| <policy domain="coder" rights="none" pattern="MVG" /> | |
| <policy domain="coder" rights="none" pattern="MSL" /> |
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
| <?php | |
| $dbconn = pg_connect("host= dbname=OTIENDA user= password=") | |
| or die('Could not connect: ' . pg_last_error()); | |
| $query = file_get_contents('data.txt'); | |
| $time_start = microtime_float(); | |
| $result = pg_query($query) or die('Query failed: ' . pg_last_error()); | |
| $time_end = microtime_float(); | |
| $time = round($time_end - $time_start, 3); |
NewerOlder