- Clear feature ownership
- Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
This file contains hidden or 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
class App extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
joined: false, | |
nickname: "", | |
email: "", | |
msg: "", | |
messages: {}, | |
}; |
This file contains hidden or 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
# Platzi - Reto 8 Diciembre 23 | |
# @author: @israellias | |
# ruby_version: 2.5.3 | |
#regalaconocimiento | |
module Model | |
class Box < Struct.new(:name, :money, :weight) | |
end | |
class Combination < Struct.new(:boxes) |
This file contains hidden or 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 withData from '@/lib/withData' | |
import { ApolloClient } from 'apollo-boost' | |
import App, { AppProps, Container } from 'next/app' | |
import { ApolloProvider } from 'react-apollo' | |
export default withData( | |
class extends App<MyAppProps> { | |
public static async getInitialProps({ Component, ...ctx }) { | |
let pageProps = {} |
This file contains hidden or 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 express = require('express'); | |
const next = require('next'); | |
const LRUCache = require('lru-cache'); | |
const port = parseInt(process.env.PORT, 10) || 3000; | |
const dev = process.env.NODE_ENV !== 'production'; | |
const app = next({dev}); | |
const handle = app.getRequestHandler(); | |
// This is where we cache our rendered HTML pages |
This file contains hidden or 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
// NOTE: you will NOT write code like this when using suspense | |
// instead, you'll use react-cache (not yet officially published) | |
// it'll handle things like pre-loading, handling rapid re-renders, etc. | |
const cache = {} | |
function FetchPokemon({pokemonName}) { | |
const pokemon = cache[pokemonName] | |
if (!pokemon) { | |
const promise = fetchPokemon(pokemonName).then( |
This file contains hidden or 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 ReactDOM from 'react-dom'; | |
import App from './App/App'; | |
import './index.css'; | |
const render = () => { | |
ReactDOM.render(<App />, document.getElementById('root')); | |
} | |
if ( |
This file contains hidden or 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 jwt from "jsonwebtoken"; | |
import User from "@server/models/user_model"; | |
const PRODUCTION = process.env.NODE_ENV === "production"; | |
export default (options) => async (req, res, next) => { | |
const refreshToken = req.cookies["refresh_token"]; | |
const accessToken = req.cookies["access_token"]; | |
const csrfHeader = req.get("X-Csrf-Token"); |
This file contains hidden or 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
#!/usr/bin/env node | |
const request = require('request'); | |
const AWS = require('aws-sdk'); | |
const rekognition = new AWS.Rekognition({ | |
// Detect moderation labels is available on AWS region us-east-1, us-west-2 and eu-west-1 | |
region: "us-west-2", | |
accessKeyId: "YOUR accessKeyId", | |
secretAccessKey: "YOUR secretAccessKey" |