Skip to content

Instantly share code, notes, and snippets.

@luizomf
luizomf / useReducer.jsx
Created February 16, 2021 19:11
React Hook useReducer - Curso React
import { useReducer } from 'react';
import './App.css';
const globalState = {
title: 'O título que contexto',
body: 'O body do contexto',
counter: 0,
};
const reducer = (state, action) => {
@luizomf
luizomf / useRef.jsx
Created February 16, 2021 15:00
React Hook useRef - Curso React
import P from 'prop-types';
import { useEffect, useMemo, useState, useRef } from 'react';
import './App.css';
const Post = ({ post, handleClick }) => {
console.log('Filho renderizou');
return (
<div key={post.id} className="post">
<h1 style={{ fontSize: '14px' }} onClick={() => handleClick(post.title)}>
{post.title}
@luizomf
luizomf / useMemo.jsx
Created February 16, 2021 01:11
React Hook useMemo - Curso React
import P from 'prop-types';
import { useEffect, useMemo, useState } from 'react';
import './App.css';
const Post = ({ post }) => {
console.log('Filho renderizou');
return (
<div key={post.id} className="post">
<h1>{post.title}</h1>
<p>{post.body}</p>
@luizomf
luizomf / useEffect.jsx
Created February 15, 2021 20:18
Exemplo de useEffect do Curso de React
import './App.css';
import { useState, useEffect } from 'react';
const eventFn = () => {
console.log('h1 clicado');
};
function App() {
const [counter, setCounter] = useState(0);
const [counter2, setCounter2] = useState(0);
@luizomf
luizomf / useState.jsx
Last active March 28, 2024 19:45
Exemplo de useState - Curso React.
import logo from './logo.svg';
import './App.css';
import { useState } from 'react';
function App() {
const [reverse, setReverse] = useState(false);
const [counter, setCounter] = useState(0);
const reverseClass = reverse ? 'reverse' : '';
const handleClick = () => {
@Therises
Therises / fix_mic_lenovo320.md
Last active May 14, 2024 17:21
Fix microphone on Lenovo IdeaPad 320 on Ubuntu 18.04

In /usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf and /usr/share/pulseaudio/alsa-mixer/paths/analog-input-mic.conf:

  • Under [Element Internal Mic Boost] set volume to zero.
  • Under [Element Int Mic Boost] set volume to zero.
  • Under [Element Mic Boost] set volume to zero

Find your source name from the following command; mine is alsa_input.pci-0000_00_1f.3.analog-stereo

  $ pacmd list-sources | grep 'name:.*input'

Edit /etc/pulse/default.pa and add the following lines, where INPUT_NAME is name of the input source from above step: