Skip to content

Instantly share code, notes, and snippets.

View iandanforth's full-sized avatar

Ian Danforth iandanforth

View GitHub Profile
@iandanforth
iandanforth / GoalDirectedSensoryMotorLearning
Last active August 29, 2015 13:57
Thoughts on how Goals are associated with, and eventually drive behavior.
There is almost always a goal
A goal needs to be able to *start* or *modify* behavior.
The spatial representation is a concatenation of senses and intended movement
At some level that combination needs to be represented uniquely. Aka few enough possibilities to represent them all.
When a goal is achieved the behavior that led to it needs to be reinforced.
@iandanforth
iandanforth / GoalDirectedBehaviorInCLA
Last active August 29, 2015 13:57
A detailed example of how a Goal can influence behavior in CLA
The answer is to allow cells that are both *predicted* and *desired* to become
active. Not just put into a predictive state.
Let me illustrate.
Let's say you have a world with three rooms in a row with letter labels:
ABC
In this world you have a creature that can go Left, go Right, or Stay where it
@iandanforth
iandanforth / pixymoninstall.md
Last active August 29, 2015 14:04
How to Install PixyMon (Pixy / CMUCam5 GUI) on Ubuntu 14.04

Install the stable version of PixyMon

cd ~/
mkdir pixy
cd pixy
wget http://cmucam.org/attachments/download/1007/pixymon_src-0.1.49.tar.gz
tar xvfz pixymon_src-0.1.49.tar.gz 
cd pixymon-0.1.49/
sudo cp pixy.rules /etc/udev/rules.d/

sudo apt-get install -y build-essential qt4-qmake uic-qt4 libqt4-dev-bin libqt4-dev libusb-1.0-0-dev

@iandanforth
iandanforth / gist:68b59a4c6c5fc789791a
Last active August 29, 2015 14:20
Error - backbone - Synchronous XMLHttpRequest on the main thread is deprecated
Descriptions:
ready event fires twice
backbone router runs twice
router won't render sub-pages
Long description:
My backbone app wouldn't render any pages that were not at the root of the
tree. For example /robots would render fine but /robots/id/1 would not.
@iandanforth
iandanforth / iteritems.sublime-snippet
Last active August 29, 2015 14:23
Sublime Snippet: JavaScript functional equivalent of Python's dict.iteritems() or dict.items()
<snippet>
<content><![CDATA[for (var ${20:key} in ${1:Thing}) {
if (${1:Thing}.hasOwnProperty(${20:key})) {
var ${300:val} = ${1:Thing}[${20:key}];
${4000}
}
};]]></content>
<tabTrigger>for</tabTrigger>
<scope>source.js</scope>
<description>for key, val in object</description>
@iandanforth
iandanforth / wtfdiv.md
Last active August 29, 2015 14:28
Where the F#$K is my div?!

So you're trying to build a nice slide-in menu. Something that shows up from the bottom of your app when a user clicks a menu button. Here are a collection of things I wish I had known a few hours ago.

You can't do this with just CSS (or you shouldn't)

You need to have a bit of JavaScript to change a class on the element you're trying to animate.

You need a position: relative parent, a regular child div, and a position: absolute child with left and bottom set.

If you don't have a position: relative parent, your absolutely positioned div (the one you want to slide on screen) may not

@iandanforth
iandanforth / botoBatchWrappers.py
Created April 30, 2012 23:00
Boto DynamoDB batch_write and batch_get wrappers. Overcomes 25 and 100 item limits respectively.
def unlimitedBatchRead(logger, db, keys):
'''
Takes a list of N keys and breaks it into requests of 100 keys or less.
This is the max per call key count as imposed by Amazon.
* db - A boto Table object
* keys - A list of item hash keys
'''
conn = db.layer2
finalItems = []
@iandanforth
iandanforth / medianflowtracker.py
Last active December 16, 2015 18:00
This is a revision of mftrack.py by jayrambhia from here: https://github.com/jayrambhia/MFTracker
##############################################################################
# Full Imports
import time
import cv
import cv2
import sys
##############################################################################
# Partial Imports
from bb import getBB, getRectFromBB
@iandanforth
iandanforth / learningLoop.py
Last active December 16, 2015 20:29
Learning Loop - A simple bit of python code that illustrates biological style learning.
#!/usr/bin/python
import time
from random import randint
"""
#############################
Learning Loop
Our scenario is that of a simple creature in a very simple world.
@iandanforth
iandanforth / gist:5835609
Created June 22, 2013 02:35
Dynamixel Setup
'''
How to work with the AX1 Sensor
git clone git@github.com:iandanforth/pydynamixel.git
git checkout axs1
python setup.py install
'''
import dynamixel
import time