Skip to content

Instantly share code, notes, and snippets.

View angeldelacruzdev's full-sized avatar
:shipit:
I may be slow to respond.

Ángel De La Cruz angeldelacruzdev

:shipit:
I may be slow to respond.
View GitHub Profile
@angeldelacruzdev
angeldelacruzdev / numberformat.js
Created August 10, 2017 21:33
number_format(number, decimals, decPoint, thousandsSep) in JavaScript, known from PHP. It formats a number to a string with grouped thousands, with custom seperator and custom decimal point
function number_format(number, decimals, decPoint, thousandsSep){
decimals = decimals || 0;
number = parseFloat(number);
if(!decPoint || !thousandsSep){
decPoint = '.';
thousandsSep = ',';
}
var roundedNumber = Math.round( Math.abs( number ) * ('1e' + decimals) ) + '';
@angeldelacruzdev
angeldelacruzdev / number_format.js
Created April 7, 2018 09:14 — forked from VassilisPallas/index.ts
Equivalent to PHP function number_format in Javascript
function number_format(number, decimals, dec_point, thousands_point) {
if (number == null || !isFinite(number)) {
throw new TypeError("number is not valid");
}
if (!decimals) {
var len = number.toString().split('.').length;
decimals = len > 1 ? len : 0;
}
@angeldelacruzdev
angeldelacruzdev / tablapaises.sql
Created March 29, 2019 01:11 — forked from angeldelrio/tablapaises.sql
Tabla MySQL paises el mundo en español
CREATE TABLE `paises` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) DEFAULT NULL,
`nombre` varchar(80) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
INSERT INTO `paises` VALUES(1, 'AF', 'Afganistán');
INSERT INTO `paises` VALUES(2, 'AX', 'Islas Gland');
INSERT INTO `paises` VALUES(3, 'AL', 'Albania');
<!-- Twitter -->
<meta name="twitter:site" content="@themepixels">
<meta name="twitter:creator" content="@themepixels">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Bracket">
<meta name="twitter:description" content="Premium Quality and Responsive UI for Dashboard.">
<meta name="twitter:image" content="http://themepixels.me/bracket/img/bracket-social.png">
<!-- Facebook -->
<meta property="og:url" content="http://themepixels.me/bracket">
export const StrShortString = (str) =>{
return str.length > 25 ? str.substring(0, 50) + "..." : str;
}