Skip to content

Instantly share code, notes, and snippets.

View atamocius's full-sized avatar
😜

Anton Mata atamocius

😜
View GitHub Profile
@atamocius
atamocius / paging-utils-example-2.js
Last active September 2, 2020 12:34
A slightly more practical example of how to use the paging utilities
import {
calcPageNumbers,
calcOffset,
calcPageCount,
getPageItems,
} from './paging-utils';
// We'll use lodash's `clamp` function
import clamp from 'lodash/clamp';
@atamocius
atamocius / paging-utils-example.js
Last active September 2, 2020 12:25
An example of how to use the paging utilities
import {
calcPageNumbers,
calcOffset,
calcPageCount,
getPageItems,
} from './paging-utils';
// We'll use lodash's `clamp` function
import clamp from 'lodash/clamp';
@atamocius
atamocius / paging-utils.js
Last active September 2, 2020 12:09
A set of JS functions that help in implementing paging.
import range from 'lodash/range';
/**
* Returns the items in a given page.
* @template T
* @param {number} offset The index offset based on the given `pageIndex`
* (precomputed from `calcOffset`).
* @param {number} itemsPerPage The number of items per page.
* @param {T[]} items The array of items.
*/
@atamocius
atamocius / machine.js
Last active August 29, 2020 11:02
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@atamocius
atamocius / advanced-js-rx.md
Created May 13, 2020 13:05
Advanced JS - Reactive Programming

Advanced JS - Reactive Programming

@atamocius
atamocius / advanced-js-patterns.md
Last active May 13, 2020 13:01
Advanced JS - Design Patterns

Advanced JS - Design Patterns

📖 Introduction

What is a "Pattern"?

"Gang of Four" (GoF)

Types/Categories

@atamocius
atamocius / advanced-js-async.md
Last active May 13, 2020 13:11
Advanced JS - Asynchronous Programming

Advanced JS - Asynchronous Programming

📖 Introduction

Synchronous vs. Asynchronous

Callbacks

🔗 Promises

@atamocius
atamocius / advanced-js-func.md
Last active May 13, 2020 13:10
Advanced JS - Functional Programming

Advanced JS - Functional Programming

📖 Introduction

Imperative vs. Declarative

First class functions

🏭 Pure Functions

@atamocius
atamocius / web-dev-training.md
Last active May 27, 2020 21:28
Web Development Training