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

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>A simple library to get platform informations in Java.</description>
    <url>https://github.com/redpois0n/oslib</url>

    <licenses>
        <license>
            <name>The MIT License</name>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>redpois0n</name>
            <email>red@cmail.nu</email>
            <organization>redpois0n</organization>
            <organizationUrl>https://redpois0n.com/</organizationUrl>
            <roles>
                <role>Author</role>
            </roles>
        </developer>
        <developer>
            <name>Tristan Deloche</name>
            <email>tristandeloche@gmail.com</email>
            <roles>
                <role>Contributor</role>
            </roles>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/redpois0n/oslib.git</connection>
        <developerConnection>scm:git:ssh://github.com/redpois0n/oslib.git</developerConnection>
        <url>https://github.com/redpois0n/oslib/tree/master</url>
    </scm>

    <groupId>nu.redpois0n</groupId>
    <artifactId>oslib</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>deploy-ossrh</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>

</project>


text: Password is no longer required if you specify an OAuth token.

redpajama_set_name: RedPajamaGithub


text:
from ostsa.exe.classification import XGBClassifier
import csv
import os

if (len(os.sys.argv) != 6):
    print('Invalid number of args. Check python script.')
    os.sys.exit(1)

feature_matrix_file = os.sys.argv[1]
sample_labels_file = os.sys.argv[2]
classifier_file = os.sys.argv[3]
confusion_matrix_file = os.sys.argv[4]
scoresheet_file = os.sys.argv[5]

# Load in the feature matrix and ids.
print('Loading features...')
with open(feature_matrix_file) as file:
    rows = [row for row in csv.reader(file)]

    ids = [row[0] for row in rows]
    features = [row[1:] for row in rows]

# Load in the labels.
print('Loading labels...')
with open(sample_labels_file) as file:
    rows = [row for row in csv.reader(file)]
    labels_dict = {row[0]: row[1] for row in rows[1:]}

labels = [labels_dict[id] for id in ids]

# Create the classifier.
print('Training classifier...')
classifier = XGBClassifier(features, labels, training_ratio=0.7)

# Save the classifier.
print('Saving classifier...')
classifier.save(classifier_file)

# Create the confusion matrix.
print('Creating confusion matrix...')
classifier.save_confusion_matrix(confusion_matrix_file)

# Calculate accuracy.
print('Calculating accuracy...')
accuracy = classifier.accuracy()
with open(scoresheet_file, 'w') as file:
    file.write('{0:<30}{1}'.format('Accuracy:', accuracy))

# Calculate logloss.
print('Calculating log loss...')
logloss = classifier.logloss()
with open(scoresheet_file, 'a') as file:
    file.write('\r\n{0:<30}{1}'.format('Log loss:', logloss))

# Calculate cross validation.
print('Cross validating (this will take a while)...')
cross_vals = classifier.cross_val_scores()
average = sum(cross_vals) / float(len(cross_vals))
with open(scoresheet_file, 'a') as file:
    file.write('\r\n{0}-Fold Cross Validation:'.format(len(cross_vals)))
    file.write('\r\n'.join('{0}{1}'.format(' ' * 30, x) for x in cross_vals))
    file.write((' ' * 30) + ('-' * 17))
    file.write('{0}{1}', (' ' * 30) + str(average))

print('\nSuccessfully evaluated classifier!')


text:
<idea-plugin>
  <id>com.intellij.tasks</id>
  <name>Task Management</name>
  <description>Enables task and context management</description>
  <version>1.0</version>
  <vendor>JetBrains</vendor>

  <!--fake dependency for Web IDE-->
  <depends>com.intellij.modules.xml</depends>
  <depends optional="true" config-file="java-contexts.xml">com.intellij.modules.java</depends>
  <!-- Optional dependency on XPath plugin for syntax highlighting in GenericRepository configuration dialog -->
  <depends optional="true">XPathView</depends>

  <project-components>
    <component>
      <interface-class>com.intellij.tasks.TaskManager</interface-class>
      <implementation-class>com.intellij.tasks.impl.TaskManagerImpl</implementation-class>
    </component>
  </project-components>

  <actions>

    <group id="task.actions">
      <action id="tasks.switch" class="com.intellij.tasks.actions.SwitchTaskAction" text="_Switch Task...">
        <keyboard-shortcut keymap="$default" first-keystroke="alt shift T"/>
      </action>
      <action id="tasks.goto" class="com.intellij.tasks.actions.GotoTaskAction">
        <keyboard-shortcut keymap="$default" first-keystroke="alt shift N"/>
      </action>
      <action id="tasks.close" class="com.intellij.tasks.actions.CloseTaskAction" text="_Close Active Task...">
        <keyboard-shortcut keymap="$default" first-keystroke="alt shift W"/>
      </action>
      <separator/>
      <action id="tasks.edit" class="com.intellij.tasks.actions.EditTaskAction" text="Edit Task..."/>
      <action id="tasks.create.changelist" class="com.intellij.tasks.actions.CreateChangelistAction" text="Create Change_list..."/>
      <action id="tasks.show.task.description" class="com.intellij.tasks.actions.ShowTaskDescription" text="Show Description"/>
      <action id="tasks.open.in.browser" class="com.intellij.tasks.actions.OpenTaskInBrowserAction" text="Open in _Browser">
        <keyboard-shortcut keymap="$default" first-keystroke="alt shift B"/>
      </action>
      <action id="tasks.analyze.stacktrace" class="com.intellij.tasks.actions.AnalyzeTaskStacktraceAction"
              text="Analyze _Stack Trace From Task..."/>
      <separator/>
      <action id="tasks.configure.servers" class="com.intellij.tasks.actions.ConfigureServersAction" text="Configure Servers..."/>
    </group>

    <group id="working.context">
      <action id="context.save" class="com.intellij.tasks.actions.context.SaveContextAction" text="_Save Context...">
        <keyboard-shortcut keymap="$default" first-keystroke="alt shift S"/>
      </action>
      <action id="context.load" class="com.intellij.tasks.actions.context.LoadContextAction" text="_Load Context...">
        <keyboard-shortcut keymap="$default" first-keystroke="alt shift L"/>
        <keyboard-shortcut keymap="Mac OS X" first-keystroke="alt shift L" remove="true"/>
      </action>
      <action id="context.clear" class="com.intellij.tasks.actions.context.ClearContextAction" text="_Clear Context">
        <keyboard-shortcut keymap="$default" first-keystroke="alt shift X"/>
      </action>
    </group>

    <group id="tasks.internal" text="_Tasks" internal="true" popup="true">
      <action id="show.certificate" class="com.intellij.tasks.actions.ShowCertificateInfoAction" text="_Show certificate dialog"/>
      <action id="deadlock.with.certificate.dialog" class="com.intellij.tasks.actions.DeadlockWithCertificateDialogAction"
              text="_Deadlock IDE with certificate dialog"/>
      <add-to-group group-id="Internal"/>
    </group>

    <group id="tasks.and.contexts" text="_Tasks & Contexts" popup="true">
      <reference ref="task.actions"/>
      <separator/>
      <reference ref="working.context"/>
      <!-- <reference ref="tasks.util"/> -->
    </group>

    <group id="tasks.group">
      <reference ref="tasks.and.contexts"/>
      <separator/>
      <add-to-group group-id="ToolsMenu" anchor="first"/>
    </group>

    <group id="tasks.toolbar.group" text="Tasks toolbar">
      <separator/>
      <reference id="tasks.switch"/>
      <add-to-group group-id="MainToolBar" anchor="last"/>
      <add-to-group group-id="NavBarToolBarOthers" anchor="last"/>
    </group>

    <!--
    <action id="tasks.trackContext" class="com.intellij.tasks.actions.AssociateWithTaskAction"
            text="Associate with _Task"
            description="Reload context (e.g. open editors) when changelist is set active">

      <add-to-group group-id="ChangesViewPopupMenu" relative-to-action="ChangesView.SetDefault" anchor="after"/>
    </action>
    -->

  </actions>

  <extensionPoints>
    <extensionPoint name="repositoryType" interface="com.intellij.tasks.TaskRepositoryType"/>
    <extensionPoint name="dialogPanelProvider" interface="com.intellij.tasks.ui.TaskDialogPanelProvider"/>
    <extensionPoint name="commitPlaceholderProvider" interface="com.intellij.tasks.CommitPlaceholderProvider"/>
  </extensionPoints>

  <extensions defaultExtensionNs="com.intellij">

    <projectConfigurable groupId="tools" instance="com.intellij.tasks.config.TaskConfigurable" id="tasks" displayName="Tasks" nonDefaultProject="true">
      <configurable instance="com.intellij.tasks.config.TaskRepositoriesConfigurable" displayName="Servers" id="tasks.servers"/>
    </projectConfigurable>
    <tasks.dialogPanelProvider implementation="com.intellij.tasks.actions.vcs.VcsTaskDialogPanelProvider"/>

    <editChangelistSupport implementation="com.intellij.tasks.impl.TaskChangelistSupport"/>

    <projectService serviceImplementation="com.intellij.tasks.impl.TaskProjectConfiguration"/>
    <applicationService serviceImplementation="com.intellij.tasks.config.RecentTaskRepositories"/>
    <applicationService serviceImplementation="com.intellij.tasks.config.TaskSettings"/>
    <search.optionContributor implementation="com.intellij.tasks.config.TaskSearchableOptionContributor"/>

    <lang.documentationProvider language="TEXT" implementationClass="com.intellij.tasks.doc.TaskDocumentationProvider"/>

    <tasks.repositoryType implementation="com.intellij.tasks.jira.JiraRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.youtrack.YouTrackRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.lighthouse.LighthouseRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.pivotal.PivotalTrackerRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.redmine.RedmineRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.trac.TracRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.fogbugz.FogBugzRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.mantis.MantisRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.generic.GenericRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.trello.TrelloRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.gitlab.GitlabRepositoryType"/>
    <tasks.repositoryType implementation="com.intellij.tasks.bugzilla.BugzillaRepositoryType"/>

    <!-- JQL support -->
    <fileTypeFactory implementation="com.intellij.tasks.jira.jql.JqlFileTypeFactory"/>
    <lang.parserDefinition language="JQL"
                           implementationClass="com.intellij.tasks.jira.jql.JqlParserDefinition"/>
    <lang.syntaxHighlighterFactory language="JQL" implementationClass="com.intellij.tasks.jira.jql.JqlHighlighterFactory"/>
    <lang.braceMatcher language="JQL" implementationClass="com.intellij.tasks.jira.jql.JqlBraceMatcher"/>
    <completion.contributor language="JQL"
                            implementationClass="com.intellij.tasks.jira.jql.codeinsight.JqlCompletionContributor"/>
    <annotator language="JQL" implementationClass="com.intellij.tasks.jira.jql.codeinsight.JqlAnnotator"/>

    <checkinHandlerFactory implementation="com.intellij.tasks.impl.TaskCheckinHandlerFactory"/>
    <vcs.commitMessageProvider implementation="com.intellij.tasks.impl.TaskCommitMessageProvider"/>
    <!-- YouTrack support -->
    <!--<annotator language="TEXT" implementationClass="com.intellij.tasks.youtrack.lang.YouTrackHighlightingAnnotator"/>-->
    <lang.parserDefinition language="YouTrack" implementationClass="com.intellij.tasks.youtrack.lang.YouTrackParserDefinition"/>
    <completion.contributor language="YouTrack"
                            implementationClass="com.intellij.tasks.youtrack.lang.codeinsight.YouTrackCompletionContributor"/>
    <externalAnnotator language="YouTrack" implementationClass="com.intellij.tasks.youtrack.lang.YouTrackHighlightingAnnotator"/>
    <tasks.commitPlaceholderProvider implementation="com.intellij.tasks.impl.DefaultCommitPlaceholderProvider"/>
  </extensions>

</idea-plugin>


text:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<artifactId>spring-cloud-etcd-discovery</artifactId>
	<packaging>jar</packaging>
	<name>Spring Cloud Etcd Discovery</name>
	<description>Spring Cloud Etcd Discovery</description>

	<parent>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-etcd</artifactId>
		<version>1.0.0.BUILD-SNAPSHOT</version>
		<relativePath>..</relativePath>
	</parent>

	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-etcd-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-netflix-core</artifactId>
		</dependency>
		<dependency>
			<groupId>com.netflix.archaius</groupId>
			<artifactId>archaius-core</artifactId>
		</dependency>
		<!-- archaius dep -->
		<dependency>
			<groupId>commons-configuration</groupId>
			<artifactId>commons-configuration</artifactId>
		</dependency>
		<dependency>
			<groupId>com.netflix.ribbon</groupId>
			<artifactId>ribbon</artifactId>
		</dependency>
		<dependency>
			<groupId>com.netflix.ribbon</groupId>
			<artifactId>ribbon-core</artifactId>
		</dependency>
		<dependency>
			<groupId>com.netflix.ribbon</groupId>
			<artifactId>ribbon-httpclient</artifactId>
		</dependency>
		<dependency>
			<groupId>com.netflix.ribbon</groupId>
			<artifactId>ribbon-loadbalancer</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

</project>


text:
/* $XFree86$ */
/*
 * This include file is designed to be a portable way for systems to define
 * bit field manipulation of arrays of bits.
 */
#ifndef __XTRAPBITS__
#define __XTRAPBITS__ "@(#)xtrapbits.h	1.6 - 90/09/18  "

/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1994 by Digital Equipment Corporation,
Maynard, MA

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

*****************************************************************************/
/*
 *
 *  CONTRIBUTORS:
 *
 *      Dick Annicchiarico
 *      Robert Chesler
 *      Dan Coutu
 *      Gene Durso
 *      Marc Evans
 *      Alan Jamison
 *      Mark Henry
 *      Ken Miller
 *
 */
typedef unsigned char *UByteP;  /* Pointer to an unsigned byte array */
#define BitsInByte    8L        /* The number of bits in a byte */

#define BitInByte(bit)	        /* Returns the bit mask of a byte */ \
    (1L << (((bit) % BitsInByte)))

#define BitInWord(bit)	        /* Returns the bit mask of a word */ \
    (1L << (((bit) % (BitsInByte * 2L))))

#define BitInLong(bit)	        /* Returns the bit mask of a long */ \
    (1L << (((bit) % (BitsInByte * 4L))))

#define ByteInArray(array,bit)	/* Returns the byte offset to get to a bit */ \
    (((UByteP)(array))[(bit) / BitsInByte])

#define BitIsTrue(array,bit)    /* Test to see if a specific bit is True */ \
    (ByteInArray(array,bit) & BitInByte(bit))

#define BitIsFalse(array,bit)   /* Test to see if a specific bit is False */ \
    (!(BitIsTrue(array,bit)))

#define BitTrue(array,bit)      /* Set a specific bit to be True */ \
    (ByteInArray(array,bit) |= BitInByte(bit))

#define BitFalse(array,bit)     /* Set a specific bit to be False */ \
    (ByteInArray(array,bit) &= ~BitInByte(bit))

#define BitToggle(array,bit)    /* Toggle a specific bit */ \
    (ByteInArray(array,bit) ^= BitInByte(bit))

#define BitCopy(dest,src,bit)   /* Copy a specific bit */ \
    BitIsTrue((src),(bit)) ? BitTrue((dest),(bit)) : BitFalse((dest),(bit))

#define BitValue(array,bit)     /* Return True or False depending on bit */ \
    (BitIsTrue((array),(bit)) ? True : False)

#define BitSet(array,bit,value) /* Set bit to given value in array */ \
    (value) ? BitTrue((array),(bit)) : BitFalse((array),(bit))

#endif /* __XTRAPBITS__ */


text:
from __future__ import unicode_literals

from django.db import models
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.urls import reverse
from django.utils.text import slugify

from job_board.models.country import Country

class Company(models.Model):
    name = models.CharField(max_length=50)
    url = models.URLField(verbose_name="URL")
    twitter = models.CharField(
                  max_length=20,
                  blank=True,
                  null=True,
                  help_text="Please leave empty if none"
              )
    country = models.ForeignKey(
                  Country,
                  blank=True,
                  null=True,
                  help_text="Please leave empty if 100% virtual",
                  on_delete=models.PROTECT
              )
    site = models.ForeignKey(Site, on_delete=models.CASCADE)
    user = models.ForeignKey(User, on_delete=models.CASCADE)

    class Meta:
        verbose_name_plural = "companies"
        unique_together = ("name", "site")
        ordering = ['name']

    def __str__(self):
        return self.name

    def active_jobs(self):
        return self.job_set.filter(paid_at__isnull=False,
                                   expired_at__isnull=True)

    def paid_jobs(self):
        return self.job_set.filter(paid_at__isnull=False)

    def slug(self):
        return slugify(self.name)

    def get_absolute_url(self):
        return reverse('companies_show_slug', args=(self.id, self.slug(),))


text:
#ifndef __luaCppBridge_HybridObject_h__
#define __luaCppBridge_HybridObject_h__

#include <lua.hpp>
#include "lcbBaseObject.h"
#include "lcbException.h"
#include "lcbTypeChecks.h"

#define LCB_HO_DECLARE_EXPORTABLE(classname) \
	static const LuaCppBridge::HybridObject< classname >::RegType methods[];\
	static const char* className

namespace LuaCppBridge {

/**
An HybridObject is a C++ class whose instances are exposed to Lua as tables. It differs from RawObject
in that additional methods and members can be added dynamically to its instances.
*/
template <typename T, bool is_disposable = false> class HybridObject : public BaseObject<T, HybridObject<T> > {
private:
	typedef BaseObject<T, HybridObject<T> > base_type;
public:
	typedef typename base_type::RegType RegType;
	typedef typename base_type::userdataType userdataType;

	typedef struct ObjectWrapper {
		T* wrappedObject;
		bool collectable;
	} ObjectWrapper;

public:
	static void Register (lua_State* L, const char* parentClassName) {
		Register(L, parentClassName, true);
	}

	static void Register (lua_State* L, const char* parentClassName, bool isCreatableByLua)
	{
		int libraryTable = lua_gettop(L);
		luaL_checktype(L, libraryTable, LUA_TTABLE);	// must have library table on top of the stack
		lua_pushcfunction(L, RegisterLua);
		lua_pushvalue(L, libraryTable);
		lua_pushstring(L, parentClassName);
		lua_pushboolean(L, isCreatableByLua);
		lua_call(L, 3, 0);
	}

	// create a new T object and push onto the Lua stack a table containing a userdata which itself contains a pointer
	// to T object
	static int new_T (lua_State* L) {
		lua_remove(L, 1);	// use classname:new(), instead of classname.new()
		T* obj = new T(L);	// call constructor for T objects
		int newTable = push(L, obj, true); // gc_T will delete this object
		if(base_type::s_trackingEnabled) {
			obj->KeepTrack(L);
		}

		// if this method was called with a table as parameter, copy its values to the newly created object
		if(lua_gettop(L) == 2 && lua_istable(L, 1)) {
			lua_pushnil(L);
			while(lua_next(L, 1)) {
				lua_pushvalue(L, -2);
				lua_insert(L, -2);
				lua_settable(L, newTable);
			}
		}
		// last step in the creation of the object. call a method that can access the userdata that will be sent
		// back to Lua
		obj->PostConstruct(L);
		return 1;
	}

	// push onto the Lua stack a table containing a userdata which itself contains a pointer to T object
	static int push (lua_State* L, T* obj, bool gc = false) {
		if(!obj) {
			lua_pushnil(L);
			return 0;
		}
		base_type::getmetatable(L, T::className);	// look for the metatable
		if(lua_isnil(L, -1)) {
			return error(L, "%s missing metatable", T::className);
		}
		// stack: metatable
		int metatable = lua_gettop(L);
		base_type::subtable(L, metatable, "userdata", "v");
		// stack: metatable, table userdata
		ObjectWrapper* wrapper = static_cast<ObjectWrapper*>(lua_newuserdata(L, sizeof(ObjectWrapper)));
		if(wrapper) {
			// set up a table as the userdata environment
			lua_newtable(L);
			lua_setfenv(L, -2);
			wrapper->wrappedObject = obj;	// store pointer to object in userdata
			lua_pushvalue(L, metatable);
			lua_setmetatable(L, -2);	// set metatable for userdata
			wrapper->collectable = gc;
		}
		// leave userdata on top of the stack
		lua_replace(L, metatable);
		lua_settop(L, metatable);
		return metatable;	// index of userdata containing pointer to T object
	}

	// get userdata from Lua stack and return pointer to T object
	// this is somewhat permissive, does not check for correct metatable (beware!)
	static T* check (lua_State* L, int narg) {
		checktype(L, narg, LUA_TUSERDATA);
		T* pT = static_cast<ObjectWrapper*>(lua_touserdata(L, narg))->wrappedObject;
		if(!pT) {
			typerror(L, narg, T::className);
		}
		return pT;	// pointer to T object
	}

	// test if the value in the given position in the stack is a T object
	// this is somewhat permissive, does not check for correct metatable (beware!)
	static bool test (lua_State* L, int narg) {
		if(!lua_isuserdata(L, narg)) {
			return false;
		}
		T* pT = static_cast<ObjectWrapper*>(lua_touserdata(L, narg))->wrappedObject;
		if(!pT) {
			return false;
		}
		return true;
	}

protected:
	/**
	__index metamethod. Looks for a dynamic property, then for a method.
	upvalues:
			1 = table with methods
	initial stack: self (userdata), key
	*/
	static int thunk_index(lua_State* L) {
		base_type::check(L, 1);	// get 'self', or if you prefer, 'this'
		lua_getfenv(L, 1);					// stack: userdata, key, userdata_env

		// Look in the userdata's environment
		lua_pushvalue(L, 2);				// stack: userdata, key, userdata_env, key
		lua_rawget(L, 3);
		if(!lua_isnil(L, -1)) {
			// found something, return it
			return 1;
		}
		lua_pop(L, 2);						// stack: userdata, key

		lua_pushvalue(L, 2);				// stack: userdata, key, key

		// not a property, look for a method up the inheritance hierarchy
		lua_gettable(L, lua_upvalueindex(1));
		if(!lua_isnil(L, -1)) {
			// found the method, return it
			return 1;
		}
		else {
			// nothing was found
			lua_pushnil(L);
			return 1;
		}
		return 0;
	}

	/**
	__newindex metamethod. Looks for a set property, else it sets the value as a dynamic property.
	initial stack: self (userdata), key, value
	*/
	static int thunk_newindex (lua_State* L) {
		base_type::check(L, 1);	// get 'self', or if you prefer, 'this'

		lua_getfenv(L, 1);					// stack: userdata, key, value, userdata_env
		lua_replace(L, 1);					// stack: userdata_env, key, value
		lua_rawset(L, 1);

		return 0;
	}

private:
	static int RegisterLua (lua_State* L) {
		luaL_checktype(L, 1, LUA_TTABLE);	// must pass a table
		const char* parentClassName = luaL_optstring(L, 2, NULL);
		bool isCreatableByLua = lua_toboolean(L, 3) != 0;

		int whereToRegister = 1;
		// creo una tabla para los métodos
		lua_newtable(L);
		int methods = lua_gettop(L);

		base_type::newmetatable(L, T::className);
		int metatable = lua_gettop(L);

		// store method table in module so that scripts can add functions written in Lua.
		lua_pushvalue(L, methods);
		base_type::set(L, whereToRegister, T::className);

		// make getmetatable return the methods table
		lua_pushvalue(L, methods);
		lua_setfield(L, metatable, "__metatable");

		// set __index and __newindex metamethods
		lua_pushvalue(L, methods);
		lua_pushcclosure(L, T::thunk_index, 1);
		base_type::set(L, metatable, "__index");

		lua_pushcfunction(L, T::thunk_newindex);
		base_type::set(L, metatable, "__newindex");

		lua_pushcfunction(L, T::tostring_T);
		base_type::set(L, metatable, "__tostring");

		lua_pushcfunction(L, T::gc_T);
		base_type::set(L, metatable, "__gc");

		lua_pushstring(L, T::get_full_class_name_T());
		base_type::set(L, metatable, "__name");

		if(isCreatableByLua) {
			// Make Classname() and Classname:new() construct an instance of this class
			lua_newtable(L);							// mt for method table
			lua_pushcfunction(L, T::new_T);
			lua_pushvalue(L, -1);						// dup new_T function
			base_type::set(L, methods, "new");			// add new_T to method table
			base_type::set(L, -3, "__call");			// mt.__call = new_T
			lua_setmetatable(L, methods);
		}
		else {
			// Both Make Classname() and Classname:new() will issue an error
			lua_newtable(L);							// mt for method table
			lua_pushcfunction(L, base_type::forbidden_new_T);
			lua_pushvalue(L, -1);						// dup new_T function
			base_type::set(L, methods, "new");			// add new_T to method table
			base_type::set(L, -3, "__call");			// mt.__call = new_T
			lua_setmetatable(L, methods);
		}

		// fill method table with methods from class T
		for(const RegType* l = T::methods; l->name; l++) {
			lua_pushstring(L, l->name);
			lua_pushlightuserdata(L, (void*)l);
			lua_pushcclosure(L, base_type::thunk_methods, 1);
			lua_settable(L, methods);
		}
		// If a parent class was supplied, make it inherit from it
		if(parentClassName) {
			// do this:
			// getmetatable(T::className).__index = className
			// ie: getmetatable(VbButton).__index = CVbCtrlObj
			lua_getmetatable(L, methods);
			lua_pushliteral(L, "__index");
			lua_getfield(L, whereToRegister, parentClassName);
			if(lua_isnil(L, -1)) {
				return luaL_error(L, "class %s is not defined", parentClassName);
			}
			lua_rawset(L, -3);
			lua_pop(L, 1);
		}

		if(isCreatableByLua && is_disposable) {
			lua_pushcfunction(L, T::dispose_T);
			base_type::set(L, methods, "dispose");
		}

		lua_pop(L, 2);	// drop metatable and method table
		return 0;
	}

public:
	void PostConstruct (lua_State* L) {};
};

} // end of the namespace

#endif


text:
module DTK
  class Target
    class Clone
      require_relative('clone/objects')
      require_relative('clone/special_node_attributes')

      module Mixin
        def clone_post_copy_hook(clone_copy_output, opts = {})
          Clone.clone(self, clone_copy_output, opts)
        end
      end

      def initialize(target, clone_copy_output)
        @target            = target
        @objects           = Objects.new(clone_copy_output)
        @assembly_instance = clone_copy_output.assembly?(subclass_object: true)
      end
      private :initialize

      # opts can have keys:
      #   :version
      def self.clone(target, clone_copy_output, opts = {})
        new(target, clone_copy_output).clone(opts)
      end

      def clone(opts = {})
        #adjust link_def_id on ports
        set_ports_link_def_and_cmp_ids

        return if self.nodes.empty?
        SpecialNodeAttributes.process(self.nodes, self.assembly_instance)

        # The method create_target_refs_and_links?
        # - creates if needed target refs and links to them
        # - moves node attributes to the target refs
        # - returns any needed 'create node' state change objects, which designate that
        #   target ref node needs to be created as opposed to it exists already
        create_target_refs_and_links?

        # Computing port_links (and also attribute links after create_target_refs_and_links
        # because relying on the node attributes to be shifted to target refs if connected to target refs
        create_attribute_links__clone_if_needed

        # TODO: currently this is not being used
        # if settings = opts[:service_settings]
        #   settings.apply_settings(target, assembly)
        # end

        update_task_templates

        unless self.components_hash_form.empty?
          component_new_items = self.components_hash_form.map do |child_hash|
            { new_item: child_hash[:id_handle], parent: self.target_idh }
          end
          StateChange.create_pending_change_items(component_new_items)
        end
      end

      protected

      attr_reader :target, :objects, :assembly_instance

      def nodes
        @nodes ||= self.objects.nodes
      end

      def ports
        @ports ||= self.objects.ports
      end

      def port_links
        @port_links ||= self.objects.port_links
      end

      def link_defs
        @link_defs ||= self.objects.link_defs
      end

      def components_hash_form
        @components_hash_form ||= self.objects.components(hash_form: true)
      end

      def components
        @components ||= self.objects.components
      end

      def task_templates
        @task_templates ||= self.objects.task_templates
      end

      def module_branch
        @module_branch ||= ret_module_branch
      end

      def target_idh
        @target_idh ||= self.target.id_handle
      end

      private

      def set_ports_link_def_and_cmp_ids
        return if self.ports.empty?
        port_mh = self.ports.first.id_handle.createMH
        Port.set_ports_link_def_and_cmp_ids(port_mh, self.ports, self.components, self.link_defs)
      end

      def create_target_refs_and_links?
        nodes_for_create_sc = Node::TargetRef::Clone.new(self.target, self.assembly_instance, self.nodes).create_target_refs_and_links?
        create_state_changes_for_create_node?(nodes_for_create_sc)
      end

      # find the port_links under the assembly and then add attribute_links associated with it
      def create_attribute_links__clone_if_needed
        return if self.port_links.empty?
        sp_hash = {
          cols: [:id, :display_name, :group_id, :input_id, :output_id],
          filter: [:oneof, :id, self.port_links.map(&:id)]
        }
        port_link_mh = self.port_links.first.id_handle.createMH
        Model.get_objs(port_link_mh, sp_hash).each do |port_link|
          port_link.create_attribute_links__clone_if_needed(self.target.id_handle, set_port_link_temporal_order: true)
        end
      end

      def update_task_templates
        add_node_component_tasks_if_needed
        add_service_module_task_templates
      end

      def add_node_component_tasks_if_needed
        assembly_wide_node = nil
        real_nodes         = []
        self.nodes.each do |node|
          if node.is_assembly_wide_node?
            assembly_wide_node = node
          else
            real_nodes << node
          end
        end
        return if real_nodes.empty? or assembly_wide_node.nil?
        NodeComponent.node_components(real_nodes, self.assembly_instance).map do |node_component|
          component = node_component.component
          node_name = node_component.node.display_name
          task_template_opts = { component_title: node_name, insert_strategy: :insert_at_start }
          Task::Template::ConfigComponents.update_when_added_component_or_action?(self.assembly_instance, assembly_wide_node, component, task_template_opts)
        end
      end

      def add_service_module_task_templates
        task_templates = self.module_branch.get_service_module_task_templates
        return if task_templates.empty?

        # remove any service_level task_templates that match an assembly level one using :task_action as the key
        assembly_task_actions = self.task_templates.map { |t| t[:task_action] }
        self.task_templates.reject! { |t| assembly_task_actions.include?(t) }
        return if self.task_templates.empty?

        Task::Template.clone_to_assembly(self.assembly_instance, self.task_templates)
      end

      def create_state_changes_for_create_node?(nodes_for_create_sc)
        #Do not create stages for node that are physical
        pruned_nodes = nodes_for_create_sc.reject do |node|
          (node.get_field?(:external_ref) || {})[:type] == 'physical'
        end
        return if pruned_nodes.empty?

        node_new_items = pruned_nodes.map { |node| { new_item: node.id_handle, parent: self.target_idh } }
        sc_hashes = create_state_change_objects(node_new_items)
        create_state_changes_for_node_group_members(pruned_nodes, sc_hashes)
        nil
      end

      def create_state_changes_for_node_group_members(pruned_nodes, sc_hashes)
        ret = []
        node_groups = pruned_nodes.select(&:is_node_group?)
        return ret if node_groups.empty?
        ng_mh =  node_groups.first.model_handle
        ndx_sc_ids = sc_hashes.inject({}) { |h, sc| h.merge(sc[:node_id] => sc[:id]) }
        sc_mh = self.target_idh.createMH(:state_change)
        new_items_hash = []
        NodeGroup.get_ndx_node_group_members(node_groups.map(&:id_handle)).each do |ng_id, node_members|
          unless ng_state_change_id = ndx_sc_ids[ng_id]
            Log.eror('Unexpected that ndx_sc_ihs[ng_id] is null')
            next
          end
          ng_state_change_idh = sc_mh.createIDH(id: ng_state_change_id)
          node_members.each do |node|
            new_items_hash << { new_item: node.id_handle, parent: ng_state_change_idh }
          end
        end
        create_state_change_objects(new_items_hash)
      end

      def create_state_change_objects(new_items_hash)
        opts_sc = { target_idh: self.target_idh, returning_sql_cols: [:id, :display_name, :group_id, :node_id] }
        StateChange.create_pending_change_items(new_items_hash, opts_sc)
      end

      def ret_module_branch
        module_branch_id = self.assembly_instance.get_field?(:module_branch_id)
        self.assembly_instance.model_handle(:module_branch).createIDH(id: module_branch_id).create_object
      end

    end
  end
end


text:
layout: searchList
title: Search
permalink: /search/
public: true
---
<div id="home-search">

	<script>
		(function() {
			var cx = '011873619592842964601:abylzkmz0_u';
			var gcse = document.createElement('script');
			gcse.type = 'text/javascript';
			gcse.async = true;
			gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
			var s = document.getElementsByTagName('script')[0];
			s.parentNode.insertBefore(gcse, s);
		})();
	</script>
	<gcse:search linkTarget="_parent" queryParameterName="searchString"></gcse:search>
</div>


text:
<?php namespace PhilipBrown\WorldPay\Tests;

use PhilipBrown\WorldPay\Response;

class ResponseTest extends \PHPUnit_Framework_TestCase
{
    /** @test */
    public function should_create_a_new_response()
    {
        $response = new Response('', []);

        $this->assertInstanceOf('PhilipBrown\WorldPay\Response', $response);
    }

    /** @test */
    public function should_have_access_to_response_attributes()
    {
        $response = new Response('', ['name' => 'Philip Brown']);

        $this->assertEquals('Philip Brown', $response->name);
    }

    /** @test */
    public function should_be_valid_with_correct_password()
    {
        $response = new Response('qwerty', ['callbackPW' => 'qwerty']);

        $this->assertTrue($response->isValid());
    }

    /** @test */
    public function should_be_invalid_with_incorrect_password()
    {
        $response = new Response('qwerty', ['callbackPW' => 'dvorak']);

        $this->assertFalse($response->isValid());
    }

    /** @test */
    public function should_be_a_success()
    {
        $response = new Response('', ['transStatus' => 'Y']);

        $this->assertTrue($response->isSuccess());
    }

    /** @test */
    public function should_not_be_a_success()
    {
        $response = new Response('', ['transStatus' => 'C']);

        $this->assertFalse($response->isSuccess());
    }

    /** @test */
    public function should_be_cancelled()
    {
        $response = new Response('', ['transStatus' => 'C']);

        $this->assertTrue($response->isCancelled());
    }

    /** @test */
    public function should_not_be_cancelled()
    {
        $response = new Response('', ['transStatus' => 'Y']);

        $this->assertFalse($response->isCancelled());
    }

    /** @test */
    public function should_be_in_production()
    {
        $response = new Response('', ['testMode' => '0']);

        $this->assertTrue($response->isProduction());
    }

    /** @test */
    public function should_not_be_in_production()
    {
        $response = new Response('', ['testMode' => '100']);

        $this->assertFalse($response->isProduction());
    }

    /** @test */
    public function should_be_in_development()
    {
        $response = new Response('', ['testMode' => '100']);

        $this->assertTrue($response->isDevelopment());
    }

    /** @test */
    public function should_not_be_in_development()
    {
        $response = new Response('', ['testMode' => '0']);

        $this->assertFalse($response->isDevelopment());
    }

    /** @test */
    public function should_return_null_for_invalid_property()
    {
        $response = new Response('', []);

        $this->assertEquals(null, $response->nope);
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1">
        <link rel="stylesheet" href="../css/examples.css">
        <link rel="stylesheet" href="../../src/themes/default/nexBase.css">
        <link rel="stylesheet" href="../../src/themes/default/form/form.css">

0

        <input type="text" value="12"/>

            <button onClick="getResize();">容器宽度</button>
            <button onClick="changeInfo();">想换就换</button>

        <input type="text" value="3090" disabled="disabled"/>
        adfa
        <select style="width:100px;">
        	<option>1testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>2testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>3testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>4testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>5testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>6testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>7testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
            <option>testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest11</option>
        </select>

        <textarea style="white-space:100px; height:200px;" disabled="disabled">afa</textarea>
		<input type="checkbox" value="1" checked="checked" readonly="true" />

adfa

        <input type="text" value="1" placeholder='我的。。。' style="line-height:18px; padding:2px;">

			选项1

			选项1

			选项1

			选项1

我的加

        ------------------------


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace D3_Bot_Tool
{
    class MyResult
    {
        public MyResult(bool error, String msg)
        {
            this.error = error;
            this.error_msg = msg;
        }

        public bool error;
        public String error_msg;
    }
}


text:
using System;

namespace SocketToMe.Extensions
{
    public static class Int32Extensions
    {
        public static byte[] GetBigEndianBytes(this Int32 value)
        {
            var data = BitConverter.GetBytes(value);
            if (BitConverter.IsLittleEndian) Array.Reverse(data);
            return data;
        }
    }
}


text:
  //  var CollisionTest = require('../Group');

import Group from './utils/Group';
import Body from './Body';

import NarrowPhase from './NarrowPhase';
import Signal from 'mini-signals';

export default class World
{

    constructor()
    {
        // on hit test against.. platforms
        this.onCollideBegin = new Signal();
        this.onCollideEnd = new Signal();

        this.staticBodies = this[Body.STATIC] = new Group();
        this.dynamicBodies = this[Body.DYNAMIC] = new Group();
        this.bodies = new Group();

        this.collisions = [];
        this.narrowPhase = new NarrowPhase(this);

        this.dt = 1;

        this.collisionKeys = {};

        this.DEBUG = false;

        this.registerCollison(0,0);

    }

    add(body)
    {
        this[body.type].add(body);
        this.bodies.add(body);
    }

    remove(body)
    {
        this[body.type].remove(body);
        this.bodies.remove(body);
    }

    update()
    {
        //TODO seperate to a broadphase
       // console.log(this.bodies.children.length)
        for (var i = 0; i < this.dynamicBodies.children.length; i++)
        {
            this.dynamicBodies.children[i].update(this.dt);
        };

        var collisions = this.getCollisions();
        this.narrowPhase.collide(collisions);
    }

    reset()
    {
        this.staticBodies.empty();
        this.dynamicBodies.empty();
        this.bodies.empty();

        this.collisions.length = 0;

        this.narrowPhase.reset();

    }

    getKey(a, b)
    {
        return (a << 12) + b;
    }

    registerCollison(type1, type2)
    {
        this.collisionKeys[this.getKey(type1, type2)] = true;
        this.collisionKeys[this.getKey(type2, type1)] = true;
    }

    updateBounds()
    {
        // TODO no need to update static!
        var list = this.bodies.children;

        for (var i = 0; i < list.length; i++)
        {
            list[i].updateBounds();
        }
    }

    getCollisions()
    {
        this.collisions.length = 0;

        var size = 0;

        this.updateBounds();

        //SAP!
        var list =  this.bodies.children;

        this.sortAxisList( list );

        for (var i = 0; i < list.length; i++)
        {
            var body1 = list[i];
            var newItemLeft = body1.position.x + body1.boundingBox.upper.x;
            for (var j = i+1; j < list.length; j++)
            {
                var body2 = list[j];

                var currentItemRight = body2.position.x + body2.boundingBox.lower.x;// - 5;

                if(newItemLeft <= currentItemRight)
                {
                    break;
                }
                else
                {
                    if(this.canCollide(body1, body2))
                    {
                        // this is important to add as it makes sure bodies are hit test in the correct order
                        // every frame whilst a collision endures
                        if(body1.id > body2.id)
                        {
                           this.collisions.push(body1,
                                                body2);
                        }
                        else
                        {
                            this.collisions.push(body2,
                                                 body1);
                        }
                    }

                }
            }
        };

        // finallly hit tes the bounds..

        return this.collisions;
    }

    canCollide(body1, body2)
    {
        if((body1.type | body2.type) !== (Body.STATIC | Body.STATIC))
        {
            if(body2.canCollide && body1.canCollide)
            {
                var key = this.getKey(body2.collisionMask, body1.collisionMask)

                if(this.collisionKeys[key])
                {
                    return true;
                }
            }
        }

        return false;
    }

    sortAxisList(a)
    {
        for(var i=1,l=a.length; i<l; i++)
        {
            var v = a[i];
            for(var j=i - 1;j>=0;j--)
            {
                var a2 = a[j];

                if(a2.boundingBox.lower.x + a2.position.x  <= v.boundingBox.lower.x + v.position.x )
                {
                    break;
                }

                a[j+1] = a[j];
            }

            a[j+1] = v;
        }

        return a;
    };

}


text:
'use strict';

var Verbose = require('./Verbose');
var Nuclide = require('./entities/Nuclide');
var Color = require('./entities/Color');
var Mixin = require('./entities/Mixin');
var Atom = require('./entities/Atom');
var Icon = require('./entities/Icon');
var Molecule = require('./entities/Molecule');
var Structure = require('./entities/Structure');

var Dot = require('dot-object');

var Transform = {};

/**
 * Calls the transformation for every style and sorts it into
 * groups expected by the view.
 *
 * @param  {object} styles
 *         Raw styles information from the crawler.
 * @return {object}
 *         Transformed view data.
 */
Transform.forView = function(styles) {
  var viewData = {};
  var dot = new Dot(' > ');

  for (var s in styles) {
    Verbose.spin('Analyzing styles');
    var style = styles[s];
    var entity = this.createEntity(style);

    // If entity is empty, we cold not specify a type or
    // validation failed during entity instantiation.
    if (!entity || (Object.keys(entity).length === 0)) {
      continue;
    }

    // Pick the section or create it, if not defined yet.
    // TODO: _e is a bad idea!!
    // TODO: Extract!
    var section = dot.pick(entity.section, viewData) || {
      '_e': []
    };
    section._e.push(entity);
    dot.copy('data', entity.section, {
      data: section
    }, viewData);
  }

  return viewData;
};

/**
 * Returns the type of the style.
 *
 * @param  {object} style
 * @return {string}
 */
Transform.getStyleType = function(style) {
  // Loop through the available type annotations and check if the style
  // has one of these. If there's more than one, show a warning.
  var typeAnnotations = [
    'color', 'mixin', 'nuclide',
    'atom', 'icon', 'molecule', 'structure'
  ];

  var foundType = null;
  for (var t in typeAnnotations) {
    if (this.hasAnnotation(typeAnnotations[t], style)) {

      // Do we have multiple style type annotations?
      if (foundType !== null) {
        Verbose.warn('multiple_types', [style]);
      }

      foundType = typeAnnotations[t];
    }
  }

  // Whow warning, if no type has been found.
  if (foundType === null) {
    Verbose.warn('no_type_annotation', [style]);
  }

  return foundType;
};

/**
 * Returns whether a style has a given annotation.
 *
 * @param  {string}  key
 * @param  {object}  style
 * @return {Boolean}
 *         Returns true if the annotation exists.
 */
Transform.hasAnnotation = function(key, style) {
  return Object.keys(style.annotations).indexOf(key) !== -1;
};

/**
 * Creates an Entity-Object out of raw style data.
 *
 * @param  {[type]} style [description]
 * @return {[type]}       [description]
 */
Transform.createEntity = function(style) {
  switch (this.getStyleType(style)) {
    case 'color':
      return new Color(style);
    case 'mixin':
      return new Mixin(style);
    case 'atom':
      return new Atom(style);
    case 'icon':
      return new Icon(style);
    case 'molecule':
      return new Molecule(style);
    case 'structure':
      return new Structure(style);
    case 'nuclide':
      return new Nuclide(style);
    default:
      // TODO: Is this possible? Maybe resolve the
      // anti-pattern then.
      console.log("Skipping unknown entity type.");
  }
  return false;
};

module.exports = Transform;


text:
/** @author Jia Pan */

#ifndef FCL_BROAD_PHASE_INTERVAL_TREE_INL_H
#define FCL_BROAD_PHASE_INTERVAL_TREE_INL_H

#include "fcl/broadphase/broadphase_interval_tree.h"

namespace fcl
{

//==============================================================================
extern template
class IntervalTreeCollisionManager<double>;

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::unregisterObject(CollisionObject<S>* obj)
{
  // must sorted before
  setup();

  EndPoint p;
  p.value = obj->getAABB().min_[0];
  auto start1 = std::lower_bound(endpoints[0].begin(), endpoints[0].end(), p);
  p.value = obj->getAABB().max_[0];
  auto end1 = std::upper_bound(start1, endpoints[0].end(), p);

  if(start1 < end1)
  {
    unsigned int start_id = start1 - endpoints[0].begin();
    unsigned int end_id = end1 - endpoints[0].begin();
    unsigned int cur_id = start_id;
    for(unsigned int i = start_id; i < end_id; ++i)
    {
      if(endpoints[0][i].obj != obj)
      {
        if(i == cur_id) cur_id++;
        else
        {
          endpoints[0][cur_id] = endpoints[0][i];
          cur_id++;
        }
      }
    }
    if(cur_id < end_id)
      endpoints[0].resize(endpoints[0].size() - 2);
  }

  p.value = obj->getAABB().min_[1];
  auto start2 = std::lower_bound(endpoints[1].begin(), endpoints[1].end(), p);
  p.value = obj->getAABB().max_[1];
  auto end2 = std::upper_bound(start2, endpoints[1].end(), p);

  if(start2 < end2)
  {
    unsigned int start_id = start2 - endpoints[1].begin();
    unsigned int end_id = end2 - endpoints[1].begin();
    unsigned int cur_id = start_id;
    for(unsigned int i = start_id; i < end_id; ++i)
    {
      if(endpoints[1][i].obj != obj)
      {
        if(i == cur_id) cur_id++;
        else
        {
          endpoints[1][cur_id] = endpoints[1][i];
          cur_id++;
        }
      }
    }
    if(cur_id < end_id)
      endpoints[1].resize(endpoints[1].size() - 2);
  }

  p.value = obj->getAABB().min_[2];
  auto start3 = std::lower_bound(endpoints[2].begin(), endpoints[2].end(), p);
  p.value = obj->getAABB().max_[2];
  auto end3 = std::upper_bound(start3, endpoints[2].end(), p);

  if(start3 < end3)
  {
    unsigned int start_id = start3 - endpoints[2].begin();
    unsigned int end_id = end3 - endpoints[2].begin();
    unsigned int cur_id = start_id;
    for(unsigned int i = start_id; i < end_id; ++i)
    {
      if(endpoints[2][i].obj != obj)
      {
        if(i == cur_id) cur_id++;
        else
        {
          endpoints[2][cur_id] = endpoints[2][i];
          cur_id++;
        }
      }
    }
    if(cur_id < end_id)
      endpoints[2].resize(endpoints[2].size() - 2);
  }

  // update the interval tree
  if(obj_interval_maps[0].find(obj) != obj_interval_maps[0].end())
  {
    SAPInterval* ivl1 = obj_interval_maps[0][obj];
    SAPInterval* ivl2 = obj_interval_maps[1][obj];
    SAPInterval* ivl3 = obj_interval_maps[2][obj];

    interval_trees[0]->deleteNode(ivl1);
    interval_trees[1]->deleteNode(ivl2);
    interval_trees[2]->deleteNode(ivl3);

    delete ivl1;
    delete ivl2;
    delete ivl3;

    obj_interval_maps[0].erase(obj);
    obj_interval_maps[1].erase(obj);
    obj_interval_maps[2].erase(obj);
  }
}

//==============================================================================
template <typename S>
IntervalTreeCollisionManager<S>::IntervalTreeCollisionManager() : setup_(false)
{
  for(int i = 0; i < 3; ++i)
    interval_trees[i] = nullptr;
}

//==============================================================================
template <typename S>
IntervalTreeCollisionManager<S>::~IntervalTreeCollisionManager()
{
  clear();
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::registerObject(CollisionObject<S>* obj)
{
  EndPoint p, q;

  p.obj = obj;
  q.obj = obj;
  p.minmax = 0;
  q.minmax = 1;
  p.value = obj->getAABB().min_[0];
  q.value = obj->getAABB().max_[0];
  endpoints[0].push_back(p);
  endpoints[0].push_back(q);

  p.value = obj->getAABB().min_[1];
  q.value = obj->getAABB().max_[1];
  endpoints[1].push_back(p);
  endpoints[1].push_back(q);

  p.value = obj->getAABB().min_[2];
  q.value = obj->getAABB().max_[2];
  endpoints[2].push_back(p);
  endpoints[2].push_back(q);
  setup_ = false;
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::setup()
{
  if(!setup_)
  {
    std::sort(endpoints[0].begin(), endpoints[0].end());
    std::sort(endpoints[1].begin(), endpoints[1].end());
    std::sort(endpoints[2].begin(), endpoints[2].end());

    for(int i = 0; i < 3; ++i)
      delete interval_trees[i];

    for(int i = 0; i < 3; ++i)
      interval_trees[i] = new detail::IntervalTree<S>;

    for(unsigned int i = 0, size = endpoints[0].size(); i < size; ++i)
    {
      EndPoint p = endpoints[0][i];
      CollisionObject<S>* obj = p.obj;
      if(p.minmax == 0)
      {
        SAPInterval* ivl1 = new SAPInterval(obj->getAABB().min_[0], obj->getAABB().max_[0], obj);
        SAPInterval* ivl2 = new SAPInterval(obj->getAABB().min_[1], obj->getAABB().max_[1], obj);
        SAPInterval* ivl3 = new SAPInterval(obj->getAABB().min_[2], obj->getAABB().max_[2], obj);

        interval_trees[0]->insert(ivl1);
        interval_trees[1]->insert(ivl2);
        interval_trees[2]->insert(ivl3);

        obj_interval_maps[0][obj] = ivl1;
        obj_interval_maps[1][obj] = ivl2;
        obj_interval_maps[2][obj] = ivl3;
      }
    }

    setup_ = true;
  }
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::update()
{
  setup_ = false;

  for(unsigned int i = 0, size = endpoints[0].size(); i < size; ++i)
  {
    if(endpoints[0][i].minmax == 0)
      endpoints[0][i].value = endpoints[0][i].obj->getAABB().min_[0];
    else
      endpoints[0][i].value = endpoints[0][i].obj->getAABB().max_[0];
  }

  for(unsigned int i = 0, size = endpoints[1].size(); i < size; ++i)
  {
    if(endpoints[1][i].minmax == 0)
      endpoints[1][i].value = endpoints[1][i].obj->getAABB().min_[1];
    else
      endpoints[1][i].value = endpoints[1][i].obj->getAABB().max_[1];
  }

  for(unsigned int i = 0, size = endpoints[2].size(); i < size; ++i)
  {
    if(endpoints[2][i].minmax == 0)
      endpoints[2][i].value = endpoints[2][i].obj->getAABB().min_[2];
    else
      endpoints[2][i].value = endpoints[2][i].obj->getAABB().max_[2];
  }

  setup();

}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::update(CollisionObject<S>* updated_obj)
{
  AABB<S> old_aabb;
  const AABB<S>& new_aabb = updated_obj->getAABB();
  for(int i = 0; i < 3; ++i)
  {
    const auto it = obj_interval_maps[i].find(updated_obj);
    interval_trees[i]->deleteNode(it->second);
    old_aabb.min_[i] = it->second->low;
    old_aabb.max_[i] = it->second->high;
    it->second->low = new_aabb.min_[i];
    it->second->high = new_aabb.max_[i];
    interval_trees[i]->insert(it->second);
  }

  EndPoint dummy;
  typename std::vector<EndPoint>::iterator it;
  for(int i = 0; i < 3; ++i)
  {
    dummy.value = old_aabb.min_[i];
    it = std::lower_bound(endpoints[i].begin(), endpoints[i].end(), dummy);
    for(; it != endpoints[i].end(); ++it)
    {
      if(it->obj == updated_obj && it->minmax == 0)
      {
        it->value = new_aabb.min_[i];
        break;
      }
    }

    dummy.value = old_aabb.max_[i];
    it = std::lower_bound(endpoints[i].begin(), endpoints[i].end(), dummy);
    for(; it != endpoints[i].end(); ++it)
    {
      if(it->obj == updated_obj && it->minmax == 0)
      {
        it->value = new_aabb.max_[i];
        break;
      }
    }

    std::sort(endpoints[i].begin(), endpoints[i].end());
  }
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::update(const std::vector<CollisionObject<S>*>& updated_objs)
{
  for(size_t i = 0; i < updated_objs.size(); ++i)
    update(updated_objs[i]);
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::clear()
{
  endpoints[0].clear();
  endpoints[1].clear();
  endpoints[2].clear();

  delete interval_trees[0]; interval_trees[0] = nullptr;
  delete interval_trees[1]; interval_trees[1] = nullptr;
  delete interval_trees[2]; interval_trees[2] = nullptr;

  for(int i = 0; i < 3; ++i)
  {
    for(auto it = obj_interval_maps[i].cbegin(), end = obj_interval_maps[i].cend();
        it != end; ++it)
    {
      delete it->second;
    }
  }

  for(int i = 0; i < 3; ++i)
    obj_interval_maps[i].clear();

  setup_ = false;
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::getObjects(std::vector<CollisionObject<S>*>& objs) const
{
  objs.resize(endpoints[0].size() / 2);
  unsigned int j = 0;
  for(unsigned int i = 0, size = endpoints[0].size(); i < size; ++i)
  {
    if(endpoints[0][i].minmax == 0)
    {
      objs[j] = endpoints[0][i].obj; j++;
    }
  }
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::collide(CollisionObject<S>* obj, void* cdata, CollisionCallBack<S> callback) const
{
  if(size() == 0) return;
  collide_(obj, cdata, callback);
}

//==============================================================================
template <typename S>
bool IntervalTreeCollisionManager<S>::collide_(CollisionObject<S>* obj, void* cdata, CollisionCallBack<S> callback) const
{
  static const unsigned int CUTOFF = 100;

  std::deque<detail::SimpleInterval<S>*> results0, results1, results2;

  results0 = interval_trees[0]->query(obj->getAABB().min_[0], obj->getAABB().max_[0]);
  if(results0.size() > CUTOFF)
  {
    results1 = interval_trees[1]->query(obj->getAABB().min_[1], obj->getAABB().max_[1]);
    if(results1.size() > CUTOFF)
    {
      results2 = interval_trees[2]->query(obj->getAABB().min_[2], obj->getAABB().max_[2]);
      if(results2.size() > CUTOFF)
      {
        int d1 = results0.size();
        int d2 = results1.size();
        int d3 = results2.size();

        if(d1 >= d2 && d1 >= d3)
          return checkColl(results0.begin(), results0.end(), obj, cdata, callback);
        else if(d2 >= d1 && d2 >= d3)
          return checkColl(results1.begin(), results1.end(), obj, cdata, callback);
        else
          return checkColl(results2.begin(), results2.end(), obj, cdata, callback);
      }
      else
        return checkColl(results2.begin(), results2.end(), obj, cdata, callback);
    }
    else
      return checkColl(results1.begin(), results1.end(), obj, cdata, callback);
  }
  else
    return checkColl(results0.begin(), results0.end(), obj, cdata, callback);
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::distance(CollisionObject<S>* obj, void* cdata, DistanceCallBack<S> callback) const
{
  if(size() == 0) return;
  S min_dist = std::numeric_limits<S>::max();
  distance_(obj, cdata, callback, min_dist);
}

//==============================================================================
template <typename S>
bool IntervalTreeCollisionManager<S>::distance_(CollisionObject<S>* obj, void* cdata, DistanceCallBack<S> callback, S& min_dist) const
{
  static const unsigned int CUTOFF = 100;

  Vector3<S> delta = (obj->getAABB().max_ - obj->getAABB().min_) * 0.5;
  AABB<S> aabb = obj->getAABB();
  if(min_dist < std::numeric_limits<S>::max())
  {
    Vector3<S> min_dist_delta(min_dist, min_dist, min_dist);
    aabb.expand(min_dist_delta);
  }

  int status = 1;
  S old_min_distance;

  while(1)
  {
    bool dist_res = false;

    old_min_distance = min_dist;

    std::deque<detail::SimpleInterval<S>*> results0, results1, results2;

    results0 = interval_trees[0]->query(aabb.min_[0], aabb.max_[0]);
    if(results0.size() > CUTOFF)
    {
      results1 = interval_trees[1]->query(aabb.min_[1], aabb.max_[1]);
      if(results1.size() > CUTOFF)
      {
        results2 = interval_trees[2]->query(aabb.min_[2], aabb.max_[2]);
        if(results2.size() > CUTOFF)
        {
          int d1 = results0.size();
          int d2 = results1.size();
          int d3 = results2.size();

          if(d1 >= d2 && d1 >= d3)
            dist_res = checkDist(results0.begin(), results0.end(), obj, cdata, callback, min_dist);
          else if(d2 >= d1 && d2 >= d3)
            dist_res = checkDist(results1.begin(), results1.end(), obj, cdata, callback, min_dist);
          else
            dist_res = checkDist(results2.begin(), results2.end(), obj, cdata, callback, min_dist);
        }
        else
          dist_res = checkDist(results2.begin(), results2.end(), obj, cdata, callback, min_dist);
      }
      else
        dist_res = checkDist(results1.begin(), results1.end(), obj, cdata, callback, min_dist);
    }
    else
      dist_res = checkDist(results0.begin(), results0.end(), obj, cdata, callback, min_dist);

    if(dist_res) return true;

    results0.clear();
    results1.clear();
    results2.clear();

    if(status == 1)
    {
      if(old_min_distance < std::numeric_limits<S>::max())
        break;
      else
      {
        if(min_dist < old_min_distance)
        {
          Vector3<S> min_dist_delta(min_dist, min_dist, min_dist);
          aabb = AABB<S>(obj->getAABB(), min_dist_delta);
          status = 0;
        }
        else
        {
          if(aabb.equal(obj->getAABB()))
            aabb.expand(delta);
          else
            aabb.expand(obj->getAABB(), 2.0);
        }
      }
    }
    else if(status == 0)
      break;
  }

  return false;
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::collide(void* cdata, CollisionCallBack<S> callback) const
{
  if(size() == 0) return;

  std::set<CollisionObject<S>*> active;
  std::set<std::pair<CollisionObject<S>*, CollisionObject<S>*> > overlap;
  unsigned int n = endpoints[0].size();
  S diff_x = endpoints[0][0].value - endpoints[0][n-1].value;
  S diff_y = endpoints[1][0].value - endpoints[1][n-1].value;
  S diff_z = endpoints[2][0].value - endpoints[2][n-1].value;

  int axis = 0;
  if(diff_y > diff_x && diff_y > diff_z)
    axis = 1;
  else if(diff_z > diff_y && diff_z > diff_x)
    axis = 2;

  for(unsigned int i = 0; i < n; ++i)
  {
    const EndPoint& endpoint = endpoints[axis][i];
    CollisionObject<S>* index = endpoint.obj;
    if(endpoint.minmax == 0)
    {
      auto iter = active.begin();
      auto end = active.end();
      for(; iter != end; ++iter)
      {
        CollisionObject<S>* active_index = *iter;
        const AABB<S>& b0 = active_index->getAABB();
        const AABB<S>& b1 = index->getAABB();

        int axis2 = (axis + 1) % 3;
        int axis3 = (axis + 2) % 3;

        if(b0.axisOverlap(b1, axis2) && b0.axisOverlap(b1, axis3))
        {
          std::pair<typename std::set<std::pair<CollisionObject<S>*, CollisionObject<S>*> >::iterator, bool> insert_res;
          if(active_index < index)
            insert_res = overlap.insert(std::make_pair(active_index, index));
          else
            insert_res = overlap.insert(std::make_pair(index, active_index));

          if(insert_res.second)
          {
            if(callback(active_index, index, cdata))
              return;
          }
        }
      }
      active.insert(index);
    }
    else
      active.erase(index);
  }

}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::distance(void* cdata, DistanceCallBack<S> callback) const
{
  if(size() == 0) return;

  this->enable_tested_set_ = true;
  this->tested_set.clear();
  S min_dist = std::numeric_limits<S>::max();

  for(size_t i = 0; i < endpoints[0].size(); ++i)
    if(distance_(endpoints[0][i].obj, cdata, callback, min_dist)) break;

  this->enable_tested_set_ = false;
  this->tested_set.clear();
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::collide(BroadPhaseCollisionManager<S>* other_manager_, void* cdata, CollisionCallBack<S> callback) const
{
  IntervalTreeCollisionManager* other_manager = static_cast<IntervalTreeCollisionManager*>(other_manager_);

  if((size() == 0) || (other_manager->size() == 0)) return;

  if(this == other_manager)
  {
    collide(cdata, callback);
    return;
  }

  if(this->size() < other_manager->size())
  {
    for(size_t i = 0, size = endpoints[0].size(); i < size; ++i)
      if(other_manager->collide_(endpoints[0][i].obj, cdata, callback)) return;
  }
  else
  {
    for(size_t i = 0, size = other_manager->endpoints[0].size(); i < size; ++i)
      if(collide_(other_manager->endpoints[0][i].obj, cdata, callback)) return;
  }
}

//==============================================================================
template <typename S>
void IntervalTreeCollisionManager<S>::distance(BroadPhaseCollisionManager<S>* other_manager_, void* cdata, DistanceCallBack<S> callback) const
{
  IntervalTreeCollisionManager* other_manager = static_cast<IntervalTreeCollisionManager*>(other_manager_);

  if((size() == 0) || (other_manager->size() == 0)) return;

  if(this == other_manager)
  {
    distance(cdata, callback);
    return;
  }

  S min_dist = std::numeric_limits<S>::max();

  if(this->size() < other_manager->size())
  {
    for(size_t i = 0, size = endpoints[0].size(); i < size; ++i)
      if(other_manager->distance_(endpoints[0][i].obj, cdata, callback, min_dist)) return;
  }
  else
  {
    for(size_t i = 0, size = other_manager->endpoints[0].size(); i < size; ++i)
      if(distance_(other_manager->endpoints[0][i].obj, cdata, callback, min_dist)) return;
  }
}

//==============================================================================
template <typename S>
bool IntervalTreeCollisionManager<S>::empty() const
{
  return endpoints[0].empty();
}

//==============================================================================
template <typename S>
size_t IntervalTreeCollisionManager<S>::size() const
{
  return endpoints[0].size() / 2;
}

//==============================================================================
template <typename S>
bool IntervalTreeCollisionManager<S>::checkColl(
    typename std::deque<detail::SimpleInterval<S>*>::const_iterator pos_start,
    typename std::deque<detail::SimpleInterval<S>*>::const_iterator pos_end,
    CollisionObject<S>* obj,
    void* cdata,
    CollisionCallBack<S> callback) const
{
  while(pos_start < pos_end)
  {
    SAPInterval* ivl = static_cast<SAPInterval*>(*pos_start);
    if(ivl->obj != obj)
    {
      if(ivl->obj->getAABB().overlap(obj->getAABB()))
      {
        if(callback(ivl->obj, obj, cdata))
          return true;
      }
    }

    pos_start++;
  }

  return false;
}

//==============================================================================
template <typename S>
bool IntervalTreeCollisionManager<S>::checkDist(
    typename std::deque<detail::SimpleInterval<S>*>::const_iterator pos_start,
    typename std::deque<detail::SimpleInterval<S>*>::const_iterator pos_end,
    CollisionObject<S>* obj,
    void* cdata,
    DistanceCallBack<S> callback,
    S& min_dist) const
{
  while(pos_start < pos_end)
  {
    SAPInterval* ivl = static_cast<SAPInterval*>(*pos_start);
    if(ivl->obj != obj)
    {
      if(!this->enable_tested_set_)
      {
        if(ivl->obj->getAABB().distance(obj->getAABB()) < min_dist)
        {
          if(callback(ivl->obj, obj, cdata, min_dist))
            return true;
        }
      }
      else
      {
        if(!this->inTestedSet(ivl->obj, obj))
        {
          if(ivl->obj->getAABB().distance(obj->getAABB()) < min_dist)
          {
            if(callback(ivl->obj, obj, cdata, min_dist))
              return true;
          }

          this->insertTestedSet(ivl->obj, obj);
        }
      }
    }

    pos_start++;
  }

  return false;
}

//==============================================================================
template <typename S>
bool IntervalTreeCollisionManager<S>::EndPoint::operator<(
    const typename IntervalTreeCollisionManager<S>::EndPoint& p) const
{
  return value < p.value;
}

//==============================================================================
template <typename S>
IntervalTreeCollisionManager<S>::SAPInterval::SAPInterval(
    S low_, S high_, CollisionObject<S>* obj_)
  : detail::SimpleInterval<S>()
{
  this->low = low_;
  this->high = high_;
  obj = obj_;
}

} // namespace fcl

#endif


text:
// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.mediapipe.framework;

/**
 * A {@link TextureFrame} that represents a texture produced by MediaPipe.
 *
 *
The consumer is typically your application, which should therefore call the {@link #release()}
 * method.
 */
public class GraphTextureFrame implements TextureFrame {
  private long nativeBufferHandle;
  // We cache these to be able to get them without a JNI call.
  private int textureName;
  private int width;
  private int height;
  private long timestamp = Long.MIN_VALUE;
  // True when created with PacketGetter.getTextureFrameDeferredSync(). This will result in gpuWait
  // when calling getTextureName().
  private final boolean deferredSync;

  GraphTextureFrame(long nativeHandle, long timestamp) {
    this(nativeHandle, timestamp, false);
  }

  GraphTextureFrame(long nativeHandle, long timestamp, boolean deferredSync) {
    nativeBufferHandle = nativeHandle;
    // TODO: use a single JNI call to fill in all info
    textureName = nativeGetTextureName(nativeBufferHandle);
    width = nativeGetWidth(nativeBufferHandle);
    height = nativeGetHeight(nativeBufferHandle);
    this.timestamp = timestamp;
    this.deferredSync = deferredSync;
  }

  /**
   * Returns the name of the underlying OpenGL texture.
   *
   *
Note: if this texture has been obtained using getTextureFrameDeferredWait, a GPU wait on the
   * producer sync will be done here. That means this method should be called on the GL context that
   * will actually use the texture. Note that in this case, it is also susceptible to a race
   * condition if release() is called after the if-check for nativeBufferHandle is already passed.
   */
  @Override
  public int getTextureName() {
    // Return special texture id 0 if handle is 0 i.e. frame is already released.
    if (nativeBufferHandle == 0) {
      return 0;
    }
    // Gpu wait only if deferredSync is true, such as when this GraphTextureFrame is created using
    // PacketGetter.getTextureFrameDeferredSync().
    if (deferredSync) {
      // Note that, if a CPU wait has already been done, the sync point will have been
      // cleared and this will turn into a no-op. See GlFenceSyncPoint::Wait.
      nativeGpuWait(nativeBufferHandle);
    }
    return textureName;
  }

  /** Returns the width of the underlying OpenGL texture. */
  @Override
  public int getWidth() {
    return width;
  }

  /** Returns the height of the underlying OpenGL texture. */
  @Override
  public int getHeight() {
    return height;
  }

  @Override
  public long getTimestamp() {
    return timestamp;
  }

  /**
   * Releases a reference to the underlying buffer.
   *
   *
The consumer calls this when it is done using the texture.
   */
  @Override
  public void release() {
    GlSyncToken consumerToken =
        new GraphGlSyncToken(nativeCreateSyncTokenForCurrentExternalContext(nativeBufferHandle));
    release(consumerToken);
  }

  /**
   * Releases a reference to the underlying buffer.
   *
   *
This form of the method is called when the consumer is MediaPipe itself. This can occur if a
   * packet coming out of the graph is sent back into an input stream. Since both the producer and
   * the consumer use the same context, we do not need to do further synchronization. Note: we do
   * not currently support GPU sync across multiple graphs. TODO: Application consumers
   * currently cannot create a GlSyncToken, so they cannot call this method.
   */
  @Override
  public void release(GlSyncToken consumerSyncToken) {
    if (nativeBufferHandle != 0) {
      long token = consumerSyncToken == null ? 0 : consumerSyncToken.nativeToken();
      nativeReleaseBuffer(nativeBufferHandle, token);
      nativeBufferHandle = 0;
    }
    if (consumerSyncToken != null) {
      consumerSyncToken.release();
    }
  }

  private native void nativeReleaseBuffer(long nativeHandle, long consumerSyncToken);

  private native int nativeGetTextureName(long nativeHandle);
  private native int nativeGetWidth(long nativeHandle);
  private native int nativeGetHeight(long nativeHandle);

  private native void nativeGpuWait(long nativeHandle);

  private native long nativeCreateSyncTokenForCurrentExternalContext(long nativeHandle);
}


text:
layout: organization
category: national

title: The Gorilla Foundation
impact_area: Environment
keywords:
location_services:
location_offices:
website: koko.org

description:
mission: |
  To bring interspecies communication to the public, in order to save gorillas from extinction,

  and inspire our children to create a sustainable future for all great apes.

cash_grants:
grants:
service_opp:
services:

learn:
cont_relationship:

salutation:
first_name:
last_name:
title_contact_person:

city: Woodside
state: CA
address: |
  PO Box 620530
  Woodside CA 94062
lat: 37.428476
lng: -122.276859
phone: 800-634-6273
ext:
fax: 650-365-7906
email:
preferred_contact:
contact_person_intro:
---


text:
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.util.concurrent.ConcurrentLinkedQueue;

public class Worker implements Runnable {

	private volatile ConcurrentLinkedQueue<Task> taskList;
	private Socket socket;
	private volatile mandelbrotMatrix matrix;

	public Worker(Socket s, ConcurrentLinkedQueue<Task> t, mandelbrotMatrix m){
		this.taskList = t;
		this.socket = s;
		this.matrix = m;
	};

	public void run() {
		OutputStream out;
		ObjectOutputStream outObject;
		ObjectInputStream inObject;
		InputStream in;
		try {
			out = this.socket.getOutputStream();
			outObject = new ObjectOutputStream(out);
			in = this.socket.getInputStream();
			inObject= new ObjectInputStream(in);

			while(!taskList.isEmpty()){
					Task task = this.taskList.poll();
					outObject.writeObject(task);
					task = (Task) inObject.readObject(); //blocking

					//System.out.println("Coping chunk to main output");
					this.copyOnBig(task);
			}
			//close things
					outObject.close();
					out.close();
					inObject.close();
					in.close();
					this.socket.close();
		} catch(Exception e) {
			return;
		}
	}

	private void copyOnBig(Task task){
		matrix.setMatrix(task);
	}

}


text:
#ifndef __vtk_libproj4_h
#define __vtk_libproj4_h

/* Use the libproj4 library configured for VTK.  */
#include "vtkToolkits.h"
#ifdef VTK_USE_SYSTEM_LIBPROJ4
# include <lib_proj.h>
#else
# include <vtklibproj4/lib_proj.h>
#endif

#endif


text:
using ClosedXML.Excel;
using NUnit.Framework;

namespace ClosedXML_Tests
{
    [TestFixture]
    public class XLRangeAddressTests
    {
        [Test]
        public void ToStringTest()
        {
            IXLWorksheet ws = new XLWorkbook().Worksheets.Add("Sheet1");
            IXLRangeAddress address = ws.Cell(1, 1).AsRange().RangeAddress;

            Assert.AreEqual("A1:A1", address.ToString());

            Assert.AreEqual("A1:A1", address.ToStringRelative());
            Assert.AreEqual("'Sheet1'!A1:A1", address.ToStringRelative(true));

            Assert.AreEqual("$A$1:$A$1", address.ToStringFixed());
            Assert.AreEqual("$A$1:$A$1", address.ToStringFixed(XLReferenceStyle.A1));
            Assert.AreEqual("R1C1:R1C1", address.ToStringFixed(XLReferenceStyle.R1C1));
            Assert.AreEqual("$A$1:$A$1", address.ToStringFixed(XLReferenceStyle.Default));
            Assert.AreEqual("'Sheet1'!$A$1:$A$1", address.ToStringFixed(XLReferenceStyle.A1, true));
            Assert.AreEqual("'Sheet1'!R1C1:R1C1", address.ToStringFixed(XLReferenceStyle.R1C1, true));
            Assert.AreEqual("'Sheet1'!$A$1:$A$1", address.ToStringFixed(XLReferenceStyle.Default, true));
        }
    }
}


text:
namespace ang
{
	namespace collections
	{
		template<class T> class base_iterator
		{
		protected:
			ienum<T>* _parent;
			position_t _current;
			wsize _offset;
			wsize _unused;

		public:
			base_iterator(base_iterator const&);
			base_iterator(ienum<T>* p = null, position_t cur = null, wsize offset = 0U);
			~base_iterator();

		public: //Overrides
			void clean();

		public: //Methods
			ienum<T>* parent()const;
			void parent(ienum<T>*);
			position_t current()const;
			void current(position_t);
			wsize offset()const;
			void offset(wsize);
			bool is_valid()const;

			base_iterator& operator = (const base_iterator&);

			bool operator ==  (const base_iterator& it)const {
				return it._current == _current && it._offset == _offset;
			}
			bool operator !=  (const base_iterator& it)const {
				return it._current != _current || it._offset != _offset;
			}
			bool operator >=  (const base_iterator& it)const {
				if (_current == it._current)
					return _offset >= it._offset;
				else
					return _current > _current;
			}
			bool operator <=  (const base_iterator& it)const {
				if (_current == it._current)
					return _offset <= it._offset;
				else
					return _current < _current;
			}
			bool operator >  (const base_iterator& it)const {
				if (_current == it._current)
					return _offset > it._offset;
				else
					return _current > _current;
			}
			bool operator <  (const base_iterator& it)const {
				if (_current == it._current)
					return _offset < it._offset;
				else
					return _current < _current;
			}
		};

		template<class T> class iterator : public base_iterator<T>
		{
		public:
			iterator(base_iterator<T> const& it) : base_iterator<T>(it) {}
			iterator(ienum<T>* p = null, position_t cur = null, wsize offset = 0U)
				: base_iterator<T>(p, cur, offset) {
			}

			iterator& operator = (const base_iterator<T>& it) {
				base_iterator<T>::operator = (it);
				return*this;
			}

			operator T*()const;
			T* operator -> ()const;
			T& operator * ()const;
		};

		template<class T> class iterator<const T> : public base_iterator<T>
		{
		public:
			iterator(base_iterator<T> const& it) : base_iterator<T>(it) {}
			iterator(ienum<T>* p = null, position_t cur = null, wsize offset = 0U)
				: base_iterator<T>(p, cur, offset) {
			}

			iterator& operator = (const base_iterator<T>& it) {
				base_iterator<T>::operator = (it);
				return*this;
			}

			operator T const*()const;
			T const* operator -> ()const;
			T const& operator * ()const;
		};

		template<class T>
		class forward_iterator : public iterator<T>
		{
		public:
			forward_iterator(base_iterator<T> const& it) : iterator<T>(it) {}
			forward_iterator(ienum<T>* p = null, position_t cur = null, wsize offset = 0U)
				: iterator<T>(p,cur,offset) {
			}

			forward_iterator& operator +=(int);
			forward_iterator& operator -=(int);
			forward_iterator& operator ++();//Prefix
			forward_iterator& operator --();//Prefix
			forward_iterator operator ++(int);//Postfix
			forward_iterator operator --(int);//Postfix
			forward_iterator operator + (int)const;
			forward_iterator operator - (int)const;
		};

		template<class T>
		class forward_iterator<const T> : public iterator<const T>
		{
		public:
			forward_iterator(base_iterator<T> const& it) : iterator<const T>(it) {}
			forward_iterator(ienum<T>* p = null, position_t cur = null, wsize offset = 0U)
				: iterator<const T>(p, cur, offset) {
			}

			forward_iterator& operator +=(int);
			forward_iterator& operator -=(int);
			forward_iterator& operator ++();//Prefix
			forward_iterator& operator --();//Prefix
			forward_iterator operator ++(int);//Postfix
			forward_iterator operator --(int);//Postfix
			forward_iterator operator + (int)const;
			forward_iterator operator - (int)const;
		};

		template<class T>
		class backward_iterator : public iterator<T>
		{
		public:
			backward_iterator(base_iterator<T> const& it) : iterator<T>(it) {}
			backward_iterator(ienum<T>* p = null, position_t cur = null, wsize offset = 0U)
				: iterator<T>(p, cur, offset) {
			}

			backward_iterator& operator +=(int);
			backward_iterator& operator -=(int);
			backward_iterator& operator ++();//Prefix
			backward_iterator& operator --();//Prefix
			backward_iterator operator ++(int);//Postfix
			backward_iterator operator --(int);//Postfix
			backward_iterator operator + (int)const;
			backward_iterator operator - (int)const;
		};

		template<class T>
		class backward_iterator<const T> : public iterator<const T>
		{
		public:
			backward_iterator(base_iterator<T> const& it) : iterator<const T>(it) {}
			backward_iterator(ienum<T>* p = null, position_t cur = null, wsize offset = 0U)
				: iterator<const T>(p, cur, offset) {
			}

			backward_iterator& operator +=(int);
			backward_iterator& operator -=(int);
			backward_iterator& operator ++();//Prefix
			backward_iterator& operator --();//Prefix
			backward_iterator operator ++(int);//Postfix
			backward_iterator operator --(int);//Postfix
			backward_iterator operator + (int)const;
			backward_iterator operator - (int)const;
		};

	}//collections
}//ang

#endif //__ANG_COLLECTIONS_ITERATORS_HPP__


text:
package org.jasig.portal.groups;

import org.jasig.portal.concurrency.IEntityLock;

 /**
 * Defines an IEntityGroup that can be locked for update.
 *

 * @author Dan Ellentuck
 * @version $Revision$
 */

public interface ILockableEntityGroup extends IEntityGroup {
/**
 * @return org.jasig.portal.concurrency.IEntityLock
 */
public IEntityLock getLock();
/**
 * @param lock org.jasig.portal.concurrency.IEntityLock
 */
public void setLock(IEntityLock lock);

/**
 * Updates the group and its members and renews the lock.
 */
public void updateAndRenewLock() throws GroupsException;

/**
 * Updates the members and renews the lock.
 */
public void updateMembersAndRenewLock() throws GroupsException;
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Lobivia aurea var. albiflora Rausch

### Remarks
null


text:
@implementation NSDateFormatter (APUtils)

+ (NSDateFormatter *)threadSafeInstanceWithFormat:(NSString *)inDateFormat {
    NSParameterAssert(inDateFormat);

    NSString *key = [@"NSDateFormatter." stringByAppendingString:inDateFormat];

    NSMutableDictionary *threadDictionary = [[NSThread currentThread] threadDictionary];
    NSDateFormatter *dateFormatter = threadDictionary[key];

    if (dateFormatter == nil
        || ![inDateFormat isEqualToString:dateFormatter.dateFormat]) { // if the format of the cached date formatter has changed (maybe due to a call to setFormat)
        dateFormatter = [[NSDateFormatter alloc] init];

        // See https://developer.apple.com/library/ios/qa/qa1480/_index.html. Also flagged by FauxPasApp.
        NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
        [dateFormatter setLocale:enUSPOSIXLocale];

        [dateFormatter setDateFormat:inDateFormat];

        threadDictionary[key] = dateFormatter;
    }

    return dateFormatter;
}

@end