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 / 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 / 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 / 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 / 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 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 / 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 / loading-sample-data.ipynb
Created November 17, 2015 21:52
Loading sample neuro data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@freeman-lab
freeman-lab / convert.py
Created November 5, 2015 13:37
Hack to split images along black gaps
from numpy import array
from thunder import Images, ThunderContext
tsc = ThunderContext.start()
rawpath = ''
savepath = ''
data = tsc.loadImages(rawpath, inputFormat='tif', nplanes=1)
@freeman-lab
freeman-lab / notes.md
Last active October 4, 2015 21:15
chrome @ home

Notes on compiling chromium using an EC2 cluster

This note lays out the machine specifications and configurations used to get a distributed Chome build working on cloud compute (in this case AWS EC2) using the icecc tool.

These links were a good starting point:

but I couldn't fine a full walk through, so hopefully we can make it easier for others.

@freeman-lab
freeman-lab / lightning-for-loop.ipynb
Created September 5, 2015 04:25
Example using a for loop with Lightning in the notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.