Skip to content

Instantly share code, notes, and snippets.

View brunormferreira's full-sized avatar
:octocat:
coding and learning

Bruno Ramires brunormferreira

:octocat:
coding and learning
View GitHub Profile
import {
Component,
OnInit,
Input,
HostBinding,
AfterContentInit,
SimpleChanges
} from "@angular/core";
import { css } from "emotion";
import { BehaviorSubject } from "rxjs/internal/BehaviorSubject";

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@adrianlemess
adrianlemess / Code snippets.md
Last active December 27, 2019 17:42
Angular Awesome List

Snippets

Component:

  • HTML
<div *ngIf="item.length > 0">
@diego3g
diego3g / settings.json
Last active May 7, 2024 17:38
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {
@LucasCalazans
LucasCalazans / usememo-example.js
Last active April 22, 2022 20:22
useMemo example
const categories = useMemo(() => {
return products.reduce((categories, { category }) => {
return !category || categories.find(({ id }) => category && category.id === id)
? categories
: [
...categories,
{
id: category.id,
value: category.id,
label: category.title,
module.exports = {
env: {
browser: true,
es6: true,
jest: true,
},
extends: [
'react-app',
'airbnb',
'plugin:@typescript-eslint/recommended',
@codediodeio
codediodeio / print.js
Last active February 9, 2024 14:11
print
export const print = (v) => {
const el = document.createElement('h3');
el.innerText = '🔵 ' + v;
document.body.appendChild(el);
}
@astoilkov
astoilkov / readme.md
Last active March 13, 2024 10:19
Async Operations with useReducer Hook

Async Operations with useReducer Hook

9 March, 2019

We were discussing with @erusev what we can do with async operation when using useReducer() in our application. Our app is simple and we don't want to use a state management library. All our requirements are satisfied with using one root useReducer(). The problem we are facing and don't know how to solve is async operations.

In a discussion with Dan Abramov he recommends Solution 3 but points out that things are fresh with hooks and there could be better ways of handling the problem.

Problem

{
// Define o tema do VSCode
"workbench.colorTheme": "Dracula",
// Configura tamanho e família da fonte
"editor.fontSize": 18,
"editor.lineHeight": 24,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
@gaearon
gaearon / MyResponsiveComponent.js
Created November 1, 2018 10:05
Examples from "Making Sense of React Hooks"
function MyResponsiveComponent() {
const width = useWindowWidth(); // Our custom Hook
return (
<p>Window width is {width}</p>
);
}