Skip to content

Instantly share code, notes, and snippets.

@parse
parse / normalize-denormalize.md
Created Jan 12, 2017 — forked from fuyi/normalize-denormalize.md
Model normalize/denormalize flow
View normalize-denormalize.md

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
@parse
parse / circle.yml
Created Oct 12, 2016 — forked from dtran320/circle.yml
Yarn on CircleCI
View circle.yml
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash
override:
- yarn
post: # At least for me, it doesn't seem like `scripts` in `package.json` are being run, so you need to add them explicitly
- yarn run postinstall
@parse
parse / AppDelegate
Created Apr 2, 2013
Remove menu toolbar in keyboard on UIWebView. Credit to photokandyStudios
View AppDelegate
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
// Register for notification center
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
View test.lua
-- Code created by Kwik - Copyright: kwiksher.com
-- Version: 2.2.5
module(..., package.seeall)
function new()
local numPages = 3
local menuGroup = display.newGroup()
local dispose
local _W = 1536
local _H = 2048
@parse
parse / gist:5094464
Created Mar 5, 2013
Fox algorithm output
View gist:5094464
n = 1000
t = 1
Time: 0.000726, Threads used: 1
Time: 0.000699, Threads used: 1
View movieclip.lua
--
-- Abstract: animated sprite or "movieclip" library
-- This library assembles animation sequences from individual image files. For more advanced
-- texture memory handling, see the "sprite sheet" feature in Corona Game Edition.
--
-- Version: 2.01
--
-- Modified by Michael Hartlef, June 12th, 2010
-- Added setSpeed method, which sets the speed of animation.
@parse
parse / gist:4655433
Created Jan 28, 2013
Identify tall iOS devices (e.g. iphone 5) in Corona/Lua
View gist:4655433
isTall = ( "iPhone" == system.getInfo( "model" ) ) and ( display.pixelHeight > 960 )
@parse
parse / matrixmult.c
Created Jan 28, 2013
Simple matrix multiplication
View matrixmult.c
#include <stdio.h>
typedef struct {
int nrows, ncols;
float *data;
} matrix_t;
float constC(int i, int j, matrix_t A, matrix_t B) {
int k;
float res = 0.0;
View ehtml.erl
-module(ehtml).
%-compile(export_all).
-export([ehtml_expand/1]).
%%%Nicked from YAWS
%% ------------------------------------------------------------
@parse
parse / gol.erl
Last active Feb 23, 2016
Game of Life implementation in Erlang.
View gol.erl
-module(gol).
-export([gol/3,timer/1,cell/6]).
% Main program
gol(W,H,Alive) ->
frame:init(),
frame:set_head("Conway's Game of Life in Erlang"),
frame:set_foot("By Jonatan and Anders"),
frame:set_w(W),
frame:set_h(H),