Skip to content

Instantly share code, notes, and snippets.

View guifromrio's full-sized avatar

Guilherme Rodrigues guifromrio

View GitHub Profile
@guifromrio
guifromrio / stateless-component-typescript.tsx
Created May 4, 2017 23:44
How to write a React stateless (functional) component in TypeScript
import * as React from 'react'
const Button: React.StatelessComponent<{}> = ({children}) => (
<button
className="f4 br2 grow no-underline ph5 pv3 dib white bg-dark-pink bn shadow-3 w-100 w-auto-ns b">
{children}
</button>
)
export default Button
@guifromrio
guifromrio / stateless-component-typescript-error.tsx
Last active May 4, 2017 23:43
How to write a React stateless (functional) component in TypeScript
import * as React from 'react'
const Button = ({children}) => (
<button
className="f4 br2 grow no-underline ph5 pv3 dib white bg-dark-pink bn shadow-3 w-100 w-auto-ns b">
{children}
</button>
)
export default Button

VTEX Render - Straight to React

Production-ready Universal React Apps in 5 minutes

Publishing a fast, production-ready server side rendered React app takes a lot of effort. Platforms, build servers, CI, CD, CSS frameworks... So many choices, so little time.

VTEX Render is a web framework that let's you go "Straight to React"®. You just need an editor and a small CLI to sync your files. Updates are blazing-fast and it even does hot module replacement. By using GraphQL for data fetching, functional CSS for styling and a robust component library, developers create beautiful apps in hours, not weeks. Not only that: non-technical users can customize VTEX Render apps in a beautiful WYSIWYG interface.

VTEX Render is a refreshingly simple approach to building scalable web apps, fast.

Keybase proof

I hereby claim:

  • I am firstdoit on github.
  • I am firstdoit (https://keybase.io/firstdoit) on keybase.
  • I have a public key whose fingerprint is E635 402F DFAB 17A0 D560 C3AC A0DA EDB7 003A C77F

To claim this, I am signing this object:

_.chain(students)
.filter(isApproved)
.pluck('grades')
.flatten()
.min() // Can you guess what this does?
.value()
// 6
_.every(studentsByClass["A"], isApproved) // false
_.every(studentsByClass["B"], isApproved) // true
var studentGrades = _.pluck(studentsByClass["A"], 'grades')
// [[7.0, 6.9, 8.0], [5.0, 8.7, 3.7]] - not very useful
var grades = _.flatten(studentGrades)
// [7.0, 6.9, 8.0, 5.0, 8.7, 3.7]
average(grades)
// 6.55
var studentsByClass = _.groupBy(students, 'class')
// Same result! Neat.
var studentsByClass = _.groupBy(students, function (student) { return student.class })
/* {
"A": [
{ name: "John", grades: [7.0, 6.9, 8.0], class: "A" },
{ name: "Paul", grades: [5.0, 8.7, 3.7], class: "A" }
],
"B": [
{ name: "Luke", grades: [9.0, 8.2, 6.2], class: "B" },
{ name: "Mark", grades: [6.0, 9.0, 8.4], class: "B" }
]
_.pluck(approvedStudents, 'name')
// ["John", "Luke", "Mark"]