Skip to content

Instantly share code, notes, and snippets.

View freeman-lab's full-sized avatar

Jeremy Freeman freeman-lab

View GitHub Profile
@freeman-lab
freeman-lab / one-handed-keyboard-config.xml
Last active February 9, 2016 18:56
modified karabiner config to mimic the right-handed QWERTY behavior and layout of the matias one-handed keyboards
<root>
<item>
<!-- a discussion about this config was posted at https://groups.google.com/d/topic/osx-karabiner/4TdHyfImc-k,
and a version was posted in a gist at https://gist.github.com/emory/4c0aa3b41958f8960c95,
this version eliminates the notifications and has a more responsive modifier handling, and is right hand only-->
<name>matias style one-handed right half-QWERTY</name>
<identifier>right half-QWERTY</identifier>
<autogen>--KeyOverlaidModifier-- KeyCode::SPACE, KeyCode::VK_MODIFIER_EXTRA5, KeyCode::SPACE</autogen>
<!-- Top row -->
@freeman-lab
freeman-lab / index.js
Created February 16, 2016 00:07
using lightning scatter in js without the server
var scatter = require('lightning-scatter')
var el = document.body.appendChild(document.createElement('div'))
var viz = new scatter(el, {points: [[Math.random(), Math.random()], [Math.random(), Math.random()]]})
setInterval(function () {
viz.appendData({points: [[Math.random(), Math.random()], [Math.random(), Math.random()]]})
}, 50)
@freeman-lab
freeman-lab / experiment-runner.js
Last active March 1, 2016 01:04
redux-style experiment control system
// api
var task = require('2AFC')
var runner = require('runner')
var johnny = require('johnny-five')
var board = new johnny({type: 'arduino'})
var input = require('track-ball')(board, opts)
var output = require('lick-port')(board, opts)
@freeman-lab
freeman-lab / index.js
Created March 2, 2016 17:39
redux + hyperx + main-loop
var redux = require('redux')
var vdom = require('virtual-dom')
var hyperx = require('hyperx')
var hx = hyperx(vdom.h)
var reducer = require('./reducer')
var store = redux.createStore(reducer)
var item = function (state) {
function onclick () {
@freeman-lab
freeman-lab / morph.js
Last active March 2, 2016 23:07
input handling with virtual or morphing doms
var morphdom = require('morphdom')
var el1 = document.createElement('div')
el1.innerHTML = 'foo'
var el2 = document.createElement('div')
el2.innerHTML = 'bar'
var input1 = document.createElement('input')
var input2 = document.createElement('input')
@freeman-lab
freeman-lab / hyperx.js
Created March 4, 2016 03:02
hyperx.js
var vdom = require('virtual-dom')
var hyperx = require('hyperx')
var main = require('main-loop')
var hx = hyperx(vdom.h)
function list (items) {
return hx`<div>
<ul>${
items.map(function (item, i) {
return hx`<li>${item}</li>`
@freeman-lab
freeman-lab / stylex.md
Last active March 5, 2016 20:28
generic wrapper for assigning styles

goal

Generic wrapper for hyperx output that appends styles and supports state styles (:hover, :active, etc), should solve for both virtual-dom/h and bel (at least). Should be achievable with a tiny module. Basic styles are pretty easy, state styles are a bit trickier.

Prior art

  • radium "does the right thing" but is big and react-specific

Some discussion:

@freeman-lab
freeman-lab / random-neurofinder-algorithm.py
Last active June 8, 2016 18:49
example neurofinder algorithm : generates random regions
import json
from numpy import zeros, random, asarray, where, ones
from scipy.ndimage.morphology import binary_closing, binary_dilation
datasets = ['00.00.test', '00.01.test', '01.00.test', '01.01.test', '02.00.test', '02.01.test', '03.00.test', '04.00.test', '04.01.test']
dims = [500,500]
margin = 20
n = 200
@freeman-lab
freeman-lab / terrible-neurofinder-algorithm.py
Last active June 8, 2016 18:46
example neurofinder algorithm : uses a fixed two-pixel region for all neurons
import json
datasets = ['00.00.test', '00.01.test', '01.00.test', '01.01.test', '02.00.test', '02.01.test', '03.00.test', '04.00.test', '04.01.test']
submission = []
for dataset in datasets:
result = {'dataset': dataset, 'regions': [{'coordinates': [[0, 0], [0, 1]]}]}
submission.append(result)
@freeman-lab
freeman-lab / thunder-api.md
Last active March 31, 2016 14:23
draft thunder api docs

data types

images

count()

Explicit count of the number of items.

For lazy or distributed data, will force a computation.