# Thebe

## Jupyter javascript plugin for static sites

A really simple example using the iruby Kernel:

    puts 'Hello, world!'

    require 'set' # Deals with a collection of unordered values with no duplicates

    # Include this module to make your class taggable. The names of the
    # instance variable and the setup method are prefixed with "taggable_"
    # to reduce the risk of namespace collision. You must call
    # taggable_setup before you can use any of this module's methods.
    module Taggable
      attr_accessor :tags

      def taggable_setup
        @tags = Set.new
      end

      def add_tag(tag)
        @tags << tag
      end

      def remove_tag(tag)
        @tags.delete(tag)
      end
    end

    IRuby.display IRuby.table({a:[11,12,13,14],b:[21,22,23],c:[31,32,33,34]})

    $stderr.puts 'Error!'

    Math.sqrt(2)

An plot example:

    require 'gnuplot'

    Gnuplot::Plot.new do |plot|
        plot.xrange '[-0.5:0.5]'
        plot.title  'Example plot'
        plot.ylabel 'x'
        plot.xlabel 'sin(1/x)'
        plot.samples 10000
        plot.data << Gnuplot::DataSet.new('sin(1/x)') do |ds|
            ds.with = 'lines'
            ds.linewidth = 2
        end
    end

Mathjax support built in:

\begin{align} \dot{x} & = \sigma(y-x) \ \dot{y} & = \rho x - y - xz \ \dot{z} & = -\beta z + xy \end{align}