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
image: node:7.0 #node v7 | |
clone: # the 'clone' section | |
depth: 1 # latest commit only | |
pipelines: | |
default: | |
- step: | |
script: | |
- npm i -g yarn | |
- yarn |
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
root = true | |
[*] | |
charset = utf-8 | |
indent_style = tab | |
indent_size = 4 | |
end_of_line = lf | |
insert_final_newline = false | |
trim_trailing_whitespace = true |
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 sortArr(arr){ | |
return arr.sort(function (a, b){ | |
return a - b; | |
}); | |
} |
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
module.exports = { | |
'type': '', | |
'project_id': '', | |
'private_key_id': '', | |
'private_key': '', | |
'client_email': '', | |
'client_id': '', | |
'auth_uri': '', | |
'token_uri': '', | |
'auth_provider_x509_cert_url': '', |
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
html, body { | |
height:100vh; /* viewport height */ | |
} | |
/* | |
The second method is using the vh unit. Surely you already know that to determine the "size" | |
of an element in CSS we can use units such as pixels, points, percentages or even em. But | |
maybe you have not heard about the vh and vw units. A vh unit (viewport height) is | |
equivalent to 1% of the height of the viewport (the total of the screen of the device that | |
shows our web). 1vh = 1% of the total screen, 100vh = 100%. As you may have guessed, the |
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
Number.prototype.toRad = function() { | |
return this * Math.PI / 180; | |
} | |
var lat2 = 42.741; | |
var lon2 = -71.3161; | |
var lat1 = 42.806911; | |
var lon1 = -71.290611; | |
var R = 6371; // km |
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 NMEA2GPS(num, pole){ | |
var poles = {'N':1,'S':-1,'W':-1,'E':1}; | |
var s = parseFloat(num).toString(); | |
var deg = s.substring(0,2); | |
var min = s.substring(2); | |
return (parseInt(deg) + parseFloat(min)/60) * poles[pole]; | |
} | |
// NMEA2GPS(07721.2060, 'W') => -77.35347 |
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
// You'll need to include the prototypes.js file before use it. | |
// To NodeJs: let proto = require('prototypes'); | |
// To Html: <script src="path/prototypes.js"></script> | |
// Note: ChanceJs plugin could be omited since it's only used to verify the correct working for any case. | |
let Chance = require('chance'); // Plugin to generate content random | |
let chance = new Chance(); | |
let text = chance.paragraph(); // Generating paragraph random |
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 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); |
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
RewriteEngine On | |
RewriteBase / | |
#if the request is not secure | |
RewriteCond %{HTTPS} off | |
#redirect to the secure version | |
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L] | |
#These are your existing rules | |
RewriteCond %{REQUEST_FILENAME} !.(jpg|jpeg|gif|png|css|js|pl|txt)$ [NC] |