Skip to content

Instantly share code, notes, and snippets.

View EdwinBetanc0urt's full-sized avatar
💼
Working

Edwin Betancourt EdwinBetanc0urt

💼
Working
View GitHub Profile
@oskansavli
oskansavli / DecimalFormat.js
Created February 11, 2011 14:03
Javascript number formatter (Java DecimalFormat Implemented in Javascript)
/**
* @class DecimalFormat
* @constructor
* @param {String} formatStr
* @author Oskan Savli
*/
function DecimalFormat(formatStr)
{
/**
* @fieldOf DecimalFormat
@jrobinsonc
jrobinsonc / number-format.js
Last active July 23, 2021 22:09
Funcion para darle formato a un número. #javascript #numbers
function number_format(amount, decimals) {
amount += ''; // por si pasan un numero en vez de un string
amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto
decimals = decimals || 0; // por si la variable no fue fue pasada
// si no es un numero o es igual a cero retorno el mismo cero
if (isNaN(amount) || amount === 0)
return parseFloat(0).toFixed(decimals);
@angelmartz
angelmartz / diashabiles.php
Last active April 11, 2022 17:11
Obtener días hábiles en PHP
<?php
/**
* Metodo getDiasHabiles
*
* Permite devolver un arreglo con los dias habiles
* entre el rango de fechas dado excluyendo los
* dias feriados dados (Si existen)
*
* @param string $fechainicio Fecha de inicio en formato Y-m-d
* @param string $fechafin Fecha de fin en formato Y-m-d
@chrisjhoughton
chrisjhoughton / proxy.apache.conf
Last active May 14, 2024 15:08
Sample Nginx reverse proxy to Apache set up for Wordpress.
<VirtualHost *:{PORT}>
ServerName www.yourdomain.com
ServerAdmin mail@domain.com
DocumentRoot /var/www/yourdir/
<Directory /var/www/yourdir>
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
@xombra
xombra / bancos
Last active May 30, 2023 18:16
Codigo y Bancos correspondientes de Venezuela
Banco:
<select name="banco">
<option value=""></option>
<option value="0156">100%BANCO</option>
<option value="0196">ABN AMRO BANK</option>
<option value="0172">BANCAMIGA BANCO MICROFINANCIERO, C.A.</option>
<option value="0171">BANCO ACTIVO BANCO COMERCIAL, C.A.</option>
<option value="0166">BANCO AGRICOLA</option>
<option value="0175">BANCO BICENTENARIO</option>
<option value="0128">BANCO CARONI, C.A. BANCO UNIVERSAL</option>
@luckyshot
luckyshot / secsToTime.js
Created July 24, 2014 08:20
Seconds to Time Given the number of seconds it returns the value in minutes and seconds (i.e. 62 seconds returns 1:02)
/**
* secsToTime
* Given the number of seconds it returns the value in minutes and seconds
* (i.e. 62 seconds returns 1:02)
*/
function secsToTime(secs) {
return (secs / 60).toFixed() +':'+ ('0'+secs % 60).slice(-2);
}
@luckyshot
luckyshot / sendemail.php
Last active September 16, 2017 21:53
HTML emails in PHP
<?php
$email = array(
'fromName' => 'Adam',
'fromEmail' => 'adam@example.com',
'toName' => 'Bob',
'toEmail' => 'bob@example.com',
//'cc' => 'charles@example.com',
'subject' => 'Website Change Request',
'body' => 'Hello,<br>Bye',
@luckyshot
luckyshot / geoip.php
Last active November 13, 2020 17:58
PHP - Geolocalization by IP address
<?php
define('GEOIP_CACHE_TIME', 5184000); // 5184000 = 60 days
/**
* Returns the country of an IP address
* If IP is cached and less than 2 months old, otherwhise requests it to geoplugin.com API
*
* @string $ip The IP address
* @bool $justcountry If you want the full array or just the country
@alfchee
alfchee / NumeroALetras.js
Last active June 15, 2024 09:21
Código en JavaScript que convierte números a letras, bastante útil para formularios de documentos contables y similares
/*************************************************************/
// NumeroALetras
// The MIT License (MIT)
//
// Copyright (c) 2015 Luis Alfredo Chee
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@demonio
demonio / console.php
Last active April 7, 2023 17:51
Clase para imprimir variables PHP en la consola del navegador
<?php
/**
* Clase para imprimir variables PHP en la consola del navegador.
*
* Esta clase ha sido creada a partir de esta otra:
* http://www.codeforest.net/debugging-php-in-browsers-javascript-console
*/
class Console
{
/**