Skip to content

Instantly share code, notes, and snippets.

View czarnega's full-sized avatar
👷‍♂️
reticulating splines

Colin Zarnegar czarnega

👷‍♂️
reticulating splines
View GitHub Profile
@czarnega
czarnega / info.plist
Created August 3, 2016 22:59
React-Native Socket.io
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
@czarnega
czarnega / fileStructure.txt
Last active August 3, 2016 21:21
Introduction to React-Native
├── android
│   ├── app
│   ├── build.gradle
│   ├── gradle
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── keystores
│   └── settings.gradle
├── app
@czarnega
czarnega / .eslintrc
Last active July 28, 2016 22:29
Getting started with testing and linting
{
"parser" : "babel-eslint",
"extends" : [
"airbnb"
],
"plugins": [
"babel"
],
"ecmaFeatures": {
"jsx": true
@czarnega
czarnega / actionsIndex.js
Last active June 9, 2016 17:33
React-Router Example
export function signinUser({ email, password }) {
return function(dispatch) {
axios.post(`${ROOT_URL}/signin`, { email, password })
.then((response) => {
dispatch({ type: AUTH_USER });
browserHistory.push('/feature');
})
.catch((error) => {
});
@czarnega
czarnega / redux-promise.js
Created June 9, 2016 16:52
Redux-Promise action creator example
export const loadUserData = (uid) => {
const request = axios.get(`/users/${uid}`);
return {
type: LOAD_USERDATA,
payload: request
};
}
@czarnega
czarnega / redux-saga.js
Created June 9, 2016 16:44
Redux-Saga action creator example
export function* loadUserData(uid) {
try {
yield put({ type: USERDATA_REQUEST });
let { data } = yield call(request.get, `/users/${uid}`);
yield put({ type: USERDATA_SUCCESS, data });
} catch(error) {
yield put({ type: USERDATA_ERROR, error });
}
}
@czarnega
czarnega / redux-thunk.js
Created June 9, 2016 16:44
Redux-Thunk action creator example
export const loadUserData = (uid) => async (dispatch) => {
try {
dispatch({ type: USERDATA_REQUEST });
let { data } = await request.get(`/users/${uid}`);
dispatch({ type: USERDATA_SUCCESS, data });
} catch(error) {
dispatch({ type: USERDATA_ERROR, error });
}
}
@czarnega
czarnega / index.js
Created June 9, 2016 04:58
Adding Redux Devtools as middleware
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
const createStoreWithMiddleware = applyMiddleware(reduxThunk)(createStore);
const store = createStoreWithMiddleware(reducers,window.devToolsExtension ? window.devToolsExtension() : f => f);
ReactDOM.render(