Skip to content

Instantly share code, notes, and snippets.

function tasaNominalToEfectiva(tasa_nominal_anual, freq_anual)
{
return Math.pow(1+(tasa_nominal_anual/freq_anual), freq_anual) - 1;
}
function cambioPeriocidadTasaEfectiva(tasa_efectiva_por_periodo, nueva_periodicidad)
{
// Si tenemos una tasa efectiva mensual del 2% y queremos convertirla a anual, debemos hacer nueva_periodicidad == 12 (meses)
/*
Valores comunes para el parametro nueva_periodicidad, suponiendo que la tasa efectiva por periodo esta en meses:
// If each iteration has 30ms, then
// 100 000 iterationts * 30ms = 3 000 000ms
// 3 000 000ms/1000ms = 3000s
// 3000s / 60s = 50minutes
function totalTimeInMinutes(iterationsCount, iterationDurationInMs)
{
return ((iterationsCount*iterationDurationInMs)/1000)/60;
}
# SUB QUERIESS
```SQL
SELECT name, MIN(cost) FROM items WHERE name LIKE '%frog%' AND seller_id IN (
SELECT DISTINCT seller_id FROM items WHERE name LIKE '%frog%'
);
function prestacionServicios(salario)
{
var retencion = salario*0.11;
var montoGrabable = salario*0.4;
var pension = 0.165*montoGrabable;
var salud = 0.12*montoGrabable;
return (salario - retencion - pension - salud)
}
var Financial = {
InteresSimple: {
// El nombre del metodo hace referencia a la incognita que se quiere hallar
Final: null, // Valor al final de la inversion
Presente: null, // Valor al final de la inversion
Interes: null // Tasa de interes requerida
},
InteresCompuesto: {
// El nombre del metodo hace referencia a la incognita que se quiere hallar
Final: null, // Valor al final de la inversion
@jorovipe97
jorovipe97 / backupit.sh
Created October 18, 2018 13:35
A simple zipper command with custom name, ideal for make simple backups in unix systems.
# Author: Jose Romualdo Villalobos Perez
# Date: 18 oct, 2018
# Shell is white-space sensitive in many places, inluding = operator
# var = foo throw error
# var=foo is fine
dirName=$1
DATE=`date '+%Y-%m-%d-%H-%M-%S'`
zipFile="$dirName-$DATE.zip"
@jorovipe97
jorovipe97 / request_generator.js
Last active November 22, 2018 14:27
Test method for tour.telemedellin micrositio
// request generator
function create_req(method, url, bodyObj)
{
var xmlhttp = new XMLHttpRequest();
xmlhttp.open(method, url);
// Gets the parsed data from the request body. Only for the POST/PUT/DELETE methods.
xmlhttp.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xmlhttp.setRequestHeader('Content-Type', 'text/json; charset=UTF-8');
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script type="text/javascript">
// Avoids conflicts with the theme jquery version
// https://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page
var jQuery_3_3_1 = $.noConflict(true);
</script>
import React, { Component } from 'react';
import { View, Text, Button, Image } from 'react-native';
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
class LogoTitle extends Component {
render() {
return (
<Image
source={require('./google.png')}
@jorovipe97
jorovipe97 / hexToGlslColor.js
Last active November 10, 2019 00:52
Converts a color in hex format to decimal vector, similar to the ones used on glsl or unity
function hexToGlslColor(hexColor) {
var r = +hexColor >> 16;
r /= 255;
var g = (+hexColor & 0x00FF00) >> 8;
g /= 255;
var b = (+hexColor & 0x0000FF);
b /= 255;
return `vec4(${r.toFixed(5)}, ${g.toFixed(5)}, ${b.toFixed(5)}, 1.0)`
}