Skip to content

Instantly share code, notes, and snippets.

View fuyi's full-sized avatar
🎯
Focusing

YI FU fuyi

🎯
Focusing
  • Stockholm, Sweden
View GitHub Profile
@fuyi
fuyi / normalize-denormalize.md
Last active January 12, 2017 12:54
Model normalize/denormalize flow

Flow

  1. Define nested Schema
  2. Saga middleware detect a _REQUEST Action, which trigger a API request
  3. API request success trigger a _REQUEST_SUCCESS Action, api client get API response, map it with model to be normalized to, if the match found, normalizer flatten the nested JSON objects into flat entities structure, then send to store
  4. Redux store puts the normalized entities in place automatically
  5. ?? We need to manually update associated key to parent object, can this be automated?
  6. When passing data from Store to Container, we denormalize the objects by recursively looking into the key -> object mapping, reassemble the parent object. If any child object is missing, we report a error in console
@fuyi
fuyi / new_gist_file.md
Last active September 23, 2015 12:23
Halo 2.0 Web Frontend Architecture Spec

Objective

  • Enterprise grade system
  • High performance
  • Decouple frontend and backend
  • Easy to maintain (decoupled module), reduced complexity
  • Easy to scale
  • Highly resuable components
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')