This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Windows | |
# First thing, install android-studio | |
# Powershell | |
adb kill-server | |
adb -a nodaemon server start | |
# WSL2 (Ubuntu) | |
cd android | |
./gradlew assembleDebug # assembleRelease for release builds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
$arguments = "& '" + $myinvocation.mycommand.definition + "'" | |
Start-Process powershell -Verb runAs -ArgumentList $arguments | |
Break | |
} | |
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '" | |
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; | |
if ($found) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useDispatch } from 'react-redux'; | |
import { addToCart } from './cart-actions'; | |
const products = [ | |
{ | |
id: 1, | |
name: 'Coffe Bottle', | |
price: 29 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useSelector } from 'react-redux'; | |
function ProductList() { | |
const cart = useSelector(state => state.shop.cart); | |
return ( | |
<div> | |
{ | |
cart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { connect } from 'react-redux'; | |
function ProductList({ cart }) { // A prop cart foi injetada pelo HOC do React Redux | |
return ( | |
<div> | |
{ | |
cart | |
.map(cartProduct => ( | |
<h1 key={cartProduct.id}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const products = [ | |
{ | |
name: 'Disposable Mask', | |
price: 8.75, | |
category: 'Health' | |
}, | |
{ | |
name: 'Painkiller', | |
price: 2.35, | |
category: 'Health' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numbers = [5, 10, 15]; | |
const sum = numbers.reduce((sum, number) => sum + number, 0) | |
// sum = 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
import ReactDOM from 'react-dom'; | |
function App() { | |
const [count, setCount] = useState(0) | |
function incrementCount() { | |
setCount(count + 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createProduct({ name, price }) { | |
function getName() { | |
return name | |
} | |
function getPrice() { | |
return price | |
} | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createCart() { | |
const data = { | |
items: [] | |
} | |
function onItemAddedToCart() { | |
alert(`The cart has ${data.items.length} items`) | |
} | |
function addItem(item) { |
NewerOlder