text:
package com.html5parser.algorithms;

import java.util.List;

import javax.xml.parsers.ParserConfigurationException;

import com.html5dom.Document;
import com.html5dom.Document.QuirksMode;
import com.html5dom.Element;
import com.html5dom.Node;
import com.html5dom.Node.NodeType;
import com.html5parser.classes.InsertionMode;
import com.html5parser.classes.ParserContext;
import com.html5parser.classes.Token.TokenType;
import com.html5parser.classes.TokenizerContext;
import com.html5parser.classes.TokenizerState;
import com.html5parser.classes.token.TagToken;
import com.html5parser.constants.Namespace;
import com.html5parser.factories.InsertionModeFactory;
import com.html5parser.factories.TokenizerStateFactory;
import com.html5parser.parser.Parser;

public class ParsingHTMLFragments {

	public static List<Node> run(ParserContext parserContext, Element context,
			String input) throws ParserConfigurationException {

			parserContext.addParseEvent("8.4");

		// Create a new Document node, and mark it as being an HTML document.
		Document document = new Document();

		// TODO If the node document of the context element is in quirks mode,
		// then
		// let the Document be in quirks mode. Otherwise, the node document of
		// the context element is in limited-quirks mode, then let the Document
		// be in limited-quirks mode. Otherwise, leave the Document in no-quirks
		// mode.
		document.setQuirksMode(QuirksMode.noQuirks);

		// Create a new HTML parser, and associate it with the just created
		// Document node.
		Parser parser = new Parser();
		parser.setDoc(document);

		// This is for our implementation, to know if the parser was created in
		// this script
		parser.getParserContext().setFlagHTMLFragmentParser(true);

		// Set the state of the HTML parser's tokenization stage as follows:
		// NOTE the spec does not say anything about namspace of the context
		// element, so we assume the elements must be in the HTML namespace
		TokenizerContext tokenizer = parser.getParserContext()
				.getTokenizerContext();
		TokenizerStateFactory factory = TokenizerStateFactory.getInstance();
		String elementName = context.getTagName();

		if (context.isHTMLElement()) {
			switch (elementName) {

			// If it is a title or textarea element
			// Switch the tokenizer to the RCDATA state.
			case "title":
			case "textarea":
				tokenizer.setNextState(factory
						.getState(TokenizerState.RCDATA_state));
				break;

			// If it is a style, xmp, iframe, noembed, or noframes element
			// Switch the tokenizer to the RAWTEXT state.
			case "style":
			case "xmp":
			case "iframe":
			case "noembed":
			case "noframes":
				tokenizer.setNextState(factory
						.getState(TokenizerState.RAWTEXT_state));
				break;

			// If it is a script element
			// Switch the tokenizer to the script data state.
			case "script":
				tokenizer.setNextState(factory
						.getState(TokenizerState.Script_data_state));
				break;

			// If it is a noscript element
			// If the scripting flag is enabled, switch the tokenizer to the
			// RAWTEXT
			// state. Otherwise, leave the tokenizer in the data state.
			case "noscript":
				if (parserContext.isFlagScripting())
					tokenizer.setNextState(factory
							.getState(TokenizerState.RAWTEXT_state));
				else
					tokenizer.setNextState(factory
							.getState(TokenizerState.Data_state));
				break;

			// If it is a plaintext element
			// Switch the tokenizer to the PLAINTEXT state.
			case "plaintext":
				tokenizer.setNextState(factory
						.getState(TokenizerState.PLAINTEXT_state));
				break;

			// Otherwise
			// Leave the tokenizer in the data state.
			default:
				tokenizer.setNextState(factory
						.getState(TokenizerState.Data_state));
				break;

			}
		} else
			tokenizer.setNextState(factory.getState(TokenizerState.Data_state));

		// Let root be a new html element with no attributes.
		Element root = document.createElementNS(Namespace.HTML, "html");

		// Append the element root to the Document node created above.
		document.appendChild(root);

		// Set up the parser's stack of open elements so that it contains just
		// the single element root.
		ParserContext newParserContext = parser.getParserContext();
		newParserContext.getOpenElements().push(root);

		// If the context element is a template element, push "in template" onto
		// the stack of template insertion modes so that it is the new current
		// template insertion mode.
		InsertionModeFactory insertionModeFactory = InsertionModeFactory
				.getInstance();
		if (elementName.equals("template")) {
			newParserContext.getTemplateInsertionModes().push(
					insertionModeFactory
							.getInsertionMode(InsertionMode.in_template));
		}

		// Create a start tag token whose name is the local name of context and
		// whose attributes are the attributes of context.
		//
		// Let this start tag token be the start tag token of the context node,
		// e.g. for the purposes of determining if it is an HTML integration
		// point. TODO:?????
		TagToken startTagToken = new TagToken(TokenType.start_tag,
				context.getNodeName());
		for (int i = 0; i < context.getAttributes().size(); i++) {
			Node attribute = context.getAttributes().get(i);
			startTagToken.createAttribute(attribute.getNodeName());
			startTagToken.appendCharacterInValueInLastAttribute(attribute
					.getNodeValue());
		}

		// Add start tag token to the stack of emmited start tags
		tokenizer.appendEmittedStartTag(startTagToken.getValue());

		// Set namespace as attribute
		if (context.getNamespaceURI() != null) {
			startTagToken.createAttribute("xmlns");
			startTagToken.appendCharacterInValueInLastAttribute(context
					.getNamespaceURI());
		}

		context.setUserData("startTagToken", startTagToken);
		parser.getParserContext().setHtmlFragmentContext(context);

		// Reset the parser's insertion mode appropriately.
		ResetTheInsertionModeAppropriately.Run(newParserContext, context);

		// Set the parser's form element pointer to the nearest node to the
		// context element that is a form element (going straight up the
		// ancestor chain, and including the element itself, if it is a form
		// element), if any. (If there is no such form element, the form element
		// pointer keeps its initial value, null.)
		Element elementPointer = context;

		do {
			if (elementPointer.getTagName().equals("form")) {
				newParserContext.setFormElementPointer(elementPointer);
				break;
			}
			if (context.getParentNode() != null
					&& context.getParentNode().getNodeType() == NodeType.ELEMENT_NODE)
				elementPointer = (Element) context.getParentNode();
			else
				elementPointer = null;

		} while (elementPointer != null);

		// Place the input into the input stream for the HTML parser just
		// created. The encoding confidence is irrelevant.
		// Start the parser and let it run until it has consumed all the
		// characters just inserted into the input stream.
		parser.parse(input);

		// Return the child nodes of root, in tree order.
		return root.getChildNodes();

		// Question, what happen with the allocated memory for the newly created
		// parser
		// should we set this to null?

	}

	public static void main(String[] args) throws ParserConfigurationException {
		Document doc = new Document();
		ParserContext parserContext = new ParserContext();

		parserContext.setDocument(doc);

		Element context = doc.createElementNS(Namespace.SVG, "path");
		doc.appendChild(context);
		String input = "<nobr>X";
		List<Node> result = ParsingHTMLFragments.run(parserContext, context,
				input);
		System.out.println(result.size());
		int size = result.size();
		for (int i = 0; i < size; i++) {
			Node node = result.get(i);
			System.out.println(node);
			Node adopted = doc.importNode(node, true);
			context.appendChild(adopted);
		}
		// System.out.println(Serializer.toHtmlString(doc));
		// System.out.println(parserContext.getParseErrors());
	}
}


text:
/*
 * Skin: Black
 * -----------
 */
/* skin-black navbar */
.skin-black .main-header {
  -webkit-box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
  box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
}
.skin-black .main-header .navbar-toggle {
  color: #333;
}
.skin-black .main-header .navbar-brand {
  color: #333;
  border-right: 1px solid #eee;
}
.skin-black .main-header .navbar {
  background-color: #000000;
}
.skin-black .main-header .navbar .nav > li > a {
  color: #333333;
}
.skin-black .main-header .navbar .nav > li > a:hover,
.skin-black .main-header .navbar .nav > li > a:active,
.skin-black .main-header .navbar .nav > li > a:focus,
.skin-black .main-header .navbar .nav .open > a,
.skin-black .main-header .navbar .nav .open > a:hover,
.skin-black .main-header .navbar .nav .open > a:focus,
.skin-black .main-header .navbar .nav > .active > a {
  background: #ffffff;
  color: #999999;

}
.skin-black .main-header .navbar .sidebar-toggle {
  color: #333333;
}
.skin-black .main-header .navbar .sidebar-toggle:hover {
  color: #000000;
  background: #ffffff;
}
.skin-black .main-header .navbar > .sidebar-toggle {
  color: #ffffff;
  border-right: 1px solid #eee;
}
.skin-black .main-header .navbar .navbar-nav > li > a {
  border-right: 1px solid #eee;
}
.skin-black .main-header .navbar .navbar-custom-menu .navbar-nav > li > a,
.skin-black .main-header .navbar .navbar-right > li > a {
  border-left: 1px solid #eee;
  border-right-width: 0;
}
.skin-black .main-header > .logo {
  background-color: #000000;
  color: #ffffff;
  border-bottom: 0 solid transparent;
  border-right: 1px solid #eee;
}
.skin-black .main-header > .logo:hover {
  color: #000000;
  background: #ffffff;
}
@media (max-width: 767px) {
  .skin-black .main-header > .logo {
    background-color: #222222;
    color: #ffffff;
    border-bottom: 0 solid transparent;
    border-right: none;
  }
  .skin-black .main-header > .logo:hover {
    background-color: #1f1f1f;
  }
}
.skin-black .main-header li.user-header {
  background-color: #222;
}
.skin-black .content-header {
  background: transparent;
  box-shadow: none;
}
.skin-black .wrapper,
.skin-black .main-sidebar,
.skin-black .left-side {
  background-color: #222d32;
}
.skin-black .user-panel > .info,
.skin-black .user-panel > .info > a {
  color: #fff;
}
.skin-black .sidebar-menu > li.header {
  color: #4b646f;
  background: #1a2226;
}
.skin-black .sidebar-menu > li > a {
  border-left: 3px solid transparent;
}
.skin-black .sidebar-menu > li:hover > a,
.skin-black .sidebar-menu > li.active > a {
  color: #ffffff;
  background: #1e282c;
  border-left-color: #ffffff;
}
.skin-black .sidebar-menu > li > .treeview-menu {
  margin: 0 1px;
  background: #2c3b41;
}
.skin-black .sidebar a {
  color: #b8c7ce;
}
.skin-black .sidebar a:hover {
  text-decoration: none;
}
.skin-black .treeview-menu > li > a {
  color: #8aa4af;
}
.skin-black .treeview-menu > li.active > a,
.skin-black .treeview-menu > li > a:hover {
  color: #ffffff;
}
.skin-black .sidebar-form {
  border-radius: 3px;
  border: 1px solid #374850;
  margin: 10px 10px;
}
.skin-black .sidebar-form input[type="text"],
.skin-black .sidebar-form .btn {
  box-shadow: none;
  background-color: #374850;
  border: 1px solid transparent;
  height: 35px;
}
.skin-black .sidebar-form input[type="text"] {
  color: #666;
  border-top-left-radius: 2px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 2px;
}
.skin-black .sidebar-form input[type="text"]:focus,
.skin-black .sidebar-form input[type="text"]:focus + .input-group-btn .btn {
  background-color: #fff;
  color: #666;
}
.skin-black .sidebar-form input[type="text"]:focus + .input-group-btn .btn {
  border-left-color: #fff;
}
.skin-black .sidebar-form .btn {
  color: #999;
  border-top-left-radius: 0;
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
  border-bottom-left-radius: 0;
}
.skin-black .pace .pace-progress {
  background: #222;
}
.skin-black .pace .pace-activity {
  border-top-color: #222;
  border-left-color: #222;
}

redpajama_set_name: RedPajamaGithub


text:
#pragma once
#include "universal_map.h"
#include "GraphicsDevice.h"
#include "Timer.h"
#include "Input.h"
#include "Console.h"

namespace Engine
{
	typedef std::shared_ptr<Engine::GraphicsDevice> EGraphics;
	typedef std::shared_ptr<Input> EInput;
	typedef std::shared_ptr<Timer> ETimer;
	typedef std::shared_ptr<Console> EConsole;
	/*Holds all data/objects relevant to the active window.
	Data is stored as universal_structs and must be cast to use.
	Because objets passed to this interface become "global", ensure that they are thread safe!
	Helper functions will not work if given graphics interfaces do not match expected output types.
	Ex: GetInput() etc. can still be obtained through GetAddon() function using designated reserved keys.
	Reserved keys:
	-GRAPHICS
	-INPUT
	-TIMER*/
	class WindowResources
	{
	public:
		__engine_decl static void SetGraphics(const universal_struct& graphics);
		__engine_decl static void SetInput(const universal_struct& input);
		__engine_decl static void SetTimer(const universal_struct& timer);
		__engine_decl static void SetConsole(const universal_struct& console);
		__engine_decl static void RemoveAddon(const std::string& key);
		__engine_decl static bool InsertAddon(const std::string& key, const universal_struct& obj);
		__engine_decl static EGraphics GetGraphics();
		__engine_decl static EInput GetInput();
		__engine_decl static ETimer GetTimer();
		__engine_decl static EConsole GetConsole();
		__engine_decl static const universal_struct* GetAddon(const std::string& key);
		__engine_decl static std::vector<std::string> GetKeyList();

	protected:
		friend class GraphicsWindow;
		__engine_decl static void Reset();

	private:
		static bool IsReserved(const std::string& key);
		static const std::string m_reserved[4];
		static universal_map m_resources;
	};

}


text:
module Socializer
  # Namespace for models related to the Person model
  class Person
    #
    # Person Profile model
    #
    # Links to other profiles that the {Socializer::Person person} has.
    # For example: Twitter, Facebook, etc.
    #
    class Profile < ApplicationRecord
      # Relationships
      belongs_to :person, inverse_of: :profiles

      # Validations
      validates :display_name, presence: true
      validates :url, presence: true
    end
  end
end


text:
var assert = (
    global && global.chai
    ? global.chai.assert
    : require('chai').assert
  )
  , SVGPathData = (
    global && global.SVGPathData
    ? global.SVGPathData
    : require(__dirname + '/../src/SVGPathData.js')
  )
;

describe("Parsing horizontal commands", function() {

  beforeEach(function() {
  });

  afterEach(function() {
  });

  it("should work with single coordinate", function() {
    var commands = new SVGPathData('H100').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].relative, false);
    assert.equal(commands[0].x, '100');
  });

  it("should work with single complexer coordinate", function() {
    var commands = new SVGPathData('H-10e-5').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].relative, false);
    assert.equal(commands[0].x, '-10e-5');
  });

  it("should work with single even more complexer coordinate", function() {
    var commands = new SVGPathData('H-10.0032e-5').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].relative, false);
    assert.equal(commands[0].x, '-10.0032e-5');
  });

  it("should work with single relative coordinate", function() {
    var commands = new SVGPathData('h100').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].relative, true);
    assert.equal(commands[0].x, '100');
  });

  it("should work with comma separated coordinates", function() {
    var commands = new SVGPathData('H123,456,7890,9876').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].x, '123');
    assert.equal(commands[1].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[1].x, '456');
    assert.equal(commands[2].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[2].x, '7890');
    assert.equal(commands[3].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[3].x, '9876');
  });

  it("should work with space separated coordinates", function() {
    var commands = new SVGPathData('H123 456 7890 9876').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].x, '123');
    assert.equal(commands[1].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[1].x, '456');
    assert.equal(commands[2].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[2].x, '7890');
    assert.equal(commands[3].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[3].x, '9876');
  });

  it("should work with nested separated coordinates", function() {
    var commands = new SVGPathData('H123 ,  456  \t,\n7890 \r\n 9876').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].x, '123');
    assert.equal(commands[1].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[1].x, '456');
    assert.equal(commands[2].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[2].x, '7890');
    assert.equal(commands[3].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[3].x, '9876');
  });

  it("should work with multiple command declarations", function() {
    var commands = new SVGPathData('H123 ,  456  \t,\n7890 \r\n 9876H123 , \
       456  \t,\n7890 \r\n 9876').commands;
    assert.equal(commands[0].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[0].x, '123');
    assert.equal(commands[1].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[1].x, '456');
    assert.equal(commands[2].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[2].x, '7890');
    assert.equal(commands[3].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[3].x, '9876');
    assert.equal(commands[4].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[4].x, '123');
    assert.equal(commands[5].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[5].x, '456');
    assert.equal(commands[6].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[6].x, '7890');
    assert.equal(commands[7].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[7].x, '9876');
  });

});

describe("Parsing vertical commands", function() {

  beforeEach(function() {
  });

  afterEach(function() {
  });

  it("should work with single coordinate", function() {
    var commands = new SVGPathData('V100').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].relative, false);
    assert.equal(commands[0].y, '100');
  });

  it("should work with single complexer coordinate", function() {
    var commands = new SVGPathData('V-10e-5').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].relative, false);
    assert.equal(commands[0].y, '-10e-5');
  });

  it("should work with single even more complexer coordinate", function() {
    var commands = new SVGPathData('V-10.0032e-5').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].relative, false);
    assert.equal(commands[0].y, '-10.0032e-5');
  });

  it("should work with single relative coordinate", function() {
    var commands = new SVGPathData('v100').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].relative, true);
    assert.equal(commands[0].y, '100');
  });

  it("should work with comma separated coordinates", function() {
    var commands = new SVGPathData('V123,456,7890,9876').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].y, '123');
    assert.equal(commands[1].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[1].y, '456');
    assert.equal(commands[2].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[2].y, '7890');
    assert.equal(commands[3].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[3].y, '9876');
  });

  it("should work with space separated coordinates", function() {
    var commands = new SVGPathData('V123 456 7890 9876').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].y, '123');
    assert.equal(commands[1].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[1].y, '456');
    assert.equal(commands[2].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[2].y, '7890');
    assert.equal(commands[3].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[3].y, '9876');
  });

  it("should work with nested separated coordinates", function() {
    var commands = new SVGPathData('V123 ,  456  \t,\n7890 \r\n 9876').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].y, '123');
    assert.equal(commands[1].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[1].y, '456');
    assert.equal(commands[2].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[2].y, '7890');
    assert.equal(commands[3].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[3].y, '9876');
  });

  it("should work with multiple command declarations", function() {
    var commands = new SVGPathData('V123 ,  456  \t,\n7890 \r\n\
     9876V123 ,  456  \t,\n7890 \r\n 9876').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].y, '123');
    assert.equal(commands[1].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[1].y, '456');
    assert.equal(commands[2].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[2].y, '7890');
    assert.equal(commands[3].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[3].y, '9876');
    assert.equal(commands[4].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[4].y, '123');
    assert.equal(commands[5].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[5].y, '456');
    assert.equal(commands[6].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[6].y, '7890');
    assert.equal(commands[7].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[7].y, '9876');
  });

});

describe("Parsing nested vertical/horizontal commands", function() {

  beforeEach(function() {
  });

  afterEach(function() {
  });

  it("should work", function() {
    var commands = new SVGPathData(
      'V100H100v0.12h0.12,V100,h100v-10e-5 H-10e-5').commands;
    assert.equal(commands[0].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[0].relative, false);
    assert.equal(commands[0].y, '100');
    assert.equal(commands[1].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[1].relative, false);
    assert.equal(commands[1].x, '100');
    assert.equal(commands[2].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[2].relative, true);
    assert.equal(commands[2].y, '0.12');
    assert.equal(commands[3].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[3].relative, true);
    assert.equal(commands[3].x, '0.12');
    assert.equal(commands[4].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[4].relative, false);
    assert.equal(commands[4].y, '100');
    assert.equal(commands[5].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[5].relative, true);
    assert.equal(commands[5].x, '100');
    assert.equal(commands[6].type, SVGPathData.VERT_LINE_TO);
    assert.equal(commands[6].relative, true);
    assert.equal(commands[6].y, '-10e-5');
    assert.equal(commands[7].type, SVGPathData.HORIZ_LINE_TO);
    assert.equal(commands[7].relative, false);
    assert.equal(commands[7].x, '-10e-5');
  });

});

describe("Encoding nested vertical/horizontal commands", function() {

  beforeEach(function() {
  });

  afterEach(function() {
  });

  it("should work", function() {
    assert.equal(
      new SVGPathData('V100H100v0.12h0.12V100h100v-10e-5H-10e-5').encode(),
      'V100H100v0.12h0.12V100h100v-0.0001H-0.0001'
    );
  });

});


text:
package com.offbynull.portmapper.mapper;

/**
 * Describes the port type.
 *
 * @author Kasra Faghihi
 */
public enum PortType {

    /**
     * UDP port.
     */
    UDP(17),
    /**
     * TCP port.
     */
    TCP(6);

    private final int protocolNumber;

    PortType(int protocolNumber) {
        this.protocolNumber = protocolNumber;
    }

    /**
     * Get the IANA protocol number.
     *
     * @return IANA protocol number
     */
    public int getProtocolNumber() {
        return protocolNumber;
    }

    /**
     * Convert IANA protocol number to {@link PortType}.
     * @param number IANA protocol number
     * @return corresponding {@link PortType}
     * @throws IllegalArgumentException if {@code number} didn't match any {@link PortType} value
     */
    public static PortType fromIanaNumber(int number) {
        switch (number) {
            case 6:
                return PortType.TCP;
            case 17:
                return PortType.UDP;
            default:
                throw new IllegalArgumentException();
        }
    }

}


text:
Social sharing for flot plugin

!! Not yet ready !!


text:
<fli-item ng-repeat="item in pinterest.pins"
          ng-init="fliItem = {
          url:item.url,
          img:item.img,
          title:item.title,
          content:item.content
          };
          fliItemCtrl.href=pinterest.href;
          fliItemCtrl.share=pinterest.share;">

</fli-item>


text:
package labels

import (
	"fmt"
	"reflect"
	"strings"
	"testing"

	"github.com/google/go-cmp/cmp"
	"github.com/google/go-cmp/cmp/cmpopts"
	"k8s.io/apimachinery/pkg/selection"
	"k8s.io/apimachinery/pkg/util/sets"
	"k8s.io/apimachinery/pkg/util/validation/field"
)

var (
	ignoreDetail = cmpopts.IgnoreFields(field.Error{}, "Detail")
)

func TestSelectorParse(t *testing.T) {
	testGoodStrings := []string{
		"x=a,y=b,z=c",
		"",
		"x!=a,y=b",
		"x=",
		"x= ",
		"x=,z= ",
		"x= ,z= ",
		"!x",
		"x>1",
		"x>1,z<5",
	}
	testBadStrings := []string{
		"x=a||y=b",
		"x==a==b",
		"!x=a",
		"x<a",
	}
	for _, test := range testGoodStrings {
		lq, err := Parse(test)
		if err != nil {
			t.Errorf("%v: error %v (%#v)\n", test, err, err)
		}
		if strings.Replace(test, " ", "", -1) != lq.String() {
			t.Errorf("%v restring gave: %v\n", test, lq.String())
		}
	}
	for _, test := range testBadStrings {
		_, err := Parse(test)
		if err == nil {
			t.Errorf("%v: did not get expected error\n", test)
		}
	}
}

func TestDeterministicParse(t *testing.T) {
	s1, err := Parse("x=a,a=x")
	s2, err2 := Parse("a=x,x=a")
	if err != nil || err2 != nil {
		t.Errorf("Unexpected parse error")
	}
	if s1.String() != s2.String() {
		t.Errorf("Non-deterministic parse")
	}
}

func expectMatch(t *testing.T, selector string, ls Set) {
	lq, err := Parse(selector)
	if err != nil {
		t.Errorf("Unable to parse %v as a selector\n", selector)
		return
	}
	if !lq.Matches(ls) {
		t.Errorf("Wanted %s to match '%s', but it did not.\n", selector, ls)
	}
}

func expectNoMatch(t *testing.T, selector string, ls Set) {
	lq, err := Parse(selector)
	if err != nil {
		t.Errorf("Unable to parse %v as a selector\n", selector)
		return
	}
	if lq.Matches(ls) {
		t.Errorf("Wanted '%s' to not match '%s', but it did.", selector, ls)
	}
}

func TestEverything(t *testing.T) {
	if !Everything().Matches(Set{"x": "y"}) {
		t.Errorf("Nil selector didn't match")
	}
	if !Everything().Empty() {
		t.Errorf("Everything was not empty")
	}
}

func TestSelectorMatches(t *testing.T) {
	expectMatch(t, "", Set{"x": "y"})
	expectMatch(t, "x=y", Set{"x": "y"})
	expectMatch(t, "x=y,z=w", Set{"x": "y", "z": "w"})
	expectMatch(t, "x!=y,z!=w", Set{"x": "z", "z": "a"})
	expectMatch(t, "notin=in", Set{"notin": "in"}) // in and notin in exactMatch
	expectMatch(t, "x", Set{"x": "z"})
	expectMatch(t, "!x", Set{"y": "z"})
	expectMatch(t, "x>1", Set{"x": "2"})
	expectMatch(t, "x<1", Set{"x": "0"})
	expectNoMatch(t, "x=z", Set{})
	expectNoMatch(t, "x=y", Set{"x": "z"})
	expectNoMatch(t, "x=y,z=w", Set{"x": "w", "z": "w"})
	expectNoMatch(t, "x!=y,z!=w", Set{"x": "z", "z": "w"})
	expectNoMatch(t, "x", Set{"y": "z"})
	expectNoMatch(t, "!x", Set{"x": "z"})
	expectNoMatch(t, "x>1", Set{"x": "0"})
	expectNoMatch(t, "x<1", Set{"x": "2"})

	labelset := Set{
		"foo": "bar",
		"baz": "blah",
	}
	expectMatch(t, "foo=bar", labelset)
	expectMatch(t, "baz=blah", labelset)
	expectMatch(t, "foo=bar,baz=blah", labelset)
	expectNoMatch(t, "foo=blah", labelset)
	expectNoMatch(t, "baz=bar", labelset)
	expectNoMatch(t, "foo=bar,foobar=bar,baz=blah", labelset)
}

func expectMatchDirect(t *testing.T, selector, ls Set) {
	if !SelectorFromSet(selector).Matches(ls) {
		t.Errorf("Wanted %s to match '%s', but it did not.\n", selector, ls)
	}
}

//lint:ignore U1000 currently commented out in TODO of TestSetMatches
//nolint:unused,deadcode
func expectNoMatchDirect(t *testing.T, selector, ls Set) {
	if SelectorFromSet(selector).Matches(ls) {
		t.Errorf("Wanted '%s' to not match '%s', but it did.", selector, ls)
	}
}

func TestSetMatches(t *testing.T) {
	labelset := Set{
		"foo": "bar",
		"baz": "blah",
	}
	expectMatchDirect(t, Set{}, labelset)
	expectMatchDirect(t, Set{"foo": "bar"}, labelset)
	expectMatchDirect(t, Set{"baz": "blah"}, labelset)
	expectMatchDirect(t, Set{"foo": "bar", "baz": "blah"}, labelset)

	//TODO: bad values not handled for the moment in SelectorFromSet
	//expectNoMatchDirect(t, Set{"foo": "=blah"}, labelset)
	//expectNoMatchDirect(t, Set{"baz": "=bar"}, labelset)
	//expectNoMatchDirect(t, Set{"foo": "=bar", "foobar": "bar", "baz": "blah"}, labelset)
}

func TestNilMapIsValid(t *testing.T) {
	selector := Set(nil).AsSelector()
	if selector == nil {
		t.Errorf("Selector for nil set should be Everything")
	}
	if !selector.Empty() {
		t.Errorf("Selector for nil set should be Empty")
	}
}

func TestSetIsEmpty(t *testing.T) {
	if !(Set{}).AsSelector().Empty() {
		t.Errorf("Empty set should be empty")
	}
	if !(NewSelector()).Empty() {
		t.Errorf("Nil Selector should be empty")
	}
}

func TestLexer(t *testing.T) {
	testcases := []struct {
		s string
		t Token
	}{
		{"", EndOfStringToken},
		{",", CommaToken},
		{"notin", NotInToken},
		{"in", InToken},
		{"=", EqualsToken},
		{"==", DoubleEqualsToken},
		{">", GreaterThanToken},
		{"<", LessThanToken},
		//Note that Lex returns the longest valid token found
		{"!", DoesNotExistToken},
		{"!=", NotEqualsToken},
		{"(", OpenParToken},
		{")", ClosedParToken},
		//Non-"special" characters are considered part of an identifier
		{"~", IdentifierToken},
		{"||", IdentifierToken},
	}
	for _, v := range testcases {
		l := &Lexer{s: v.s, pos: 0}
		token, lit := l.Lex()
		if token != v.t {
			t.Errorf("Got %d it should be %d for '%s'", token, v.t, v.s)
		}
		if v.t != ErrorToken && lit != v.s {
			t.Errorf("Got '%s' it should be '%s'", lit, v.s)
		}
	}
}

func min(l, r int) (m int) {
	m = r
	if l < r {
		m = l
	}
	return m
}

func TestLexerSequence(t *testing.T) {
	testcases := []struct {
		s string
		t []Token
	}{
		{"key in ( value )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, ClosedParToken}},
		{"key notin ( value )", []Token{IdentifierToken, NotInToken, OpenParToken, IdentifierToken, ClosedParToken}},
		{"key in ( value1, value2 )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, CommaToken, IdentifierToken, ClosedParToken}},
		{"key", []Token{IdentifierToken}},
		{"!key", []Token{DoesNotExistToken, IdentifierToken}},
		{"()", []Token{OpenParToken, ClosedParToken}},
		{"x in (),y", []Token{IdentifierToken, InToken, OpenParToken, ClosedParToken, CommaToken, IdentifierToken}},
		{"== != (), = notin", []Token{DoubleEqualsToken, NotEqualsToken, OpenParToken, ClosedParToken, CommaToken, EqualsToken, NotInToken}},
		{"key>2", []Token{IdentifierToken, GreaterThanToken, IdentifierToken}},
		{"key<1", []Token{IdentifierToken, LessThanToken, IdentifierToken}},
	}
	for _, v := range testcases {
		var tokens []Token
		l := &Lexer{s: v.s, pos: 0}
		for {
			token, _ := l.Lex()
			if token == EndOfStringToken {
				break
			}
			tokens = append(tokens, token)
		}
		if len(tokens) != len(v.t) {
			t.Errorf("Bad number of tokens for '%s %d, %d", v.s, len(tokens), len(v.t))
		}
		for i := 0; i < min(len(tokens), len(v.t)); i++ {
			if tokens[i] != v.t[i] {
				t.Errorf("Test '%s': Mismatching in token type found '%v' it should be '%v'", v.s, tokens[i], v.t[i])
			}
		}
	}
}
func TestParserLookahead(t *testing.T) {
	testcases := []struct {
		s string
		t []Token
	}{
		{"key in ( value )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, ClosedParToken, EndOfStringToken}},
		{"key notin ( value )", []Token{IdentifierToken, NotInToken, OpenParToken, IdentifierToken, ClosedParToken, EndOfStringToken}},
		{"key in ( value1, value2 )", []Token{IdentifierToken, InToken, OpenParToken, IdentifierToken, CommaToken, IdentifierToken, ClosedParToken, EndOfStringToken}},
		{"key", []Token{IdentifierToken, EndOfStringToken}},
		{"!key", []Token{DoesNotExistToken, IdentifierToken, EndOfStringToken}},
		{"()", []Token{OpenParToken, ClosedParToken, EndOfStringToken}},
		{"", []Token{EndOfStringToken}},
		{"x in (),y", []Token{IdentifierToken, InToken, OpenParToken, ClosedParToken, CommaToken, IdentifierToken, EndOfStringToken}},
		{"== != (), = notin", []Token{DoubleEqualsToken, NotEqualsToken, OpenParToken, ClosedParToken, CommaToken, EqualsToken, NotInToken, EndOfStringToken}},
		{"key>2", []Token{IdentifierToken, GreaterThanToken, IdentifierToken, EndOfStringToken}},
		{"key<1", []Token{IdentifierToken, LessThanToken, IdentifierToken, EndOfStringToken}},
	}
	for _, v := range testcases {
		p := &Parser{l: &Lexer{s: v.s, pos: 0}, position: 0}
		p.scan()
		if len(p.scannedItems) != len(v.t) {
			t.Errorf("Expected %d items found %d", len(v.t), len(p.scannedItems))
		}
		for {
			token, lit := p.lookahead(KeyAndOperator)

			token2, lit2 := p.consume(KeyAndOperator)
			if token == EndOfStringToken {
				break
			}
			if token != token2 || lit != lit2 {
				t.Errorf("Bad values")
			}
		}
	}
}

func TestParseOperator(t *testing.T) {
	testcases := []struct {
		token         string
		expectedError error
	}{
		{"in", nil},
		{"=", nil},
		{"==", nil},
		{">", nil},
		{"<", nil},
		{"notin", nil},
		{"!=", nil},
		{"!", fmt.Errorf("found '%s', expected: %v", selection.DoesNotExist, strings.Join(binaryOperators, ", "))},
		{"exists", fmt.Errorf("found '%s', expected: %v", selection.Exists, strings.Join(binaryOperators, ", "))},
		{"(", fmt.Errorf("found '%s', expected: %v", "(", strings.Join(binaryOperators, ", "))},
	}
	for _, testcase := range testcases {
		p := &Parser{l: &Lexer{s: testcase.token, pos: 0}, position: 0}
		p.scan()

		_, err := p.parseOperator()
		if ok := reflect.DeepEqual(testcase.expectedError, err); !ok {
			t.Errorf("\nexpect err [%v], \nactual err [%v]", testcase.expectedError, err)
		}
	}
}

func TestRequirementConstructor(t *testing.T) {
	requirementConstructorTests := []struct {
		Key     string
		Op      selection.Operator
		Vals    sets.String
		WantErr field.ErrorList
	}{
		{
			Key: "x1",
			Op:  selection.In,
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values",
					BadValue: []string{},
				},
			},
		},
		{
			Key:  "x2",
			Op:   selection.NotIn,
			Vals: sets.NewString(),
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values",
					BadValue: []string{},
				},
			},
		},
		{
			Key:  "x3",
			Op:   selection.In,
			Vals: sets.NewString("foo"),
		},
		{
			Key:  "x4",
			Op:   selection.NotIn,
			Vals: sets.NewString("foo"),
		},
		{
			Key:  "x5",
			Op:   selection.Equals,
			Vals: sets.NewString("foo", "bar"),
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values",
					BadValue: []string{"bar", "foo"},
				},
			},
		},
		{
			Key: "x6",
			Op:  selection.Exists,
		},
		{
			Key: "x7",
			Op:  selection.DoesNotExist,
		},
		{
			Key:  "x8",
			Op:   selection.Exists,
			Vals: sets.NewString("foo"),
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values",
					BadValue: []string{"foo"},
				},
			},
		},
		{
			Key:  "x9",
			Op:   selection.In,
			Vals: sets.NewString("bar"),
		},
		{
			Key:  "x10",
			Op:   selection.In,
			Vals: sets.NewString("bar"),
		},
		{
			Key:  "x11",
			Op:   selection.GreaterThan,
			Vals: sets.NewString("1"),
		},
		{
			Key:  "x12",
			Op:   selection.LessThan,
			Vals: sets.NewString("6"),
		},
		{
			Key: "x13",
			Op:  selection.GreaterThan,
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values",
					BadValue: []string{},
				},
			},
		},
		{
			Key:  "x14",
			Op:   selection.GreaterThan,
			Vals: sets.NewString("bar"),
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values[0]",
					BadValue: "bar",
				},
			},
		},
		{
			Key:  "x15",
			Op:   selection.LessThan,
			Vals: sets.NewString("bar"),
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values[0]",
					BadValue: "bar",
				},
			},
		},
		{
			Key: strings.Repeat("a", 254), //breaks DNS rule that len(key) <= 253
			Op:  selection.Exists,
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "key",
					BadValue: strings.Repeat("a", 254),
				},
			},
		},
		{
			Key:  "x16",
			Op:   selection.Equals,
			Vals: sets.NewString(strings.Repeat("a", 254)),
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values[0][x16]",
					BadValue: strings.Repeat("a", 254),
				},
			},
		},
		{
			Key:  "x17",
			Op:   selection.Equals,
			Vals: sets.NewString("a b"),
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values[0][x17]",
					BadValue: "a b",
				},
			},
		},
		{
			Key: "x18",
			Op:  "unsupportedOp",
			WantErr: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeNotSupported,
					Field:    "operator",
					BadValue: selection.Operator("unsupportedOp"),
				},
			},
		},
	}
	for _, rc := range requirementConstructorTests {
		_, err := NewRequirement(rc.Key, rc.Op, rc.Vals.List())
		if diff := cmp.Diff(rc.WantErr.ToAggregate(), err, ignoreDetail); diff != "" {
			t.Errorf("NewRequirement test %v returned unexpected error (-want,+got):\n%s", rc.Key, diff)
		}
	}
}

func TestToString(t *testing.T) {
	var req Requirement
	toStringTests := []struct {
		In    *internalSelector
		Out   string
		Valid bool
	}{

		{&internalSelector{
			getRequirement("x", selection.In, sets.NewString("abc", "def"), t),
			getRequirement("y", selection.NotIn, sets.NewString("jkl"), t),
			getRequirement("z", selection.Exists, nil, t)},
			"x in (abc,def),y notin (jkl),z", true},
		{&internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString("abc", "def"), t),
			getRequirement("y", selection.NotEquals, sets.NewString("jkl"), t),
			getRequirement("z", selection.DoesNotExist, nil, t)},
			"x notin (abc,def),y!=jkl,!z", true},
		{&internalSelector{
			getRequirement("x", selection.In, sets.NewString("abc", "def"), t),
			req}, // adding empty req for the trailing ','
			"x in (abc,def),", false},
		{&internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString("abc"), t),
			getRequirement("y", selection.In, sets.NewString("jkl", "mno"), t),
			getRequirement("z", selection.NotIn, sets.NewString(""), t)},
			"x notin (abc),y in (jkl,mno),z notin ()", true},
		{&internalSelector{
			getRequirement("x", selection.Equals, sets.NewString("abc"), t),
			getRequirement("y", selection.DoubleEquals, sets.NewString("jkl"), t),
			getRequirement("z", selection.NotEquals, sets.NewString("a"), t),
			getRequirement("z", selection.Exists, nil, t)},
			"x=abc,y==jkl,z!=a,z", true},
		{&internalSelector{
			getRequirement("x", selection.GreaterThan, sets.NewString("2"), t),
			getRequirement("y", selection.LessThan, sets.NewString("8"), t),
			getRequirement("z", selection.Exists, nil, t)},
			"x>2,y<8,z", true},
	}
	for _, ts := range toStringTests {
		if out := ts.In.String(); out == "" && ts.Valid {
			t.Errorf("%#v.String() => '%v' expected no error", ts.In, out)
		} else if out != ts.Out {
			t.Errorf("%#v.String() => '%v' want '%v'", ts.In, out, ts.Out)
		}
	}
}

func TestRequirementSelectorMatching(t *testing.T) {
	var req Requirement
	labelSelectorMatchingTests := []struct {
		Set   Set
		Sel   Selector
		Match bool
	}{
		{Set{"x": "foo", "y": "baz"}, &internalSelector{
			req,
		}, false},
		{Set{"x": "foo", "y": "baz"}, &internalSelector{
			getRequirement("x", selection.In, sets.NewString("foo"), t),
			getRequirement("y", selection.NotIn, sets.NewString("alpha"), t),
		}, true},
		{Set{"x": "foo", "y": "baz"}, &internalSelector{
			getRequirement("x", selection.In, sets.NewString("foo"), t),
			getRequirement("y", selection.In, sets.NewString("alpha"), t),
		}, false},
		{Set{"y": ""}, &internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString(""), t),
			getRequirement("y", selection.Exists, nil, t),
		}, true},
		{Set{"y": ""}, &internalSelector{
			getRequirement("x", selection.DoesNotExist, nil, t),
			getRequirement("y", selection.Exists, nil, t),
		}, true},
		{Set{"y": ""}, &internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString(""), t),
			getRequirement("y", selection.DoesNotExist, nil, t),
		}, false},
		{Set{"y": "baz"}, &internalSelector{
			getRequirement("x", selection.In, sets.NewString(""), t),
		}, false},
		{Set{"z": "2"}, &internalSelector{
			getRequirement("z", selection.GreaterThan, sets.NewString("1"), t),
		}, true},
		{Set{"z": "v2"}, &internalSelector{
			getRequirement("z", selection.GreaterThan, sets.NewString("1"), t),
		}, false},
	}
	for _, lsm := range labelSelectorMatchingTests {
		if match := lsm.Sel.Matches(lsm.Set); match != lsm.Match {
			t.Errorf("%+v.Matches(%#v) => %v, want %v", lsm.Sel, lsm.Set, match, lsm.Match)
		}
	}
}

func TestSetSelectorParser(t *testing.T) {
	setSelectorParserTests := []struct {
		In    string
		Out   Selector
		Match bool
		Valid bool
	}{
		{"", NewSelector(), true, true},
		{"\rx", internalSelector{
			getRequirement("x", selection.Exists, nil, t),
		}, true, true},
		{"this-is-a-dns.domain.com/key-with-dash", internalSelector{
			getRequirement("this-is-a-dns.domain.com/key-with-dash", selection.Exists, nil, t),
		}, true, true},
		{"this-is-another-dns.domain.com/key-with-dash in (so,what)", internalSelector{
			getRequirement("this-is-another-dns.domain.com/key-with-dash", selection.In, sets.NewString("so", "what"), t),
		}, true, true},
		{"0.1.2.domain/99 notin (10.10.100.1, tick.tack.clock)", internalSelector{
			getRequirement("0.1.2.domain/99", selection.NotIn, sets.NewString("10.10.100.1", "tick.tack.clock"), t),
		}, true, true},
		{"foo  in	 (abc)", internalSelector{
			getRequirement("foo", selection.In, sets.NewString("abc"), t),
		}, true, true},
		{"x notin\n (abc)", internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString("abc"), t),
		}, true, true},
		{"x  notin	\t	(abc,def)", internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString("abc", "def"), t),
		}, true, true},
		{"x in (abc,def)", internalSelector{
			getRequirement("x", selection.In, sets.NewString("abc", "def"), t),
		}, true, true},
		{"x in (abc,)", internalSelector{
			getRequirement("x", selection.In, sets.NewString("abc", ""), t),
		}, true, true},
		{"x in ()", internalSelector{
			getRequirement("x", selection.In, sets.NewString(""), t),
		}, true, true},
		{"x notin (abc,,def),bar,z in (),w", internalSelector{
			getRequirement("bar", selection.Exists, nil, t),
			getRequirement("w", selection.Exists, nil, t),
			getRequirement("x", selection.NotIn, sets.NewString("abc", "", "def"), t),
			getRequirement("z", selection.In, sets.NewString(""), t),
		}, true, true},
		{"x,y in (a)", internalSelector{
			getRequirement("y", selection.In, sets.NewString("a"), t),
			getRequirement("x", selection.Exists, nil, t),
		}, false, true},
		{"x=a", internalSelector{
			getRequirement("x", selection.Equals, sets.NewString("a"), t),
		}, true, true},
		{"x>1", internalSelector{
			getRequirement("x", selection.GreaterThan, sets.NewString("1"), t),
		}, true, true},
		{"x<7", internalSelector{
			getRequirement("x", selection.LessThan, sets.NewString("7"), t),
		}, true, true},
		{"x=a,y!=b", internalSelector{
			getRequirement("x", selection.Equals, sets.NewString("a"), t),
			getRequirement("y", selection.NotEquals, sets.NewString("b"), t),
		}, true, true},
		{"x=a,y!=b,z in (h,i,j)", internalSelector{
			getRequirement("x", selection.Equals, sets.NewString("a"), t),
			getRequirement("y", selection.NotEquals, sets.NewString("b"), t),
			getRequirement("z", selection.In, sets.NewString("h", "i", "j"), t),
		}, true, true},
		{"x=a||y=b", internalSelector{}, false, false},
		{"x,,y", nil, true, false},
		{",x,y", nil, true, false},
		{"x nott in (y)", nil, true, false},
		{"x notin ( )", internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString(""), t),
		}, true, true},
		{"x notin (, a)", internalSelector{
			getRequirement("x", selection.NotIn, sets.NewString("", "a"), t),
		}, true, true},
		{"a in (xyz),", nil, true, false},
		{"a in (xyz)b notin ()", nil, true, false},
		{"a ", internalSelector{
			getRequirement("a", selection.Exists, nil, t),
		}, true, true},
		{"a in (x,y,notin, z,in)", internalSelector{
			getRequirement("a", selection.In, sets.NewString("in", "notin", "x", "y", "z"), t),
		}, true, true}, // operator 'in' inside list of identifiers
		{"a in (xyz abc)", nil, false, false}, // no comma
		{"a notin(", nil, true, false},        // bad formed
		{"a (", nil, false, false},            // cpar
		{"(", nil, false, false},              // opar
	}

	for _, ssp := range setSelectorParserTests {
		if sel, err := Parse(ssp.In); err != nil && ssp.Valid {
			t.Errorf("Parse(%s) => %v expected no error", ssp.In, err)
		} else if err == nil && !ssp.Valid {
			t.Errorf("Parse(%s) => %+v expected error", ssp.In, sel)
		} else if ssp.Match && !reflect.DeepEqual(sel, ssp.Out) {
			t.Errorf("Parse(%s) => parse output '%#v' doesn't match '%#v' expected match", ssp.In, sel, ssp.Out)
		}
	}
}

func getRequirement(key string, op selection.Operator, vals sets.String, t *testing.T) Requirement {
	req, err := NewRequirement(key, op, vals.List())
	if err != nil {
		t.Errorf("NewRequirement(%v, %v, %v) resulted in error:%v", key, op, vals, err)
		return Requirement{}
	}
	return *req
}

func TestAdd(t *testing.T) {
	testCases := []struct {
		name        string
		sel         Selector
		key         string
		operator    selection.Operator
		values      []string
		refSelector Selector
	}{
		{
			"keyInOperator",
			internalSelector{},
			"key",
			selection.In,
			[]string{"value"},
			internalSelector{Requirement{"key", selection.In, []string{"value"}}},
		},
		{
			"keyEqualsOperator",
			internalSelector{Requirement{"key", selection.In, []string{"value"}}},
			"key2",
			selection.Equals,
			[]string{"value2"},
			internalSelector{
				Requirement{"key", selection.In, []string{"value"}},
				Requirement{"key2", selection.Equals, []string{"value2"}},
			},
		},
	}
	for _, ts := range testCases {
		req, err := NewRequirement(ts.key, ts.operator, ts.values)
		if err != nil {
			t.Errorf("%s - Unable to create labels.Requirement", ts.name)
		}
		ts.sel = ts.sel.Add(*req)
		if !reflect.DeepEqual(ts.sel, ts.refSelector) {
			t.Errorf("%s - Expected %v found %v", ts.name, ts.refSelector, ts.sel)
		}
	}
}

func TestSafeSort(t *testing.T) {
	tests := []struct {
		name   string
		in     []string
		inCopy []string
		want   []string
	}{
		{
			name:   "nil strings",
			in:     nil,
			inCopy: nil,
			want:   nil,
		},
		{
			name:   "ordered strings",
			in:     []string{"bar", "foo"},
			inCopy: []string{"bar", "foo"},
			want:   []string{"bar", "foo"},
		},
		{
			name:   "unordered strings",
			in:     []string{"foo", "bar"},
			inCopy: []string{"foo", "bar"},
			want:   []string{"bar", "foo"},
		},
		{
			name:   "duplicated strings",
			in:     []string{"foo", "bar", "foo", "bar"},
			inCopy: []string{"foo", "bar", "foo", "bar"},
			want:   []string{"bar", "bar", "foo", "foo"},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := safeSort(tt.in); !reflect.DeepEqual(got, tt.want) {
				t.Errorf("safeSort() = %v, want %v", got, tt.want)
			}
			if !reflect.DeepEqual(tt.in, tt.inCopy) {
				t.Errorf("after safeSort(), input = %v, want %v", tt.in, tt.inCopy)
			}
		})
	}
}

func BenchmarkSelectorFromValidatedSet(b *testing.B) {
	set := map[string]string{
		"foo": "foo",
		"bar": "bar",
	}

	for i := 0; i < b.N; i++ {
		if SelectorFromValidatedSet(set).Empty() {
			b.Errorf("Unexpected selector")
		}
	}
}

func TestRequiresExactMatch(t *testing.T) {
	testCases := []struct {
		name          string
		sel           Selector
		label         string
		expectedFound bool
		expectedValue string
	}{
		{
			name:          "keyInOperatorExactMatch",
			sel:           internalSelector{Requirement{"key", selection.In, []string{"value"}}},
			label:         "key",
			expectedFound: true,
			expectedValue: "value",
		},
		{
			name:          "keyInOperatorNotExactMatch",
			sel:           internalSelector{Requirement{"key", selection.In, []string{"value", "value2"}}},
			label:         "key",
			expectedFound: false,
			expectedValue: "",
		},
		{
			name: "keyInOperatorNotExactMatch",
			sel: internalSelector{
				Requirement{"key", selection.In, []string{"value", "value1"}},
				Requirement{"key2", selection.In, []string{"value2"}},
			},
			label:         "key2",
			expectedFound: true,
			expectedValue: "value2",
		},
		{
			name:          "keyEqualOperatorExactMatch",
			sel:           internalSelector{Requirement{"key", selection.Equals, []string{"value"}}},
			label:         "key",
			expectedFound: true,
			expectedValue: "value",
		},
		{
			name:          "keyDoubleEqualOperatorExactMatch",
			sel:           internalSelector{Requirement{"key", selection.DoubleEquals, []string{"value"}}},
			label:         "key",
			expectedFound: true,
			expectedValue: "value",
		},
		{
			name:          "keyNotEqualOperatorExactMatch",
			sel:           internalSelector{Requirement{"key", selection.NotEquals, []string{"value"}}},
			label:         "key",
			expectedFound: false,
			expectedValue: "",
		},
		{
			name: "keyEqualOperatorExactMatchFirst",
			sel: internalSelector{
				Requirement{"key", selection.In, []string{"value"}},
				Requirement{"key2", selection.In, []string{"value2"}},
			},
			label:         "key",
			expectedFound: true,
			expectedValue: "value",
		},
	}
	for _, ts := range testCases {
		t.Run(ts.name, func(t *testing.T) {
			value, found := ts.sel.RequiresExactMatch(ts.label)
			if found != ts.expectedFound {
				t.Errorf("Expected match %v, found %v", ts.expectedFound, found)
			}
			if found && value != ts.expectedValue {
				t.Errorf("Expected value %v, found %v", ts.expectedValue, value)
			}

		})
	}
}

func TestValidatedSelectorFromSet(t *testing.T) {
	tests := []struct {
		name             string
		input            Set
		expectedSelector internalSelector
		expectedError    field.ErrorList
	}{
		{
			name:  "Simple Set, no error",
			input: Set{"key": "val"},
			expectedSelector: internalSelector{
				Requirement{
					key:       "key",
					operator:  selection.Equals,
					strValues: []string{"val"},
				},
			},
		},
		{
			name:  "Invalid Set, value too long",
			input: Set{"Key": "axahm2EJ8Phiephe2eixohbee9eGeiyees1thuozi1xoh0GiuH3diewi8iem7Nui"},
			expectedError: field.ErrorList{
				&field.Error{
					Type:     field.ErrorTypeInvalid,
					Field:    "values[0][Key]",
					BadValue: "axahm2EJ8Phiephe2eixohbee9eGeiyees1thuozi1xoh0GiuH3diewi8iem7Nui",
				},
			},
		},
	}

	for _, tc := range tests {
		selector, err := ValidatedSelectorFromSet(tc.input)
		if diff := cmp.Diff(tc.expectedError.ToAggregate(), err, ignoreDetail); diff != "" {
			t.Errorf("ValidatedSelectorFromSet %#v returned unexpected error (-want,+got):\n%s", tc.name, diff)
		}
		if err == nil {
			if diff := cmp.Diff(tc.expectedSelector, selector); diff != "" {
				t.Errorf("ValidatedSelectorFromSet %#v returned unexpected selector (-want,+got):\n%s", tc.name, diff)
			}
		}
	}
}

func BenchmarkRequirementString(b *testing.B) {
	r := Requirement{
		key:      "environment",
		operator: selection.NotIn,
		strValues: []string{
			"dev",
		},
	}

	b.ReportAllocs()
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		if r.String() != "environment notin (dev)" {
			b.Errorf("Unexpected Requirement string")
		}
	}
}

func TestRequirementEqual(t *testing.T) {
	tests := []struct {
		name string
		x, y *Requirement
		want bool
	}{
		{
			name: "same requirements should be equal",
			x: &Requirement{
				key:       "key",
				operator:  selection.Equals,
				strValues: []string{"foo", "bar"},
			},
			y: &Requirement{
				key:       "key",
				operator:  selection.Equals,
				strValues: []string{"foo", "bar"},
			},
			want: true,
		},
		{
			name: "requirements with different keys should not be equal",
			x: &Requirement{
				key:       "key1",
				operator:  selection.Equals,
				strValues: []string{"foo", "bar"},
			},
			y: &Requirement{
				key:       "key2",
				operator:  selection.Equals,
				strValues: []string{"foo", "bar"},
			},
			want: false,
		},
		{
			name: "requirements with different operators should not be equal",
			x: &Requirement{
				key:       "key",
				operator:  selection.Equals,
				strValues: []string{"foo", "bar"},
			},
			y: &Requirement{
				key:       "key",
				operator:  selection.In,
				strValues: []string{"foo", "bar"},
			},
			want: false,
		},
		{
			name: "requirements with different values should not be equal",
			x: &Requirement{
				key:       "key",
				operator:  selection.Equals,
				strValues: []string{"foo", "bar"},
			},
			y: &Requirement{
				key:       "key",
				operator:  selection.Equals,
				strValues: []string{"foobar"},
			},
			want: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := cmp.Equal(tt.x, tt.y); got != tt.want {
				t.Errorf("cmp.Equal() = %v, want %v", got, tt.want)
			}
		})
	}
}


text:
<?php

namespace Sylius\Bundle\OrderBundle\Controller;

use Doctrine\Common\Persistence\ObjectRepository;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

/**
 * OrderItem controller.
 *
 * @author Paweł Jędrzejewski <pjedrzejewski@sylius.pl>
 */
class OrderItemController extends ResourceController
{
    /**
     * {@inheritdoc}
     */
    public function createNew()
    {
        if (null === $orderId = $this->getRequest()->get('orderId')) {
            throw new NotFoundHttpException('No order id given.');
        }

        if (!$order = $this->getOrderRepository()->find($orderId)) {
            throw new NotFoundHttpException('Requested order does not exist.');
        }

        $orderItem = parent::createNew();
        $orderItem->setOrder($order);

        return $orderItem;
    }

    /**
     * Get order repository.
     *
     * @return ObjectRepository
     */
    protected function getOrderRepository()
    {
        return $this->get('sylius.repository.order');
    }
}


text:
using System;

namespace zad14
{
    class HexToDecimal
    {
        static void Main(string[] args)
        { //input
            string strHex = Console.ReadLine();

            //logic
            long result = 0;
            int counter = strHex.Length;

            foreach (var item in strHex)
            {
                counter--;
                switch (item)
                {
                    case 'A': result += 10 * (long)Math.Pow(16, counter); continue;
                    case 'B': result += 11 * (long)Math.Pow(16, counter); continue;
                    case 'C': result += 12 * (long)Math.Pow(16, counter); continue;
                    case 'D': result += 13 * (long)Math.Pow(16, counter); continue;
                    case 'E': result += 14 * (long)Math.Pow(16, counter); continue;
                    case 'F': result += 15 * (long)Math.Pow(16, counter); continue;
                    default:
                        result += (int)(item - '0') * (long)Math.Pow(16, counter);
                        continue;
                }

            }

            //output

            Console.WriteLine(result);
        }
    }
}


text:
package org.apache.ignite.internal.managers.events;

import org.apache.ignite.Ignite;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.Event;
import org.apache.ignite.events.EventAdapter;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteFutureTimeoutException;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;

import static org.apache.ignite.events.EventType.EVTS_ALL;

/**
 * Tests for {@link GridEventStorageManager}.
 */
public class GridEventStorageManagerSelfTest extends GridCommonAbstractTest {
    /**
     *
     */
    public GridEventStorageManagerSelfTest() {
        super(/* start grid */true);
    }

    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

        int[] evts = new int[EVTS_ALL.length + 1];

        evts[0] = Integer.MAX_VALUE - 1;

        System.arraycopy(EVTS_ALL, 0, evts, 1, EVTS_ALL.length);

        cfg.setIncludeEventTypes(evts);

        return cfg;
    }

    /**
     * @throws Exception If failed.
     */
    public void testWaitForEvent() throws Exception {
        Ignite ignite = grid();

        final int usrType = Integer.MAX_VALUE - 1;

        IgniteFuture<Event> fut = waitForLocalEvent(ignite.events(), new IgnitePredicate<Event>() {
            @Override public boolean apply(Event e) {
                return e.type() == usrType;
            }
        }, usrType);

        try {
            fut.get(500);

            fail("GridFutureTimeoutException must have been thrown.");
        }
        catch (IgniteFutureTimeoutException e) {
            info("Caught expected exception: " + e);
        }

        ignite.events().recordLocal(new EventAdapter(null, "Test message.", usrType) {
            // No-op.
        });

        assert fut.get() != null;

        assertEquals(usrType, fut.get().type());
    }

    /**
     * @throws Exception If failed.
     */
    public void testWaitForEventContinuationTimeout() throws Exception {
        Ignite ignite = grid();

        try {
            // We'll never wait for nonexistent type of event.
            int usrType = Integer.MAX_VALUE - 1;

            waitForLocalEvent(ignite.events(), F.<Event>alwaysTrue(), usrType).get(1000);

            fail("GridFutureTimeoutException must have been thrown.");
        }
        catch (IgniteFutureTimeoutException e) {
            info("Caught expected exception: " + e);
        }
    }

    /**
     * @throws Exception If failed.
     */
    public void testUserEvent() throws Exception {
        Ignite ignite = grid();

        try {
            ignite.events().recordLocal(new EventAdapter(null, "Test message.", EventType.EVT_NODE_FAILED) {
                // No-op.
            });

            assert false : "Exception should have been thrown.";

        }
        catch (IllegalArgumentException e) {
            info("Caught expected exception: " + e);
        }
    }
}


text:
{% extends base_template %}

{#################################################################################################################}

{% block title %}
     password rese confirm{% endblock title %}

{#################################################################################################################}

{% block hq-stylesheets %}
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/domain/stylesheets/sfb.css?version=3"/>
{% endblock hq-stylesheets %}

{#################################################################################################################}

{% block content %}

{% if validlink %}

Enter your new password

<form class="sfb" name="form" method="post" action="">

Reset password

{% if form.non_field_errors %}

  {{ form.non_field_errors }}

{% endif %}

{% for field in form.visible_fields %}
  {% if field.errors %}

    {{field.errors}}

  {% endif %}

  {{ field.label_tag }}

  {{ field }}

{% endfor %}

<button type="submit">Submit</button>

</form>

{% else %}

Password reset unsuccessful

The password reset link was invalid, possibly because it has already been used.  Please request a new password reset.

{% endif %}

{% endblock content %}


text:
/**
 * Module requirements.
 */

var Transport = require('../transport')
  , parser = require('engine.io-parser')
  , debug = require('debug')('engine:polling');

/**
 * Exports the constructor.
 */

module.exports = Polling;

/**
 * HTTP polling constructor.
 *
 * @api public.
 */

function Polling (req) {
  Transport.call(this, req);
};

/**
 * Inherits from Transport.
 *
 * @api public.
 */

Polling.prototype.__proto__ = Transport.prototype;

/**
 * Transport name
 *
 * @api public
 */

Polling.prototype.name = 'polling';

/**
 * Overrides onRequest.
 *
 * @param {http.ServerRequest}
 * @api private
 */

Polling.prototype.onRequest = function (req) {
  var res = req.res;

  if ('GET' == req.method) {
    this.onPollRequest(req, res);
  } else if ('POST' == req.method) {
    this.onDataRequest(req, res);
  } else {
    res.writeHead(500);
    res.end();
  }
};

/**
 * The client sends a request awaiting for us to send data.
 *
 * @api private
 */

Polling.prototype.onPollRequest = function (req, res) {
  if (this.req) {
    debug('request overlap');
    // assert: this.res, '.req and .res should be (un)set together'
    this.onError('overlap from client');
    res.writeHead(500);
  } else {
    debug('setting request');
    if (undefined === this.req) {
      debug('setting handshake request');
      this.request = req;
    }

    this.req = req;
    this.res = res;

    var self = this;

    function onClose () {
      self.onError('poll connection closed prematurely');
    }

    function cleanup () {
      req.removeListener('close', onClose);
      self.req = self.res = null;
    }

    req.cleanup = cleanup;
    req.on('close', onClose);

    this.writable = true;
    this.emit('drain');

    // if we're still writable but had a pending close, trigger an empty send
    if (this.writable && this.shouldClose) {
      debug('triggering empty send to append close packet');
      this.send([{ type: 'noop' }]);
    }
  }
};

/**
 * The client sends a request with data.
 *
 * @api private
 */

Polling.prototype.onDataRequest = function (req, res) {
  if (this.dataReq) {
    // assert: this.dataRes, '.dataReq and .dataRes should be (un)set together'
    this.onError('data request overlap from client');
    res.writeHead(500);
  } else {
    this.dataReq = req;
    this.dataRes = res;

    var chunks = ''
      , self = this

    function cleanup () {
      chunks = '';
      req.removeListener('data', onData);
      req.removeListener('end', onEnd);
      req.removeListener('close', onClose);
      self.dataReq = self.dataRes = null;
    };

    function onClose () {
      cleanup();
      self.onError('data request connection closed prematurely');
    };

    function onData (data) {
      chunks += data;
    };

    function onEnd () {
      self.onData(chunks);
      res.writeHead(200, self.headers(req, {
          'Content-Length': 2
          // text/html is required instead of text/plain to avoid an
          // unwanted download dialog on certain user-agents (GH-43)
        , 'Content-Type': 'text/html'
      }));
      res.end('ok');
      cleanup();
    };

    req.abort = cleanup;
    req.on('close', onClose);
    req.on('data', onData);
    req.on('end', onEnd);
    req.setEncoding('utf8');
  }
};

/**
 * Processes the incoming data payload.
 *
 * @param {String} encoded payload
 * @api private
 */

Polling.prototype.onData = function (data) {
  debug('received "%s"', data);
  var self = this;
  parser.decodePayload(data, function(packet){
    if ('close' == packet.type) {
      debug('got xhr close packet');
      self.onClose();
      return false;
    }

    self.onPacket(packet);
  });
};

/**
 * Writes a packet payload.
 *
 * @param {Object} packet
 * @api private
 */

Polling.prototype.send = function (packets) {
  if (this.shouldClose) {
    debug('appending close packet to payload');
    packets.push({ type: 'close' });
    this.shouldClose();
    this.shouldClose = null;
  }

  this.write(parser.encodePayload(packets));
};

/**
 * Writes data as response to poll request.
 *
 * @param {String} data
 * @api private
 */

Polling.prototype.write = function (data) {
  debug('writing "%s"', data);
  this.doWrite(data);
  this.req.cleanup();
  this.writable = false;
};

/**
 * Closes the transport.
 *
 * @api private
 */

Polling.prototype.doClose = function (fn) {
  debug('closing');

  if (this.dataReq) {
    // FIXME: should we do this?
    debug('aborting ongoing data request');
    this.dataReq.abort();
  }

  if (this.writable) {
    debug('transport writable - closing right away');
    this.send([{ type: 'close' }]);
    fn();
  } else {
    debug('transport not writable - buffering orderly close');
    this.shouldClose = fn;
  }
};


text:
import sys
import os

# Display help message
def usage():
	print("Usage: %s namefile.asm" % os.path.basename(sys.argv[0]))
	print("-h	Help")
	print("-l	Output to Logisim binary image")
	print("-b	Output to raw binary image")

# List of valid opcodes (in order)
opcodes = [ "LDI",
			"STM",
			"LDM",
			"LDMA",
			"ADDI",
			"SUBI",
			"ADDM",
			"SUBM",
			"JMPI",
			"JMPM",
			"JMPA",
			"JMPMA",
			"JZI",
			"JCI",
			"OUT",
			"HLT" ]

# Number of opperands each opcode takes (in same order as opcode list so we can do a lookup)
opperands = ["d","a","a",0,"d","d","a","a","a","a",0,0,"a","a",0,0]

# Arrays for labels and addresses
labels = []
labelValues = []

# Arrays for labels and addresses
constants = []
constantValues = []

# Array of lines for second stage to process
tempFile = []

# Output array
binaryOut = []

def main():
	# Command line argument handling
	args = sys.argv[1:]
	if "-h" in args or "--help" in args or args==[]:
		usage()
		sys.exit(2)

	# Open source file
	file = open(args[0],"r")

	# First pass
	addr = 0
	#print("First pass")

	for line in file:
		line = line.strip()
		line = line.rstrip('\r\n')

		if len(line) < 2:
			continue

		# Check if the line is a comment
		elif line[0] == "/" and line[1] == "/":
			continue

		# Check if the line is a label and add to array for reference in second pass
		elif line[-1:] == ":":
				#print("Found label: %s at %02x" % (line[:-1],addr))
				labels.append(line[:-1])
				labelValues.append(addr)
				continue

		elif len(line.split(" ")) > 2 and line.split(" ")[1] == "EQU":
				#print("Found constant: %s = %s" % (line.split(" ")[0],line.split(" ")[2]))
				constants.append(line.split(" ")[0])
				constantValues.append(line.split(" ")[2])
				continue

		for const in constants:
			if const in line and line.split(" ")[1] != "EQU":
				line = line.replace(const, str(constantValues[constants.index(const)]))

		if "$" in line:
			line = line.replace("$", str(addr))

		# If opcode or data byte then increment address and add to tempFile
		if line.split(" ")[0] in opcodes or line.split(" ")[0] == "db":
				addr += 1
				tempFile.append(line)

	# Second Pass
	addr = 0
	#print("Second pass")

	for line in tempFile:

		# Check if address is in range (0x0 - 0xF)
		if addr < 0x0 or addr > 0xF:
			print("Address out of range: %02x" % addr)
			sys.exit(1)

		else:
			# Get mnemonic
			mnemonic = line.split(" ")[0]

			# Check if mnemonic is valid
			if mnemonic in opcodes:
				opcode = opcodes.index(mnemonic)

				# Check if it takes an opperand
				if opperands[opcodes.index(mnemonic)] != 0:

					# Get opperand
					opperand = line.split(" ")[1]

					# Check to see if label and if opcode takes address
					if opperand in labels and opperands[opcodes.index(mnemonic)] == "a":
						opperand = labelValues[labels.index(opperand)]

					# Otherwise parse to int
					else:
						try:
							opperand = int(opperand,0)
						except:
							print("Invalid opperand: %s" % opperand)
							sys.exit(1)

					# Check opperand is in range (0x0-0xF)
					if opperand < 0x0 or opperand > 0xF:
						print("Opperand out of range: %02x" % opperand)
						sys.exit(1)

				# If it doesn't take an opperand just default to 0
				else:
					opperand = 0

				# Combine opcode and opperand to get final hex value
				hexout = (opcode<<4) | opperand

			# If not a valid mnemonic check if it is a data byte
			else:
				if mnemonic == "db":

					hexout = int(line.split(" ")[1],0)

					# Check data is in range (0x00 - 0xFF)
					if hexout < 0x00 or hexout > 0xFF:
						print("Data out of range: %02x" % hexout)
						sys.exit(1)

				else:
					# If it wasn't a valid opcode or a data byte then it must be an invalid opcode so exit
					print("Invalid Mnemonic: %s" % mnemonic)
					sys.exit(1)

			# Print, append to output array and increment address
			print("%01x: %02x" % (addr, hexout))
			binaryOut.append(hexout)
			addr += 1

	# Output to Logisim binary image
	if "-b" in args:
		print("Converting to raw binary image...")
		newFile = open("%s.bin" % args[0].split(".")[0] , "w")
		newFileBytes = []
		for val in binaryOut:
			newFileBytes.append(val)
		newFileByteArray = bytearray(newFileBytes)
		newFile.write(newFileByteArray)
		print("Success!")

	# Output to Logisim binary image
	if "-l" in args:
		print("Converting to Logisim binary image...")
		newFile = open("%s.lbi" % args[0].split(".")[0] , "w")
		newFileBytes = ["v", "2", ".", "0", 0x20, "r", "a", "w", 0x0A]
		for val in binaryOut:
			newFileBytes.append(("%02x" % val)[0])
			newFileBytes.append(("%02x" % val)[1])
			newFileBytes.append(0x20)
		newFileBytes.append(0x0A)
		newFileByteArray = bytearray(newFileBytes)
		newFile.write(newFileByteArray)
		print("Success!")

if __name__ == "__main__":
	main()


text:
package org.priha.util;

import javax.jcr.RepositoryException;

/**
 *  Thrown when the configuration is faulty.
 */
public class ConfigurationException extends RepositoryException
{
    private static final long serialVersionUID = 1L;

    /**
     *  Construct a ConfigurationException.
     *
     *  @param msg The exception message
     *  @param propertyKey If there is a property key, you can add it here. May be null.
     */
    public ConfigurationException( String msg, String propertyKey )
    {
        super( msg + ((propertyKey!=null) ? (":"+propertyKey) : ""));
    }

    public ConfigurationException( String msg )
    {
        this( msg, (String)null );
    }

    public ConfigurationException( String msg, Throwable e )
    {
        super( msg, e );
    }
}


text:
package main // import "pixur.org/pixur/tools/cron"

import (
	"context"
	"flag"
	"log"
	"time"

	"pixur.org/pixur/be/schema"
	sdb "pixur.org/pixur/be/schema/db"
	tab "pixur.org/pixur/be/schema/tables"
	"pixur.org/pixur/be/server/config"
	"pixur.org/pixur/be/tasks"
)

func run(ctx context.Context) error {
	db, err := sdb.Open(ctx, config.Conf.DbName, config.Conf.DbConfig)
	if err != nil {
		return err
	}
	defer db.Close()

	j, err := tab.NewJob(ctx, db)
	if err != nil {
		return err
	}
	defer j.Rollback()

	perPicFn := func(p *schema.Pic) error {
		return perPic(p, db, config.Conf.PixPath)
	}

	return j.ScanPics(sdb.Opts{
		Prefix: tab.PicsPrimary{},
		Lock:   sdb.LockNone,
	}, perPicFn)
}

func perPic(p *schema.Pic, db sdb.DB, pixPath string) error {
	now := time.Now()
	// No deletion info
	if p.DeletionStatus == nil {
		return nil
	}
	// Some deletion info, but it isn't on the chopping block.
	if p.DeletionStatus.PendingDeletedTs == nil {
		return nil
	}
	// It was already hard deleted, ignore it
	if p.DeletionStatus.ActualDeletedTs != nil {
		return nil
	}

	pendingTime := schema.ToTime(p.DeletionStatus.PendingDeletedTs)
	// It is pending deletion, just not yet.
	if !now.After(pendingTime) {
		return nil
	}

	log.Println("Preparing to delete", p.GetVarPicId(), pendingTime)
	var task = &tasks.HardDeletePicTask{
		Beg:     db,
		PixPath: pixPath,
		PicId:   p.PicId,
	}
	runner := new(tasks.TaskRunner)
	// TODO: use real userid
	if err := runner.Run(tasks.CtxFromUserToken(context.TODO(), -12345, -12345), task); err != nil {
		return err
	}

	return nil
}

func main() {
	flag.Parse()

	if err := run(context.Background()); err != nil {
		log.Println(err.(stringer).String())
	}
}

type stringer interface {
	String() string
}


text:
(function(model){

  var Event = new EventObject();

  Event.newEvent = function(eventName, callback) {
    this.createEvent(eventName,function(result) {
      Event = result;
      if(callback) callback(Event);
    });
  };

  Event.initEventPage = function(ctx,next) {
    Event.prepHandlebars();

    Handlebars.registerHelper('css', function(status) {
      if (status === -1) return 'disapprove';
      if (status === 0) return '';
      if (status === 1) return 'maybe';
      if (status === 2) return 'approve';
    });

    Handlebars.registerHelper('text', function(status) {
      if (status === -1) return 'nope';
      if (status === 0) return 'no response';
      if (status === 1) return 'maybe';
      if (status === 2) return 'attending';
    });

    EventView.initEventView(next);
  };

  Event.getEventFromHash = function(ctx,next) {
    Event.hash = ctx.params.eventHash;
    Event.loadEventFromDB(function(result) {
      if (result && result.name) {
        Event = result;
        getTopicId(Event._id,function(){
          if (next) next();
        });
      } else {
        console.error('Problem retrieving Event from Hash:',ctx.params);
        // TODO: Display a message to the user about the bad hash
        //  Give button to start at home page?
      }
    });

    // TODO: Move to topic-controller
    function getTopicId(eventHash,callback) {
      $.ajax({
        url: '/api/topics/',
        type: 'GET',
        cache: false
      })
      .done( function (data) {
        // call the callback function here
        console.log('getTopicId data:',data);
        var topicId = data.topics.filter(function(topic){
          if(topic.eventHash == eventHash) return true;
        });
        if (topicId.length) {
          $('#timing').attr('data-topicId',topicId[0]._id);
          if (callback) callback();
        } else {
          // Hopefully this will never happen.
          console.error('GET /api/topics/ Ajax call successful, but no topicIds returned!');
          if (callback) callback();
        };
      })
      .fail( function(jqXHR, textStatus, errorThrown) {
        console.warn('Ajax call failed: GET /api/events/' + eventHash);
        console.log('jqXHR.responseText:',jqXHR.responseText);
        console.log('textStatus:',textStatus);
        console.log('errorThrown:',errorThrown);
        // call the error version of the callback if any
        if (callback) callback();
      });
    }
  };

  Event.handleSubmitComment = function(clickEvent) {
    clickEvent.preventDefault();
    Event.date = $('#date').val().trim();
    Event.times = $('#times').val().trim();
    Event.description = $('#event-description').val().trim();
    Event.updateEventInDB(function(updatedEvent){
      EventView.updateDetails(updatedEvent);
    });
  };

  Event.prepHandlebars = function(){
    var rsvpTemplate = $('#guests').html();
    Event.rsvpsToHtml = Handlebars.compile(rsvpTemplate);
  };

  Event.updateRsvps = function(){
    this.getRsvpListFromDB(function(updatedRsvpList){
      var guestListHtml = Event.rsvpsToHtml({rsvp:updatedRsvpList});
      EventView.updateRsvpList(guestListHtml);
    });
  };

  model.Event = Event;
})(window);


text:
If you have an interest in contributing to this project, here is some advice for packaging your contribution. Thanks!

## Contributing Bug Reports

Most likely the most common contribution to a library like this will be bug reports.

**All bug reports need to include**:

- the Android OS version on which you are experiencing the problem
- the code necessary to reproduce the problem (this could be the repo's demo app, or it could be some demo project of yours that you publish)
- the steps necessary, using that code and that version of Android, to reproduce the problem

## Contributing Feature Requests

If you have an idea for how to make the library better, feel free to file an [issue](../../issues).
You will have better luck in getting the feature implemented if you can "sell" the library author
on how this feature will help the library author.

## Asking for Other Sorts of Help

Please read [the project documentation](README.markdown#questions)
for instructions on where and how to ask questions.

## Contributing Code

This project is not set up to accept much in the way of pull requests or other code contributions, for
licensing and contractual reasons, not technical ones.

If you send over a pull request, and it is a *de minimis* fix (i.e., there is no other reasonable way to
affect the change other than how you did it), your pull request may be accepted and merged in directly.
Otherwise, pull requests or other code samples will be used as inspiration for a fresh implementation,
rather than used directly.

In general, you should open a bug report or feature request issue
first, before submitting a pull request.


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>freeboard</title>
	<meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="viewport" content = "width = device-width, initial-scale = 1, user-scalable = no" />
    <link href="css/freeboard.min.css" rel="stylesheet" />

freeboard

Load Freeboard

                            Save Freeboard
                            [Pretty]
                            [Minified]

Add Pane

DATASOURCES

                            Name
                            Last Updated

                ADD


text:
//
//  CCamera3D.h
//  OpenJam
//
//  Created by Yevgeniy Logachev
//  Copyright (c) 2014 yev. All rights reserved.
//

#ifndef CCAMERA3D_H
#define CCAMERA3D_H

#include "ICamera.h"
#include "CMath.h"

namespace jam {
CLASS_PTR(CCamera3D)

class CCamera3D : public ICamera {
public:
    /*
     * Create new 3D camera with added transformation component
     */
    static CCamera3DPtr Create(float _fov, float _near = 0.3f, float _far = 1000.0f);

    /*
     * Default constructor. To create new camera use static method Create() instead
     */
    CCamera3D(float _fov, float _near = 0.3f, float _far = 1000.0f);

    /*
     * Destructor
     */
    virtual ~CCamera3D();

    /*
     * Returns Projection View matrix. Attribute 'frameBufferIndex' choose projection matrix for according frame buffer
     * if there are several atached frame buffers
     */
    virtual glm::mat4x4 ProjectionMatrix(uint64_t frameBufferIndex = kDefaultFrameBuffer) override;

    /*
     * Return attached framebuffer. Attribute 'frameBufferIndex' choose required frame buffer
     * if there are several atached frame buffers
     */
    virtual IFrameBufferPtr FrameBuffer(uint64_t frameBufferIndex = kDefaultFrameBuffer) const override;

    /*
     * Assign new framebuffer. Projection matrix will be recalculated to current framebuffer width and height.
     * Attribute 'frameBufferIndex' choose required frame buffer if there are several atached frame buffers
     * Pass nullptr to remove framebuffer at position 'frameBufferIndex'
     */
    virtual void FrameBuffer(IFrameBufferPtr frameBuffer, uint64_t frameBufferIndex = kDefaultFrameBuffer) override;

    /*
     * Returns count of attached frame buffers
     */
    virtual uint64_t FrameBufferCount() const override;

    /*
     * Flip camera vertically
     */
    virtual void FlipY() override;

    /*
     * Flip camera horizontally
     */
    virtual void FlipX() override;

private:
    float m_FOV;
    float m_Near;
    float m_Far;
    std::vector<glm::mat4x4> m_ProjectionMatrix;
    std::vector<IFrameBufferPtr> m_FrameBuffer;
};

}; // namespace jam

#endif /* CCAMERA3D_H */


text:
if (Module_vtkRenderingExternal AND
    ("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2"))
  message (SEND_ERROR "
  vtkRenderingExternal cannot be built
  when the rendering backend is OpenGL2.
  Please disable vtkRenderingExternal or
  change VTK_RENDERING_BACKEND to OpenGL.
  ")
  return()
endif()

vtk_module(vtkRenderingExternal
  DEPENDS
    vtkRenderingCore
    vtkRenderingOpenGL
  TEST_DEPENDS
    vtkTestingRendering
  EXCLUDE_FROM_ALL
  )


text:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.sakaiproject.announcement</groupId>
        <artifactId>announcement</artifactId>
        <version>21-SNAPSHOT</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <name>sakai-announcement-impl</name>
    <groupId>org.sakaiproject.announcement</groupId>
    <artifactId>sakai-announcement-impl</artifactId>
    <packaging>sakai-component</packaging>

    <properties>
        <deploy.target>components</deploy.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.sakaiproject.kernel</groupId>
            <artifactId>sakai-kernel-storage-util</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>sakai-announcement-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.sakaiproject.message</groupId>
            <artifactId>sakai-message-util</artifactId>
        </dependency>
        <dependency>
            <groupId>org.sakaiproject.scheduler</groupId>
            <artifactId>scheduler-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xmlParserAPIs</artifactId>
            <version>2.6.2</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.6.2</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.sakaiproject.site</groupId>
            <artifactId>sakai-mergedlist-util</artifactId>
        </dependency>
        <dependency>
        	<groupId>org.apache.commons</groupId>
        	<artifactId>commons-lang3</artifactId>
      </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${basedir}/src/sql</directory>
                <includes>
                    <include>**/*.sql</include>
                </includes>
            </resource>
            <resource>
                <directory>${basedir}/src/bundle</directory>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>


text:
import os,sys,time,re
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats

## create doc beginning
class LatexReportCreator():
    def __init__(self,docName,docType='report',docDir="report",verbose=False,extraPackages=[],generatedBy="Python"):
        self.docName = docName
        self.docType = docType
        self.docDir = docDir
        self.verbose = verbose
        self.generatedBy = generatedBy
        self.extraPackages = extraPackages
        self.fontSizeList = ["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"]

        ## error check
        if type(self.extraPackages) != type([]):
            print("INPUT ERROR: extra packages must be in list form")

        if os.path.isdir(self.docDir) == False:
            if self.verbose == True:
                print("...making report directory")
            os.mkdir(self.docDir)

        self.fid = open(os.path.join(self.docDir,self.docName + ".tex"),'w')

    def write_beginning(self,title,author,shortTitle='report',shortAuthor='',toc=False):
        self.fid.write("\documentclass[letterpaper,10pt]{%s}\n"%self.docType)
        self.fid.write("\\usepackage{pgf,graphics,color,hyperref,fullpage,natbib,algorithm,algorithmic,amsmath,ulem,bm,morefloats}\n")
        for package in self.extraPackages:
            self.fid.write("\\usepackage{%s}\n"%package)
        self.fid.write("\definecolor{darkblue}{rgb}{0.0,0.0,0.50}\n")
        self.fid.write("\definecolor{darkgreen}{rgb}{0.0,0.35,0.0}\n")
        self.fid.write("\hypersetup{colorlinks=true, linkcolor=darkblue, citecolor=darkblue, urlcolor=darkblue}\n")
        self.fid.write("\hypersetup{pdfauthor={%s}, pdftitle={%s}}\n"%(shortAuthor,shortTitle))
        self.fid.write("\\usepackage{titlesec}\\titleformat{\chapter}{\centering\\normalfont\Large\\bfseries}{\\thechapter}{1em}{}\n")

        ## beginning materials
        self.fid.write("\\begin{document}\n")
        self.fid.write("%%%%%\n")
        self.fid.write("\\begin{flushleft}\n")
        self.fid.write("\\textbf{%s}\\\ \n"%title)
        self.fid.write("Created by: %s\\\ \n"%author)
        self.fid.write("Created on: %s\n"%time.asctime())
        self.fid.write("\end{flushleft}\n")
        self.fid.write("\medskip\hrule height 1pt\n")
        self.fid.write("\\vspace{7pt}\n")

        if toc == True:
            self.fid.write("\\tableofcontents\n")

    ## convenience functions
    def begin(self,item):
        if item in self.fontSizeList:
            self.fid.write("\%s\n"%item)
        else:
            self.fid.write("\\begin{%s}\n"%item)

    def end(self,item):
        if item in self.fontSizeList:
            self.fid.write("\\normalsize\n")
        else:
            self.fid.write("\end{%s}\n"%item)

    def section(self,sectionName,sectionType="section",numbers=True,toc=False):
        '''
        toc - used to manually add a section to the table of contents -- must also call toc = True in 'write_beginning'

        '''

        if numbers == True:
            self.fid.write("\%s{%s}\n"%(sectionType,sectionName))
        else:
            self.fid.write("\%s*{%s}\n"%(sectionType,sectionName))

        if toc == True:
            self.fid.write("\\addcontentsline{toc}{%s}{%s}\n"%(sectionType,sectionName))

    ## main functions
    def write_paragraph(self,body):
        self.fid.write(body+"\n\n")

    def write_end(self):
        self.fid.write("\n\end{document}")
        self.fid.close()

    def compile(self):
        currentDir = os.getcwd()
        os.chdir(self.docDir)
        os.system("pdflatex %s"%self.docName+".tex")
        os.chdir(currentDir)

    def include_figure(self,figPath,caption=None,label=None,scale=0.65):
        if os.path.isfile(figPath) == False:
            print("ERROR: could not include figure does not exist", figPath)

        self.fid.write("\\begin{figure}[!ht]\n")
        self.begin("center")
        self.fid.write("\includegraphics[scale = %s]{%s}\n"%(scale,figPath))
        if caption != None:
            self.fid.write("\caption{%s}\n"%caption)
        if label != None:
            self.fid.write("\label{fig:%s}\n"%label)
        self.end("center")
        self.end("figure")

    def include_table(self,rowDict,colHeader=None,customHeader=None,justifications=None,caption=None,label=None,fontSize='normalsize',ordered=False):
        '''
        rowDict - which has row header elements as keys and lists to fill out the cols as values
        colHeader - are the header elements for the columns
        '''

        ## if keys are only numeric
        numericKeys = False
        if not re.search('\D',str(rowDict.keys()[0])):
            numericKeys = True

        ## error checking
        if type(rowDict) != type({}):
            print("ERROR: rowDict for include_table must be of type dict")
        if type(rowDict[rowDict.keys()[0]]) != type([]):
            print("ERROR: the values in rowDict for included_table must be of type list")

        numCols = len(rowDict[rowDict.keys()[0]])
        if justifications == None and numericKeys == False:
            justifications = '|l|'+'c'*numCols+"|"
        elif justifications == None and numericKeys == True:
            justifications = '|l|'+'c'*(numCols-1)+"|"

        self.fid.write('\\begin{table}[!h]\n')
        self.begin('center')
        self.begin(fontSize)
        self.fid.write("\\begin{tabular}{%s}\n"%justifications)
        self.fid.write("\\hline\n")

        if customHeader != None:
            self.fid.write(customHeader)
            self.fid.write("\\hline\n")

        if colHeader != None:
            header = "".join([i + "&" for i in colHeader])[:-1]+"\\\ \n"
            self.fid.write(header)
            self.fid.write("\\hline\n")

        if numericKeys == True:
            sk = [int(k) for k in rowDict.keys()]
            sk.sort()
            for key in sk:
                row = rowDict[str(key)]
                if row[0] == "hline":
                    self.fid.write("\\hline\n")
                else:
                    row = "".join([i + "&" for i in row])[:-1]+"\\\ \n"
                    self.fid.write(row)
        elif type(ordered) == type([]):
            for rowHead in ordered:
                row = rowDict[rowHead]
                if rowHead == 'hline':
                    self.fid.write("\\hline\n")
                else:
                    row = rowHead + "&" + "".join([i + "&" for i in row])[:-1]+"\\\ \n"
                    self.fid.write(row)
        elif ordered == True:
            it = iter(sorted(rowDict.iteritems()))
            for rowHead, row in it:
                if row[0] == 'hline':
                    self.fid.write("\\hline\n")
                else:
                    row = rowHead + "&" + "".join([i + "&" for i in row])[:-1]+"\\\ \n"
                    self.fid.write(row)
        else:
            for rowHead, row in rowDict.iteritems():
                if row[0] == 'hline':
                    self.fid.write("\\hline\n")
                else:
                    row = rowHead + "&" + "".join([i + "&" for i in row])[:-1]+"\\\ \n"
                    self.fid.write(row)

        self.fid.write("\\hline\n")
        self.end('tabular')
        self.end(fontSize)
        self.end('center')
        if caption != None:
            self.fid.write("\caption{%s}\n"%caption)
        if label != None:
            self.fid.write("\label{tab:%s}\n"%label)
        self.end('table')

## run a small test
if __name__ == '__main__':

    ## create a preambble
    report = LatexReportCreator('test',verbose=True)
    report.write_beginning("Test Report Title","Ender Wiggin",toc=True)

    ## create the body
    report.section("About",numbers=False,toc=True)

    report.write_paragraph("this is a paragraph blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "+
                           "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah")
    report.write_paragraph("this is a paragraph blah blah blah blah blah blah blah blah blah blah blah blah "+
                           "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah")

    report.section("Results",numbers=False,toc=True)
    report.write_paragraph("this is a paragraph blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "+
                           "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah")
    report.write_paragraph("this is a paragraph blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah "+
                           "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah")

    colHeader = ["I", "II", "III", "IV"]
    rowDict = {"a":["1","2","3"],
               "b":["4","5","6"],
               "c":["7","8","9"]
               }

    caption = "\\textbf{an example table}. this is a table caption"
    label = "example-table"
    report.include_table(rowDict,colHeader,caption=caption,label=label)

    ## create a test figure
    fig = plt.figure()
    ax = fig.add_subplot(111)
    n = 5000
    alpha,beta = 2.0,3.0
    samples = np.random.beta(alpha,beta,size=n)
    p1 =ax.hist(samples,normed=1,alpha=0.7)
    pdfX = np.linspace(0,1,300)
    pdfY = stats.beta.pdf(pdfX,alpha,beta)
    p2 = ax.plot(pdfX,pdfY,color='orange',linewidth=2.5)
    ax.set_xlim((0,1))

    ax.set_title(r"Beta distribution: $a$ = %s, $b$ = %s, $n$ = %s"%(alpha,beta,n))
    figPath = os.path.join(report.docDir,"examplefig.pdf")
    ax.legend([p2],["pdf"])
    plt.savefig(figPath)

    ## add in test figure
    caption = "\\textbf{The beta distribution}. this is a figure caption"
    label = "beta-distn"
    report.include_figure("examplefig.pdf",caption=caption,label=label,scale=0.5)

    ## add another paragraph and close report
    report.write_paragraph("This is an example of how to make a reference to Figure~\\ref{fig:beta-distn} blah blah blah blah blah "+
                           "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah")

    report.write_end()
    report.compile()


text:
import os

def is_sys_win():
    """
    Check if current OS is a Windows system.

    :return: If current operating system is Windows or not.
    :rtype: bool
    """
    return os.name == 'nt'

def is_sys_posix():
    """
    Check if current OS is a posix system.

    :return: If current operating system is posix or not.
    :rtype: bool
    """
    return os.name == 'posix'

def is_user_admin():
    """
    Check if current user is admin/root.

    :return: If current user has administrator/root privileges or not.
    :rtype: bool
    :raises NotImplementedError: If this method is used on neither Windows
        systems nor posix systems.
    """
    if is_sys_win():
        import ctypes
        # WARNING: requires Windows XP SP2 or higher!
        return ctypes.windll.shell32.IsUserAnAdmin()
    elif is_sys_posix():
        # Check for root on Posix
        return os.getuid() == 0
    else:
        raise NotImplementedError("Unsupported operating system: %s" % os.name)


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Naturwiss. Z. Forst-Landw. 5: (1907)

#### Original name
Ceratostomella cana Münch, 1907

### Remarks
null


text: sudo apt-get install -y --force-yes libopencv-dev #- development files for opencv


text:
WAIT_CMD="adb -s emulator-5554 wait-for-device shell getprop init.svc.bootanim"

until $WAIT_CMD | grep -m 1 stopped; do
  echo "Waiting for first emulator..."
  sleep 1
done


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>RemoteSyslogAppender.SyslogSeverity Enumeration</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            log4net SDK Reference

RemoteSyslogAppender.SyslogSeverity Enumeration

 syslog severities

        [Visual Basic]

Public Enum RemoteSyslogAppender.SyslogSeverity

        [C#]

public enum RemoteSyslogAppender.SyslogSeverity

Remarks

 The syslog severities.

Members

Member Name	Description

Emergency	 system is unusable

Alert	 action must be taken immediately

Critical	 critical conditions

Error	 error conditions

Warning	 warning conditions

Notice	 normal but significant condition

Informational	 informational

Debug	 debug-level messages

Requirements

Namespace: log4net.Appender

Assembly: log4net (in log4net.dll)

See Also

log4net.Appender Namespace

Copyright 2001-2006 The Apache Software Foundation.

Generated from assembly log4net [1.2.10.0]