Skip to content

Instantly share code, notes, and snippets.

Avatar

Antony Courtney antonycourtney

View GitHub Profile
@antonycourtney
antonycourtney / FruitFragments.as
Last active Aug 29, 2015
Some Fruit layout code
View FruitFragments.as
-- 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 Mar 23, 2015
Breeze MultivariateGaussian Timing Test
View TimingTest.scala
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 Jul 16, 2015
Keybase verification
View keybase.md

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 Aug 29, 2015
Proposed requirement for peer-reviewed conference papers
View Conference Form.md

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 / Message.js
Created Oct 15, 2015
oneref-chat Message as Immutable Record
View Message.js
const Message = Immutable.Record({
id: '',
threadID: '',
threadName: '',
authorName: '',
text: '',
date: new Date(),
isRead: false
});
@antonycourtney
antonycourtney / Thread.js
Created Oct 15, 2015
oneref-chat message Thread
View Thread.js
/**
* Contents of a single conversation (message thread) sharing a common thread ID
*
* We use a SortedMap and add messages in chronological order
*/
export default class Thread extends Immutable.Record({
messageIdMap: Immutable.OrderedMap() // map from id to Message, ordered by date
}) {
/*
* add or update the message by its message id
View oneRef.js
import EventEmitter from 'events';
export class Ref extends EventEmitter {
constructor(v) {
super();
this._value = v;
}
getValue() {
@antonycourtney
antonycourtney / fillView.js
Created Oct 15, 2015
fillView action in oneref-flux-challenge
View fillView.js
/*
* fill view by generating more requests if necessary
*/
function fillView(st,updater) {
const lastSith = st.lastKnownSith();
if (st.needsApprentice(lastSith)) {
requestSithInfo(true,lastSith.info.apprenticeId,updater);
} else {
const firstSith = st.firstKnownSith();
if (st.needsMaster(firstSith)) {
@antonycourtney
antonycourtney / scrollAction.js
Created Oct 15, 2015
scroll action in oneref-flux-challenge
View scrollAction.js
export function scroll(scrollAmount,updater) {
updater((prevState) => {
const {nextState, oldRequests} = prevState.scrollAdjust(scrollAmount);
oldRequests.forEach((req) => req.abort()); // cancel old requests
// Need invokeLater since we're within updater
invokeLater(() => fillView(nextState,updater));
return nextState;
});
}
@antonycourtney
antonycourtney / todoItem.js
Last active Oct 19, 2015
An individual TODO list item as an Immutable Record
View todoItem.js
/**
* 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});
You can’t perform that action at this time.