In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and
returning the cached result when the same
inputs occur again.
— wikipedia
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 type { NextPage } from 'next'; | |
import { getServerSidePropsPrivate } from '../../../middlewares/getServerSidePropsPrivate'; | |
const MyPrivatePage: NextPage = ({ me }) => { | |
// use me data | |
/* code goes here */ | |
}; | |
export const getServerSideProps = getServerSidePropsPrivate; |
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
oi Fusa |
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 { FormikProvider, useFormik } from 'formik' | |
import * as yup from 'yup' | |
import TextInputFormik from './TextInputFormik' | |
const ReactNativeFormikExample: React.FC<unknown> = (props) => { | |
const formik = useFormik({ | |
initialValues: { | |
name: '', |
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 readlineSync = require('readline-sync'); | |
function isValid1(answer) { | |
return answer === 'y' | |
} | |
function isValid2(answer) { | |
return Number(answer) >= 18 && Number(answer) <= 75 | |
} |
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
module.exports = { | |
presets: [ | |
'@babel/preset-react', | |
[ | |
'@babel/preset-env', | |
{ | |
targets: { | |
node: 'current', | |
}, | |
}, |
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 { promises } from "fs"; | |
import crypto from "crypto"; | |
import path from "path"; | |
import { print, parse } from "graphql"; | |
const plugin = { | |
name: "relay", | |
setup: build => { | |
build.onLoad({ filter: /\.tsx$/, namespace: "" }, async args => { | |
let contents = await promises.readFile(args.path, "utf8"); |
you should review every pull request of your team
- each pull request will make understand what everyone in your team is working on
- it will ensure you keep consistency of file location, and code patterns
- it will catch bugs/regression early on
- it will teach the best way to solve the problem
you should ensure consistency of the code base
you should pair programming with all devs of your team
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
export async function responseTime(ctx, next) { | |
const start = new Date(); | |
await next(); | |
const ms = new Date() - start; | |
ctx.set('X-Response-Time', ms + 'ms'); | |
} |
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 webpack = require('webpack') | |
const path = require('path') | |
const nodeExternals = require('webpack-node-externals') | |
const StartServerPlugin = require('start-server-webpack-plugin') | |
module.exports = { | |
entry: [ | |
'webpack/hot/poll?1000', | |
'./local/server' | |
], | |
watch: true, |