Skip to content

Instantly share code, notes, and snippets.

View joalbertg's full-sized avatar
🎯
Focusing

Joalbert Andrés González joalbertg

🎯
Focusing
View GitHub Profile
@joalbertg
joalbertg / README.md
Created May 23, 2020 18:26
markdown: languages supported

Languages Supported Markdown

Link article

  • actionscript3
  • apache
@joalbertg
joalbertg / array-to-hash-for-search.js
Created June 2, 2020 13:59
javascript: array to hash for search
// array to hash for search
const users = [];
const products = [];
const elem = 10;
const keyBy = (arr, key) => arr.reduce((acc, el) => {
//console.log('acc', acc);
//console.log('acc[el]', el);
//console.log('acc[el[key]]', el[key]);
@joalbertg
joalbertg / composition.js
Created June 18, 2020 15:25
javascript: composition
const capitalize = str => (
str.replace(/\w\S*/g, txt =>
txt.charAt(0)
.toUpperCase() + txt.substr(1).toLowerCase())
);
const users = [{
id: 1, name: 'joalbert', surname: 'gonzález'
}];
@joalbertg
joalbertg / closures.js
Created June 20, 2020 05:31
javascript: closures
// 1-basic
console.log('++++++++++++++++++++++++++++++++++++++++++++++++++');
const count = (() => {
let currentValue = 0;
return () => currentValue += 1;
})();
console.log('count:', count()); //1
console.log('count:', count()); //2
console.log('count:', count()); //3
@joalbertg
joalbertg / calendar-messages-es.js
Created July 9, 2020 05:40 — forked from Klerith/calendar-messages-es.js
Big-Calendar - mensajes en español
export const messages = {
allDay: 'Todo el día',
previous: '<',
next: '>',
today: 'Hoy',
month: 'Mes',
week: 'Semana',
day: 'Día',
agenda: 'Agenda',
date: 'Fecha',
@joalbertg
joalbertg / greatest-sequence.js
Last active July 21, 2020 21:48
javascript: Greatest Sequence
/*
* In the following 6 digit number:
* 283910
* 91 is the greatest sequence of 2 consecutive digits.
*
* In the following 10 digit number:
* 1234567890
* 67890 is the greatest sequence of 5 consecutive digits.
*
* Complete the solution so that it returns the greatest sequence
@joalbertg
joalbertg / README.md
Created August 24, 2020 20:22
ruby: entrada y salida estándar

Ruby STDIN/STDOUT

cat in.txt | ruby stdin_stdout.rb > out.txt
ruby stdin_stdout.rb < in.txt > out.txt
@joalbertg
joalbertg / README.md
Created September 6, 2020 20:50
ruby: Strategy Pattern

Strategy Pattern

Strategy::V1::HTMLFormatter
 
<html>
  <head>
    <title>Monthly Report</title>
 
@joalbertg
joalbertg / README.md
Created September 7, 2020 03:34
ruby: Factory Method Pattern

Factory Method Pattern

Duck Duck0 says Quack!
Duck Duck1 says Quack!
Duck Duck2 says Quack!
Duck Duck0 is eating.
Duck Duck1 is eating.
Duck Duck2 is eating.
@joalbertg
joalbertg / README.md
Created September 21, 2020 02:17
ruby: Observer Pattern

Observer Pattern

V1
  name:   Fred Flintstone
  title:  Crane Operator
  salary: 30000
35000