Skip to content

Instantly share code, notes, and snippets.

View DanSmaR's full-sized avatar
🏠
Working from home

Danilo Martins DanSmaR

🏠
Working from home
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Using the URL object</title>
<style>
figure img {
max-width: 300px;
height: auto;
@DanSmaR
DanSmaR / headers.html
Created September 1, 2022 16:33 — forked from prof3ssorSt3v3/headers.html
Code from the video about why fetch headers matter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Request Headers</title>
<style>
html {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,

Render With Router

import React from 'react';
import { Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import { render } from '@testing-library/react';

const renderWithRouter = (component) => {
  const history = createMemoryHistory();

Checklist do react-redux

Antes de começar

  • pensar como será o formato do seu estado global
  • pensar quais actions serão necessárias na sua aplicação

Instalação

  • npm i redux react-redux;
  • npm i redux-devtools-extension;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Lexical Scope and `this`</title>
</head>
<body>
<header>
<h1>What the Lexical is <code>this</code>?</h1>
[{
"id":123,
"title":"Bell",
"desc":"Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
"img":"bell-lg.png",
"price":12.34
},{
"id":456,
"title":"Bullhorn",
"desc":"Quisquam, veritatis, officia. Veritatis, saepe!",
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Shopping Cart</title>
<meta name="viewport" content="width=device-width">
<style>
*{
padding: 0;
margin: 0;
@DanSmaR
DanSmaR / hello.txt
Created June 6, 2022 15:13 — forked from prof3ssorSt3v3/hello.txt
Code from YouTube video about Error First Callbacks
Hey there!
Guten Tag.
Hur mår du?
@DanSmaR
DanSmaR / finally.html
Created June 6, 2022 13:55 — forked from prof3ssorSt3v3/finally.html
Promise.prototype.finally
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Promise.finally</title>
<style>
html {
font-size: 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
const isMoreThan5 = number => number > 5
const numbers = [ 2, 4, 8, 9 ]
const result = filter(isMoreThan5, numbers)
const addThree = number => number + 3
const result = map(addThree, numbers)
result
function map(transform, array) {
const initialArray = []
const mapReducer = (mappedArray, currentItem) =>