Skip to content

Instantly share code, notes, and snippets.

View luisbd's full-sized avatar

Luis Belmonte Díaz luisbd

View GitHub Profile
@kdmadej
kdmadej / CamelCase.ts
Created February 12, 2021 15:22
TypeScript template string literal type casing
type DefaultSeparator = '_' | '-';
type CamelCase<S extends string, Separator extends string = DefaultSeparator, Beginning extends boolean = true>
= S extends `${infer Character}${infer Rest}`
? Character extends Separator
? `${CamelCase<Capitalize<Rest>, Separator, Beginning>}`
: `${Beginning extends true ? Lowercase<Character> : Character}${CamelCase<Rest, Separator, false>}`
: '';
// Example: type T = "awaBbbCcc"

#Effective Communication


Prepare the conversation.

  • Why are we having this conversation?
    Your time is valuable, other people's time is valuable. If you need to use this time, the least you can do is to prepare it. Things such as "what do you want to achieve?", "What info you need to give?", and all following...
  • What do you expect from the meeting?
    How many times do you go to a meeting without thinking what's the outcome you want from it?
  • Try to understand the audience.:
  • How can I get to my audience better?.
@svinkle
svinkle / a11y-react-live-coding-notes-links.md
Created October 17, 2018 13:26
Creating accessible React apps — a11yTOConf 2018 — Notes and Links
@tlakomy
tlakomy / jQuery>React.markdown
Last active August 17, 2022 12:08
Let's not forget about jQuery

In this talk I'd like to use 5 minutes of my time to explain to the audience why jQuery is simply way better than React.

  • Does React have a fadeIn() method? Nah, I don't think so. You need to install a react-transition-group package which weighs over 3GB.
  • Can you do $.get(https://stackoverflow.com/questions/12345/adding_two_numbers_javascript) in React? NOPE.
  • Remember React 3.3.1? Me neither, because they didn't make it. Meanwhile in jQuery land: https://code.jquery.com/jquery-3.3.1.min.js
  • Can you learn jQuery for free? Sure! Can you learn React for free? It'll be $500 USD and your left kidney for a conference ticket.

And many, many more.

(This is a completely serious lightning talk proposal, I promise.)

@rafaelrozon
rafaelrozon / mock_axios_storybook.jsx
Last active April 26, 2023 12:29
Mock Axios requests in Storybook
import React from 'react';
import { storiesOf } from '@storybook/react';
// 1. import axios and MockAdapter
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
// 2. create the mock
const mock = new MockAdapter(axios);
@BretFisher
BretFisher / docker-for-mac.md
Last active July 9, 2024 11:29
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@crizstian
crizstian / solid.js
Last active March 15, 2023 02:40
Code examples of SOLID principles for JavaScript
/*
Code examples from the article: S.O.L.I.D The first 5 priciples of Object Oriented Design with JavaScript
https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa#.7uj4n7rsa
*/
const shapeInterface = (state) => ({
type: 'shapeInterface',
area: () => state.area(state)
})
@wojteklu
wojteklu / clean_code.md
Last active July 17, 2024 05:49
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@paulirish
paulirish / what-forces-layout.md
Last active July 17, 2024 00:51
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent