text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>PixieApp Publishing — PixieDust Documentation</title>
    <link rel="stylesheet" href="_static/better.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/custom.css" type="text/css" />

    <link rel="shortcut icon" href="_static/pd_icon.ico"/>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Release Notes" href="releasenotes.html" />
    <link rel="prev" title="Chart Sharing" href="chart-sharing.html" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

        PixieDust Documentation

PixieApp Publishing¶

The Publication Process

Once you have developed your PixieApp in a Jupyter Notebook, here's how you can publish it to the web

Click on the publish icon (the electric plug icon 🔌 in the upper-right corner) to deploy the PixieApp into the PixieGateway.

The Publish Configuration dialog contains the following panels:

Basic configuration info, such as server address, page title, and page icon. The only required field is the PixieGateway server location. You can simply enter it, and click the Publish button.

You can also view more details. The Imports pane contains a list of package dependencies (automatically detected by static code analysis).

And finally, you can view the Kernel Spec information.

If all goes well, you should see a dialog similar to the following:

Click on the provided link and start using the PixieApp as a regular web application.

Table Of Contents

Use PixieDust

Develop for PixieDust

PixieApps

PixieGateway

Install PixieGateway

Chart Sharing

PixieApp Publishing

Release Notes

Quick search

    <form class="search" action="search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Go" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

  © 2017, IBM.
      Created using Sphinx
      1.6.3.


text:
namespace libfoo {

    template<typename T>
    struct lifecycle_traits;

    template<>
    struct lifecycle_traits<foo_thing1_t> {
        using value_type = foo_thing1_t;
        static constexpr const auto& ctor = foo_thing1_create;
        static constexpr const auto& dtor = foo_thing1_destroy;
        using ctor_type = decltype(ctor);
        using dtor_type = decltype(dtor);
    };

    template<>
    struct lifecycle_traits<foo_thing2_t> {
        using value_type = foo_thing2_t;
        static constexpr const auto& ctor = foo_thing2_create;
        static constexpr const auto& dtor = foo_thing2_destroy;
        using ctor_type = decltype(ctor);
        using dtor_type = decltype(dtor);
    };

    template<typename T>
    struct traits {
        using lifecycle = lifecycle_traits<T>;
        using deleter_type = decltype(lifecycle::dtor);
        using unique_ptr = std::unique_ptr<typename lifecycle::value_type, deleter_type>;
    };

    template<typename T>
    using unique_ptr = typename traits<T>::unique_ptr;

    template<typename T, class... Args>
    unique_ptr<T> make_unique(Args&& ...args) {
        using lifecycle = typename traits<T>::lifecycle;
        using unique_ptr = unique_ptr<T>;
        return unique_ptr(lifecycle::ctor(std::forward<Args>(args)...), lifecycle::dtor);
    }

    template<typename T, class... Args>
    std::shared_ptr<T> make_shared(Args&& ...args) {
        using lifecycle = typename traits<T>::lifecycle;
        return std::shared_ptr<T>(lifecycle::ctor(std::forward<Args>(args)...), lifecycle::dtor);
    }

    class thing1_t {
    public:
        template<class... Args>
        explicit thing1_t(Args&& ...args)
            : _thing{make_unique<foo_thing1_t>(std::forward<Args>(args)...)} {};

        int value() const {
            return _thing->val;
        }

        void value(int value) const {
            _thing->val = value;
        }

    private:
        unique_ptr<foo_thing1_t> _thing;
    };

    class thing2_t {
    public:
        template<class... Args>
        explicit thing2_t(Args&& ...args)
            : _thing{make_unique<foo_thing2_t>(std::forward<Args>(args)...)} {};

        double value() const {
            return _thing->val;
        }

        void value(double value) const {
            _thing->val = value;
        }

        explicit operator foo_thing2_t* () {
            return base_type();
        }

        explicit operator const foo_thing2_t* () const {
            return base_type();
        }

        void print() const {
            foo_thing2_print(base_type());
        }

    private:
        foo_thing2_t* base_type() { return _thing.get(); }
        foo_thing2_t const* base_type() const { return _thing.get(); }

        unique_ptr<foo_thing2_t> _thing;
    };

} // namespace libfoo

int main(int argc, char* argv[]) {

    libfoo::thing1_t thing1;
    libfoo::thing2_t thing2_a{0.0};
    libfoo::thing2_t thing2_b{42};

    thing2_b.value(thing1.value() * thing2_a.value());
    assert(thing2_b.value() == 0.0);

    foo_thing2_print(static_cast<foo_thing2_t*>(thing2_b));
    thing2_b.print();

    return EXIT_SUCCESS;
}

redpajama_set_name: RedPajamaGithub


text:
namespace flash{
namespace text{

Void TextFormat_obj::__construct(::String font,Dynamic size,Dynamic color,Dynamic bold,Dynamic italic,Dynamic underline,::String url,::String target,::String align,Dynamic leftMargin,Dynamic rightMargin,Dynamic indent,Dynamic leading)
{
HX_STACK_PUSH("TextFormat::new","flash/text/TextFormat.hx",28);
{
	HX_STACK_LINE(30)
	this->font = font;
	HX_STACK_LINE(31)
	this->size = size;
	HX_STACK_LINE(32)
	this->color = color;
	HX_STACK_LINE(33)
	this->bold = bold;
	HX_STACK_LINE(34)
	this->italic = italic;
	HX_STACK_LINE(35)
	this->underline = underline;
	HX_STACK_LINE(36)
	this->url = url;
	HX_STACK_LINE(37)
	this->target = target;
	HX_STACK_LINE(38)
	this->align = align;
	HX_STACK_LINE(39)
	this->leftMargin = leftMargin;
	HX_STACK_LINE(40)
	this->rightMargin = rightMargin;
	HX_STACK_LINE(41)
	this->indent = indent;
	HX_STACK_LINE(42)
	this->leading = leading;
}
;
	return null();
}

TextFormat_obj::~TextFormat_obj() { }

Dynamic TextFormat_obj::__CreateEmpty() { return  new TextFormat_obj; }
hx::ObjectPtr< TextFormat_obj > TextFormat_obj::__new(::String font,Dynamic size,Dynamic color,Dynamic bold,Dynamic italic,Dynamic underline,::String url,::String target,::String align,Dynamic leftMargin,Dynamic rightMargin,Dynamic indent,Dynamic leading)
{  hx::ObjectPtr< TextFormat_obj > result = new TextFormat_obj();
	result->__construct(font,size,color,bold,italic,underline,url,target,align,leftMargin,rightMargin,indent,leading);
	return result;}

Dynamic TextFormat_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< TextFormat_obj > result = new TextFormat_obj();
	result->__construct(inArgs[0],inArgs[1],inArgs[2],inArgs[3],inArgs[4],inArgs[5],inArgs[6],inArgs[7],inArgs[8],inArgs[9],inArgs[10],inArgs[11],inArgs[12]);
	return result;}

TextFormat_obj::TextFormat_obj()
{
}

void TextFormat_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(TextFormat);
	HX_MARK_MEMBER_NAME(url,"url");
	HX_MARK_MEMBER_NAME(underline,"underline");
	HX_MARK_MEMBER_NAME(target,"target");
	HX_MARK_MEMBER_NAME(tabStops,"tabStops");
	HX_MARK_MEMBER_NAME(size,"size");
	HX_MARK_MEMBER_NAME(rightMargin,"rightMargin");
	HX_MARK_MEMBER_NAME(letterSpacing,"letterSpacing");
	HX_MARK_MEMBER_NAME(leftMargin,"leftMargin");
	HX_MARK_MEMBER_NAME(leading,"leading");
	HX_MARK_MEMBER_NAME(kerning,"kerning");
	HX_MARK_MEMBER_NAME(italic,"italic");
	HX_MARK_MEMBER_NAME(indent,"indent");
	HX_MARK_MEMBER_NAME(font,"font");
	HX_MARK_MEMBER_NAME(display,"display");
	HX_MARK_MEMBER_NAME(color,"color");
	HX_MARK_MEMBER_NAME(bullet,"bullet");
	HX_MARK_MEMBER_NAME(bold,"bold");
	HX_MARK_MEMBER_NAME(blockIndent,"blockIndent");
	HX_MARK_MEMBER_NAME(align,"align");
	HX_MARK_END_CLASS();
}

void TextFormat_obj::__Visit(HX_VISIT_PARAMS)
{
	HX_VISIT_MEMBER_NAME(url,"url");
	HX_VISIT_MEMBER_NAME(underline,"underline");
	HX_VISIT_MEMBER_NAME(target,"target");
	HX_VISIT_MEMBER_NAME(tabStops,"tabStops");
	HX_VISIT_MEMBER_NAME(size,"size");
	HX_VISIT_MEMBER_NAME(rightMargin,"rightMargin");
	HX_VISIT_MEMBER_NAME(letterSpacing,"letterSpacing");
	HX_VISIT_MEMBER_NAME(leftMargin,"leftMargin");
	HX_VISIT_MEMBER_NAME(leading,"leading");
	HX_VISIT_MEMBER_NAME(kerning,"kerning");
	HX_VISIT_MEMBER_NAME(italic,"italic");
	HX_VISIT_MEMBER_NAME(indent,"indent");
	HX_VISIT_MEMBER_NAME(font,"font");
	HX_VISIT_MEMBER_NAME(display,"display");
	HX_VISIT_MEMBER_NAME(color,"color");
	HX_VISIT_MEMBER_NAME(bullet,"bullet");
	HX_VISIT_MEMBER_NAME(bold,"bold");
	HX_VISIT_MEMBER_NAME(blockIndent,"blockIndent");
	HX_VISIT_MEMBER_NAME(align,"align");
}

Dynamic TextFormat_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"url") ) { return url; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"size") ) { return size; }
		if (HX_FIELD_EQ(inName,"font") ) { return font; }
		if (HX_FIELD_EQ(inName,"bold") ) { return bold; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"color") ) { return color; }
		if (HX_FIELD_EQ(inName,"align") ) { return align; }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"target") ) { return target; }
		if (HX_FIELD_EQ(inName,"italic") ) { return italic; }
		if (HX_FIELD_EQ(inName,"indent") ) { return indent; }
		if (HX_FIELD_EQ(inName,"bullet") ) { return bullet; }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"leading") ) { return leading; }
		if (HX_FIELD_EQ(inName,"kerning") ) { return kerning; }
		if (HX_FIELD_EQ(inName,"display") ) { return display; }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"tabStops") ) { return tabStops; }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"underline") ) { return underline; }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"leftMargin") ) { return leftMargin; }
		break;
	case 11:
		if (HX_FIELD_EQ(inName,"rightMargin") ) { return rightMargin; }
		if (HX_FIELD_EQ(inName,"blockIndent") ) { return blockIndent; }
		break;
	case 13:
		if (HX_FIELD_EQ(inName,"letterSpacing") ) { return letterSpacing; }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic TextFormat_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"url") ) { url=inValue.Cast< ::String >(); return inValue; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"size") ) { size=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"font") ) { font=inValue.Cast< ::String >(); return inValue; }
		if (HX_FIELD_EQ(inName,"bold") ) { bold=inValue.Cast< Dynamic >(); return inValue; }
		break;
	case 5:
		if (HX_FIELD_EQ(inName,"color") ) { color=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"align") ) { align=inValue.Cast< ::String >(); return inValue; }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"target") ) { target=inValue.Cast< ::String >(); return inValue; }
		if (HX_FIELD_EQ(inName,"italic") ) { italic=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"indent") ) { indent=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"bullet") ) { bullet=inValue.Cast< Dynamic >(); return inValue; }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"leading") ) { leading=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"kerning") ) { kerning=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"display") ) { display=inValue.Cast< ::String >(); return inValue; }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"tabStops") ) { tabStops=inValue.Cast< Array< int > >(); return inValue; }
		break;
	case 9:
		if (HX_FIELD_EQ(inName,"underline") ) { underline=inValue.Cast< Dynamic >(); return inValue; }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"leftMargin") ) { leftMargin=inValue.Cast< Dynamic >(); return inValue; }
		break;
	case 11:
		if (HX_FIELD_EQ(inName,"rightMargin") ) { rightMargin=inValue.Cast< Dynamic >(); return inValue; }
		if (HX_FIELD_EQ(inName,"blockIndent") ) { blockIndent=inValue.Cast< Dynamic >(); return inValue; }
		break;
	case 13:
		if (HX_FIELD_EQ(inName,"letterSpacing") ) { letterSpacing=inValue.Cast< Dynamic >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void TextFormat_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("url"));
	outFields->push(HX_CSTRING("underline"));
	outFields->push(HX_CSTRING("target"));
	outFields->push(HX_CSTRING("tabStops"));
	outFields->push(HX_CSTRING("size"));
	outFields->push(HX_CSTRING("rightMargin"));
	outFields->push(HX_CSTRING("letterSpacing"));
	outFields->push(HX_CSTRING("leftMargin"));
	outFields->push(HX_CSTRING("leading"));
	outFields->push(HX_CSTRING("kerning"));
	outFields->push(HX_CSTRING("italic"));
	outFields->push(HX_CSTRING("indent"));
	outFields->push(HX_CSTRING("font"));
	outFields->push(HX_CSTRING("display"));
	outFields->push(HX_CSTRING("color"));
	outFields->push(HX_CSTRING("bullet"));
	outFields->push(HX_CSTRING("bold"));
	outFields->push(HX_CSTRING("blockIndent"));
	outFields->push(HX_CSTRING("align"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	String(null()) };

static ::String sMemberFields[] = {
	HX_CSTRING("url"),
	HX_CSTRING("underline"),
	HX_CSTRING("target"),
	HX_CSTRING("tabStops"),
	HX_CSTRING("size"),
	HX_CSTRING("rightMargin"),
	HX_CSTRING("letterSpacing"),
	HX_CSTRING("leftMargin"),
	HX_CSTRING("leading"),
	HX_CSTRING("kerning"),
	HX_CSTRING("italic"),
	HX_CSTRING("indent"),
	HX_CSTRING("font"),
	HX_CSTRING("display"),
	HX_CSTRING("color"),
	HX_CSTRING("bullet"),
	HX_CSTRING("bold"),
	HX_CSTRING("blockIndent"),
	HX_CSTRING("align"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
	HX_MARK_MEMBER_NAME(TextFormat_obj::__mClass,"__mClass");
};

static void sVisitStatics(HX_VISIT_PARAMS) {
	HX_VISIT_MEMBER_NAME(TextFormat_obj::__mClass,"__mClass");
};

Class TextFormat_obj::__mClass;

void TextFormat_obj::__register()
{
	hx::Static(__mClass) = hx::RegisterClass(HX_CSTRING("flash.text.TextFormat"), hx::TCanCast< TextFormat_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}

void TextFormat_obj::__boot()
{
}

} // end namespace flash
} // end namespace text


text:
namespace TheXDS.MCART.Resources;
using System.IO;
using System.IO.Compression;
using TheXDS.MCART.Attributes;

/// <summary>
/// <see cref="ICompressorGetter"/> que construye un
/// <see cref="GZipStream"/> que puede ser utilizado para extraer
/// información comprimida desde un <see cref="Stream"/>.
/// </summary>
[Identifier("gzip")]
[Identifier("gz")]
public sealed class GZipGetter : ICompressorGetter
{
    /// <summary>
    /// Obtiene un <see cref="GZipStream"/> para extraer información
    /// comprimida desde <paramref name="inputStream"/>.
    /// </summary>
    /// <param name="inputStream">
    /// <see cref="Stream"/> que contiene la información a extraer.
    /// </param>
    /// <returns>
    /// Un <see cref="GZipStream"/> que puede utilizarse para extraer
    /// información comprimida desde <paramref name="inputStream"/>.
    /// </returns>
    public Stream GetCompressor(Stream inputStream) => new GZipStream(inputStream, CompressionMode.Decompress);
    /// <summary>
    /// Obtiene la extensión utilizada de forma predeterminada para un
    /// recurso comprimido utilizando este
    /// <see cref="ICompressorGetter"/>.
    /// </summary>
    public string Extension => ".gzip";
}


text:
window.log = function () {
  var args = Array.prototype.slice.call(arguments);
  args.push(+new Date());
  console.log.apply(console, args)
};


text:
(function outer(modules, cache, entries){

  /**
   * Global
   */

  var global = (function(){ return this; })();

  /**
   * Require `name`.
   *
   * @param {String} name
   * @param {Boolean} jumped
   * @api public
   */

  function require(name, jumped){
    if (cache[name]) return cache[name].exports;
    if (modules[name]) return call(name, require);
    throw new Error('cannot find module "' + name + '"');
  }

  /**
   * Call module `id` and cache it.
   *
   * @param {Number} id
   * @param {Function} require
   * @return {Function}
   * @api private
   */

  function call(id, require){
    var m = cache[id] = { exports: {} };
    var mod = modules[id];
    var name = mod[2];
    var fn = mod[0];

    fn.call(m.exports, function(req){
      var dep = modules[id][1][req];
      return require(dep ? dep : req);
    }, m, m.exports, outer, modules, cache, entries);

    // expose as `name`.
    if (name) cache[name] = cache[id];

    return cache[id].exports;
  }

  /**
   * Require all entries exposing them on global if needed.
   */

  for (var id in entries) {
    if (entries[id]) {
      global[entries[id]] = require(id);
    } else {
      require(id);
    }
  }

  /**
   * Duo flag.
   */

  require.duo = true;

  /**
   * Expose cache.
   */

  require.cache = cache;

  /**
   * Expose modules
   */

  require.modules = modules;

  /**
   * Return newest require.
   */

   return require;
})({
1: [function(require, module, exports) {
Grapher = require('ayasdi/grapher@1.0.3');
require('../center.js')(Grapher);

}, {"ayasdi/grapher@1.0.3":2,"../center.js":3}],
2: [function(require, module, exports) {
// Ayasdi Inc. Copyright 2014
// Grapher.js may be freely distributed under the Apache 2.0 license

;(function () {

/**
  * Grapher
  * =======
  * WebGL network grapher rendering with PIXI
  */
  function Grapher () {
    this.initialize.apply(this, arguments);
    return this;
  }

/**
  * Helpers and Renderers
  * =====================
  * Load helpers and renderers.
  */
  var WebGLRenderer = Grapher.WebGLRenderer = require('./renderers/gl/renderer.js'),
      CanvasRenderer = Grapher.CanvasRenderer = require('./renderers/canvas/renderer.js'),
      Color = Grapher.Color = require('./helpers/color.js'),
      Link = Grapher.Link = require('./helpers/link.js'),
      Node = Grapher.Node = require('./helpers/node.js'),
      u = Grapher.utils = require('./helpers/utilities.js');

  Grapher.prototype = {};

  /**
    * grapher.initialize
    * ------------------
    *
    * Initialize is called when a grapher instance is created:
    *
    *     var grapher = new Grapher(width, height, options);
    *
    */
  Grapher.prototype.initialize = function (o) {
    if (!o) o = {};

    // Extend default properties with options
    this.props = u.extend({
      color: 0x222222,
      scale: 1,
      translate: [0, 0],
      resolution: window.devicePixelRatio || 1
    }, o);

    if (!o.canvas) this.props.canvas = document.createElement('canvas');
    if (!o.width) this.props.width = this.props.canvas.clientWidth;
    if (!o.height) this.props.height = this.props.canvas.clientHeight;
    this.canvas = this.props.canvas;

    var webGL = this._getWebGL();
    if (webGL) {
      this.props.webGL = webGL;
      this.props.canvas.addEventListener('webglcontextlost', function (e) { this._onContextLost(e); }.bind(this));
      this.props.canvas.addEventListener('webglcontextrestored', function (e) { this._onContextRestored(e); }.bind(this));
    }

    // Renderer and view
    this.renderer =  webGL ? new WebGLRenderer(this.props) : new CanvasRenderer(this.props);
    this.rendered = false;

    // Initialize sizes
    this.resize(this.props.width, this.props.height);

    // Sprite array
    this.links = [];
    this.nodes = [];

    this.renderer.setLinks(this.links);
    this.renderer.setNodes(this.nodes);

    // Indices that will update
    this.willUpdate = {};
    this.updateAll = {};
    this._clearUpdateQueue();

    // Bind some updaters
    this._updateLink = u.bind(this._updateLink, this);
    this._updateNode = u.bind(this._updateNode, this);
    this._updateLinkByIndex = u.bind(this._updateLinkByIndex, this);
    this._updateNodeByIndex = u.bind(this._updateNodeByIndex, this);
    this.animate = u.bind(this.animate, this);

    // Event Handlers
    this.handlers = {};

    // Do any additional setup
    u.eachKey(o, this.set, this);
  };

  /**
    * grapher.set
    * ------------------
    *
    * General setter for a grapher's properties.
    *
    *     grapher.set(1, 'scale');
    */
  Grapher.prototype.set = function (val, key) {
    var setter = this[key];
    if (setter && u.isFunction(setter))
      return setter.call(this, val);
  };

  /**
    * grapher.on
    * ------------------
    *
    * Add a listener to a grapher event. Only one listener can be bound to an
    * event at this time. Available events:
    *
    *   * mousedown
    *   * mouseover
    *   * mouseup
    */
  Grapher.prototype.on = function (event, fn) {
    this.handlers[event] = this.handlers[event] || [];
    this.handlers[event].push(fn);
    this.canvas.addEventListener(event, fn, false);
    return this;
  };

  /**
    * grapher.off
    * ------------------
    *
    * Remove a listener from an event.
    */
  Grapher.prototype.off = function (event, fn) {
    if (this.handlers[event]) {
      var i = u.indexOf(this.handlers[event], fn);
      if (i > -1) this.handlers[event].splice(i, 1);
    }
    this.canvas.removeEventListener(event, fn, false);
    return this;
  };

  /**
    * grapher.data
    * ------------------
    *
    * Accepts network data in the form:
    *
    *     {
    *       nodes: [{x: 0, y: 0, r: 20, color: (swatch or hex/rgb)}, ... ],
    *       links: [{from: 0, to: 1, color: (swatch or hex/rgb)}, ... ]
    *     }
    */
  Grapher.prototype.data = function (data) {
    if (u.isUndefined(data)) return this.props.data;

    this.props.data = data;
    this.exit();
    this.enter();
    this.update();

    return this;
  };

  /**
    * grapher.enter
    * ------------------
    *
    * Creates node and link sprites to match the number of nodes and links in the
    * data.
    */
  Grapher.prototype.enter = function () {
    var data = this.data();
    if (this.links.length < data.links.length) {
      var links = data.links.slice(this.links.length, data.links.length);
      u.eachPop(links, u.bind(function () { this.links.push(new Link()); }, this));
    }

    if (this.nodes.length < data.nodes.length) {
      var nodes = data.nodes.slice(this.nodes.length, data.nodes.length);
      u.eachPop(nodes, u.bind(function () { this.nodes.push(new Node()); }, this));
    }

    return this;
  };

  /**
    * grapher.exit
    * ------------------
    *
    * Removes node and link sprites to match the number of nodes and links in the
    * data.
    */
  Grapher.prototype.exit = function () {
    var data = this.data(),
        exiting = [];

    if (data.links.length < this.links.length) {
      this.links.splice(data.links.length, this.links.length - data.links.length);
    }
    if (data.nodes.length < this.nodes.length) {
      this.nodes.splice(data.nodes.length, this.nodes.length - data.nodes.length);
    }

    return this;
  };

  /**
    * grapher.update
    * ------------------
    *
    * Add nodes and/or links to the update queue by index. Passing in no arguments will
    * add all nodes and links to the update queue. Node and link sprites in the update
    * queue are updated at the time of rendering.
    *
    *     grapher.update(); // updates all nodes and links
    *     grapher.update('links'); // updates only links
    *     grapher.update('nodes', 0, 4); // updates nodes indices 0 to 3 (4 is not inclusive)
    *     grapher.update('links', [0, 1, 2, 6, 32]); // updates links indexed by the indices
    */
  Grapher.prototype.update = function (type, start, end) {
    var indices;
    if (u.isArray(start)) indices = start;
    else if (u.isNumber(start) && u.isNumber(end)) indices = u.range(start, end);

    if (u.isArray(indices)) {
      this._addToUpdateQueue(type, indices);
      if (type === NODES) this._addToUpdateQueue(LINKS, this._findLinks(indices));
    } else {
      if (type !== NODES) this.updateAll.links = true;
      if (type !== LINKS) this.updateAll.nodes = true;
    }
    return this;
  };

  /**
    * grapher.updateNode
    * ------------------
    *
    * Add an individual node to the update queue. Optionally pass in a boolean to
    * specify whether or not to also add links connected with the node to the update queue.
    */
  Grapher.prototype.updateNode = function (index, willUpdateLinks) {
    this._addToUpdateQueue(NODES, [index]);
    if (willUpdateLinks) this._addToUpdateQueue(LINKS, this._findLinks([index]));
    return this;
  };

  /**
    * grapher.updateLink
    * ------------------
    *
    * Add an individual link to the update queue.
    */
  Grapher.prototype.updateLink = function (index) {
    this._addToUpdateQueue(LINKS, [index]);
    return this;
  };

  /**
    * grapher.render
    * ------------------
    *
    * Updates each sprite and renders the network.
    */
  Grapher.prototype.render = function () {
    this.rendered = true;
    this._update();
    this.renderer.render();
    return this;
  };

  /**
    * grapher.animate
    * ------------------
    *
    * Calls render in a requestAnimationFrame loop.
    */
  Grapher.prototype.animate = function (time) {
    this.render();
    this.currentFrame = requestAnimationFrame(this.animate);
  };

  /**
    * grapher.play
    * ------------------
    *
    * Starts the animate loop.
    */
  Grapher.prototype.play = function () {
    this.currentFrame = requestAnimationFrame(this.animate);
    return this;
  };

  /**
    * grapher.pause
    * ------------------
    *
    * Pauses the animate loop.
    */
  Grapher.prototype.pause = function () {
    if (this.currentFrame) cancelAnimationFrame(this.currentFrame);
    this.currentFrame = null;
    return this;
  };

  /**
    * grapher.resize
    * ------------------
    *
    * Resize the grapher view.
    */
  Grapher.prototype.resize = function (width, height) {
    this.props.width = width;
    this.props.height = height;

    this.renderer.resize(width, height);
    return this;
  };

  /**
    * grapher.width
    * ------------------
    *
    * Specify or retrieve the width.
    */
  Grapher.prototype.width = function (width) {
    if (u.isUndefined(width)) return this.props.width;
    this.resize(width, this.props.height);
    return this;
  };

   /**
    * grapher.height
    * ------------------
    *
    * Specify or retrieve the height.
    */
  Grapher.prototype.height = function (height) {
    if (u.isUndefined(height)) return this.props.height;
    this.resize(this.props.width, height);
    return this;
  };

  /**
    * grapher.transform
    * ------------------
    *
    * Set the scale and translate as an object.
    * If no arguments are passed in, returns the current transform object.
    */
  Grapher.prototype.transform = function (transform) {
    if (u.isUndefined(transform))
      return {scale: this.props.scale, translate: this.props.translate};

    this.scale(transform.scale);
    this.translate(transform.translate);
    return this;
  };

  /**
    * grapher.scale
    * ------------------
    *
    * Set the scale.
    * If no arguments are passed in, returns the current scale.
    */
  Grapher.prototype.scale = function (scale) {
    if (u.isUndefined(scale)) return this.props.scale;
    if (u.isNumber(scale)) this.props.scale = scale;
    this.updateTransform = true;
    return this;
  };

  /**
    * grapher.translate
    * ------------------
    *
    * Set the translate.
    * If no arguments are passed in, returns the current translate.
    */
  Grapher.prototype.translate = function (translate) {
    if (u.isUndefined(translate)) return this.props.translate;
    if (u.isArray(translate)) this.props.translate = translate;
    this.updateTransform = true;
    return this;
  };

  /**
    * grapher.color
    * ------------------
    *
    * Set the default color of nodes and links.
    * If no arguments are passed in, returns the current default color.
    */
  Grapher.prototype.color = function (color) {
    if (u.isUndefined(color)) return this.props.color;
    this.props.color = Color.parse(color);
    return this;
  };

  /**
    * grapher.getDataPosition
    * ------------------
    *
    * Returns data space coordinates given display coordinates.
    * If a single argument passed in, function considers first argument an object with x and y props.
    */
  Grapher.prototype.getDataPosition = function (x, y) {
    var xCoord = u.isUndefined(y) ? x.x : x;
    var yCoord = u.isUndefined(y) ? x.y : y;
    x = this.renderer.untransformX(xCoord);
    y = this.renderer.untransformY(yCoord);
    return {x: x, y: y};
  };

  /**
  * grapher.getDisplayPosition
  * ------------------
  *
  * Returns display space coordinates given data coordinates.
  * If a single argument passed in, function considers first argument an object with x and y props.
  */
  Grapher.prototype.getDisplayPosition = function (x, y) {
    var xCoord = u.isUndefined(y) ? x.x : x;
    var yCoord = u.isUndefined(y) ? x.y : y;
    x = this.renderer.transformX(xCoord);
    y = this.renderer.transformY(yCoord);
    return {x: x, y: y};
  };

/**
  * Private Functions
  * =================
  *
  */

  /**
    * grapher._addToUpdateQueue
    * -------------------
    *
    * Add indices to the nodes or links update queue.
    *
    */
  Grapher.prototype._addToUpdateQueue = function (type, indices) {
    var willUpdate = type === NODES ? this.willUpdate.nodes : this.willUpdate.links,
        updateAll = type === NODES ? this.updateAll.nodes : this.updateAll.links,
        spriteSet = type === NODES ? this.nodes : this.links;

    var insert = function (n) { u.uniqueInsert(willUpdate, n); };
    if (!updateAll && u.isArray(indices)) u.each(indices, insert, this);

    updateAll = updateAll || willUpdate.length >= spriteSet.length;

    if (type === NODES) this.updateAll.nodes = updateAll;
    else this.updateAll.links = updateAll;
  };

  /**
    * grapher._clearUpdateQueue
    * -------------------
    *
    * Clear the update queue.
    *
    */
  Grapher.prototype._clearUpdateQueue = function () {
    this.willUpdate.links = [];
    this.willUpdate.nodes = [];
    this.updateAll.links = false;
    this.updateAll.nodes = false;
    this.updateTransform = false;
  };

  /**
    * grapher._update
    * -------------------
    *
    * Update nodes and links in the update queue.
    *
    */
  Grapher.prototype._update = function () {
    var updatingLinks = this.willUpdate.links,
        updatingNodes = this.willUpdate.nodes,
        i;

    if (this.updateAll.links) u.each(this.links, this._updateLink);
    else if (updatingLinks && updatingLinks.length) u.eachPop(updatingLinks, this._updateLinkByIndex);

    if (this.updateAll.nodes) u.each(this.nodes, this._updateNode);
    else if (updatingNodes && updatingNodes.length) u.eachPop(updatingNodes, this._updateNodeByIndex);

    if (this.updateTransform) {
      this.renderer.setScale(this.props.scale);
      this.renderer.setTranslate(this.props.translate);
    }

    this._clearUpdateQueue();
  };

  Grapher.prototype._updateLink = function (link, i) {
    var data = this.data(),
        l = data.links[i],
        from = data.nodes[l.from],
        to = data.nodes[l.to];

    var color = !u.isUndefined(l.color) ? this._findColor(l.color) :
        Color.interpolate(this._findColor(from.color), this._findColor(to.color));

    link.update(from.x, from.y, to.x, to.y, color);
  };

  Grapher.prototype._updateNode = function (node, i) {
    var n = this.data().nodes[i];
    node.update(n.x, n.y, n.r, this._findColor(n.color));
  };

  Grapher.prototype._updateNodeByIndex = function (i) { this._updateNode(this.nodes[i], i); };

  Grapher.prototype._updateLinkByIndex = function (i) { this._updateLink(this.links[i], i); };

  /**
    * grapher._findLinks
    * -------------------
    *
    * Search for links connected to the node indices provided.
    *
    * isLinked is a helper function that returns true if a link is
    * connected to a node in indices.
    */
  var isLinked = function (indices, l) {
    var i, len = indices.length, flag = false;
    for (i = 0; i < len; i++) {
      if (l.to == indices[i] || l.from == indices[i]) {
        flag = true;
        break;
      }
    }
    return flag;
  };

  Grapher.prototype._findLinks = function (indices) {
    var links = this.data().links,
        i, numLinks = links.length,
        updatingLinks = [];

    for (i = 0; i < numLinks; i++) {
      if (isLinked(indices, links[i])) updatingLinks.push(i);
    }

    return updatingLinks;
  };

  /**
    * grapher._findColor
    * -------------------
    *
    * Search for a color whether it's defined by palette index, string,
    * integer.
    */
  Grapher.prototype._findColor = function (c) {
    var color = Color.parse(c);

    // if color is still not set, use the default
    if (u.isNaN(color)) color = this.color();
    return color;
  };

  /**
    * grapher._getWebGL
    * -------------------
    *
    *get webGL context if available
    *
    */
  Grapher.prototype._getWebGL = function () {
    var gl = null;
    try { gl = this.canvas.getContext("webgl") || this.canvas.getContext("experimental-webgl"); }
    catch (x) { gl = null; }
    return gl;
  };

 /**
    * grapher._onContextLost
    * ----------------------
    *
    * Handle context lost.
    *
    */
  Grapher.prototype._onContextLost = function (e) {
    e.preventDefault();
    if (this.currentFrame) cancelAnimationFrame(this.currentFrame);
  };

  /**
    * grapher._onContextRestored
    * --------------------------
    *
    * Handle context restored.
    *
    */
  Grapher.prototype._onContextRestored = function (e) {
    var webGL = this._getWebGL();
    this.renderer.initGL(webGL);
    if (this.currentFrame) this.play(); // Play the graph if it was running.
    else if (this.rendered) this.render();
  };

/**
  * Grapher Static Properties
  * =========================
  */
  var NODES = Grapher.NODES = 'nodes';
  var LINKS = Grapher.LINKS = 'links';

  if (module && module.exports) module.exports = Grapher;
})();

}, {"./renderers/gl/renderer.js":4,"./renderers/canvas/renderer.js":5,"./helpers/color.js":6,"./helpers/link.js":7,"./helpers/node.js":8,"./helpers/utilities.js":9}],
4: [function(require, module, exports) {
;(function () {
  var LinkVertexShaderSource = require('./shaders/link.vert'),
      LinkFragmentShaderSource = require('./shaders/link.frag'),
      NodeVertexShaderSource = require('./shaders/node.vert'),
      NodeFragmentShaderSource = require('./shaders/node.frag'),
      Renderer = require('../renderer.js');

  var WebGLRenderer = Renderer.extend({
    init: function (o) {
      this._super(o);
      this.initGL(o.webGL);

      this.NODE_ATTRIBUTES = 6;
      this.LINKS_ATTRIBUTES = 3;
    },

    initGL: function (gl) {
      this.gl = gl;
      this.gl.viewport(0, 0, this.canvas.width, this.canvas.height);

      this.linksProgram = this.initShaders(LinkVertexShaderSource, LinkFragmentShaderSource);
      this.nodesProgram = this.initShaders(NodeVertexShaderSource, NodeFragmentShaderSource);

      this.gl.linkProgram(this.linksProgram);
      this.gl.linkProgram(this.nodesProgram);

      this.gl.blendFuncSeparate(this.gl.SRC_ALPHA, this.gl.ONE_MINUS_SRC_ALPHA, this.gl.ONE, this.gl.ONE_MINUS_SRC_ALPHA);
      this.gl.enable(this.gl.BLEND);
    },

    initShaders: function (vertexShaderSource, fragmentShaderSource) {
      var vertexShader = this.getShaders(this.gl.VERTEX_SHADER, vertexShaderSource);
      var fragmentShader = this.getShaders(this.gl.FRAGMENT_SHADER, fragmentShaderSource);
      var shaderProgram = this.gl.createProgram();
      this.gl.attachShader(shaderProgram, vertexShader);
      this.gl.attachShader(shaderProgram, fragmentShader);
      return shaderProgram;
    },

    getShaders: function (type, source) {
      var shader = this.gl.createShader(type);
      this.gl.shaderSource(shader, source);
      this.gl.compileShader(shader);
      return shader;
    },

    updateNodesBuffer: function () {
      var j = 0;
      this.nodes = [];
      for (var i = 0; i < this.nodeObjects.length; i++) {
        var node = this.nodeObjects[i];
        var cx = this.transformX(node.x) * this.resolution;
        var cy = this.transformY(node.y) * this.resolution;
        // adding one px to keep shader area big enough for antialiasing pixesls
        var r = node.r * Math.abs(this.scale * this.resolution) + 1;
        var color = node.color;

        this.nodes[j++] = (cx - r);
        this.nodes[j++] = (cy - r);
        this.nodes[j++] = color;
        this.nodes[j++] = cx;
        this.nodes[j++] = cy;
        this.nodes[j++] = r;

        this.nodes[j++] = (cx + (1 + Math.sqrt(2))*r);
        this.nodes[j++] = cy - r;
        this.nodes[j++] = color;
        this.nodes[j++] = cx;
        this.nodes[j++] = cy;
        this.nodes[j++] = r;

        this.nodes[j++] = (cx - r);
        this.nodes[j++] = (cy + (1 + Math.sqrt(2))*r);
        this.nodes[j++] = color;
        this.nodes[j++] = cx;
        this.nodes[j++] = cy;
        this.nodes[j++] = r;
      }
    },

    updateLinksBuffer: function () {
      var j = 0;
      this.links = [];
      for (var i = 0; i < this.linkObjects.length; i++) {
        var link = this.linkObjects[i];
        var x1 = this.transformX(link.x1) * this.resolution;
        var y1 = this.transformY(link.y1) * this.resolution;
        var x2 = this.transformX(link.x2) * this.resolution;
        var y2 = this.transformY(link.y2) * this.resolution;
        var color = link.color;

        this.links[j++] = x1;
        this.links[j++] = y1;
        this.links[j++] = color;

        this.links[j++] = x2;
        this.links[j++] = y2;
        this.links[j++] = color;
      }
    },

    resize: function (width, height) {
      this._super(width, height);
      this.gl.viewport(0, 0, this.canvas.width, this.canvas.height);
    },

    render: function () {
      this.updateNodesBuffer();
      this.updateLinksBuffer();
      this.renderLinks(); // links have to be rendered first because of blending;
      this.renderNodes();
    },

    renderLinks: function () {
      var program = this.linksProgram;
      this.gl.useProgram(program);

      var linksBuffer = new Float32Array(this.links);
      var buffer = this.gl.createBuffer();

      this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);
      this.gl.bufferData(this.gl.ARRAY_BUFFER, linksBuffer, this.gl.STATIC_DRAW);

      var resolutionLocation = this.gl.getUniformLocation(program, 'u_resolution');
      this.gl.uniform2f(resolutionLocation, this.canvas.width, this.canvas.height);

      var positionLocation = this.gl.getAttribLocation(program, 'a_position');
      var colorLocation = this.gl.getAttribLocation(program, 'a_color');

      this.gl.enableVertexAttribArray(positionLocation);
      this.gl.enableVertexAttribArray(colorLocation);

      this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, false, this.LINKS_ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
      this.gl.vertexAttribPointer(colorLocation, 1, this.gl.FLOAT, false, this.LINKS_ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);

      var lineWidthRange = this.gl.getParameter(this.gl.ALIASED_LINE_WIDTH_RANGE), // ex [1,10]
          lineWidth = this.lineWidth * Math.abs(this.scale * this.resolution),
          lineWidthInRange = Math.min(Math.max(lineWidth, lineWidthRange[0]), lineWidthRange[1]);

      this.gl.lineWidth(lineWidthInRange);
      this.gl.drawArrays(this.gl.LINES, 0, this.links.length/this.LINKS_ATTRIBUTES);
    },

    renderNodes: function () {
      var program = this.nodesProgram;
      this.gl.useProgram(program);

      var nodesBuffer = new Float32Array(this.nodes);
      var buffer = this.gl.createBuffer();

      this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);
      this.gl.bufferData(this.gl.ARRAY_BUFFER, nodesBuffer, this.gl.STATIC_DRAW);

      var resolutionLocation = this.gl.getUniformLocation(program, 'u_resolution');
      this.gl.uniform2f(resolutionLocation, this.canvas.width, this.canvas.height);

      var positionLocation = this.gl.getAttribLocation(program, 'a_position');
      var colorLocation = this.gl.getAttribLocation(program, 'a_color');
      var centerLocation = this.gl.getAttribLocation(program, 'a_center');
      var radiusLocation = this.gl.getAttribLocation(program, 'a_radius');

      this.gl.enableVertexAttribArray(positionLocation);
      this.gl.enableVertexAttribArray(colorLocation);
      this.gl.enableVertexAttribArray(centerLocation);
      this.gl.enableVertexAttribArray(radiusLocation);

      this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, false, this.NODE_ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0);
      this.gl.vertexAttribPointer(colorLocation, 1, this.gl.FLOAT, false, this.NODE_ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8);
      this.gl.vertexAttribPointer(centerLocation, 2, this.gl.FLOAT, false, this.NODE_ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 12);
      this.gl.vertexAttribPointer(radiusLocation, 1, this.gl.FLOAT, false, this.NODE_ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 20);

      this.gl.drawArrays(this.gl.TRIANGLES, 0, this.nodes.length/this.NODE_ATTRIBUTES);
    }
  });

  if (module && module.exports) module.exports = WebGLRenderer;
})();

}, {"./shaders/link.vert":10,"./shaders/link.frag":11,"./shaders/node.vert":12,"./shaders/node.frag":13,"../renderer.js":14}],
10: [function(require, module, exports) {
module.exports = 'uniform vec2 u_resolution;\nattribute vec2 a_position;\nattribute float a_color;\nvarying vec4 color;\nvarying vec2 position;\nvarying vec2 resolution;\nvoid main() {\n  vec2 clipspace = a_position / u_resolution * 2.0 - 1.0;\n  gl_Position = vec4(clipspace * vec2(1, -1), 0, 1);\n  float c = a_color;\n  color.b = mod(c, 256.0); c = floor(c / 256.0);\n  color.g = mod(c, 256.0); c = floor(c / 256.0);\n  color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;\n  color.a = 1.0;\n}\n';
}, {}],
11: [function(require, module, exports) {
module.exports = 'precision mediump float;\nvarying vec4 color;\nvoid main() {\n  gl_FragColor = color;\n}\n';
}, {}],
12: [function(require, module, exports) {
module.exports = 'uniform vec2 u_resolution;\nattribute vec2 a_position;\nattribute float a_color;\nattribute vec2 a_center;\nattribute float a_radius;\nvarying vec3 rgb;\nvarying vec2 center;\nvarying vec2 resolution;\nvarying float radius;\nvoid main() {\n  vec2 clipspace = a_position / u_resolution * 2.0 - 1.0;\n  gl_Position = vec4(clipspace * vec2(1, -1), 0, 1);\n  float c = a_color;\n  rgb.b = mod(c, 256.0); c = floor(c / 256.0);\n  rgb.g = mod(c, 256.0); c = floor(c / 256.0);\n  rgb.r = mod(c, 256.0); c = floor(c / 256.0); rgb /= 255.0;\n  radius = a_radius - 1.0 ;\n  center = a_center;\n  resolution = u_resolution;\n}\n';
}, {}],
13: [function(require, module, exports) {
module.exports = 'precision mediump float;\nvarying vec3 rgb;\nvarying vec2 center;\nvarying vec2 resolution;\nvarying float radius;\nvoid main() {\n  vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n  float x = gl_FragCoord.x;\n  float y = resolution[1] - gl_FragCoord.y;\n  float dx = center[0] - x;\n  float dy = center[1] - y;\n  float distance = sqrt(dx*dx + dy*dy);\n  float diff = distance - radius;\n  if ( diff < 0.0 ) \n    gl_FragColor = vec4(rgb, 1.0);\n  else if ( diff >= 0.0 && diff <= 1.0 )\n    gl_FragColor = vec4(rgb, 1.0 - diff);\n  else \n    gl_FragColor = color0;\n}\n';
}, {}],
14: [function(require, module, exports) {
;(function () {

  var Renderer = function () {
    if ( !initializing && this.init )
      this.init.apply(this, arguments);
    return this;
  };

  Renderer.prototype = {
    init: function (o) {
      this.canvas = o.canvas;
      this.lineWidth = o.lineWidth || 2;
      this.resolution = o.resolution || 1;
      this.scale = o.scale;
      this.translate = o.translate;
    },
    setNodes: function (nodes) { this.nodeObjects = nodes; },
    setLinks: function (links) { this.linkObjects = links; },
    setScale: function (scale) { this.scale = scale; },
    setTranslate: function (translate) { this.translate = translate; },
    transformX: function (x) { return x * this.scale + this.translate[0]; },
    transformY: function (y) { return y * this.scale + this.translate[1]; },
    untransformX: function (x) { return (x - this.translate[0]) / this.scale; },
    untransformY: function (y) { return (y - this.translate[1]) / this.scale; },
    resize: function (width, height) {
      var displayWidth  = width * this.resolution;
      var displayHeight = height * this.resolution;

      this.canvas.width  = displayWidth;
      this.canvas.height = displayHeight;
    }
  };

  var initializing = false;

  Renderer.extend = function (prop) {
    var _super = this.prototype;

    initializing = true;
    var prototype = new this();
    initializing = false;

    prototype._super = this.prototype;
    for (var name in prop) {
      prototype[name] = typeof prop[name] == "function" &&
        typeof _super[name] == "function" && /\b_super\b/.test(prop[name]) ?
        (function(name, fn){
          return function() {
            var tmp = this._super;

            // Add a new ._super() method that is the same method
            // but on the super-class
            this._super = _super[name];

            // The method only need to be bound temporarily, so we
            // remove it when we're done executing
            var ret = fn.apply(this, arguments);
            this._super = tmp;

            return ret;
          };
        })(name, prop[name]) :
        prop[name];
    }

    // The dummy class constructor
    function Renderer () {
      // All construction is actually done in the init method
      if ( !initializing && this.init )
        this.init.apply(this, arguments);
    }

    // Populate our constructed prototype object
    Renderer.prototype = prototype;

    // Enforce the constructor to be what we expect
    Renderer.prototype.constructor = Renderer;

    // And make this class extendable
    Renderer.extend = arguments.callee;

    return Renderer;
  };

  if (module && module.exports) module.exports = Renderer;
})();

}, {}],
5: [function(require, module, exports) {
;(function () {

  var Renderer = require('../renderer.js');
  var Color = require('../../helpers/color.js');

  var CanvasRenderer = Renderer.extend({
    init: function (o) {
      this._super(o);

      this.context = this.canvas.getContext('2d');
    },

    render: function () {
      this.context.clearRect( 0 , 0 , this.canvas.width, this.canvas.height );
      this.renderLinks();
      this.renderNodes();
    },

    renderNodes: function () {
      for (var i = 0 ; i < this.nodeObjects.length; i ++) {
        var node = this.nodeObjects[i];
        var cx = this.transformX(node.x) * this.resolution;
        var cy = this.transformY(node.y) * this.resolution;
        var r = node.r * Math.abs(this.scale * this.resolution);

        this.context.beginPath();
        this.context.arc(cx, cy, r, 0, 2 * Math.PI, false);
        this.context.fillStyle = Color.toRgb(node.color);
        this.context.fill();
      }
    },

    renderLinks: function () {
      for (var i = 0 ; i < this.linkObjects.length; i ++) {
        var link = this.linkObjects[i];
        var x1 = this.transformX(link.x1) * this.resolution;
        var y1 = this.transformY(link.y1) * this.resolution;
        var x2 = this.transformX(link.x2) * this.resolution;
        var y2 = this.transformY(link.y2) * this.resolution;

        this.context.beginPath();
        this.context.moveTo(x1, y1);
        this.context.lineTo(x2, y2);
        this.context.lineWidth = this.lineWidth * Math.abs(this.scale * this.resolution);

        this.context.strokeStyle = Color.toRgb(link.color);
        this.context.stroke();
      }
    }
  });

  if (module && module.exports) module.exports = CanvasRenderer;
})();

}, {"../renderer.js":14,"../../helpers/color.js":6}],
6: [function(require, module, exports) {
// Ayasdi Inc. Copyright 2014
// Color.js may be freely distributed under the Apache 2.0 license

var Color = module.exports = {
  hexToRgb: hexToRgb,
  rgbToHex: rgbToHex,
  toRgb: toRgb,
  interpolate: interpolate,
  parse: parse
};

function hexToRgb (hex) {
  return {r: (hex >> 16) & 0xff, g: (hex >> 8) & 0xff, b: hex & 0xff};
};

function rgbToHex (r, g, b) {
  return r << 16 | g << 8 | b;
};

function interpolate (a, b, amt) {
  amt = amt === undefined ? 0.5 : amt;
  var colorA = hexToRgb(a),
      colorB = hexToRgb(b),
      interpolated = {
        r: colorA.r + (colorB.r - colorA.r) * amt,
        g: colorA.g + (colorB.g - colorA.g) * amt,
        b: colorA.b + (colorB.b - colorA.b) * amt
      };
  return rgbToHex(interpolated.r, interpolated.g, interpolated.b);
};

function parse (c) {
  var color = parseInt(c);
  if (typeof c === 'string') {
    if (c.split('#').length > 1) { // hex format '#ffffff'
      color = parseInt(c.replace('#', ''), 16);
    }

    else if (c.split('rgb(').length > 1) { // rgb format 'rgb(255, 255, 255)'
      var rgb = c.substring(4, c.length-1).replace(/ /g, '').split(',');
      color = rgbToHex(rgb[0], rgb[1], rgb[2]);
    }
  }
  return color;
};

function toRgb (intColor) {
  var r = (intColor >> 16) & 255;
  var g = (intColor >> 8) & 255;
  var b = intColor & 255;

  return 'rgb(' + r + ', ' + g + ', ' + b + ')';
};
}, {}],
7: [function(require, module, exports) {
;(function () {
  function Link () {
    this.x1 = 0;
    this.y1 = 0;
    this.x2 = 0;
    this.y2 = 0;
    this.color = 0;
    return this;
  }

  Link.prototype.update = function (x1, y1, x2, y2, color) {
    this.x1 = x1;
    this.y1 = y1;
    this.x2 = x2;
    this.y2 = y2;
    this.color = color;
    return this;
  };

  if (module && module.exports) module.exports = Link;
})();

}, {}],
8: [function(require, module, exports) {
;(function () {
  function Node () {
    this.x = 0;
    this.y = 0;
    this.r = 10;
    this.color = 0;
    return this;
  }

  Node.prototype.update = function (x, y, r, color) {
    this.x = x;
    this.y = y;
    this.r = r;
    this.color = color;
    return this;
  };

  if (module && module.exports) module.exports = Node;
})();

}, {}],
9: [function(require, module, exports) {
/**
 * Utilities
 * =========
 *
 * Various utility functions
 */
var Utilities = module.exports = {
  each: each,
  eachPop: eachPop,
  eachKey: eachKey,
  map: map,
  clean: clean,
  range: range,
  sortedIndex: sortedIndex,
  indexOf: indexOf,
  uniqueInsert: uniqueInsert,
  extend: extend,
  bind: bind,
  noop: noop,
  isUndefined: isUndefined,
  isFunction: isFunction,
  isObject: isObject,
  isArray: Array.isArray,
  isNumber: isNumber,
  isNaN: isNaN
};

/**
 * noop
 * -----
 *
 * A function that does nothing.
 */
function noop () {}

/**
 * each
 * -----
 *
 * Perform an operation on each element in an array.
 *
 *     var arr = [1, 2, 3];
 *     u.each(arr, fn);
 */
function each (arr, fn, ctx) {
  fn = bind(fn, ctx);
  var i = arr.length;
  while (--i > -1) {
    fn(arr[i], i);
  }
  return arr;
}

/**
 * eachPop
 * -------
 *
 * Perform a function on each element in an array. Faster than each, but won't pass index and the
 * array will be cleared.
 *
 *     u.eachPop([1, 2, 3], fn);
 */
function eachPop (arr, fn, ctx) {
  fn = bind(fn, ctx);
  while (arr.length) {
    fn(arr.pop());
  }
  return arr;
}

/**
 * eachKey
 * -------
 *
 * Perform a function on each property in an object.
 *
 *     var obj = {foo: 0, bar: 0};
 *     u.eachKey(obj, fn);
 */
function eachKey (obj, fn, ctx) {
  fn = bind(fn, ctx);
  if (isObject(obj)) {
    var keys = Object.keys(obj);

    while (keys.length) {
      var key = keys.pop();
      fn(obj[key], key);
    }
  }
  return obj;
}

/**
 * map
 * -----
 *
 * Get a new array with values calculated from original array.
 *
 *     var arr = [1, 2, 3];
 *     var newArr = u.map(arr, fn);
 */
function map (arr, fn, ctx) {
  fn = bind(fn, ctx);
  var i = arr.length,
      mapped = new Array(i);
  while (--i > -1) {
    mapped[i] = fn(arr[i], i);
  }
  return mapped;
}

/**
 * clean
 * -----
 *
 * Clean an array by reference.
 *
 *     var arr = [1, 2, 3];
 *     u.clean(arr); // arr = []
 */
function clean (arr) {
  eachPop(arr, noop);
  return arr;
}

/**
 * range
 * -----
 *
 * Create an array of numbers from start to end, incremented by step.
 */
function range (start, end, step) {
  step = isNumber(step) ? step : 1;
  if (isUndefined(end)) {
    end = start;
    start = 0;
  }

  var i = Math.max(Math.ceil((end - start) / step), 0),
      result = new Array(i);

  while (--i > -1) {
    result[i] = start + (step * i);
  }
  return result;
}

/**
 * sortedIndex
 * -----------
 *
 * Finds the sorted position of a number in an Array of numbers.
 */
function sortedIndex (arr, n) {
  var min = 0,
      max = arr.length;

  while (min < max) {
    var mid = min + max >>> 1;
    if (n < mid) max = mid;
    else min = mid + 1;
  }

  return min;
}

/**
 * indexOf
 * -------
 *
 * Finds the index of a variable in an array.
 * Returns -1 if not found.
 */
function indexOf (arr, n) {
  var i = arr.length;
  while (--i > -1) {
    if (arr[i] === n) return i;
  }
  return i;
}

/**
 * uniqueInsert
 * ------------
 *
 * Inserts a value into an array only if it does not already exist
 * in the array.
 */
function uniqueInsert (arr, n) {
  if (indexOf(arr, n) === -1) arr.push(n);
  return arr;
}

/**
 * extend
 * ------
 *
 * Extend an object with the properties of one other objects
 */
function extend (obj, source) {
  if (isObject(obj) && isObject(source)) {
    var props = Object.getOwnPropertyNames(source),
      i = props.length;
    while (--i > -1) {
      var prop = props[i];
      obj[prop] = source[prop];
    }
  }
  return obj;
}

/**
   * bind
   * ----
   *
   * Bind a function to a context. Optionally pass in the number of arguments
   * which will use the faster fn.call if the number of arguments is 0, 1, or 2.
   */
function bind (fn, ctx) {
  if (!ctx) return fn;
  return function () { return fn.apply(ctx, arguments); };
}

/**
 * isUndefined
 * -----------
 *
 * Checks if a variable is undefined.
 */
function isUndefined (o) {
  return typeof o === 'undefined';
}

/**
 * isFunction
 * ----------
 *
 * Checks if a variable is a function.
 */
function isFunction (o) {
  return typeof o === 'function';
}

/**
 * isObject
 * --------
 *
 * Checks if a variable is an object.
 */
function isObject (o) {
  return typeof o === 'object' && !!o;
}

/**
 * isNumber
 * --------
 *
 * Checks if a variable is a number.
 */
function isNumber (o) {
  return typeof o === 'number';
}

/**
 * isNaN
 * -----
 *
 * Checks if a variable is NaN.
 */
function isNaN (o) {
  return isNumber(o) && o !== +o;
}

}, {}],
3: [function(require, module, exports) {
;(function () {
  var center = function (g) {

  /**
    * grapher.center
    * ------------------
    *
    * Center the whole network or provided nodeIds in the view.
    */
    g.prototype.center = function (nodeIds) {
      var x = 0,
          y = 0,
          scale = 1,
          allNodes = this.data() ? this.data().nodes : null,
          nodes = [];
      if (nodeIds) for (i = 0; i < nodeIds.length; i++) { nodes.push(allNodes[nodeIds[i]]); }
      else nodes = allNodes;

      var numNodes = nodes ? nodes.length : 0;

      if (numNodes) { // get initial transform
        var minX = Infinity, maxX = -Infinity,
            minY = Infinity, maxY = -Infinity,
            width = this.width(),
            height = this.height(),
            pad = 1.1,
            i;

        for (i = 0; i < numNodes; i++) {
          if (nodes[i].x < minX) minX = nodes[i].x;
          if (nodes[i].x > maxX) maxX = nodes[i].x;
          if (nodes[i].y < minY) minY = nodes[i].y;
          if (nodes[i].y > maxY) maxY = nodes[i].y;
        }

        var dX = maxX - minX,
            dY = maxY - minY;

        scale = Math.min(width / dX, height / dY, 2) / pad;
        x = (width - dX * scale) / 2 - minX * scale;
        y = (height - dY * scale) / 2 - minY * scale;
      }

      return this.scale(scale).translate([x, y]);
    };

  /**
    * grapher.centerToPoint
    * ------------------
    *
    * Center the network to the point with x and y coordinates
    */
    g.prototype.centerToPoint = function (point) {
      var width = this.width(),
          height = this.height(),
          x = this.translate()[0] + width / 2 - point.x,
          y = this.translate()[1] + height / 2 - point.y;

      return this.translate([x, y]);
    };

  /**
    * Extend data to call this.center,
    * scale and translate to track when the user modifies the transform.
    */
    var render = g.prototype.render,
        scale = g.prototype.scale,
        translate = g.prototype.translate;

    g.prototype._hasModifiedTransform = false;
    g.prototype.render = function () {
      if (!this._hasModifiedTransform) this.center();
      return render.apply(this, arguments);
    };
    g.prototype.scale = function () {
      var res = scale.apply(this, arguments);
      if (res === this) this._hasModifiedTransform = true;
      return res;
    };
    g.prototype.translate = function () {
      var res = translate.apply(this, arguments);
      if (res === this) this._hasModifiedTransform = true;
      return res;
    };
  };

  if (typeof module !== 'undefined' && module.exports) module.exports = center;
  else center(Grapher);
})();

}, {}]}, {}, {"1":""})


text:
<!DOCTYPE HTML>

    <META charset="UTF-8">
    <title>[JUI Library] - CSS/Accordion</title>

    <link rel="stylesheet" href="../../dist/jui.css" />
    <link rel="stylesheet" href="../../dist/dark.theme.css" />

Title contents

Title contents

Title contents

Title contents

Title contents


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/*
 * This class holds the JSON structure for a call to osu's get_player API.  It's built so JSON Deserialize Object can fill every field
 * when it is given a valid JSON file.
 */
namespace Cygnus
{
    class OsuPlayer
    {
        [JsonProperty("user_id")]
        public string User_id { get; set; }
        [JsonProperty("username")]
        public string Username { get; set; }
        [JsonProperty("count300")]
        public string Count300 { get; set; }
        [JsonProperty("count100")]
        public string Count100 { get; set; }
        [JsonProperty("count50")]
        public string Count50 { get; set; }
        [JsonProperty("playcount")]
        public string Playcount { get; set; }
        [JsonProperty("ranked_score")]
        public string Ranked_score { get; set; }
        [JsonProperty("total_score")]
        public string Total { get; set; }
        [JsonProperty("pp_rank")]
        public string PP_rank { get; set; }
        [JsonProperty("level")]
        public string Level { get; set; }
        [JsonProperty("pp_raw")]
        public string PP_raw { get; set; }
        [JsonProperty("accuracy")]
        public string Accuracy { get; set; }
        [JsonProperty("count_rank_ss")]
        public string Count_rank_ss { get; set; }
        [JsonProperty("count_rank_s")]
        public string Count_rank_s { get; set; }
        [JsonProperty("count_rank_a")]
        public string Count_rank_a { get; set; }
        [JsonProperty("country")]
        public string Country { get; set; }
        [JsonProperty("pp_country_rank")]
        public string PP_country_rank { get; set; }
        [JsonProperty("events")]
        public List<object> Events { get; set; }
    }
}


text:
package liquibase.database.typeconversion.core;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import liquibase.database.structure.type.CustomType;

public class CacheTypeConverterTest extends DefaultTypeConverterTest {
    @Test
    public void getFalseBooleanValue() {
        assertEquals("0", new CacheTypeConverter().getBooleanType().getFalseBooleanValue());
    }

    @Test
    public void getTrueBooleanValue() {
        assertEquals("1", new CacheTypeConverter().getBooleanType().getTrueBooleanValue());
    }

    @Test
	public void getDateType() {
		assertEquals("DATE", new CacheTypeConverter().getDateType().toString());
	}

    @Test
	public void getBlobType() {
		assertEquals("LONGVARBINARY", new CacheTypeConverter().getBlobType().toString());
	}

    @Test
	public void getBooleanType() {
		assertEquals("INT", new CacheTypeConverter().getBooleanType().toString());
	}

    @Test
	public void getClobType() {
		assertEquals("LONGVARCHAR", new CacheTypeConverter().getClobType().toString());
	}

    @Test
	public void getCurrencyType() {
		assertEquals("MONEY", new CacheTypeConverter().getCurrencyType().toString());
	}

    @Test
    public void getDateTimeType() {
        assertEquals("DATETIME", new CacheTypeConverter().getDateTimeType().toString());
    }

    @Test
    public void getUUIDType() {
        assertEquals("CHAR(36)", new CacheTypeConverter().getUUIDType().toString());
    }

}


text:
#ifndef NetscapePlugInStreamLoader_h
#define NetscapePlugInStreamLoader_h

#include "ResourceLoader.h"
#include <wtf/Forward.h>

namespace WebCore {

class NetscapePlugInStreamLoader;

class NetscapePlugInStreamLoaderClient {
public:
    virtual void didReceiveResponse(NetscapePlugInStreamLoader*, const ResourceResponse&) = 0;
    virtual void didReceiveData(NetscapePlugInStreamLoader*, const char*, int) = 0;
    virtual void didFail(NetscapePlugInStreamLoader*, const ResourceError&) = 0;
    virtual void didFinishLoading(NetscapePlugInStreamLoader*) { }
    virtual bool wantsAllStreams() const { return false; }

protected:
    virtual ~NetscapePlugInStreamLoaderClient() { }
};

class NetscapePlugInStreamLoader : public ResourceLoader {
public:
    static PassRefPtr<NetscapePlugInStreamLoader> create(Frame*, NetscapePlugInStreamLoaderClient*, const ResourceRequest&);
    virtual ~NetscapePlugInStreamLoader();

    bool isDone() const;

private:
    virtual void didReceiveResponse(const ResourceResponse&);
    virtual void didReceiveData(const char*, int, long long encodedDataLength, bool allAtOnce);
    virtual void didFinishLoading(double finishTime);
    virtual void didFail(const ResourceError&);

    virtual void releaseResources();

    NetscapePlugInStreamLoader(Frame*, NetscapePlugInStreamLoaderClient*);

    virtual void willCancel(const ResourceError&);
    virtual void didCancel(const ResourceError&);

    NetscapePlugInStreamLoaderClient* m_client;
};

}

#endif // NetscapePlugInStreamLoader_h


text:
/**
 * This indirection is needed to free up Component, etc symbols in the public API
 * to be used by the decorator versions of these annotations.
 */
import { makeDecorator } from 'angular2/src/util/decorators';
import { CanActivate as CanActivateAnnotation } from './lifecycle_annotations_impl';
export { canReuse, canDeactivate, onActivate, onReuse, onDeactivate } from './lifecycle_annotations_impl';
export var CanActivate = makeDecorator(CanActivateAnnotation);
//# sourceMappingURL=lifecycle_annotations.js.map


text:
var Checker = require('../../lib/checker');
var assert = require('assert');

describe('rules/require-curly-braces', function() {
    var checker;

    beforeEach(function() {
        checker = new Checker();
        checker.registerDefaultRules();
    });

    it('should report missing `if` braces', function() {
        checker.configure({ requireCurlyBraces: ['if'] });
        assert(checker.checkString('if (x) x++;').getErrorCount() === 1);
    });

    it('should not report `if` with braces', function() {
        checker.configure({ requireCurlyBraces: ['if'] });
        assert(checker.checkString('if (x) { x++; }').isEmpty());
    });

    it('should report missing `else` braces', function() {
        checker.configure({ requireCurlyBraces: ['else'] });
        assert(checker.checkString('if (x) x++; else x--;').getErrorCount() === 1);
    });

    it('should not report `else` with braces', function() {
        checker.configure({ requireCurlyBraces: ['else'] });
        assert(checker.checkString('if (x) x++; else { x--; }').isEmpty());
    });

    it('should report missing `while` braces', function() {
        checker.configure({ requireCurlyBraces: ['while'] });
        assert(checker.checkString('while (x) x++;').getErrorCount() === 1);
    });

    it('should not report `while` with braces', function() {
        checker.configure({ requireCurlyBraces: ['while'] });
        assert(checker.checkString('while (x) { x++; }').isEmpty());
    });

    it('should report missing `for` braces', function() {
        checker.configure({ requireCurlyBraces: ['for'] });
        assert(checker.checkString('for (;;) x++;').getErrorCount() === 1);
    });

    it('should not report `for` with braces', function() {
        checker.configure({ requireCurlyBraces: ['for'] });
        assert(checker.checkString('for (;;) { x++; }').isEmpty());
    });

    it('should report missing `for in` braces', function() {
        checker.configure({ requireCurlyBraces: ['for'] });
        assert(checker.checkString('for (i in z) x++;').getErrorCount() === 1);
    });

    it('should not report `for in` with braces', function() {
        checker.configure({ requireCurlyBraces: ['for'] });
        assert(checker.checkString('for (i in z) { x++; }').isEmpty());
    });

    it('should report missing `do` braces', function() {
        checker.configure({ requireCurlyBraces: ['do'] });
        assert(checker.checkString('do x++; while (x);').getErrorCount() === 1);
    });

    it('should not report `do` with braces', function() {
        checker.configure({ requireCurlyBraces: ['do'] });
        assert(checker.checkString('do { x++; } while (x);').isEmpty());
    });

    it('should report missing `case` braces', function() {
        checker.configure({ requireCurlyBraces: ['case'] });
        assert(checker.checkString('switch(x){case 1:a=b;}').getErrorCount() === 1);
    });

    it('should report missing `case` braces, but not missing `default`', function() {
        checker.configure({ requireCurlyBraces: ['case'] });
        assert(checker.checkString('switch(x){case 1:a=b;default:a=c;}').getErrorCount() === 1);
    });

    it('should not report `case` with braces', function() {
        checker.configure({ requireCurlyBraces: ['case'] });
        assert(checker.checkString('switch(x){case 1:{a=b;}}').isEmpty());
    });

    it('should not report empty `case` with missing braces', function() {
        checker.configure({ requireCurlyBraces: ['case'] });
        assert(checker.checkString('switch(x){case 0:case 1:{a=b;}}').isEmpty());
    });

    it('should report missing `default` braces', function() {
        checker.configure({ requireCurlyBraces: ['default'] });
        assert(checker.checkString('switch(x){default:a=b;}').getErrorCount() === 1);
    });

    it('should report missing `default` braces, but not missing `case`', function() {
        checker.configure({ requireCurlyBraces: ['default'] });
        assert(checker.checkString('switch(x){case 1:a=b;default:a=c;}').getErrorCount() === 1);
    });

    it('should not report `default` with braces', function() {
        checker.configure({ requireCurlyBraces: ['default'] });
        assert(checker.checkString('switch(x){default:{a=b;}}').isEmpty());
    });

    it('should ignore method name if it\'s a reserved word (#180)', function() {
        checker.configure({ requireCurlyBraces: ['catch'] });
        assert(checker.checkString('promise.catch()').isEmpty());
    });

    it('should report on all optionally curly braced keywords if a value of true is supplied', function() {
        checker.configure({ requireCurlyBraces: true });

        assert(!checker.checkString('if (x) x++;').isEmpty());
        assert(!checker.checkString('if (x) {x++} else x--;').isEmpty());
        assert(!checker.checkString('for (x = 0; x < 10; x++) x++;').isEmpty());
        assert(!checker.checkString('while (x) x++;').isEmpty());
        assert(!checker.checkString('do x++; while(x < 5);').isEmpty());
        assert(!checker.checkString('try {x++;} catch(e) throw e;').isEmpty());
        assert(!checker.checkString('switch(\'4\'){ case \'4\': break; }').isEmpty());
        assert(!checker.checkString('switch(\'4\'){ case \'4\': {break;} default: 1; }').isEmpty());
        assert(!checker.checkString('with(x) console.log(toString());').isEmpty());
    });

    it('should correctly set pointer (#799)', function() {
        checker.configure({ requireCurlyBraces: ['else'] });

        // jscs:disable
        var error = checker.checkString(function foo() {
            if (foo === 1)
                return 1;
            else
                return 3;
        }.toString()).getErrorList()[ 0 ];
        // jscs:enable

        assert(error.line === 4);
        assert(error.column === 12);
    });
});


text:
#include "connection.h"

#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>

#include "nettools.h"
#include "mem.h"
#include "oop.h"

#ifdef HAVE_SOCKER_GET
#include <socker.h>
#endif /* HAVE_SOCKER_GET */

typedef enum connection_magic {
  CONNECTION_MAGIC = 0x7d794ad3
} connection_magic_t;

struct connection {
  connection_magic_t  magic;
  int                 ref_count;

  void                *context;
  ev_source_t         *source;
  connection_event_cb event_cb;
  net_addr_t          addr;
  uint16_t            port;
  bool                listening;
};

#define GETTER(type, attr) \
type \
connection_get_ ## attr (connection_t *c) \
{ \
  connection_check(c); \
  return (c->attr); \
}

#define SETTER(type, attr) \
void \
connection_set_ ## attr (connection_t *c, type val) \
{ \
  connection_check(c); \
  (c->attr) = (val); \
}

GETTER(net_addr_t, addr)
GETTER(uint16_t, port)
GETTER(bool, listening)
GETTER(ev_source_t *, source)
GETTER(void *, context)

SETTER(connection_event_cb, event_cb)
SETTER(void *, context)

void
connection_check(connection_t *c)
{
  RUNTIME_ASSERT(c);
  RUNTIME_ASSERT(CONNECTION_MAGIC == c->magic);
  RUNTIME_ASSERT(c->ref_count > 0);
}

char *
connection_get_addrstr(connection_t *c, char *dst, size_t size)
{
  connection_check(c);
  print_net_addr(dst, size, c->addr);
  return dst;
}

int
connection_get_fd(connection_t *c)
{
  connection_check(c);
  return c->source ? ev_source_get_fd(c->source) : -1;
}

bool
connection_is_closed(connection_t *c)
{
  connection_check(c);
  return !c->source || ev_source_is_closed(c->source);
}

void
connection_close(connection_t *c)
{
  connection_check(c);

  if (c->source) {
    int fd;

    ev_source_check(c->source);
    fd = ev_source_get_fd(c->source);
    if (fd >= 0) {
      if (close(fd)) {
        CRIT("close(%d) failed: %s", fd, compat_strerror(errno));
      }
      ev_source_close(c->source);
    }
    ev_source_set_context(c->source, NULL);
    ev_source_set_event_cb(c->source, NULL);
    ev_source_unref(c->source);
    c->source = NULL;
  }
}

static connection_t *
connection_alloc(void)
{
  connection_t *c;

  c = mem_chunk_alloc(sizeof *c);
  return c;
}

static void
connection_free(connection_t *c)
{
  if (c) {
    c->magic = 0;
    c->context = NULL;
    c->source = NULL;
    c->event_cb = NULL;
    mem_chunk_free(c, sizeof *c);
  }
}

void
connection_ref(connection_t *c)
{
  connection_check(c);
  RUNTIME_ASSERT(c->ref_count > 0);
  RUNTIME_ASSERT(c->ref_count < INT_MAX);
  c->ref_count++;
}

void
connection_unref(connection_t *c)
{
  connection_check(c);
  RUNTIME_ASSERT(c->ref_count > 0);
  c->ref_count--;
  if (0 == c->ref_count) {
    connection_free(c);
  }
}

static int
connection_set_sockopt(connection_t *c, int level, int opt, int optval,
    const char *optname)
{
  socklen_t optlen = sizeof optval;
  int fd, ret;

  connection_check(c);

  fd = connection_get_fd(c);
  ret = setsockopt(fd, level, opt, &optval, optlen);
  if (ret) {
    WARN("setsockopt(%d, ..., %s, ...) failed: %s\n",
        fd, optname, compat_strerror(errno));
  }
  return ret;
}

static void
connection_event_callback(ev_source_t *evs, ev_type_t ev)
{
  connection_t *c;

  ev_source_check(evs);

  c = ev_source_get_context(evs);
  connection_check(c);

  RUNTIME_ASSERT(c->event_cb);
  c->event_cb(c, ev);
}

void
connection_set_source(connection_t *c, ev_source_t *evs)
{
  connection_check(c);
  ev_source_check(evs);

  c->source = evs;
  ev_source_set_context(c->source, c);
  ev_source_set_event_cb(c->source, connection_event_callback);
}

int
connection_set_rcvbuf(connection_t *c, int optval)
{
  connection_check(c);
  return connection_set_sockopt(c, SOL_SOCKET, SO_RCVBUF, optval, "SO_RCVBUF");
}

int
connection_set_sndbuf(connection_t *c, int optval)
{
  connection_check(c);
  return connection_set_sockopt(c, SOL_SOCKET, SO_SNDBUF, optval, "SO_SNDBUF");
}

/**
 * Enables or disables the TCP_NODELAY socket option (Nagle algorithm) on
 * the connection socket.
 *
 * @param value if true, TCP_NODELAY is enabled, otherwise it's disabled.
 * @return -1 on failure (see errno) and zero on success.
 */
int
connection_set_nodelay(connection_t *c, bool value)
{
  connection_check(c);
  return connection_set_sockopt(c, IPPROTO_TCP, TCP_NODELAY,
          value ? 1 : 0, "TCP_NODELAY");
}

int
connection_set_tos_lowdelay(connection_t *c)
{
  connection_check(c);
  return connection_set_sockopt(c, IPPROTO_IP, IP_TOS, IPTOS_LOWDELAY,
            "IPTOS_LOWDELAY");
}

int
connection_set_tos_throughput(connection_t *c)
{
  connection_check(c);
  return connection_set_sockopt(c, IPPROTO_IP, IP_TOS, IPTOS_THROUGHPUT,
            "IPTOS_THROUGHPUT");
}

int
connection_set_tos_reliability(connection_t *c)
{
  connection_check(c);
  return connection_set_sockopt(c, IPPROTO_IP, IP_TOS, IPTOS_RELIABILITY,
            "IPTOS_RELIABILITY");
}

int
connection_set_rcvlowat(connection_t *c, unsigned int lowat)
{
  connection_check(c);

#ifdef SO_RCVLOWAT
  return connection_set_sockopt(c, SOL_SOCKET, SO_RCVLOWAT, lowat,
          "SO_RCVLOWAT");
#else   /* !SO_RCVLOWAT */
  (void) lowat;
#endif  /* SO_RCVLOWAT */

  return 0;
}

int
connection_set_blocking(connection_t *c, bool block)
{
  int flags, fd;

  connection_check(c);

  fd = connection_get_fd(c);
  flags = fcntl(fd, F_GETFL);
  if (-1 == flags) {
    CRIT("fcntl(%d, F_GETFL) failed: %s", fd, compat_strerror(errno));
    return -1;
  }

  if (block) {
    if (0 == (flags & O_NONBLOCK))
      return 0;
    flags &= ~O_NONBLOCK;
  } else {
    if (0 != (flags & O_NONBLOCK))
      return 0;
    flags |= O_NONBLOCK;
  }

  if (-1 == fcntl(fd, F_SETFL, flags)) {
    CRIT("fcntl(%d, F_SETFL) failed: %s", fd, compat_strerror(errno));
    return -1;
  }
  return 0;
}

/**
 * @return -1 on failure (see errno) and zero on success.
 */
int
connection_accept_http_filter(connection_t *c)
#if defined(SO_ACCEPTFILTER)
{
  static const struct accept_filter_arg zero_arg;
  struct accept_filter_arg arg;
  static const char name[] = "httpready";
  int fd;

  connection_check(c);

  arg = zero_arg;
  STATIC_ASSERT(sizeof arg.af_name >= STATIC_STRLEN(name));
  strncpy(arg.af_name, name, sizeof arg.af_name);

  fd = connection_get_fd(c);
  if (setsockopt(fd, SOL_SOCKET, SO_ACCEPTFILTER, &arg, sizeof arg)) {
    WARN("Cannot set SO_ACCEPTFILTER (%s): %s", name, compat_strerror(errno));
    return -1;
  }
  return 0;
}
#else /* !SO_ACCEPTFILTER */
{
  (void) c;
  errno = ENOTSUP;
  return -1;
}
#endif /* SO_ACCEPTFILTER */

/**
 * @return -1 on failure (see errno) and zero on success.
 */
int
connection_set_defer_accept(connection_t *c, int seconds)
#if defined(TCP_DEFER_ACCEPT)
{
  connection_check(c);
  return connection_set_sockopt(c, IPPROTO_TCP, TCP_DEFER_ACCEPT, seconds,
            "TCP_DEFER_ACCEPT");
}
#else /* !TCP_DEFER_ACCEPT */
{
  connection_check(c);
  (void) seconds;
  errno = ENOTSUP;
  return -1;
}
#endif /* TCP_DEFER_ACCEPT */

/**
 * @return -1 on failure (see errno) and zero on success.
 */
int
connection_set_quick_ack(connection_t *c, bool value)
#if defined(TCP_QUICKACK)
{
  connection_check(c);
  return connection_set_sockopt(c, IPPROTO_TCP, TCP_QUICKACK, value ? 1 : 0,
            "TCP_QUICKACK");
}
#else /* !TCP_QUICKACK */
{
  connection_check(c);
  (void) value;
  errno = ENOTSUP;
  return -1;
}
#endif /* TCP_QUICKACK */

/**
 * @return -1 on failure (see errno) and zero on success.
 */
int
connection_set_nopush(connection_t *c, bool value)
#if defined(TCP_NOPUSH)
{
  connection_check(c);
  return connection_set_sockopt(c, IPPROTO_TCP, TCP_NOPUSH, value ? 1 : 0,
            "TCP_NOPUSH");
}
#else /* !TCP_NOPUSH */
{
  connection_check(c);
  (void) value;
  errno = ENOTSUP;
  return -1;
}
#endif /* TCP_NOPUSH */

int
connection_socker_get(const net_addr_t addr, uint16_t port, int type)
#ifdef HAVE_SOCKER_GET
{
  char addr_buf[NET_ADDR_BUFLEN];
  int fd;

  print_net_addr(addr_buf, sizeof addr_buf, addr);
  fd = socker_get(net_addr_family(addr), type, 0, addr_buf, port);
  if (-1 == fd) {
    CRIT("socker_get() failed");
  }
  return fd;
}
#else /* HAVE_SOCKER_GET */
{
  (void) addr;
  (void) port;
  (void) type;
  errno = ENOTSUP;
  return -1;
}
#endif

int
connection_bind_socket(const net_addr_t addr, uint16_t port, int type,
  bool reuse_addr)
{
  bool used_socker = false;
  int fd;

  fd = socket(net_addr_family(addr), type, 0);
  if (fd < 0) {
    int saved_errno = errno;

    fd = connection_socker_get(addr, port, type);
    if (fd < 0) {
      if (ENOTSUP == errno) {
        errno = saved_errno;
        CRIT("socket() failed: %s", compat_strerror(errno));
      }
      return -1;
    }

    used_socker = true;
  }

  if (reuse_addr) {
    static const int enable = 1;
    if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof enable)) {
      CRIT("setsockopt() failed: %s", compat_strerror(errno));
      close(fd);
      return -1;
    }
  }

  if (!used_socker) {
    const struct sockaddr *sa;
    socklen_t len;

    /* Always enable IPv6-only for IPv6 sockets so that the socket()
     * does not accept IPv4 connections. Some implementations
     * do not support this anyway. */
#if defined(IPV6_V6ONLY) && defined(HAVE_IPV6_SUPPORT)
    if (AF_INET6 == net_addr_family(addr)) {
      static const int enable = 1;

      if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &enable, sizeof enable)) {
        WARN("setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, ...)");
      }
    }
#endif /* IPV6_V6ONLY */

    len = net_addr_sockaddr(addr, port, &sa);
    if (0 != bind(fd, sa, len)) {
      int saved_errno = errno;

      close(fd);
      fd = connection_socker_get(addr, port, type);
      if (fd < 0) {
        if (ENOTSUP == errno) {
          errno = saved_errno;
          CRIT("bind() failed: %s", compat_strerror(errno));
        }
        return -1;
      }
    }
  }

  return fd;
}

connection_t *
connection_listen(const net_addr_t addr, uint16_t port, int backlog)
{
  connection_t *c;
  int fd;

  fd = connection_bind_socket(addr, port, SOCK_STREAM, true);
  if (-1 == fd) {
    return NULL;
  }

  if (listen(fd, backlog)) {
    CRIT("listen() failed: %s", compat_strerror(errno));
    close(fd);
    return NULL;
  }

  c = connection_new(addr, port);
  if (c) {
    c->listening = true;
    connection_set_source(c, ev_source_new(fd));
  } else {
    close(fd);
  }
  return c;
}

connection_t *
connection_udp(const net_addr_t addr, uint16_t port)
{
  connection_t *c;
  int fd;

  fd = connection_bind_socket(addr, port, SOCK_DGRAM, false);
  if (-1 == fd) {
    return NULL;
  }

  c = connection_new(addr, port);
  if (c) {
    connection_set_source(c, ev_source_new(fd));
  } else {
    close(fd);
  }
  return c;
}

connection_t *
connection_accept(connection_t *server)
{
  static bool inherits = false;
#ifdef HAVE_IPV6_SUPPORT
  struct sockaddr_storage sa;
#else
  struct sockaddr sa;
#endif
  socklen_t len = sizeof sa;
  net_addr_t addr;
  int fd, s_fd;
  uint16_t port;

  s_fd = connection_get_fd(server);
  fd = accept(s_fd, cast_to_void_ptr(&sa), &len);
  if (-1 == fd)
    return NULL;

#ifdef HAVE_IPV6_SUPPORT
  switch (sa.ss_family) {
  case PF_INET6:
    {
      const struct sockaddr_in6 *sin6 = cast_to_void_ptr(&sa);

      addr = net_addr_peek_ipv6(cast_to_const_void_ptr(&sin6->sin6_addr));
      port = ntohs(sin6->sin6_port);
    }
    break;
#else
  switch (sa.sa_family) {
#endif

  case PF_INET:
    {
      const struct sockaddr_in *sin4 = cast_to_void_ptr(&sa);

      addr = net_addr_set_ipv4(sin4->sin_addr.s_addr);
      port = ntohs(sin4->sin_port);
    }
    break;

  default:
    {
      unsigned u =
#ifdef HAVE_IPV6_SUPPORT
        sa.ss_family;
#else
        sa.sa_family;
#endif

      WARN("accept()ed connection of unknown protocol (%u), closing", u);
    }
    close(fd);
    return NULL;
  }

  if (!inherits) {
    static bool checked = false;
    int c_flags, s_flags;

    c_flags = fcntl(fd, F_GETFL);
    if (c_flags == -1) {
      CRIT("fcntl(fd, F_GETFL) failed: %s", compat_strerror(errno));
      c_flags = 0;
    }

    s_flags = fcntl(s_fd, F_GETFL);
    if (s_flags == -1) {
      CRIT("fcntl(fd, F_GETFL) failed: %s", compat_strerror(errno));
    }

    if (-1 != s_flags && !checked) {
      checked = true;
      inherits = (s_flags & O_NONBLOCK) == (c_flags & O_NONBLOCK);
      DBUG("client socket %s O_NONBLOCK from server",
        inherits ? "inherits" : "does NOT inherit");
    }

    c_flags = (c_flags & ~O_NONBLOCK) | (s_flags & O_NONBLOCK);
    if (-1 == fcntl(fd, F_SETFL, c_flags)) {
      CRIT("fcntl(fd, F_SETFL) failed: %s", compat_strerror(errno));
    }
  }

  {
    connection_t *c = connection_new(addr, port);
    if (c) {
      connection_set_source(c, ev_source_new(fd));
      return c;
    }
  }

  CRIT("connection_new() failed");
  close(fd);
  return NULL;
}

connection_t *
connection_new(const net_addr_t addr, uint16_t port)
{
  connection_t *c;

  c = connection_alloc();
  if (c) {
    c->magic = CONNECTION_MAGIC;
    c->ref_count = 1;
    c->addr = addr;
    c->port = port;
    c->context = NULL;
    c->source = NULL;
    c->listening = false;
  }
  return c;
}

/* vi: set ai et sts=2 sw=2 cindent: */


text:
"""
SIMBAD Query Tool
=================

The SIMBAD query tool creates a `script query
<http://simbad.u-strasbg.fr/simbad/sim-fscript>`__ that returns VOtable XML
data that is then parsed into a SimbadResult object.  This object then
parses the data and returns a table parsed with `astropy.io.votable.parse`.
"""
from astropy import config as _config

class Conf(_config.ConfigNamespace):
    """
    Configuration parameters for `astroquery.simbad`.
    """
    server = _config.ConfigItem(
        ['simbad.u-strasbg.fr', 'simbad.harvard.edu'],
        'Name of the SIMBAD mirror to use.')

    timeout = _config.ConfigItem(
        60,
        'Time limit for connecting to Simbad server.')

    row_limit = _config.ConfigItem(
        # O defaults to the maximum limit
        0,
        'Maximum number of rows that will be fetched from the result.')

conf = Conf()

from .core import Simbad, SimbadClass, SimbadBaseQuery

__all__ = ['Simbad', 'SimbadClass',
           'SimbadBaseQuery',
           'Conf', 'conf',
           ]


text:
package org.robolectric.res;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class FileFsFileTest {

  public String origFileSeparator;

  @Before
  public void setUp() throws Exception {
    origFileSeparator = FileFsFile.FILE_SEPARATOR;
  }

  @After
  public void tearDown() throws Exception {
    FileFsFile.FILE_SEPARATOR = origFileSeparator;
  }

  @Test
  public void from_shouldConstructPath() {
    final String path = FileFsFile.from("foo", "bar", "baz").getPath();
    assertThat(path).isEqualTo("foo" + File.separator + "bar" + File.separator + "baz");
  }

  @Test
  public void from_shouldIgnoreNullOrMissingComponents() {
    final String path = FileFsFile.from(null, "", "foo", "bar").getPath();
    assertThat(path).isEqualTo(safe("foo/bar"));
  }

  @Test public void from_shouldAllowSingleDotPart() throws Exception {
    final String path = FileFsFile.from(".").getPath();
    assertThat(path).isEqualTo(".");
  }

  @Test public void from_shouldAllowLeadingSlash() throws Exception {
    final String path = FileFsFile.from(safe("/some/path")).getPath();
    assertThat(path).isEqualTo(safe("/some/path"));

  }

  @Test public void from_shouldIgnoreDotParts() throws Exception {
    final String path = FileFsFile.from(safe("/some/path/./to/here")).getPath();
    assertThat(path).isEqualTo(safe("/some/path/to/here"));

  }

  @Test public void join_shouldIgnoreDotParts() throws Exception {
    final String path = FileFsFile.from(".").join(safe("some/./path"), ".", safe("to/here")).getPath();
    assertThat(path).isEqualTo(safe("./some/path/to/here"));
  }

  @Test
  public void from_shouldWorkOnWindows() throws Exception {
    FileFsFile.FILE_SEPARATOR = "\\";

    assertThat(partsOf(FileFsFile.from("\\", "a\\b\\c", "d")))
        .containsExactly("a", "b", "c", "d");
  }

  @Test
  public void join_shouldWorkOnWindows() throws Exception {
    FileFsFile.FILE_SEPARATOR = "\\";

    assertThat(partsOf(FileFsFile.from("a\\b\\c").join("d\\e\\f")))
        .containsExactly("a", "b", "c", "d", "e", "f");
  }

  List<String> partsOf(FsFile fsFile) {
    List<String> parts = new ArrayList<>();
    while (fsFile != null) {
      parts.add(fsFile.getName());
      fsFile = fsFile.getParent();
    }
    Collections.reverse(parts);
    return parts;
  }

  @Nonnull
  private String safe(String path) {
    return path.replace("/", File.separator);
  }
}


text:
Rails.application.routes.draw do

  get "messages/new", to: "messages#new"
  post :messages, to: "messages#create"

  mount Simplec::Engine => "/"

  scope module: :admin, as: :admin, constraints: { subdomain: 'admin' } do
    root 'static#dashboard'

    resources :subdomains, only: %w(index new create edit update destroy)
    resources :pages, only: %w(index new create edit update destroy)
    resources :documents, only: %w(index new create edit update destroy)
    resources :document_sets, only: %w(index new create edit update destroy) do
      resources :documents, only: %w(index new create edit update destroy)
    end
    resources :embedded_images, only: %w(create) # TODO nice to put this in gem

    resource :session, only: %w(new create destroy)
  end

end


text:
<?php

namespace Afoozle\NewrelicTools\Deployments;

/**
 * Class Deployment
 *
 * This is a value object which represents a single deployment
 *
 * @package Afoozle\NewrelicTools\Deployments
 */
class Deployment {

    /** @var string The application Name from New Relic */
    private $appName = null;

    /** @var int The application ID from New Relic */
    private $applicationId = null;

    /** @var string A text description for this deployment */
    private $description = null;

    /** @var null The revision id for this deployment */
    private $revision = null;

    /** @var string A textual changelog for this deployment */
    private $changelog = null;

    /** @var string The user running this deployment */
    private $user = null;

    /**
     * @param null|int $applicationId
     * @param null|string $appName
     * @throws \InvalidArgumentException
     */
    public function __construct($applicationId = null, $appName = null) {

        if ($applicationId !== null && $appName !== null) {
            throw new \InvalidArgumentException('Setting only application name or id is required, choose one');
        }

        if ($applicationId !== null) {
            if (false === is_int($applicationId) || $applicationId <= 0) {
                throw new \InvalidArgumentException('Application ID must be null or an integer');
            }

            $this->applicationId = $applicationId;
        }

        if ($appName !== null) {
            if (false === is_string($appName)) {
                throw new \InvalidArgumentException('App Name must be null or a string');
            }
            $this->appName = (string)$appName;
        }
    }

    /**
     * The application Name from New Relic
     *
     * @return string
     */
    public function getAppName()
    {
        return $this->appName;
    }

    /**
     * The application ID from New Relic
     *
     * @return int
     */
    public function getApplicationId()
    {
        return $this->applicationId;
    }

    /**
     * A textual changelog for this deployment
     *
     * @return string
     */
    public function getChangelog()
    {
        return $this->changelog;
    }

    /**
     * A textual changelog for this deployment
     *
     * @param string $changelog
     */
    public function setChangelog($changelog)
    {
        $this->changelog = $changelog;
    }

    /**
     * A text description for this deployment
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * A text description for this deployment
     *
     * @param string $description
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * The revision id for this deployment
     *
     * @return null
     */
    public function getRevision()
    {
        return $this->revision;
    }

    /**
     * The revision id for this deployment
     *
     * @param null $revision
     */
    public function setRevision($revision)
    {
        $this->revision = $revision;
    }

    /**
     * The user running this deployment
     *
     * @return string
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * The user running this deployment
     *
     * @param string $user
     */
    public function setUser($user)
    {
        $this->user = $user;
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Ative.DB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;

/**
 *
 * @author matheus
 */
public class Connect {
     public Connection getConnection() {
        Connection conexao;
        try {
            String stringConexao = "jdbc:mysql://sql8.hostinger.com.br/";
            String nomeBanco = "u642109495_proxy";
            String usuarioBanco = "u642109495_proxy";
            String senhaBanco = "matheus23";

            Class.forName("com.mysql.jdbc.Driver");

            conexao = DriverManager.getConnection(stringConexao+nomeBanco,
                    usuarioBanco, senhaBanco);
            //JOptionPane.showMessageDialog(null, "Banco Online");

        } catch (SQLException | ClassNotFoundException e) {
            JOptionPane.showMessageDialog(null, "Verifique sua conexão à internet");
	    JOptionPane.showMessageDialog(null, e.getMessage());
            //System.out.println(e.getMessage());
            conexao = null;
        }

        return conexao;
    }
}


text:
package engo

// Cursor is a reference to standard cursors, to be used in conjunction with `SetCursor`. What they look like, is
// different for each platform.
type Cursor uint8

const (
	// CursorNone can be used to reset the cursor.
	CursorNone Cursor = iota
	CursorArrow
	CursorCrosshair
	CursorHand
	CursorIBeam
	CursorHResize
	CursorVResize
)


text:
import colorfield.fields
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models

class Migration(migrations.Migration):
    dependencies = [
        ("store", "0001_create_superuser"),
    ]

    operations = [
        migrations.CreateModel(
            name="Product",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=64)),
                ("image", models.ImageField(blank=True, null=True, upload_to="photos")),
                ("description", models.CharField(max_length=1000)),
                ("price", models.DecimalField(decimal_places=2, max_digits=10)),
                ("active", models.BooleanField()),
                ("discount_percent", models.IntegerField()),
                ("inventory_count", models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name="Transaction",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("datetime", models.DateTimeField()),
                ("unit_price", models.DecimalField(decimal_places=2, max_digits=10)),
                (
                    "product_id",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="store.product"
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Testimonial",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("reviewer_name", models.CharField(max_length=64)),
                (
                    "rating",
                    models.IntegerField(
                        default=5,
                        validators=[
                            django.core.validators.MinValueValidator(1),
                            django.core.validators.MaxValueValidator(5),
                        ],
                    ),
                ),
                ("summary", models.CharField(max_length=1000)),
                ("description", models.CharField(max_length=5000)),
                (
                    "product_id",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="store.product"
                    ),
                ),
                ("reviewer_location", models.CharField(default="asdf", max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name="SiteConfig",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "color_primary",
                    colorfield.fields.ColorField(
                        default="#C200C2",
                        help_text="For the site banner gradient",
                        image_field=None,
                        max_length=18,
                        samples=None,
                    ),
                ),
                (
                    "color_secondary",
                    colorfield.fields.ColorField(
                        default="#BE0000",
                        help_text="For headings",
                        image_field=None,
                        max_length=18,
                        samples=None,
                    ),
                ),
                ("site_name", models.CharField(default="Simulatum", max_length=200)),
                (
                    "site_name_font",
                    models.CharField(
                        default="Pacifico",
                        help_text="Any valid Google Font name. Dynamically loaded at runtime.",
                        max_length=100,
                    ),
                ),
                (
                    "base_font",
                    models.CharField(
                        default="Tahoma",
                        help_text="Any valid Google Font name. Dynamically loaded at runtime.",
                        max_length=100,
                    ),
                ),
                ("active", models.BooleanField(default=True)),
                (
                    "color_action",
                    colorfield.fields.ColorField(
                        default="#00AFAF",
                        help_text="Fill for buttons",
                        image_field=None,
                        max_length=18,
                        samples=None,
                    ),
                ),
                (
                    "site_name_color",
                    colorfield.fields.ColorField(
                        default="#0D8645", image_field=None, max_length=18, samples=None
                    ),
                ),
                (
                    "color_action_text",
                    colorfield.fields.ColorField(
                        default="#000000",
                        help_text="Text for buttons",
                        image_field=None,
                        max_length=18,
                        samples=None,
                    ),
                ),
            ],
        ),
    ]


text:
require 'rubygems'
require 'mutter'
require 'unit-hosting/api'

module UnitHosting
  module Groups

    def update
      each { |g| g.update}
      self
    end

    def tablize
      return "no groups" if length == 0
      table = Mutter::Table.new(:delimiter => '|') do
        column :style => :green
        column
      end
      each do |group|
        table << [group.instance_id, group.name]
      end
      table.to_s if length > 0
    end

    def ids
      collect { |g| g.instance_id }
    end
  end

  class Group
    include UnitHosting::Api

    attr_accessor :instance_id, :key, :name, :remote, :vms
    alias :apikey :key

    def initialize(instance_id = nil)
      @instance_id = instance_id
    end

    def update
      # STDERR.puts "update #{instance_id}"
      @vms = VmGroup.new(@instance_id,@key).vms
      self
    end

    def tablize
      table = Mutter::Table.new(:delimiter => '|') do
        column :style => :green
        column;column
      end
      return "#{instance_id} has no vms" unless @vms
      @vms.each { |vm|
        table << [vm["instance_id"],vm["status"],vm["display_name"]]
      }
      table.to_s if @vms.length > 0
    end
  end

end


text:
function Resolve-PathSafe
{
    param( [string] $Path )
    $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path)
}