This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| import Subapp from './subapp/Root' | |
| class BigApp extends Component { | |
| render() { | |
| return ( | |
| <div> | |
| <Subapp /> | |
| <Subapp /> | |
| <Subapp /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // connect() is a function that injects Redux-related props into your component. | |
| // You can inject data and callbacks that change that data by dispatching actions. | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| // It lets us inject component as the last step so people can use it as a decorator. | |
| // Generally you don't need to worry about it. | |
| return function (WrappedComponent) { | |
| // It returns a component | |
| return class extends React.Component { | |
| render() { | |
| return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { combineReducers } from 'redux'; | |
| import users from './reducers/users'; | |
| import posts from './reducers/posts'; | |
| export default function createReducer(asyncReducers) { | |
| return combineReducers({ | |
| users, | |
| posts, | |
| ...asyncReducers | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| var Child = React.createClass({ | |
| getInitialState: function(){ | |
| console.log('Child getInitialState'); | |
| return { value: 'start'} | |
| }, | |
| getDefaultProps: function(){ | |
| console.log('Child getDefaultProps'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { Field, reduxForm } from 'redux-form'; | |
| import { connect } from 'react-redux'; | |
| import * as actions from '../../actions'; | |
| const form = reduxForm({ | |
| form: 'ReduxFormTutorial', | |
| validate | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "presets": ["es2015", "react"] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // List all fonts on iPhone | |
| NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; | |
| NSArray *fontNames; | |
| NSInteger indFamily, indFont; | |
| for (indFamily=0; indFamily<[familyNames count]; ++indFamily) | |
| { | |
| NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]); | |
| fontNames = [[NSArray alloc] initWithArray: | |
| [UIFont fontNamesForFamilyName: | |
| [familyNames objectAtIndex:indFamily]]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // TestSwift | |
| // | |
| // Created by Jameson Quave on 6/2/14. | |
| // Copyright (c) 2014 JQ Software LLC. All rights reserved. | |
| // | |
| import UIKit | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // NSObject+Blocks.h | |
| // Filemator | |
| // | |
| // Created by Zachary Waldowski on 4/12/11. | |
| // Copyright 2011 Dizzy Technology. All rights reserved. | |
| // | |
| @interface NSObject (Blocks) |