Skip to content

Instantly share code, notes, and snippets.

View atticoos's full-sized avatar
🧑‍💻
building Rally

Atticus White atticoos

🧑‍💻
building Rally
View GitHub Profile
@atticoos
atticoos / enzyme-context.js
Created May 23, 2017 19:29
attempting to set `context` with Providers
test('monkey-patches `theme` into user defined context', () => {
const Child = glamorous.div((props, context) => ({
fontSize: context.theme.fontSize,
color: context.userTheme.color,
}))
Child.contextTypes = {
userTheme: PropTypes.object,
}
const context = {
@atticoos
atticoos / after.js
Last active May 17, 2017 23:05
glamorous-native before and after
import glamorous from 'glamorous-native'
const style = StyleSheet.create({
baseStyle: {
color: '#333',
// some other "base styles"
}
})
const Text = glamorous.text(
//
// AppDelegate.m
// RXTesting
//
// Created by Atticus White on 2/1/17.
// Copyright © 2017 Atticus White. All rights reserved.
//
#import "AppDelegate.h"
#import <ReactiveCocoa/ReactiveCocoa.h>
@atticoos
atticoos / a.js
Last active January 10, 2017 06:12
var count = 0;
function increment (amount) {
count = count + 1;
return count;
}
increment(1) // 1
increment(1) // 2
increment(1) // 3
@atticoos
atticoos / app.js
Last active January 10, 2017 02:55
const todoStore = new Store([]);
const add = newTodo => todos => todos.concat(newTodo);
const remove = oldTodo => todos => todos.filter(todo => todo !== oldTodo);
todoStore.subscribe(state => {
// rerender a UI with new state
console.log('next state', state);
})
import {createReducer} from 'rxjs-store';
const TodoActions = {
add: newItem => items => items.concat(newItem),
remove: oldItem => items => items.filter(item => item !== oldItem);
};
const todos = createReducer(TodoActions, []);
// Pass these to a <Provider /> and you're done
@atticoos
atticoos / map-custom-data-type.js
Last active January 7, 2017 01:03 — forked from ericelliott/map-custom-data-type.js
Map with custom data type
const double = n => n * 2;
const doublePoints = obj => double(obj.points);
const doubleMap = numbers => numbers.map(doublePoints);
console.log(doubleMap([
{ name: 'ball', points: 2 },
{ name: 'coin', points: 3 },
{ name: 'candy', points: 4}
@atticoos
atticoos / element.js
Last active December 6, 2016 04:33
a guess at something
import render from './render';
class Element extends React.Component {
render () {
return (
<span>[this.context.foobar}</span>
);
}
}
@atticoos
atticoos / asyn-redux-middleware.js
Last active September 23, 2016 17:21
Asynchronous action middleware example for Redux
const Status = {
REQUEST: 'requrest',
SUCCESS: 'success',
FAILURE: 'failure'
};
function requestAction (payload, type) {
return {
...payload,
status: Status.REQUEST,

Keybase proof

I hereby claim:

  • I am ajwhite on github.
  • I am atticoos (https://keybase.io/atticoos) on keybase.
  • I have a public key ASA-781KbuC64otQfuCRKhdnIYG4HyAhFtHIykiS3liNhAo

To claim this, I am signing this object: