Skip to content

Instantly share code, notes, and snippets.

View iLTW1n's full-sized avatar
🚀
work hard | play hard

José Oscátegui iLTW1n

🚀
work hard | play hard
View GitHub Profile
const regex = /[0-9]/g;
const text = 'This is my test 123';
text.replace(regex, ''); // 'This is my test '
@iLTW1n
iLTW1n / fibonacci-numbers.js
Created December 19, 2019 18:02
generate-fibonacci-numbers.js
const whiteNumber = prompt('Ingresar un número para generar el fibonacci');
function fibonacci(n = 10){
let startZero = 0;
let startOne = 1;
let result;
let fibonacciNumbers = [0, 1];
for (let i = 0; i <= n; i++) {
@iLTW1n
iLTW1n / base64.js
Created October 25, 2018 22:16 — forked from indexzero/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
//
// Super simple base64 encoding / decoding with node.js
//
var base64 = exports = {
encode: function (unencoded) {
return new Buffer(unencoded).toString('base64');
},
decode: function (encoded) {
return new Buffer(encoded, 'base64').toString('utf8');
@iLTW1n
iLTW1n / routes.js
Created August 2, 2018 18:54 — forked from rcanepa/routes.js
Private routes with React Router v4
function PrivateRoute ({component: Component, authenticated, ...rest}) {
return (
<Route
{...rest}
render={(props) => authenticated === true
? <Component {...props} />
: <Redirect to={{pathname: '/login', state: {from: props.location}}} />}
/>
)
}
@iLTW1n
iLTW1n / paises.csv
Created June 5, 2018 16:52 — forked from brenes/README.md
CSV de paises, con nombre en castellano, ingles, codigo ISO y prefijo telefónico del país
nombre name nom iso2 iso3 phone_code
Afganistán Afghanistan Afghanistan AF AFG 93
Albania Albania Albanie AL ALB 355
Alemania Germany Allemagne DE DEU 49
Algeria Algeria Algérie DZ DZA 213
Andorra Andorra Andorra AD AND 376
Angola Angola Angola AO AGO 244
Anguila Anguilla Anguilla AI AIA 1 264
Antártida Antarctica L'Antarctique AQ ATA 672
Antigua y Barbuda Antigua and Barbuda Antigua et Barbuda AG ATG 1 268
@iLTW1n
iLTW1n / download-file.js
Created May 2, 2018 23:45 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);