tips to evolve as a developer
developers get stuck, paralized
https://www.oreilly.com/library/view/apprenticeship-patterns/9780596806842/ch04.html
Make It Stick https://www.amazon.com.br/Make-Stick-Science-Successful-Learning/dp/0674729013
| /* eslint-disable @typescript-eslint/ban-ts-comment */ | |
| // @ts-nocheck | |
| // Ripped from https://github.com/koajs/koa/blob/master/test/helpers/context.js | |
| // Solution courtesy of user @fl0w. See: https://github.com/koajs/koa/issues/999#issuecomment-309270599 | |
| // I've disabled type checking in this file but you are free to add types if you wish | |
| // if you want more comprehensive Koa Context object to test stuff like Cookies etc | |
| // then use https://www.npmjs.com/package/@shopify/jest-koa-mocks (requires Jest) |
| export const richTextToRelayRecordProxy = (bodyRichText, store) => { | |
| const bodyRichTextId = 'client:RichText:' + tempID++; | |
| const bodyRichTextRecord = store.create(bodyRichTextId, 'RichText'); | |
| bodyRichTextRecord.setValue(bodyRichText.text, 'text'); | |
| bodyRichTextRecord.setValue(bodyRichText.html, 'html'); | |
| const { contentState } = bodyRichText; | |
| if (contentState) { | |
| const contentStateId = 'client:DraftContentState:' + tempID++; |
| /* | |
| a = minProgress | |
| b = minResult | |
| c = maxProgress | |
| d = maxResult | |
| x = result | |
| y = progress | |
| y = (-ad + ax + bc - cx) / (b - d) |
| const path = require('path'); | |
| const webpack = require('webpack'); | |
| const WebpackNodeExternals = require('webpack-node-externals'); | |
| const ReloadServerPlugin = require('reload-server-webpack-plugin'); | |
| const cwd = process.cwd(); | |
| module.exports = { |
tips to evolve as a developer
developers get stuck, paralized
https://www.oreilly.com/library/view/apprenticeship-patterns/9780596806842/ch04.html
Make It Stick https://www.amazon.com.br/Make-Stick-Science-Successful-Learning/dp/0674729013
| const mutation = createEditSingleFieldMutation({ | |
| name: 'UserEditName', | |
| model: User, | |
| fieldName: 'title', | |
| fieldType: GraphQLString, | |
| clearCache: UserLoader.clearCache, | |
| notFoundMessage: ({ t }) => t('User not found'), | |
| successMessage: ({ t }) => t('User edited successfully'), | |
| outputFields: { | |
| user: { |
| export const initEnvironment = (records = {}) => { | |
| const network = Network.create(cacheHandler); | |
| const source = new RecordSource(records); | |
| const store = new Store(source, { | |
| // This property tells Relay to not immediately clear its cache when the user | |
| // navigates around the app. Relay will hold onto the specified number of | |
| // query results, allowing the user to return to recently visited pages | |
| // and reusing cached data if its available/fresh. | |
| gcReleaseBufferSize: 10, |
| import React, { useRef, useState } from 'react'; | |
| import { Typography } from '@material-ui/core'; | |
| import TextField from '@material-ui/core/TextField'; | |
| import CircularProgress from '@material-ui/core/CircularProgress'; | |
| import Autocomplete, { | |
| AutocompleteChangeDetails, | |
| AutocompleteChangeReason, | |
| AutocompleteProps | |
| } from '@material-ui/lab/Autocomplete'; |
| export const useStateCallback = (callback: Function) => { | |
| const [value, setValue] = useState(() => callback); | |
| const setCallback = useCallback((fn: Function) => { | |
| setValue(() => fn); | |
| }, [setValue] | |
| return [value, setCallback]; | |
| } |
| import { unstable_withSuspenseConfig, useState, useCallback } from 'react' | |
| // based on https://github.com/facebook/relay/commit/1befdc085bceef5c78f8eb8c2117459ce4b9d7c7#diff-c8dcd2c1e7d048e3b69a8538434cbca4 | |
| function useSuspenseTransition(config: {|timeoutMs: number|}) { | |
| const [isPending, setPending] = useState(false); | |
| const startTransition = useCallback( | |
| (callback: () => void) => { | |
| setPending(true); | |
| Scheduler.unstable_next(() => { |