snipdom

== ABOUT
Snipdom is a minimal live-coding environment. A Snipdom session starts
with the “bootstrap germ”, a fragment of GUI code (in your favorite
toolkit) that provides an input prompt with access to its own
namespace. The germ grows through “snippets”, which can be typed or
loaded into the prompt.

Snippets are big enough to copy/paste; small enough to grasp.

Snipdom is (not) Narrative IDE Programming Debugging Oxymoron Magic

Snipdom is a spirit of programming as much as it is any specific body of code.

Snipdom is characterised by:

brevity
clarity
pragmatism
open-endedness
hackability

== INSTALLATION

To begin, we use git to checkout the source repository. 

    % sudo apt-get install git-core
    % git clone git://git.snipdom.net/snipdom
    % cd snipdom

The germ requries python bindings to QT4:

    % sudo apt-get install python-qt4

You should now be able to run snipdom and minisnip:

    % python minisnip.py

Press ``enter'' to evaluate the code in the QLineEdit widget that is
displayed. The name of the widget is ``mini'', and you can in addition
to changing position, change and query other properties.

    dir(mini) # query for methods and attributes of mini
    mini.resize(800,30)
    mini.setFont(QtGui.QFontDialog.getFont()[0])
    mini.close()

Although minisnip.py is cute, we tend to use snipdom.py as a more
common starting point, as it allows multi-line editing and evaluation.

    % python snipdom.py

Snipdom is comprised of three widgets:
* ``snipdom'': the main widget that is displayed
* ``codeIn'': text entry point
* ``runButton'': button that executes the code within codeIn

Copy and paste the contents of jabber/loader.py into codeIn and
hit ``Run the code!''

##########
loadButton = QtGui.QPushButton("load snippet")

def loadIt():
    filename = QtGui.QFileDialog.getOpenFileName()
    if filename:
        codeIn.setPlainText(open(filename).read())

loadButton.clicked.connect(loadIt)

snipdom.insertWidget(0, loadButton)
##########

This gives you access to a file browser. When you select a snippet, it
is copied into codeIn, just like we copied the loader snippet into
codeIn.

Try out a few snippets to see what they do! snips/addWebView.py is a
good start. Some snippets are like conversations. Load
gstsnips/addVideoMix.py and hit ``run.'' Now the code you were looking
at is replaced by new code. Hit run again to see what happens.

One way to make a new snip is to use snips/startNewSnip.py. Load it
with the snipLoader as before and hit ``run.'' A template for a new
snippet should appear in codeIn. Change SESSION_NAME_HERE to whatever
you want your snippet to be called, and write something under ``#show
me the code!'' When you hit ``run,'' the first line will save the file
and the restof it will execute like any other snippet. Further
modifications are saved everytime the code runs.

There are a few more dependencies that some of the snippets
require. Install as many of them as you feel like!

    % sudo apt-get install python-numpy python-opengl \
      python-pygments python-qt4-phonon python-qt4-gl

All of the examples so far have used the QT4 germ, but the snipdom
idea is bigger than QT and maybe even bigger than python! A GTK
snipdom is in progress as well, and javascript is planned.

    % python gtkgerm/gtkminisnip.py
    % python gtkgerm/gtksnipdom.py

git clone git://git.numm.org/snipdom

snapshot: snipdom.zip

files