Skip to content

Instantly share code, notes, and snippets.

@devknoll
devknoll / resources.md
Last active August 29, 2015 14:21
Relay / GraphQL Resources
export default function CounterStore(state = initialState, action) {
switch (action.type) {
case INCREMENT_COUNTER:
return incremenent(state, action);
case DECREMENT_COUNTER:
return decremenent(state, action);
default:
return state;
}
}
class Flix extends Component {
constructor(props) {
super(props);
this.state = {
person: People[0],
};
}
_goToNextPerson() {
@devknoll
devknoll / test
Created July 19, 2012 00:52
test
test
interface IMyInterface
{
String Name { get; }
}
abstract class MyBaseClass : IMyInterface
{
// We MUST write this stub or it fails to compile for
// not implementing IMyInterface - despite being abstract.
public abstract String Name { get; }
project "Cabal"
language "C++"
kind "ConsoleApp"
files { "**.h", "**.inl", "**.cpp", "**.c" }
links { "Game", "ppapi_gles2", "ppapi" }
includedirs { "" }
targetextension ".pexe"
function __ZN5cabal9rendering19CalculateProjectionERKNS0_6CameraE($agg_result, $camera) {
;
var __label__;
var $1;
var $focalLength;
var $farToNear;
$1=$camera;
var $2=$1; //@line 38 "..\5CCabal/Rendering/Camera.h"
var $3=(($2+76)|0); //@line 38 "..\5CCabal/Rendering/Camera.h"
import React, { PropTypes } from 'react';
export default Counter = ({ counter = 0 }) => (
<div clicked={{ counter: counter + 1 }}>{counter}</div>
);
Counter.propTypes = {
counter: PropTypes.number
};
delegate Func<T1, T2> Recursive<T1, T2>(Recursive<T1, T2> r);
public static Func<T1, T2> Y<T1, T2>(Func<Func<T1, T2>, Func<T1, T2>> f)
{
return ((Recursive<T1, T2>)(g => n => f(g(g))(n)))(
g => n => f(g(g))(n));
}
var type = Class.New(new[] { typeof(ReactiveScreen), typeof(IHasState) }, cls => // Inherit from ReactiveScreen and implement IHasState.
{
var state = cls.Field<IObservable<string>>(); // Default to null.
cls.Property<IObservable<string>>(Modifier.Public, "State")
.Get(Modifier.Public, () => state.Get())
.Set(Modifier.Private, (value) => state.Set(value)); // TODO: INotifyPropertyChanged support...
cls.Function(Modifier.Public, "GetRandomNumber", () => 4); // Chosen by a fair dice roll. Guaranteed to be random.
});