react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);
2) get requireAccess func => bindCheckAuth to redux
react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);
2) get requireAccess func => bindCheckAuth to redux
// UserStore.js | |
import { EventEmitter } from 'events'; | |
import assign from 'object-assign'; | |
var events = new EventEmitter(); | |
var CHANGE_EVENT = 'change'; | |
var state = { | |
user: null |
function yoloREST(resourceName, controller) { | |
var express = require('express'); | |
var app = express(); | |
app.get(`/${resourceName}/:id`, controller.show); | |
app.get(`/${resourceName}`, controller.index); | |
app.put(`/${resourceName}/:id`, controller.update); | |
app.post(`/${resourceName}`, controller.create); | |
return app; | |
} |
var ENV = { | |
modulePrefix: 'frontend', | |
environment: environment, | |
baseURL: '/', | |
locationType: 'auto', | |
EmberENV: { | |
FEATURES: { | |
// Here you can enable experimental features on an ember canary build | |
// e.g. 'with-controller': true | |
} |
The single hardest part of front-end development at scale is making changes to code and understanding all of the visual and behavioral effects that will occur as a result.
When you build a component, tests should be written that expose each state a component can be in. This test should generate a static html file and a corresponding image for every discrete state a component can be in.
Hi Nicholas,
I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:
The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't
class RecipeCreator | |
attr_reader :recipe | |
def initialize(params) | |
@recipe = Recipe.new(params) | |
end | |
def save | |
saved = recipes.save | |
There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.
All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.
What do these lines do? Make predictions and then scroll down.
func print(pi *int) { fmt.Println(*pi) }
$.fn.center = function () { | |
this.css("position","absolute"); | |
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px"); | |
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px"); | |
return this; | |
} |
require('font-awesome/css/font-awesome.css'); | |
document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>'; |