Skip to content

Instantly share code, notes, and snippets.

View vasanthk's full-sized avatar

Vasa vasanthk

View GitHub Profile
@emilong
emilong / component.jsx
Created May 27, 2016 20:35
Creating semantic links for react-router using HOCs
import React, { Component } from 'react'
import { SubWidgetLink } from './routes'
export default class MyComponentWithALink extends Component {
render() {
const { widget } = this.props
return (
<div>
...

cf-ui monorepo

Technical Decision

Build our UI framework inside a monorepo using Lerna.

TL;DR

Building npm packages across many individual repos make big changes difficult to make, test, and publish. Using a monorepo we can solve many of these and

@vmayakumar
vmayakumar / Redux.java
Last active January 20, 2017 16:34
Redux Java
class Action {
private String type;
private Object data;
public Action(String type, Object data) {
this.type = type;
this.data = data;
}
public String getType() {

Broken Promises

Technical Decision

Eliminate all promises from application.

TL;DR

The Promise API is the source of many confusing errors in our application, using node style callbacks eliminates the issue without reducing code quality.

@didi0613
didi0613 / update-app-to-react15.5.md
Last active May 30, 2017 20:22
Update to React 15.5

Update App to React 15.5

Pre Upgrade Steps

  1. Run a gulp build and take note of the bundle sizes.
  2. Make sure your dependencies/components are using component-archetype version13 and above.

React Code Changes

  1. Replace the following in your application/components:
import React, { Component } from 'react'
import logo from './logo.svg'
import './App.css'
import { Route, Link, Redirect } from './Zero'
const paths = [ 'one', 'two', 'three' ]
class App extends Component {
render() {
// Have some complicated non-React widgets that manipulate DOM?
// Do they manage a list of DOM elements? Here's how to wrap it
// into a React component so you can "constantly rerender" it.
// A dumb non-react widget that manually manage some DOM node that
// represent a list of items
function NonReactWidget(node) {
this.node = node;
}
@rauschma
rauschma / es6_influences.md
Last active April 8, 2018 02:26
ECMAScript 6 influences

Technologies that influenced ES6 features:

  • Generators: Python
  • Arrow functions: CoffeeScript
  • const: C++ (the latest C standard has borrowed it from C++)
  • let: is old, became popular via BASIC.
    • Also frequently appears in functional programming languages (Lisp, ML, etc.), but creates immutable bindings there.
  • Template literals: E (quasi literals)
  • Destructuring: Lisp (destructuring bind)
  • Modules: CommonJS, AMD
@lazywithclass
lazywithclass / blog-post.md
Last active July 30, 2018 05:23
On tests, take home problems, and a HackerRank bookmarklet

On tests, take home problems, and a HackerRank bookmarklet - lazyblog

So recently I've been interviewing and as you can imagine that means doing take home problems and online tests.

I am not pointing fingers (so please continue hiring me lol), I am addressing the problem in the industry, because almost everyone is doing it in the same way, so you could say no one is directly responsible. Even though willingness to have a better process should be a thing.

@gaearon
gaearon / LinkThatWorksWithRedux.js
Last active November 21, 2018 03:31
Drop-in replacement for React Router <Link> that works with React Redux optimizations (https://github.com/reactjs/react-router/issues/470)
// While I claim this is a drop-in replacement, it is a little bit slower.
// If you have hundreds of links, you might spend a few more milliseconds rendering the page on transitions.
// KNOWN ISSUES WITH THIS APPROACH:
// * This doesn't work great if you animate route changes with <TransitionGroup>
// because the links are going to get updated immediately during the animation.
// * This might still not update the <Link> correctly for async routes,
// as explained in https://github.com/reactjs/react-router/issues/470#issuecomment-217010985.