Skip to content

Instantly share code, notes, and snippets.

View rickharrison's full-sized avatar

Rick Harrison rickharrison

View GitHub Profile

I have a question around handling actions for asynchronous requests to an API. Imagine that you have a middleware, which will hit an API and fire off 3 actions as is common in best practice redux/flux. One for the initial request, one for success, and one for failure. Typically you can set a fetching flag and store an error if there is one.

Here is some basic example pseudo-ish code demonstrating this:

import {
  CREATE_FOO_REQUEST,
  CREATE_FOO_SUCCESS,
  CREATE_FOO_FAILURE
} from './actions';
@rickharrison
rickharrison / jekyll.nginxconf
Created September 2, 2013 07:41
Nginx server config with clean URLs for Jekyll.
server {
listen 80;
server_name www.yourdomain.com;
return 301 $scheme://yourdomain.com$request_uri;
}
server {
listen 80;
root /var/www/yourdomain.com;
@rickharrison
rickharrison / UIViewController.m
Created August 16, 2013 05:56
iOS 7 Messages Gradient Experimentation
//
// NRTRootViewController.m
// GradientTableView
//
// Created by Rick Harrison on 8/15/13.
// Copyright (c) 2013 Rick Harrison. All rights reserved.
//
#import "NRTRootViewController.h"