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
| const nest = ({components: [Wrapper, ...rest] = [], props={}, children}) => rest | |
| ? nest({components: rest, props, children: <Wrapper {...props}>{children}</Wrapper> }) | |
| : <Wrapper {...props}>{children}</Wrapper> | |
| nest({components: [Wrapper1, Wrapper2]}) // <Wrapper2><Wrapper1/></Wrapper2> |
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 { ACTION1, ACTION2 } from './someAction' | |
| import { reducer } from 'alt-redux' | |
| export const name = "TODOS" | |
| const initialState = {} | |
| const store = reducer({ name, initialState }) | |
| store.on(ACTION1, (state, { foo, bar }) => ({...state, foo, bar })) | |
| store.on(ACTION2, (state, { baz }) => ({...state, baz })) |
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
| const STATUS_DRAFT = "STATUS_DRAFT" | |
| const STATUS_PUBLISHED = "STATUS_PUBLISHED" | |
| const STATUS_UNPUBLISHED = "STATUS_UNPUBLISHED" | |
| function createPost() { | |
| return { | |
| status: STATUS_DRAFT | |
| } | |
| } |
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
| Post = Draft | PublishedPost | UnpublishedPost | |
| publish :: Post -> PublishedPost | |
| PublishedPost | |
| unpublish :: Post -> UnpublishedPost | |
| UnpublishedPost |
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 { ACTION_PUBLISH, ACTION_UNPUBLISH } from "./actions" | |
| export const STATUS_DRAFT = "STATUS_DRAFT" | |
| export const STATUS_PUBLISHED = "STATUS_PUBLISHED" | |
| export const STATUS_UNPUBLISHED = "STATUS_UNPUBLISHED" | |
| const initialState = { | |
| status: STATUS_DRAFT | |
| } |
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
| public class Post { | |
| public enum PostStatus { | |
| PENDING, PUBLISHED, UNPUBLISHED | |
| } | |
| private PostStatus status; | |
| public void post() { | |
| this.status = PostStatus.PUBLISHED; |
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
| query Index { | |
| viewer { | |
| id | |
| ...FX | |
| } | |
| } | |
| fragment F0 on User { | |
| name | |
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 {createStore} from 'redux'; | |
| import {interceptingAction} from 'redux-intercepting-action'; | |
| import {createAction} from 'redux-actions'; | |
| import reducer from './reducers' | |
| const getInterceptingAction = (state)=> { | |
| if (state.good) { | |
| return { | |
| type: 'YAY' | |
| } |
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
| # The next command will install a [raring] based ubuntu | |
| # chroot, named [cinnamon] into the default directory | |
| # with the targets [core], [cli-extra], [touch], and [keyboard] | |
| sudo crouton -n cinnamon -r xenial -t core,cli-extra,touch,keyboard | |
| # Supply your new username and password like normal, and | |
| # once that finishes, enter the chroot with: | |
| sudo enter-chroot -n cinnamon |
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
| let obj = checkin | |
| do { | |
| console.log(Object.getOwnPropertyNames(obj)) | |
| } while ((obj = Object.getPrototypeOf(obj)) !== null) |