Skip to content

Instantly share code, notes, and snippets.

View mcabreradev's full-sized avatar
🎯
Focusing

Miguelángel Cabrera mcabreradev

🎯
Focusing
View GitHub Profile
@mcabreradev
mcabreradev / Configure Jest for Next.js with TypeScript and custom settings.md
Created August 29, 2023 14:41
This code snippet configures Jest for testing a Next.js app. It sets up custom configurations such as module aliases, test environment, coverage settings, and file extensions. It also exports the Jest configuration. This code creates a new Jest config object with custom settings, including setup options and coverage directories. It also includes…

Configure Jest for Next.js with TypeScript and custom settings

Preview:
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nextJest = require('next/jest');

const createJestConfig = nextJest({
  // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
  dir: './',
});
<img src='https://avataaars.io/?avatarStyle=Transparent&topType=ShortHairTheCaesar&accessoriesType=Prescription02&hairColor=Black&facialHairType=BeardLight&facialHairColor=Black&clotheType=Hoodie&clotheColor=Heather&eyeType=Squint&eyebrowType=Default&mouthType=Smile&skinColor=Brown'
/>
<Avatar
avatarStyle='Transparent'
topType='ShortHairTheCaesar'
accessoriesType='Prescription02'
hairColor='Black'
facialHairType='BeardLight'
facialHairColor='Black'
@mcabreradev
mcabreradev / tablapaises.sql
Created September 28, 2020 04:21 — forked from angeldelrio/tablapaises.sql
Tabla MySQL paises el mundo en español
CREATE TABLE `paises` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) DEFAULT NULL,
`nombre` varchar(80) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
INSERT INTO `paises` VALUES(1, 'AF', 'Afganistán');
INSERT INTO `paises` VALUES(2, 'AX', 'Islas Gland');
INSERT INTO `paises` VALUES(3, 'AL', 'Albania');
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl.remove();
return;
}
styleEl = document.createElement('style');
styleEl.id = 'css-layout-hack';
<button>Click here!</button>
<div>Click here!</div>
<header></header>
<section>
<article>
<figure>
<img>
<figcaption></figcaption>
</figure>
</article>
</section>
<footer></footer>
<div id="header"></div>
<div class="section">
<div class="article">
<div class="figure">
<img>
<div class="figcaption"></div>
</div>
</div>
</div>
<div id="footer"></div>
@mcabreradev
mcabreradev / common functions.js
Created March 28, 2019 00:00
common functions
/*
isAnagram
Checks if a string is an anagram of another string (case-insensitive, ignores spaces, punctuation and special characters).
*/
const isAnagram = (str1, str2) => {
const normalize = str =>
str
.toLowerCase()
.replace(/[^a-z0-9]/gi, '')
@mcabreradev
mcabreradev / tmux-cheatsheet.markdown
Created December 11, 2018 20:39 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname