Skip to content

Instantly share code, notes, and snippets.

View EdixonAlberto's full-sized avatar
🍍
Focusing

Edixon Piña EdixonAlberto

🍍
Focusing
View GitHub Profile
@EdixonAlberto
EdixonAlberto / cs-vs-ts.md
Created March 21, 2022 04:30
Comparación entre CSharp y Typescript

CSharp vs Typescript

Comparación entre lenguajes usando: namespace, static method, instance, callback, enum y types

CSharp

namespace Core.Utils
{
  public static class HttpUtil
 {
@EdixonAlberto
EdixonAlberto / helper.js
Created June 23, 2021 20:28
helper toBase64
// helper.js
export async function toBase64(blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader()
let fullStr = ''
const getPositionSymbol = symbol => {
return fullStr.search(symbol) + 1
}
@EdixonAlberto
EdixonAlberto / collector.js
Created April 26, 2021 19:09
Algorithm for grouping or collecting equal elements in an array
const nroList = [1, 4, 1, 3, 2, 4];
const collector = [];
let qty = 1;
nroList.forEach((nro, index) => {
qty = 1;
if (!collector.find(item => item.nro === nro)) {
for (let i = 0; i < nroList.length; i++) {
const nroCurrent = nroList[i];
@EdixonAlberto
EdixonAlberto / range.js
Created April 23, 2021 14:29
Create values range
const maxLimit = 1;
const minLimit = 5;
const range = [...Array(maxLimit - minLimit).fill().map((_, i) => minLimit + i), maxLimit];
console.log(range); // out: [1, 2, 3, 4, 5]
@EdixonAlberto
EdixonAlberto / fibonacci.php
Created September 22, 2020 23:47
Algorithm of Fibonacci in php
<?php
function fibonacci(int $serie): array {
$firstNro = 0;
$secondNro = 1;
$arraySequence = [0];
for ($i=1; $i <= $serie; $i++) {
$suma = $firstNro + $secondNro;
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@EdixonAlberto
EdixonAlberto / Javascript ISO country code to country name conversion
Created March 13, 2020 13:20 — forked from maephisto/Javascript ISO country code to country name conversion
ISO 3166-1 alpha-2 country code to country name conversion with a simple Javascript implementation, an array and a function.
var isoCountries = {
'AF' : 'Afghanistan',
'AX' : 'Aland Islands',
'AL' : 'Albania',
'DZ' : 'Algeria',
'AS' : 'American Samoa',
'AD' : 'Andorra',
'AO' : 'Angola',
'AI' : 'Anguilla',
'AQ' : 'Antarctica',
@EdixonAlberto
EdixonAlberto / commands-virtualenv.md
Last active March 21, 2022 04:34
(Cheat sheet) para virtualenv y pip

Cheat sheet para virtualenv y pip

🎯 Instalar virtualenv:

$> pip install virtualenv

🎯 Crear entorno virtual:

$> virtualenv env

@EdixonAlberto
EdixonAlberto / tourArray.ts
Last active June 23, 2021 20:31
List of methods to navigate an array in JavaScript using TypeScript
const numbers: number[] = [0, 1, 2, 3, 4];
// Method 1 -> FOR
function method1(): void {
for (let index = 0; index < numbers.length; index++) {
const nro: number = numbers[index];
console.log(nro);
}
}