Skip to content

Instantly share code, notes, and snippets.

@antonycourtney
antonycourtney / FruitFragments.as
Last active August 29, 2015 14:11
Some Fruit layout code
-- Apply an affine transform (passed as static arg)
-- to any GUI:
transformGUI :: Transform -> GUI b c -> GUI b c
transformGUI tf g = proc (inp, b) ->
(pic, c) <- g -< (inverse tf %$ inp, b)
returnA -< (tf %$ pic, c)
-- Dynamic version of TransformGUI
-- Takes Transform input signal instead of
-- static arg:
@antonycourtney
antonycourtney / TimingTest.scala
Created March 23, 2015 23:04
Breeze MultivariateGaussian Timing Test
import breeze.linalg._
import breeze.math._
import breeze.stats.distributions._
object TimingTest {
def timeIt[R](block: => R): R = {
val t0 = System.nanoTime()
val result = block // call-by-name
@antonycourtney
antonycourtney / keybase.md
Created July 16, 2015 14:28
Keybase verification

Keybase proof

I hereby claim:

  • I am antonycourtney on github.
  • I am antonycourtney (https://keybase.io/antonycourtney) on keybase.
  • I have a public key whose fingerprint is AB91 EB05 4FD6 D49C 7823 CACA F085 C3EC E772 A21D

To claim this, I am signing this object:

@antonycourtney
antonycourtney / Conference Form.md
Last active August 29, 2015 14:25
Proposed requirement for peer-reviewed conference papers

Source Code and Data Set Availability

Papers published as part of this conference form part of the scientific record. As such, authors are expected to make all data sets, source code and related artifacts needed to reproduce the published results publicly available.

In rare cases papers may be accepted that do not meet this criteria. These papers must include a standard disclaimer on the title page (given below).

Please select one of the following:

@antonycourtney
antonycourtney / todoItem.js
Last active October 19, 2015 02:00
An individual TODO list item as an Immutable Record
/**
* todoItem.js - An individual item in the TODO list as an Immutable record
*/
export default class TodoItem extends Immutable.Record({
id: '',
complete: false,
text: ''
}) {
constructor(text,complete = false) {
super({id: genID(), text, complete});
@antonycourtney
antonycourtney / todoAppState.js
Last active October 19, 2015 02:34
Purely functional data structure for Todo list application state
/**
* todoAppState.js -- Application State for TodoMVC as
* an immutable record
*/
export default class TodoAppState extends Immutable.Record({
todoItems: Immutable.Map() // map from id to TodoItem
}) {
/**
* functional item update -- returns a new state with the given item included in the
* set of todo items. If there is an existing entry for item.id, the result state
@antonycourtney
antonycourtney / todoAppStatic.React.js
Last active October 19, 2015 02:36
top level app component for static version of app
/**
* todoApp.React.js -- top-level React component for TodoMVC
*/
export default class TodoApp extends React.Component {
render() {
const appState = this.props.appState;
const allTodos = appState.getAll();
return (
<div>
<Header />
@antonycourtney
antonycourtney / viewTest.js
Last active October 19, 2015 02:38
Test of static version of views
/**
* viewTest.js -- render TodoApp component with static test data
*/
const item0 = new TodoItem('This is a test item');
const state0 = new TodoAppState();
const todoAppState = state0.addItem(item0);
React.render(
<TodoApp appState={todoAppState} />,
document.getElementById('todoapp')
@antonycourtney
antonycourtney / TodoApp.React.js
Last active October 19, 2015 02:36
Top level View component for TodoMVC app
/**
* todoApp.React.js -- top-level React component for TodoMVC
*/
export default class TodoApp extends React.Component {
render() {
const appState = this.props.appState;
const allTodos = appState.getAll();
return (
<div>
<Header stateRefUpdater={this.props.stateRefUpdater} />
@antonycourtney
antonycourtney / Header.react.js
Last active October 19, 2015 02:49
React Header component for oneref-todomvc
/**
* Header.react.js -- React component for TodoMVC Header UI
*/
import React from 'react';
import TodoTextInput from './TodoTextInput.react';
import * as TodoActions from '../todoActions';
export default class Header extends React.Component {
render() {
return (