Skip to content

Instantly share code, notes, and snippets.

Avatar
🦈
give me a feedback https://entria.feedback.house/sibelius

Sibelius Seraphini sibelius

🦈
give me a feedback https://entria.feedback.house/sibelius
View GitHub Profile
@sibelius
sibelius / webpack.tailwind.js
Created Jul 30, 2021
webpack tailwind production config
View webpack.tailwind.js
const webpackCommonConfig = require("./webpack.config");
const { merge } = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { trimEnd } = require('lodash');
module.exports = merge(webpackCommonConfig, {
mode: 'production',
devtool: 'source-map',
optimization: {
@sibelius
sibelius / testRequest.ts
Created Jul 15, 2021
Test a request using fetch api
View testRequest.ts
import 'isomorphic-fetch';
const run = async () => {
const payload = {
field: 'value'
}
const options = {
method: 'POST',
headers: {
View response.mdx

As perguntas são muito mais relacionadas à graduação.

Você acha que o fato de possuir uma graduação na USP te ajudou? Em quais aspectos?

Todo conhecimento acaba te ajudando. Toda a minha base teórica me permite aprender coisas novas mais rapidamente.

Se você escolhesse não ir para a faculdade, você acha que estaria como?

Minha família é não é rica, acredito que a faculdade me deu confiança e que o diploma da USP me ajudou a conseguir o primeiro emprego.

@sibelius
sibelius / get_amount.php
Created Jun 8, 2021
save get amount in cents
View get_amount.php
public function get_amount($total)
{
return absint(
wc_format_decimal((float) $total * 100, wc_get_price_decimals())
); // In cents.
}
@sibelius
sibelius / connectionFromArray.ts
Created Jun 2, 2021
connectionFromArray helper for relay tests
View connectionFromArray.ts
export const connectionFromArray = <T extends any>(arr: T[] = []) => {
if (!arr || arr.length === 0) {
return {
edges: [],
count: 0,
pageInfo: {
hasNextPage: false,
hasPreviousPage: false,
},
};
View reactLearningPath.md
  • What is React props?
  • What is React state?
  • unidirectional data flow
  • how to create a React component
  • React hooks (useState, useEffect, and other basics ones)
  • Effects
  • How to handle event handlers (onClick)
  • React Context - share state for a subtree
  • Recoiljs
  • How to refactor a class component to hooks
@sibelius
sibelius / docusaurus.config.js
Created May 12, 2021
docusuarus webpack 5 plugin to provide node polyfills
View docusaurus.config.js
module.exports = {
plugins: [require.resolve('./sitePlugin')],
}
@sibelius
sibelius / webpackOutOfMemory
Created May 12, 2021
webpack out of memory log
View webpackOutOfMemory
<--- Last few GCs --->
[78256:0x1046a1000] 10278374 ms: Scavenge (reduce) 3281.8 (3608.9) -> 3281.0 (3609.9) MB, 48.5 / 0.0 ms (average mu = 0.374, current mu = 0.659) task
[78256:0x1046a1000] 10290930 ms: Mark-sweep (reduce) 3281.3 (3608.9) -> 3280.5 (3535.9) MB, 8740.3 / 0.1 ms (+ 6465.8 ms in 19137 steps since start of marking, biggest step 264.9 ms, walltime since start of marking 23412 ms) (average mu = 0.374, current
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x1012da6a5 node::Abort() (.cold.1) [node/v14.16.1/bin/node]
2: 0x1000a6309 node::Abort() [node/v14.16.1/bin/node]
@sibelius
sibelius / suspenseErrors.ts
Created May 7, 2021
Suspense Code with Errors
View suspenseErrors.ts
import { Suspense, useState, useEffect } from 'react';
const SuspensefulUserProfile = ({ userId }) => {
const [data, setData] = useState({});
useEffect(() => {
fetchUserProfile(userId).then((profile) => setData(profile));
}, [userId, setData])
return (
<Suspense>
<UserProfile data={data} />
@sibelius
sibelius / react-google-login.mock.ts
Created May 4, 2021
react-google-login jest mock
View react-google-login.mock.ts
jest.mock('react-google-login', () => {
const defaultMockSuccess = {
tokenId: 'tokenId',
};
const GoogleLogin = ({ onSuccess, buttonText }) => {
const handleClick = () => {
onSuccess(defaultMockSuccess);
};