Skip to content

Instantly share code, notes, and snippets.

View Luise8's full-sized avatar
🎯
Focusing

Luis E. Luise8

🎯
Focusing
View GitHub Profile
@AlexAlonsoMontero
AlexAlonsoMontero / vite-testing-config.md
Last active October 9, 2023 01:54 — forked from Klerith/vite-testing-config.md
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
npm install --dev jest babel-jest @babel/preset-env @babel/preset-react 
@aeciolevy
aeciolevy / Example.js
Created March 3, 2019 17:18
Example of mongoose transaction. MongoDB transaction example
exports.deleteUser = async (req, res, next) {
const session = await mongoose.startSession();
try {
const { id } = req.params;
// Start session
await session.startTransaction();
// deleteMany in this session
const [errorOp, result] = await toAll([App.deleteMany({ user: id }).session(session), UserModel.findByIdAndRemove(id).session(session)]);
if (errorOp) {
throw new ErrorRequest(STATUS_CODE.UNPROCESSABLE, errorOp.message);
@bmaupin
bmaupin / free-database-hosting.md
Last active July 22, 2024 16:24
Free database hosting
@michaelbourne
michaelbourne / x-transparent-fixed-header.css
Created April 25, 2018 22:00
Transparent Fixed Header (Opaque on Scroll)
/** set up our navbar, and position it fixed so there is no white gap above the CS content **/
.x-navbar {
border: none;
box-shadow: none;
transition: background 0.7s ease-out;
background: transparent!important;
position: fixed;
z-index: 1030;
top: 0;
@JamieMason
JamieMason / es6-compose.md
Last active May 17, 2022 17:38
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reduceRight((prevFn, nextFn) =>
    (...args) => nextFn(prevFn(...args)),
    value => value
 );
@WaldoJeffers
WaldoJeffers / compose.js
Last active January 3, 2024 16:47
JavaScript one-line compose (ES6)
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)))
// Usage : compose functions right to left
// compose(minus8, add10, multiply10)(4) === 42
//
// The resulting function can accept as many arguments as the first function does
// compose(add2, multiply)(4, 10) === 42