text:
package org.apache.calcite.adapter.druid;

import org.apache.calcite.config.CalciteConnectionConfig;
import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeSystem;
import org.apache.calcite.rex.RexBuilder;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.calcite.sql.type.SqlTypeName;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import java.io.IOException;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.util.List;

import static org.hamcrest.core.Is.is;

/**
 * Tests generating Druid filters.
 */
public class DruidQueryFilterTest {

  private DruidQuery druidQuery;
  @Before
  public void testSetup() {
    druidQuery = Mockito.mock(DruidQuery.class);
    final CalciteConnectionConfig connectionConfigMock = Mockito
        .mock(CalciteConnectionConfig.class);
    Mockito.when(connectionConfigMock.timeZone()).thenReturn("UTC");
    Mockito.when(druidQuery.getConnectionConfig()).thenReturn(connectionConfigMock);
    Mockito.when(druidQuery.getDruidTable())
        .thenReturn(
            new DruidTable(Mockito.mock(DruidSchema.class), "dataSource", null,
                ImmutableSet.<String>of(), "timestamp", null, null,
                null
            ));
  }
  @Test public void testInFilter() throws IOException {
    final Fixture f = new Fixture();
    final List<? extends RexNode> listRexNodes =
        ImmutableList.of(f.rexBuilder.makeInputRef(f.varcharRowType, 0),
            f.rexBuilder.makeExactLiteral(BigDecimal.valueOf(1)),
            f.rexBuilder.makeExactLiteral(BigDecimal.valueOf(5)),
            f.rexBuilder.makeLiteral("value1"));

    RexNode inRexNode =
        f.rexBuilder.makeCall(SqlStdOperatorTable.IN, listRexNodes);
    DruidJsonFilter returnValue = DruidJsonFilter
        .toDruidFilters(inRexNode, f.varcharRowType, druidQuery);
    Assert.assertNotNull("Filter is null", returnValue);
    JsonFactory jsonFactory = new JsonFactory();
    final StringWriter sw = new StringWriter();
    JsonGenerator jsonGenerator = jsonFactory.createGenerator(sw);
    returnValue.write(jsonGenerator);
    jsonGenerator.close();

    Assert.assertThat(sw.toString(),
        is("{\"type\":\"in\",\"dimension\":\"dimensionName\","
            + "\"values\":[\"1\",\"5\",\"value1\"]}"));
  }

  @Test public void testBetweenFilterStringCase() throws IOException {
    final Fixture f = new Fixture();
    final List<RexNode> listRexNodes =
        ImmutableList.of(f.rexBuilder.makeLiteral(false),
            f.rexBuilder.makeInputRef(f.varcharRowType, 0),
            f.rexBuilder.makeLiteral("lower-bound"),
            f.rexBuilder.makeLiteral("upper-bound"));
    RelDataType relDataType = f.typeFactory.createSqlType(SqlTypeName.BOOLEAN);
    RexNode betweenRexNode = f.rexBuilder.makeCall(relDataType,
        SqlStdOperatorTable.BETWEEN, listRexNodes);

    DruidJsonFilter returnValue = DruidJsonFilter
        .toDruidFilters(betweenRexNode, f.varcharRowType, druidQuery);
    Assert.assertNotNull("Filter is null", returnValue);
    JsonFactory jsonFactory = new JsonFactory();
    final StringWriter sw = new StringWriter();
    JsonGenerator jsonGenerator = jsonFactory.createGenerator(sw);
    returnValue.write(jsonGenerator);
    jsonGenerator.close();
    Assert.assertThat(sw.toString(),
        is("{\"type\":\"bound\",\"dimension\":\"dimensionName\",\"lower\":\"lower-bound\","
            + "\"lowerStrict\":false,\"upper\":\"upper-bound\",\"upperStrict\":false,"
            + "\"ordering\":\"lexicographic\"}"));
  }

  /** Everything a test needs for a healthy, active life. */
  static class Fixture {
    final JavaTypeFactoryImpl typeFactory =
        new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
    final RexBuilder rexBuilder = new RexBuilder(typeFactory);
    final DruidTable druidTable =
        new DruidTable(Mockito.mock(DruidSchema.class), "dataSource", null,
            ImmutableSet.<String>of(), "timestamp", null, null,
                null);
    final RelDataType varcharType =
        typeFactory.createSqlType(SqlTypeName.VARCHAR);
    final RelDataType varcharRowType = typeFactory.builder()
        .add("dimensionName", varcharType)
        .build();
  }
}

// End DruidQueryFilterTest.java


text:
#define BIT_DEPTH 10
#define dctint int64_t
#include "vp9dsp_template.c"

redpajama_set_name: RedPajamaGithub


text:
TCDB - minuature golang clone of tinycdb library

* Has the basics I needed in my projects, see godoc: http://godoc.org/github.com/asergeyev/tcdb
* Needs support for replace/append operations
* Needs some flexibility added to currently rigid reading interface (that should come from actual need, I'll not change it before there is realistic demand)

Credits:
* Michael Tokarev's tinycdb [http://www.corpit.ru/mjt/tinycdb.html]


text:
#include "stdafx.h"
#include "PlanetaryMap.h"
#include "MixedHeightMapFactory.h"
#include "GrassFactory.h"

DECLARE_CORE_GLOBALS;

class CAppTask : public TSingleton<CAppTask>, public CKernelTask, public IInputEventListener
{
protected:
	std::vector<CPlanetaryMap> m_vPlanet;
	int m_nPolygonMode;
	bool m_bUpdate;
	bool m_bHDR;
	bool m_bHDRSquare;
	float m_fSplitFactor;
	float m_fExposure;

	CGLShaderObject m_shHDR;
	CGLFrameBufferObject m_fb;
	CVector m_vLightPos;

public:
	DEFAULT_TASK_CREATOR(CAppTask);

	virtual void OnQuit()
	{
		CKernel::GetPtr()->KillAllTasks();
	}

	virtual void OnKeyDown(int nKey, int nMod)
	{
		switch(nKey)
		{
			case SDLK_ESCAPE:
				OnQuit();
				break;
#ifdef _WIN32
			case SDLK_c:
				if(CCaptureTask::IsValid() && CKernel::GetPtr()->IsTaskRunning(CCaptureTask::GetPtr()))
					CKernel::GetPtr()->RemoveTask(CCaptureTask::GetPtr());
				else
					CKernel::GetPtr()->AddTask(CCaptureTask::IsValid() ? CCaptureTask::GetPtr() : CCaptureTask::Create(11000));
				break;
#endif
			case SDLK_h:
				m_bHDR = !m_bHDR;
				break;
			case SDLK_p:
				m_nPolygonMode = (m_nPolygonMode == GL_FILL) ? GL_LINE : GL_FILL;
				break;
			case SDLK_u:
				m_bUpdate = !m_bUpdate;
				break;
			case SDLK_PLUS:
			case SDLK_KP_PLUS:
			case SDLK_EQUALS:
				m_fSplitFactor += 0.1f;
				break;
			case SDLK_MINUS:
			case SDLK_KP_MINUS:
				m_fSplitFactor -= 0.1f;
				break;
		}
	}

	virtual bool Start()
	{
		CSimpleHeightMapFactoryType::Load();
		CSimpleCraterFactoryType::Load();
		CSimpleColorMapFactoryType::Load();
		CMixedHeightMapFactoryType::Load();
		CGrassFactoryType::Load();

		CInputTask::GetPtr()->AddInputEventListener(this);
		CCameraTask::GetPtr()->SetPosition(CVector(0, 0, 15.0f));
		CCameraTask::GetPtr()->SetThrust(1.0f);
		m_nPolygonMode = GL_FILL;
		m_bHDR = true;
		m_bUpdate = true;
		m_fSplitFactor = 16.0f;
		m_fExposure = 2.0f;

		m_vPlanet.reserve(50);
		CPropertySet prop;
		prop.LoadFile("Planet.conf");
		for(int i=1; ; i++)
		{
			char szPrefix[256];
			sprintf(szPrefix, "planet.%d.", i);
			prop.SetPrefix(szPrefix);
			if(prop.GetProperty("position") == NULL)
				break;
			m_vPlanet.push_back(CPlanetaryMap());
			m_vPlanet.back().Init(prop);
		}

		// ATI doesn't support rectangular textures in GLSL
		m_bHDRSquare = !CVideoTask::GetPtr()->IsNVIDIA();
		if(CVideoTask::GetPtr()->IsNVIDIA())
		{
			m_fb.Init(CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight(), GL_FLOAT_RGBA16_NV);
			if(m_fb.IsValid())
				m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRRectFrag.glsl");
		}
		else if(CVideoTask::GetPtr()->IsATI())
		{
			m_fb.Init(1024, 1024, GL_RGBA_FLOAT16_ATI);
			if(m_fb.IsValid())
				m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRSquareFrag.glsl");
		}
		else
		{
			m_fb.Init(1024, 1024, GL_RGBA16F_ARB);
			if(m_fb.IsValid())
				m_shHDR.Init("shaders/HDRVert.glsl", "shaders/HDRSquareFrag.glsl");
		}

		m_vLightPos = CVector(-100, 0, 0);
		return true;
	}

	virtual void Update()
	{
		int i;
		PROFILE("CAppTask::Update()", 1);

		if(m_bHDR && m_fb.IsValid())
		{
			m_fb.EnableFrameBuffer();
			if(m_bHDRSquare)
				glViewport(0, 0, 1024, 1024);
		}
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		// Cheap collision detection/response
		CVector vCamera = CCameraTask::GetPtr()->GetPosition();
		for(i=0; i<(int)m_vPlanet.size(); i++)
		{
			if(m_vPlanet[i].GetHeightAboveGround(vCamera) < 0.0f)
				CCameraTask::GetPtr()->Bounce();
		}

		// Update the planets
		if(m_bUpdate)
		{
			//CQuaternion q;
			//q.SetAxisAngle(CVector(0, 1, 0), 0.1f * CTimerTask::GetPtr()->GetFrameTicks() / 1000.0f);
			//m_vLightPos = q.TransformVector(m_vLightPos);
			for(i=0; i<(int)m_vPlanet.size(); i++)
				m_vPlanet[i].UpdateSurface(m_vLightPos, vCamera, CCameraTask::GetPtr()->GetCamera().m_qRotate, 1.25f, m_fSplitFactor);
		}

		// Draw the planets
		glPolygonMode(GL_FRONT, m_nPolygonMode);
		for(i=0; i<(int)m_vPlanet.size(); i++)
			m_vPlanet[i].DrawSurface();
		glPolygonMode(GL_FRONT, GL_FILL);

		if(m_bHDR && m_fb.IsValid())
		{
			m_fb.DisableFrameBuffer();
			if(m_bHDRSquare)
				glViewport(0, 0, CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight());
			CVideoTask::GetPtr()->GetFont().Begin();
			m_fb.EnableTexture();
			m_shHDR.Enable();
			m_shHDR.SetUniformParameter1f("fExposure", m_fExposure);
			m_shHDR.SetUniformParameter1i("s2Test", 0);
			glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
			glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
			glBegin(GL_QUADS);
			{
				if(m_bHDRSquare)
				{
					glTexCoord2f(0, 0); glVertex2i(0, CVideoTask::GetPtr()->GetHeight());
					glTexCoord2f(1, 0); glVertex2i(CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight());
					glTexCoord2f(1, 1); glVertex2i(CVideoTask::GetPtr()->GetWidth(), 0);
					glTexCoord2f(0, 1); glVertex2i(0,  0);
				}
				else
				{
					glTexCoord2f(0, 0); glVertex2i(0, CVideoTask::GetPtr()->GetHeight());
					glTexCoord2f(CVideoTask::GetPtr()->GetWidth(), 0); glVertex2i(CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight());
					glTexCoord2f(CVideoTask::GetPtr()->GetWidth(), CVideoTask::GetPtr()->GetHeight()); glVertex2i(CVideoTask::GetPtr()->GetWidth(), 0);
					glTexCoord2f(0, CVideoTask::GetPtr()->GetHeight()); glVertex2i(0,  0);
				}
			}
			glEnd();
			m_shHDR.Disable();
			m_fb.DisableTexture();
			CVideoTask::GetPtr()->GetFont().End();
		}

		glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
		char szBuffer[256];
		CFont &fFont = CVideoTask::GetPtr()->GetFont();
		fFont.Begin();
		sprintf(szBuffer, "Depth: %d, Nodes: %d, Triangles: %d", m_vPlanet[0].GetMaxDepth(), m_vPlanet[0].GetNodeCount(), m_vPlanet[0].GetTriangleCount());
		fFont.SetPosition(0, 15);
		fFont.Print(szBuffer);
		sprintf(szBuffer, "Split Factor (+/-): %-2.2f", m_fSplitFactor);
		fFont.SetPosition(0, 30);
		fFont.Print(szBuffer);
		fFont.End();
	}

	virtual void Stop()
	{
		m_fb.Cleanup();
		m_shHDR.Cleanup();
		m_vPlanet.clear();
		CPlanetaryObjectType::Unload();
		CInputTask::GetPtr()->RemoveInputEventListener(this);

		CSimpleHeightMapFactoryType::Unload();
		CSimpleCraterFactoryType::Unload();
		CSimpleColorMapFactoryType::Unload();
		CMixedHeightMapFactoryType::Unload();
		CGrassFactoryType::Unload();
	}
};

int main(int argc, char *argv[])
{
	CLog log;
	log.Init(Debug, "Planet");
	LogInfo("Starting app (%s)", g_strBuildStamp.c_str());
	CProfiler profile("main", 3, Info);

	CKernel *pKernel = CKernel::Create();
	pKernel->AddTask(CTimerTask::Create(10));
	pKernel->AddTask(CInputTask::Create(20));
	pKernel->AddTask(CInterpolatorTask::Create(30));
	pKernel->AddTask(CTriggerTask::Create(40));
	pKernel->AddTask(CCameraTask::Create(50));
	pKernel->AddTask(CConsoleTask::Create(9000));
	pKernel->AddTask(CVideoTask::Create(10000));

	pKernel->AddTask(CAppTask::Create(100));
	pKernel->Execute();
	pKernel->Destroy();

	CPlanetaryObjectType::Unload();
	LogInfo("Closing app");
	return 0;
}


text:
/*
* Bind needed Libraries in HTML
* */
export default function() {
    //let scriptJquery = document.createElement('script');
    //let scriptSpeechKitt = document.createElement('script');

    //scriptJquery.src = '//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js';
    //scriptSpeechKitt.src = '//cdnjs.cloudflare.com/ajax/libs/SpeechKITT/0.3.0/speechkitt.min.js';

    //document.getElementsByTagName('head')[0].appendChild(scriptJquery);
    //document.getElementsByTagName('head')[0].appendChild(scriptSpeechKitt);
}


text:
module.exports = function(grunt) {

  grunt.initConfig({

    pkg: grunt.file.readJSON('package.json'),

    watch: {
      engine: {
        files: ['src/**/*.coffee'],
        tasks: ['coffee:engine']
      },
      examples: {
        files: ['examples/**/*.coffee'],
        tasks: ['coffee:examples']
      }
    },

    coffee: {
      options: {
        bare: true,
        join: true
      },
      engine: {
        files: {
          'dist/engine.js': [
            'src/lib/functions.coffee',
            'src/lib/helpers.coffee',

            'src/core/Engine.coffee',
            'src/core/Entity.coffee',
            'src/core/Color.coffee',
            'src/core/Controller.coffee',
            'src/core/Point.coffee',
            'src/core/VisualEntity.coffee',
            'src/core/Pane.coffee',
            'src/core/Particle.coffee',
            'src/core/Timer.coffee',
            // 'src/core/Storage.coffee',

            'src/extended/Circle.coffee',
            'src/extended/Font.coffee',
            'src/extended/Line.coffee',
            'src/extended/Path.coffee',
            'src/extended/Polygon.coffee',
            'src/extended/Rectangle.coffee',
            'src/extended/Sprite.coffee',
            // 'src/extended/Square.coffee',
            'src/extended/Text.coffee',
            'src/extended/Tween.coffee',

            'src/extended/EngineDebugPane.coffee',

            'src/fonts/9px.coffee'
          ]
        }
      },
      examples: {
        files: {
          'examples/basics/js/app.js': ['examples/basics/js/src/*.coffee'],
          'examples/text/js/app.js': ['examples/text/js/src/*.coffee'],
          'examples/stars/js/app.js': ['examples/stars/js/src/*.coffee'],
          'examples/01-bounce/js/app.js': ['examples/01-bounce/js/src/*.coffee'],
          'examples/02-bounce/js/app.js': ['examples/02-bounce/js/src/*.coffee'],
          'examples/03-stars/js/app.js': ['examples/03-stars/js/src/*.coffee'],
          'examples/04-lines/js/app.js': ['examples/04-lines/js/src/*.coffee'],
          'examples/05-dashboard/js/app.js': ['examples/05-dashboard/js/src/*.coffee']
        }
      }
    }

  });

  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('default', ['coffee']);

};


text:
using node::Environment;
using node::IsolateData;
using node::CreateIsolateData;
using node::FreeIsolateData;
using node::CreateEnvironment;
using node::FreeEnvironment;
using node::AtExit;
using node::RunAtExit;

static bool called_cb_1 = false;
static bool called_cb_2 = false;
static void at_exit_callback1(void* arg);
static void at_exit_callback2(void* arg);
static std::string cb_1_arg;  // NOLINT(runtime/string)

class EnvironmentTest : public NodeTestFixture {
 public:
  class Env {
   public:
    Env(const v8::HandleScope& handle_scope,
        v8::Isolate* isolate,
        const Argv& argv) {
      context_ = v8::Context::New(isolate);
      CHECK(!context_.IsEmpty());
      isolate_data_ = CreateIsolateData(isolate, uv_default_loop());
      CHECK_NE(nullptr, isolate_data_);
      environment_ = CreateEnvironment(isolate_data_,
                                       context_,
                                       1, *argv,
                                       argv.nr_args(), *argv);
      CHECK_NE(nullptr, environment_);
    }

    ~Env() {
      environment_->CleanupHandles();
      FreeEnvironment(environment_);
      FreeIsolateData(isolate_data_);
    }

    Environment* operator*() const {
      return environment_;
    }

   private:
    v8::Local<v8::Context> context_;
    IsolateData* isolate_data_;
    Environment* environment_;
  };

 private:
  virtual void TearDown() {
    NodeTestFixture::TearDown();
    called_cb_1 = false;
    called_cb_2 = false;
  }
};

TEST_F(EnvironmentTest, AtExitWithEnvironment) {
  const v8::HandleScope handle_scope(isolate_);
  const Argv argv;
  Env env {handle_scope, isolate_, argv};

  AtExit(*env, at_exit_callback1);
  RunAtExit(*env);
  EXPECT_TRUE(called_cb_1);
}

TEST_F(EnvironmentTest, AtExitWithArgument) {
  const v8::HandleScope handle_scope(isolate_);
  const Argv argv;
  Env env {handle_scope, isolate_, argv};

  std::string arg{"some args"};
  AtExit(*env, at_exit_callback1, static_cast<void*>(&arg));
  RunAtExit(*env);
  EXPECT_EQ(arg, cb_1_arg);
}

TEST_F(EnvironmentTest, MultipleEnvironmentsPerIsolate) {
  const v8::HandleScope handle_scope(isolate_);
  const Argv argv;
  Env env1 {handle_scope, isolate_, argv};
  Env env2 {handle_scope, isolate_, argv};

  AtExit(*env1, at_exit_callback1);
  AtExit(*env2, at_exit_callback2);
  RunAtExit(*env1);
  EXPECT_TRUE(called_cb_1);
  EXPECT_FALSE(called_cb_2);

  RunAtExit(*env2);
  EXPECT_TRUE(called_cb_2);
}

static void at_exit_callback1(void* arg) {
  called_cb_1 = true;
  if (arg) {
    cb_1_arg = *static_cast<std::string*>(arg);
  }
}

static void at_exit_callback2(void* arg) {
  called_cb_2 = true;
}


text:
package org.objectify.services

/**
 * Sample service
 */
class MultipleFormatGetService extends Service[String] {
  def apply() = "some value"
}


text:
FROM python:3.6

# set timezone
RUN echo "US/Eastern" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata

# add mongodb to sources list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
RUN echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list
RUN apt-get update && apt-get -y upgrade

# nano editor
RUN apt-get install nano

# mongodb
RUN apt-get install -y mongodb-org
RUN mkdir -p /data/db

# add mongobar
ADD ./mongobar /mongobar/mongobar
ADD ./setup.py /mongobar/setup.py
ADD ./.mongobar_config.json /root/.mongobar_config.json

# install mongobar
WORKDIR /mongobar
RUN pip install -e .[tests]

# add tests
ADD ./tests /tests

# add init scripts
WORKDIR /

# ADD ./init.sh /init.sh
ADD ./init_auth.sh /init_auth.sh

# RUN chmod 775 /init.sh
RUN chmod 775 /init_auth.sh

# run forevz bby
CMD ["mongod"]


text:
package vcl

import (
    . "github.com/ying32/govcl/vcl/api"
    . "github.com/ying32/govcl/vcl/types"
    "unsafe"
)

type TBitmap struct {
    IGraphic
    instance uintptr
    // 特殊情况下使用,主要应对Go的GC问题,与LCL没有太多关系。
    ptr unsafe.Pointer
}

// 创建一个新的对象。
//
// Create a new object.
func NewBitmap() *TBitmap {
    b := new(TBitmap)
    b.instance = Bitmap_Create()
    b.ptr = unsafe.Pointer(b.instance)
    setFinalizer(b, (*TBitmap).Free)
    return b
}

// 动态转换一个已存在的对象实例。
//
// Dynamically convert an existing object instance.
func AsBitmap(obj interface{}) *TBitmap {
    instance, ptr := getInstance(obj)
    if instance == 0 { return nil }
    return &TBitmap{instance: instance, ptr: ptr}
}

// -------------------------- Deprecated begin --------------------------
// 新建一个对象来自已经存在的对象实例指针。
//
// Create a new object from an existing object instance pointer.
// Deprecated: use AsBitmap.
func BitmapFromInst(inst uintptr) *TBitmap {
    return AsBitmap(inst)
}

// 新建一个对象来自已经存在的对象实例。
//
// Create a new object from an existing object instance.
// Deprecated: use AsBitmap.
func BitmapFromObj(obj IObject) *TBitmap {
    return AsBitmap(obj)
}

// 新建一个对象来自不安全的地址。注意:使用此函数可能造成一些不明情况,慎用。
//
// Create a new object from an unsecured address. Note: Using this function may cause some unclear situations and be used with caution..
// Deprecated: use AsBitmap.
func BitmapFromUnsafePointer(ptr unsafe.Pointer) *TBitmap {
    return AsBitmap(ptr)
}

// -------------------------- Deprecated end --------------------------
// 释放对象。
//
// Free object.
func (b *TBitmap) Free() {
    if b.instance != 0 {
        Bitmap_Free(b.instance)
        b.instance, b.ptr = 0, nullptr
    }
}

// 返回对象实例指针。
//
// Return object instance pointer.
func (b *TBitmap) Instance() uintptr {
    return b.instance
}

// 获取一个不安全的地址。
//
// Get an unsafe address.
func (b *TBitmap) UnsafeAddr() unsafe.Pointer {
    return b.ptr
}

// 检测地址是否为空。
//
// Check if the address is empty.
func (b *TBitmap) IsValid() bool {
    return b.instance != 0
}

// 检测当前对象是否继承自目标对象。
//
// Checks whether the current object is inherited from the target object.
func (b *TBitmap) Is() TIs {
    return TIs(b.instance)
}

// 动态转换当前对象为目标对象。
//
// Dynamically convert the current object to the target object.
//func (b *TBitmap) As() TAs {
//    return TAs(b.instance)
//}

// 获取类信息指针。
//
// Get class information pointer.
func TBitmapClass() TClass {
    return Bitmap_StaticClassType()
}

// 从设备驱动中加载Bitmap。
//
// Load the Bitmap from the device driver.
func (b *TBitmap) LoadFromDevice(ADc HDC) {
    Bitmap_LoadFromDevice(b.instance, ADc)
}

// 用于ScanLine属性,aStreamIsValid 默认为 false。
//
// Used for ScanLine property, aStreamIsValid defaults to false.
func (b *TBitmap) EndUpdate(AStreamIsValid bool) {
    Bitmap_EndUpdate(b.instance, AStreamIsValid)
}

// 用于ScanLine属性,aCanvasOnly 默认为 false。
//
// Used for ScanLine properties, aCanvasOnly defaults to false.
func (b *TBitmap) BeginUpdate(ACanvasOnly bool) {
    Bitmap_BeginUpdate(b.instance, ACanvasOnly)
}

// 清除bitmap数据。
//
// Clear bitmap data.
func (b *TBitmap) Clear() {
    Bitmap_Clear(b.instance)
}

// 复制一个对象,如果对象实现了此方法的话。
//
// Copy an object, if the object implements this method.
func (b *TBitmap) Assign(Source IObject) {
    Bitmap_Assign(b.instance, CheckPtr(Source))
}

func (b *TBitmap) FreeImage() {
    Bitmap_FreeImage(b.instance)
}

// 句柄是否已经分配。
//
// Is the handle already allocated.
func (b *TBitmap) HandleAllocated() bool {
    return Bitmap_HandleAllocated(b.instance)
}

// 文件流加载。
func (b *TBitmap) LoadFromStream(Stream IStream) {
    Bitmap_LoadFromStream(b.instance, CheckPtr(Stream))
}

// 保存至流。
func (b *TBitmap) SaveToStream(Stream IStream) {
    Bitmap_SaveToStream(b.instance, CheckPtr(Stream))
}

func (b *TBitmap) SetSize(AWidth int32, AHeight int32) {
    Bitmap_SetSize(b.instance, AWidth , AHeight)
}

func (b *TBitmap) LoadFromResourceName(Instance uintptr, ResName string) {
    Bitmap_LoadFromResourceName(b.instance, Instance , ResName)
}

func (b *TBitmap) LoadFromResourceID(Instance uintptr, ResID int32) {
    Bitmap_LoadFromResourceID(b.instance, Instance , ResID)
}

// 与一个对象进行比较。
//
// Compare with an object.
func (b *TBitmap) Equals(Obj IObject) bool {
    return Bitmap_Equals(b.instance, CheckPtr(Obj))
}

// 从文件加载。
func (b *TBitmap) LoadFromFile(Filename string) {
    Bitmap_LoadFromFile(b.instance, Filename)
}

// 保存至文件。
func (b *TBitmap) SaveToFile(Filename string) {
    Bitmap_SaveToFile(b.instance, Filename)
}

// 获取类名路径。
//
// Get the class name path.
func (b *TBitmap) GetNamePath() string {
    return Bitmap_GetNamePath(b.instance)
}

// 获取类的类型信息。
//
// Get class type information.
func (b *TBitmap) ClassType() TClass {
    return Bitmap_ClassType(b.instance)
}

// 获取当前对象类名称。
//
// Get the current object class name.
func (b *TBitmap) ClassName() string {
    return Bitmap_ClassName(b.instance)
}

// 获取当前对象实例大小。
//
// Get the current object instance size.
func (b *TBitmap) InstanceSize() int32 {
    return Bitmap_InstanceSize(b.instance)
}

// 判断当前类是否继承自指定类。
//
// Determine whether the current class inherits from the specified class.
func (b *TBitmap) InheritsFrom(AClass TClass) bool {
    return Bitmap_InheritsFrom(b.instance, AClass)
}

// 获取类的哈希值。
//
// Get the hash value of the class.
func (b *TBitmap) GetHashCode() int32 {
    return Bitmap_GetHashCode(b.instance)
}

// 文本类信息。
//
// Text information.
func (b *TBitmap) ToString() string {
    return Bitmap_ToString(b.instance)
}

// 获取画布。
func (b *TBitmap) Canvas() *TCanvas {
    return AsCanvas(Bitmap_GetCanvas(b.instance))
}

// 获取控件句柄。
//
// Get Control handle.
func (b *TBitmap) Handle() HBITMAP {
    return Bitmap_GetHandle(b.instance)
}

// 设置控件句柄。
//
// Set Control handle.
func (b *TBitmap) SetHandle(value HBITMAP) {
    Bitmap_SetHandle(b.instance, value)
}

func (b *TBitmap) HandleType() TBitmapHandleType {
    return Bitmap_GetHandleType(b.instance)
}

func (b *TBitmap) SetHandleType(value TBitmapHandleType) {
    Bitmap_SetHandleType(b.instance, value)
}

func (b *TBitmap) MaskHandle() HBITMAP {
    return Bitmap_GetMaskHandle(b.instance)
}

func (b *TBitmap) SetMaskHandle(value HBITMAP) {
    Bitmap_SetMaskHandle(b.instance, value)
}

func (b *TBitmap) PixelFormat() TPixelFormat {
    return Bitmap_GetPixelFormat(b.instance)
}

func (b *TBitmap) SetPixelFormat(value TPixelFormat) {
    Bitmap_SetPixelFormat(b.instance, value)
}

func (b *TBitmap) TransparentMode() TTransparentMode {
    return Bitmap_GetTransparentMode(b.instance)
}

func (b *TBitmap) SetTransparentMode(value TTransparentMode) {
    Bitmap_SetTransparentMode(b.instance, value)
}

func (b *TBitmap) Empty() bool {
    return Bitmap_GetEmpty(b.instance)
}

// 获取高度。
//
// Get height.
func (b *TBitmap) Height() int32 {
    return Bitmap_GetHeight(b.instance)
}

// 设置高度。
//
// Set height.
func (b *TBitmap) SetHeight(value int32) {
    Bitmap_SetHeight(b.instance, value)
}

// 获取修改。
//
// Get modified.
func (b *TBitmap) Modified() bool {
    return Bitmap_GetModified(b.instance)
}

// 设置修改。
//
// Set modified.
func (b *TBitmap) SetModified(value bool) {
    Bitmap_SetModified(b.instance, value)
}

func (b *TBitmap) Palette() HPALETTE {
    return Bitmap_GetPalette(b.instance)
}

func (b *TBitmap) SetPalette(value HPALETTE) {
    Bitmap_SetPalette(b.instance, value)
}

func (b *TBitmap) PaletteModified() bool {
    return Bitmap_GetPaletteModified(b.instance)
}

func (b *TBitmap) SetPaletteModified(value bool) {
    Bitmap_SetPaletteModified(b.instance, value)
}

// 获取透明。
//
// Get transparent.
func (b *TBitmap) Transparent() bool {
    return Bitmap_GetTransparent(b.instance)
}

// 设置透明。
//
// Set transparent.
func (b *TBitmap) SetTransparent(value bool) {
    Bitmap_SetTransparent(b.instance, value)
}

// 获取宽度。
//
// Get width.
func (b *TBitmap) Width() int32 {
    return Bitmap_GetWidth(b.instance)
}

// 设置宽度。
//
// Set width.
func (b *TBitmap) SetWidth(value int32) {
    Bitmap_SetWidth(b.instance, value)
}

// 设置改变事件。
//
// Set changed event.
func (b *TBitmap) SetOnChange(fn TNotifyEvent) {
    Bitmap_SetOnChange(b.instance, fn)
}

func (b *TBitmap) ScanLine(Row int32) uintptr {
    return Bitmap_GetScanLine(b.instance, Row)
}


text:
<?php

/**
 * Customer Address Street Model
 *
 * @category   Mage
 * @package    Mage_Adminhtml
 * @author     Magento Core Team <core@magentocommerce.com>
 */
class Mage_Adminhtml_Model_System_Config_Backend_Customer_Address_Street extends Mage_Core_Model_Config_Data
{
    /**
     * Actions after save
     *
     * @return Mage_Adminhtml_Model_System_Config_Backend_Customer_Address_Street
     */
    protected function _afterSave()
    {
        $attribute = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'street');
        $value  = $this->getValue();
        switch ($this->getScope()) {
            case 'websites':
                $website = Mage::app()->getWebsite($this->getWebsiteCode());
                $attribute->setWebsite($website);
                $attribute->load($attribute->getId());
                if ($attribute->getData('multiline_count') != $value) {
                    $attribute->setData('scope_multiline_count', $value);
                }
                break;

            case 'default':
                $attribute->setData('multiline_count', $value);
                break;
        }
        $attribute->save();
        return $this;
    }

    /**
     * Processing object after delete data
     *
     * @return Mage_Core_Model_Abstract
     */
    protected function _afterDelete()
    {
        $result = parent::_afterDelete();

        if ($this->getScope() == 'websites') {
            $attribute = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'street');
            $website = Mage::app()->getWebsite($this->getWebsiteCode());
            $attribute->setWebsite($website);
            $attribute->load($attribute->getId());
            $attribute->setData('scope_multiline_count', null);
            $attribute->save();
        }

        return $result;
    }
}


text:
class ResponseHandler
  attr_reader :controller

  def initialize(controller, response)
    @controller = controller
    @response = response
  end

  def resolve
    case response.response_type
    when '404', '500'
      send("respond_with_#{response.response_type}")
    else
      respond_with(response)
    end
  end

  def response
    @response ||= Response.new(response_type: '404')
  end

  private

  def respond_with_500
    controller.render file: 'public/500.html',  status: 500
  end

  def respond_with_404
    controller.render file: 'public/404.html',  status: 404
  end

  def respond_with(response)
    status = Integer(response.response_type.split('_').first) rescue nil
    content_type = response.response_type.match(/XML|JSON/).to_s.downcase

    params = { body: response.content, content_type: "application/#{content_type}" }
    params.merge!(status: status) if status

    controller.render params
  end
end


text:
{% extends "messages/base.html" %}
{% load i18n thumbnail2 humanize%}
{% load url from future %}
{% block title %}{% trans "Inbox" %}{% endblock %}
{% block bodyclass %}user-profile-page{% endblock %}

{% block searchnav%}

{% endblock %}

{% block content %}

{% trans "Inbox" %}

					{% trans "New message" %}
					{% trans "Sent Messages" %}
					{% trans "Return to profile" %}

				{% if message_list %}
					{% for message in message_list %}

							{% if message.sender.profile.avatar.photo_original %}
								{% thumbnail message.sender.profile.avatar.photo_original "48x48" as avatar %}

							{% else %}

							{% endif %}

								 {{ message.sender }} {% if  message.sender.last_name or userModel.first_name %} ({{message.sender.first_name}} {{message.sender.last_name}}) {% endif %}

								{{ message.sent_at|naturaltime}}

{% if message.new %}{% endif %}{{ message.subject|truncatechars:100}}{% if message.new %}{% endif %}

					{% endfor %}
				{% else %}

{% trans "No messages." %}

				{% endif %}

				{%if page_obj.has_previous %}
					 {% trans "Previous" %}
				{%endif%}
				{%if page_obj.has_next %}
					 {% trans "Next" %}
				{%endif%}

					{% for curpage in page_obj.paginator.page_range %}

						{% if page_obj.number != curpage %}
							{{curpage}}
						{%else%}
							{{curpage}}
						{%endif%}

					{%endfor%}

{% endblock %}


text:
package com.sorentiny.jgroups_conf;

import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import java.awt.*;

/**
 * Table cell renderer that changes cell rendering if the Table Model indicates change in the cell
 * Created by Myhall on 11.12.2016.
 */
public class ChangeDetectionTableCellRenderer extends DefaultTableCellRenderer {
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        ProtocolPropertiesTableModel model = (ProtocolPropertiesTableModel) table.getModel();
        Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        if (model.isCellChanged(row, column))
        {
            component.setBackground(Color.YELLOW);
            component.setFont(component.getFont().deriveFont(Font.BOLD));
        } else {
            component.setBackground(null);
        }
        setToolTip(row, column, model, component);
        return component;
    }

    private void setToolTip(int row, int column, ProtocolPropertiesTableModel model, Component component) {
        if (component instanceof JComponent)
        {
            ((JComponent) component).setToolTipText(model.getDescriptionFor(row, column));
        }
    }
}


text:
layout: page
title: Fire Protector Chemical Trade Fair
date: 2016-05-24
author: Sean Villarreal
tags: weekly links, java
status: published
summary: Quisque semper gravida tincidunt. Nullam vel nunc.
banner: images/banner/office-01.jpg
booking:
  startDate: 03/18/2018
  endDate: 03/20/2018
  ctyhocn: AEXMVHX
  groupCode: FPCTF
published: true
---
Sed congue turpis ut consectetur interdum. Nulla non massa purus. Cras tempor varius mi a mattis. Sed tincidunt lacus in mollis finibus. Fusce sit amet enim ornare, fermentum nisi quis, fringilla enim. Nulla facilisi. Ut efficitur auctor eros quis semper.

1 Donec pellentesque odio in mi aliquet lacinia
1 Mauris semper felis maximus felis hendrerit, et vehicula est porttitor
1 Phasellus rhoncus metus in eros viverra pretium
1 Vestibulum tempus libero id varius rutrum
1 Cras et metus ornare, facilisis nisl sed, euismod ex.

Aliquam ac neque sed nisl euismod ornare. Praesent cursus faucibus felis, vel dictum diam convallis vitae. Duis sagittis sollicitudin metus, non sollicitudin arcu ornare nec. Donec quis malesuada sapien. Duis et justo eget lectus accumsan euismod vel sit amet augue. Ut eu consequat nulla. Etiam at gravida ante. Ut porta lacus id ante pharetra, et ultricies ligula varius. Nulla ligula elit, pretium eu scelerisque nec, euismod non ex. Fusce vehicula ligula id eros ullamcorper auctor. Cras sed tempor neque. Donec sit amet malesuada ligula.
Aenean aliquam ex nunc. Curabitur vestibulum libero sit amet malesuada laoreet. Nulla in dictum odio, vitae hendrerit nisl. In eleifend purus odio, at tristique risus fringilla sodales. Praesent lobortis gravida fringilla. Proin pulvinar porttitor nibh. Vivamus vulputate, ligula vitae consectetur tempor, lectus leo vehicula mi, vitae viverra metus mi id ex. Praesent elementum mauris sit amet augue aliquet sagittis. Nunc nec bibendum libero, eu mattis erat. Etiam feugiat orci nec risus accumsan, bibendum consectetur nisi mattis. Nulla porttitor pellentesque fermentum. Nunc porta tincidunt ex sed varius. In finibus lacus sit amet rutrum volutpat. Suspendisse nec lectus ac lorem efficitur lacinia.


text:
from __future__ import absolute_import
import copy
import json
import base64

import scrapy
from scrapy.core.engine import ExecutionEngine
from scrapy.utils.test import get_crawler
from scrapy.http import Response, TextResponse
from scrapy.downloadermiddlewares.httpcache import HttpCacheMiddleware

import scrapy_splash
from scrapy_splash.utils import to_unicode
from scrapy_splash import (
    SplashRequest,
    SplashMiddleware,
    SlotPolicy,
    SplashCookiesMiddleware,
    SplashDeduplicateArgsMiddleware,
)

def _get_crawler(settings_dict):
    settings_dict = settings_dict.copy()
    settings_dict['DOWNLOAD_HANDLERS'] = {'s3': None}  # for faster test running
    crawler = get_crawler(settings_dict=settings_dict)
    if not hasattr(crawler, 'logformatter'):
        crawler.logformatter = None
    crawler.engine = ExecutionEngine(crawler, lambda _: None)
    # spider = crawler._create_spider("foo")
    return crawler

def _get_mw():
    crawler = _get_crawler({})
    return SplashMiddleware.from_crawler(crawler)

def _get_cookie_mw():
    return SplashCookiesMiddleware(debug=True)

def test_nosplash():
    mw = _get_mw()
    cookie_mw = _get_cookie_mw()
    req = scrapy.Request("http://example.com")
    old_meta = copy.deepcopy(req.meta)

    assert cookie_mw.process_request(req, None) is None
    assert mw.process_request(req, None) is None
    assert old_meta == req.meta

    # response is not changed
    response = Response("http://example.com", request=req)
    response2 = mw.process_response(req, response, None)
    response3 = cookie_mw.process_response(req, response, None)
    assert response2 is response
    assert response3 is response
    assert response3.url == "http://example.com"

def test_splash_request():
    mw = _get_mw()
    cookie_mw = _get_cookie_mw()

    req = SplashRequest("http://example.com?foo=bar&url=1&wait=100")
    assert repr(req) == "<GET http://example.com?foo=bar&url=1&wait=100>"

    # check request preprocessing
    req2 = cookie_mw.process_request(req, None) or req
    req2 = mw.process_request(req2, None) or req2
    assert req2 is not None
    assert req2 is not req
    assert req2.url == "http://127.0.0.1:8050/render.html"
    assert req2.headers == {b'Content-Type': [b'application/json']}
    assert req2.method == 'POST'
    assert isinstance(req2, SplashRequest)
    assert repr(req2) == "<GET http://example.com?foo=bar&url=1&wait=100 via http://127.0.0.1:8050/render.html>"

    expected_body = {'url': req.url}
    assert json.loads(to_unicode(req2.body)) == expected_body

    # check response post-processing
    response = TextResponse("http://127.0.0.1:8050/render.html",
                            # Scrapy doesn't pass request to constructor
                            # request=req2,
                            headers={b'Content-Type': b'text/html'},
                            body=b"Hello")
    response2 = mw.process_response(req2, response, None)
    response2 = cookie_mw.process_response(req2, response2, None)
    assert isinstance(response2, scrapy_splash.SplashTextResponse)
    assert response2 is not response
    assert response2.real_url == req2.url
    assert response2.url == req.url
    assert response2.body == b"Hello"
    assert response2.css("body").extract_first() == "Hello"
    assert response2.headers == {b'Content-Type': [b'text/html']}

    # check .replace method
    response3 = response2.replace(status=404)
    assert response3.status == 404
    assert isinstance(response3, scrapy_splash.SplashTextResponse)
    for attr in ['url', 'real_url', 'headers', 'body']:
        assert getattr(response3, attr) == getattr(response2, attr)

def test_dont_process_response():
    mw = _get_mw()
    req = SplashRequest("http://example.com/",
        endpoint="render.html",
        dont_process_response=True,
    )
    req2 = mw.process_request(req, None)
    resp = Response("http://example.com/")
    resp2 = mw.process_response(req2, resp, None)
    assert resp2.__class__ is Response
    assert resp2 is resp

def test_splash_request_parameters():
    mw = _get_mw()
    cookie_mw = _get_cookie_mw()

    def cb():
        pass

    req = SplashRequest("http://example.com/#!start", cb, 'POST',
        body="foo=bar",
        splash_url="http://mysplash.example.com",
        slot_policy=SlotPolicy.SINGLE_SLOT,
        endpoint="execute",
        splash_headers={'X-My-Header': 'value'},
        args={
            "lua_source": "function main() end",
            "myarg": 3.0,
        },
        magic_response=False,
        headers={'X-My-Header': 'value'}
    )
    req2 = cookie_mw.process_request(req, None) or req
    req2 = mw.process_request(req2, None)
    assert req2.meta['splash'] == {
        'endpoint': 'execute',
        'splash_url': "http://mysplash.example.com",
        'slot_policy': SlotPolicy.SINGLE_SLOT,
        'splash_headers': {'X-My-Header': 'value'},
        'magic_response': False,
        'session_id': 'default',
        'http_status_from_error_code': True,
        'args': {
            'url': "http://example.com/#!start",
            'http_method': 'POST',
            'body': 'foo=bar',
            'cookies': [],
            'lua_source': 'function main() end',
            'myarg': 3.0,
            'headers': {
                'X-My-Header': 'value',
            }
        },
    }
    assert req2.callback == cb
    assert req2.headers == {
        b'Content-Type': [b'application/json'],
        b'X-My-Header': [b'value'],
    }

    # check response post-processing
    res = {
        'html': 'Hello',
        'num_divs': 0.0,
    }
    res_body = json.dumps(res)
    response = TextResponse("http://mysplash.example.com/execute",
                            # Scrapy doesn't pass request to constructor
                            # request=req2,
                            headers={b'Content-Type': b'application/json'},
                            body=res_body.encode('utf8'))
    response2 = mw.process_response(req2, response, None)
    response2 = cookie_mw.process_response(req2, response2, None)
    assert isinstance(response2, scrapy_splash.SplashJsonResponse)
    assert response2 is not response
    assert response2.real_url == req2.url
    assert response2.url == req.meta['splash']['args']['url']
    assert response2.data == res
    assert response2.body == res_body.encode('utf8')
    assert response2.text == response2.body_as_unicode() == res_body
    assert response2.encoding == 'utf8'
    assert response2.headers == {b'Content-Type': [b'application/json']}
    assert response2.splash_response_headers == response2.headers
    assert response2.status == response2.splash_response_status == 200

def test_magic_response():
    mw = _get_mw()
    cookie_mw = _get_cookie_mw()

    req = SplashRequest('http://example.com/',
                        endpoint='execute',
                        args={'lua_source': 'function main() end'},
                        magic_response=True,
                        cookies=[{'name': 'foo', 'value': 'bar'}])
    req = cookie_mw.process_request(req, None) or req
    req = mw.process_request(req, None) or req

    resp_data = {
        'url': "http://exmaple.com/#id42",
        'html': 'Hello 404',
        'http_status': 404,
        'headers': [
            {'name': 'Content-Type', 'value': "text/html"},
            {'name': 'X-My-Header', 'value': "foo"},
            {'name': 'Set-Cookie', 'value': "bar=baz"},
        ],
        'cookies': [
            {'name': 'foo', 'value': 'bar'},
            {'name': 'bar', 'value': 'baz', 'domain': '.example.com'},
            {'name': 'session', 'value': '12345', 'path': '/',
             'expires': '2055-07-24T19:20:30Z'},
        ],
    }
    resp = TextResponse("http://mysplash.example.com/execute",
                        headers={b'Content-Type': b'application/json'},
                        body=json.dumps(resp_data).encode('utf8'))
    resp2 = mw.process_response(req, resp, None)
    resp2 = cookie_mw.process_response(req, resp2, None)
    assert isinstance(resp2, scrapy_splash.SplashJsonResponse)
    assert resp2.data == resp_data
    assert resp2.body == b'Hello 404'
    assert resp2.text == 'Hello 404'
    assert resp2.headers == {
        b'Content-Type': [b'text/html'],
        b'X-My-Header': [b'foo'],
        b'Set-Cookie': [b'bar=baz'],
    }
    assert resp2.splash_response_headers == {b'Content-Type': [b'application/json']}
    assert resp2.status == 404
    assert resp2.splash_response_status == 200
    assert resp2.url == "http://exmaple.com/#id42"
    assert len(resp2.cookiejar) == 3
    cookies = [c for c in resp2.cookiejar]
    assert {(c.name, c.value) for c in cookies} == {
        ('bar', 'baz'),
        ('foo', 'bar'),
        ('session', '12345')
    }

    # send second request using the same session and check the resulting cookies
    req = SplashRequest('http://example.com/foo',
                        endpoint='execute',
                        args={'lua_source': 'function main() end'},
                        magic_response=True,
                        cookies={'spam': 'ham'})
    req = cookie_mw.process_request(req, None) or req
    req = mw.process_request(req, None) or req

    resp_data = {
        'html': 'Hello',
        'headers': [
            {'name': 'Content-Type', 'value': "text/html"},
            {'name': 'X-My-Header', 'value': "foo"},
            {'name': 'Set-Cookie', 'value': "bar=baz"},
        ],
        'cookies': [
            {'name': 'spam', 'value': 'ham'},
            {'name': 'egg', 'value': 'spam'},
            {'name': 'bar', 'value': 'baz', 'domain': '.example.com'},
           #{'name': 'foo', 'value': ''},  -- this won't be in response
            {'name': 'session', 'value': '12345', 'path': '/',
             'expires': '2056-07-24T19:20:30Z'},
        ],
    }
    resp = TextResponse("http://mysplash.example.com/execute",
                        headers={b'Content-Type': b'application/json'},
                        body=json.dumps(resp_data).encode('utf8'))
    resp2 = mw.process_response(req, resp, None)
    resp2 = cookie_mw.process_response(req, resp2, None)
    assert isinstance(resp2, scrapy_splash.SplashJsonResponse)
    assert resp2.data == resp_data
    cookies = [c for c in resp2.cookiejar]
    assert {c.name for c in cookies} == {'session', 'egg', 'bar', 'spam'}
    for c in cookies:
        if c.name == 'session':
            assert c.expires == 2731692030
        if c.name == 'spam':
            assert c.value == 'ham'

def test_cookies():
    mw = _get_mw()
    cookie_mw = _get_cookie_mw()

    def request_with_cookies(cookies):
        req = SplashRequest(
            'http://example.com/foo',
            endpoint='execute',
            args={'lua_source': 'function main() end'},
            magic_response=True,
            cookies=cookies)
        req = cookie_mw.process_request(req, None) or req
        req = mw.process_request(req, None) or req
        return req

    def response_with_cookies(req, cookies):
        resp_data = {
            'html': 'Hello',
            'headers': [],
            'cookies': cookies,
        }
        resp = TextResponse(
            'http://mysplash.example.com/execute',
            headers={b'Content-Type': b'application/json'},
            body=json.dumps(resp_data).encode('utf8'))
        resp = mw.process_response(req, resp, None)
        resp = cookie_mw.process_response(req, resp, None)
        return resp

    # Concurent requests
    req1 = request_with_cookies({'spam': 'ham'})
    req2 = request_with_cookies({'bom': 'bam'})
    resp1 = response_with_cookies(req1, [
        {'name': 'spam', 'value': 'ham'},
        {'name': 'spam_x', 'value': 'ham_x'},
    ])
    resp2 = response_with_cookies(req2, [
        {'name': 'spam', 'value': 'ham'},  # because req2 was made after req1
        {'name': 'bom_x', 'value': 'bam_x'},
    ])
    assert resp1.cookiejar is resp2.cookiejar
    cookies = {c.name: c.value for c in resp1.cookiejar}
    assert cookies == {'spam': 'ham', 'spam_x': 'ham_x', 'bom_x': 'bam_x'}

    # Removing already removed
    req1 = request_with_cookies({'spam': 'ham'})
    req2 = request_with_cookies({'spam': 'ham', 'pom': 'pam'})
    resp2 = response_with_cookies(req2, [
        {'name': 'pom', 'value': 'pam'},
    ])
    resp1 = response_with_cookies(req1, [])
    assert resp1.cookiejar is resp2.cookiejar
    cookies = {c.name: c.value for c in resp1.cookiejar}
    assert cookies == {'pom': 'pam'}

def test_magic_response2():
    # check 'body' handling and another 'headers' format
    mw = _get_mw()
    req = SplashRequest('http://example.com/', magic_response=True,
                        headers={'foo': 'bar'}, dont_send_headers=True)
    req = mw.process_request(req, None)
    assert 'headers' not in req.meta['splash']['args']

    resp_data = {
        'body': base64.b64encode(b"binary data").decode('ascii'),
        'headers': {'Content-Type': 'text/plain'},
    }
    resp = TextResponse("http://mysplash.example.com/execute",
                        headers={b'Content-Type': b'application/json'},
                        body=json.dumps(resp_data).encode('utf8'))
    resp2 = mw.process_response(req, resp, None)
    assert resp2.data == resp_data
    assert resp2.body == b'binary data'
    assert resp2.headers == {b'Content-Type': [b'text/plain']}
    assert resp2.splash_response_headers == {b'Content-Type': [b'application/json']}
    assert resp2.status == resp2.splash_response_status == 200
    assert resp2.url == "http://example.com/"

def test_unicode_url():
    mw = _get_mw()
    req = SplashRequest(
        # note unicode URL
        u"http://example.com/", endpoint='execute')
    req2 = mw.process_request(req, None)
    res = {'html': 'Hello'}
    res_body = json.dumps(res)
    response = TextResponse("http://mysplash.example.com/execute",
                            # Scrapy doesn't pass request to constructor
                            # request=req2,
                            headers={b'Content-Type': b'application/json'},
                            body=res_body.encode('utf8'))
    response2 = mw.process_response(req2, response, None)
    assert response2.url == "http://example.com/"

def test_magic_response_http_error():
    mw = _get_mw()
    req = SplashRequest('http://example.com/foo')
    req = mw.process_request(req, None)

    resp_data = {
        "info": {
            "error": "http404",
            "message": "Lua error: [string \"function main(splash)\r...\"]:3: http404",
            "line_number": 3,
            "type": "LUA_ERROR",
            "source": "[string \"function main(splash)\r...\"]"
        },
        "description": "Error happened while executing Lua script",
        "error": 400,
        "type": "ScriptError"
    }
    resp = TextResponse("http://mysplash.example.com/execute", status=400,
                        headers={b'Content-Type': b'application/json'},
                        body=json.dumps(resp_data).encode('utf8'))
    resp = mw.process_response(req, resp, None)
    assert resp.data == resp_data
    assert resp.status == 404
    assert resp.splash_response_status == 400
    assert resp.url == "http://example.com/foo"

def test_change_response_class_to_text():
    mw = _get_mw()
    req = SplashRequest('http://example.com/', magic_response=True)
    req = mw.process_request(req, None)
    # Such response can come when downloading a file,
    # or returning splash:html(): the headers say it's binary,
    # but it can be decoded so it becomes a TextResponse.
    resp = TextResponse('http://mysplash.example.com/execute',
                        headers={b'Content-Type': b'application/pdf'},
                        body=b'ascii binary data',
                        encoding='utf-8')
    resp2 = mw.process_response(req, resp, None)
    assert isinstance(resp2, TextResponse)
    assert resp2.url == 'http://example.com/'
    assert resp2.headers == {b'Content-Type': [b'application/pdf']}
    assert resp2.body == b'ascii binary data'

def test_change_response_class_to_json_binary():
    mw = _get_mw()
    # We set magic_response to False, because it's not a kind of data we would
    # expect from splash: we just return binary data.
    # If we set magic_response to True, the middleware will fail,
    # but this is ok because magic_response presumes we are expecting
    # a valid splash json response.
    req = SplashRequest('http://example.com/', magic_response=False)
    req = mw.process_request(req, None)
    resp = Response('http://mysplash.example.com/execute',
                    headers={b'Content-Type': b'application/json'},
                    body=b'non-decodable data: \x98\x11\xe7\x17\x8f',
                    )
    resp2 = mw.process_response(req, resp, None)
    assert isinstance(resp2, Response)
    assert resp2.url == 'http://example.com/'
    assert resp2.headers == {b'Content-Type': [b'application/json']}
    assert resp2.body == b'non-decodable data: \x98\x11\xe7\x17\x8f'

def test_magic_response_caching(tmpdir):
    # prepare middlewares
    spider = scrapy.Spider(name='foo')
    crawler = _get_crawler({
        'HTTPCACHE_DIR': str(tmpdir.join('cache')),
        'HTTPCACHE_STORAGE': 'scrapy_splash.SplashAwareFSCacheStorage',
        'HTTPCACHE_ENABLED': True
    })
    cache_mw = HttpCacheMiddleware.from_crawler(crawler)
    mw = _get_mw()
    cookie_mw = _get_cookie_mw()

    def _get_req():
        return SplashRequest(
            url="http://example.com",
            endpoint='execute',
            magic_response=True,
            args={'lua_source': 'function main(splash) end'},
        )

    # Emulate Scrapy middleware chain.

    # first call
    req = _get_req()
    req = cookie_mw.process_request(req, spider) or req
    req = mw.process_request(req, spider)
    req = cache_mw.process_request(req, spider) or req
    assert isinstance(req, scrapy.Request)  # first call; the cache is empty

    resp_data = {
        'html': "Hello",
        'render_time': 0.5,
    }
    resp_body = json.dumps(resp_data).encode('utf8')
    resp = TextResponse("http://example.com",
                        headers={b'Content-Type': b'application/json'},
                        body=resp_body)

    resp2 = cache_mw.process_response(req, resp, spider)
    resp3 = mw.process_response(req, resp2, spider)
    resp3 = cookie_mw.process_response(req, resp3, spider)

    assert resp3.text == "Hello"
    assert resp3.css("body").extract_first() == "Hello"
    assert resp3.data['render_time'] == 0.5

    # second call
    req = _get_req()
    req = cookie_mw.process_request(req, spider) or req
    req = mw.process_request(req, spider)
    cached_resp = cache_mw.process_request(req, spider) or req

    # response should be from cache:
    assert cached_resp.__class__ is TextResponse
    assert cached_resp.body == resp_body
    resp2_1 = cache_mw.process_response(req, cached_resp, spider)
    resp3_1 = mw.process_response(req, resp2_1, spider)
    resp3_1 = cookie_mw.process_response(req, resp3_1, spider)

    assert isinstance(resp3_1, scrapy_splash.SplashJsonResponse)
    assert resp3_1.body == b"Hello"
    assert resp3_1.text == "Hello"
    assert resp3_1.css("body").extract_first() == "Hello"
    assert resp3_1.data['render_time'] == 0.5
    assert resp3_1.headers[b'Content-Type'] == b'text/html; charset=utf-8'

def test_cache_args():
    spider = scrapy.Spider(name='foo')
    mw = _get_mw()
    mw.crawler.spider = spider
    mw.spider_opened(spider)
    dedupe_mw = SplashDeduplicateArgsMiddleware()

    # ========= Send first request - it should use save_args:
    lua_source = 'function main(splash) end'
    req = SplashRequest('http://example.com/foo',
                        endpoint='execute',
                        args={'lua_source': lua_source},
                        cache_args=['lua_source'])

    assert req.meta['splash']['args']['lua_source'] == lua_source
    # <---- spider
    req, = list(dedupe_mw.process_start_requests([req], spider))
    # ----> scheduler
    assert req.meta['splash']['args']['lua_source'] != lua_source
    assert list(mw._argument_values.values()) == [lua_source]
    assert list(mw._argument_values.keys()) == [req.meta['splash']['args']['lua_source']]
    # <---- scheduler
    # process request before sending it to the downloader
    req = mw.process_request(req, spider) or req
    # -----> downloader
    assert req.meta['splash']['args']['lua_source'] == lua_source
    assert req.meta['splash']['args']['save_args'] == ['lua_source']
    assert 'load_args' not in req.meta['splash']['args']
    assert req.meta['splash']['_local_arg_fingerprints'] == {
        'lua_source': list(mw._argument_values.keys())[0]
    }
    # <---- downloader
    resp_body = b'{}'
    resp = TextResponse("http://example.com",
                        headers={
                            b'Content-Type': b'application/json',
                            b'X-Splash-Saved-Arguments': b'lua_source=ba001160ef96fe2a3f938fea9e6762e204a562b3'
                        },
                        body=resp_body)
    resp = mw.process_response(req, resp, None)

    # ============ Send second request - it should use load_args
    req2 = SplashRequest('http://example.com/bar',
                        endpoint='execute',
                        args={'lua_source': lua_source},
                        cache_args=['lua_source'])
    req2, item = list(dedupe_mw.process_spider_output(resp, [req2, {'key': 'value'}], spider))
    assert item == {'key': 'value'}
    # ----> scheduler
    assert req2.meta['splash']['args']['lua_source'] != lua_source
    # <---- scheduler
    # process request before sending it to the downloader
    req2 = mw.process_request(req2, spider) or req2
    # -----> downloader
    assert req2.meta['splash']['args']['load_args'] == {"lua_source": "ba001160ef96fe2a3f938fea9e6762e204a562b3"}
    assert "lua_source" not in req2.meta['splash']['args']
    assert "save_args" not in req2.meta['splash']['args']
    assert json.loads(req2.body.decode('utf8')) == {
        'load_args': {'lua_source': 'ba001160ef96fe2a3f938fea9e6762e204a562b3'},
        'url': 'http://example.com/bar'
    }
    # <---- downloader
    resp = TextResponse("http://example.com/bar",
                        headers={b'Content-Type': b'application/json'},
                        body=b'{}')
    resp = mw.process_response(req, resp, spider)

    # =========== Third request is dispatched to another server where
    # =========== arguments are expired:
    req3 = SplashRequest('http://example.com/baz',
                         endpoint='execute',
                         args={'lua_source': lua_source},
                         cache_args=['lua_source'])
    req3, = list(dedupe_mw.process_spider_output(resp, [req3], spider))
    # ----> scheduler
    assert req3.meta['splash']['args']['lua_source'] != lua_source
    # <---- scheduler
    req3 = mw.process_request(req3, spider) or req3
    # -----> downloader
    assert json.loads(req3.body.decode('utf8')) == {
        'load_args': {'lua_source': 'ba001160ef96fe2a3f938fea9e6762e204a562b3'},
        'url': 'http://example.com/baz'
    }
    # <---- downloader

    resp_body = json.dumps({
        "type": "ExpiredArguments",
        "description": "Arguments stored with ``save_args`` are expired",
        "info": {"expired": ["html"]},
        "error": 498
    })
    resp = TextResponse("127.0.0.1:8050",
                        headers={b'Content-Type': b'application/json'},
                        status=498,
                        body=resp_body.encode('utf8'))
    req4 = mw.process_response(req3, resp, spider)
    assert isinstance(req4, SplashRequest)

    # process this request again
    req4, = list(dedupe_mw.process_spider_output(resp, [req4], spider))
    req4 = mw.process_request(req4, spider) or req4

    # it should become save_args request after all middlewares
    assert json.loads(req4.body.decode('utf8')) == {
        'lua_source': 'function main(splash) end',
        'save_args': ['lua_source'],
        'url': 'http://example.com/baz'
    }
    assert mw._remote_keys == {}

def test_post_request():
    mw = _get_mw()
    for body in [b'', b'foo=bar']:
        req1 = scrapy.Request("http://example.com",
                              method="POST",
                              body=body,
                              meta={'splash': {'endpoint': 'render.html'}})
        req = mw.process_request(req1, None)
        assert json.loads(to_unicode(req.body)) == {
            'url': 'http://example.com',
            'http_method': 'POST',
            'body': to_unicode(body),
        }

def test_override_splash_url():
    mw = _get_mw()
    req1 = scrapy.Request("http://example.com", meta={
        'splash': {
            'endpoint': 'render.png',
            'splash_url': 'http://splash.example.com'
        }
    })
    req = mw.process_request(req1, None)
    assert req.url == 'http://splash.example.com/render.png'
    assert json.loads(to_unicode(req.body)) == {'url': req1.url}

def test_url_with_fragment():
    mw = _get_mw()
    url = "http://example.com#id1"
    req = scrapy.Request("http://example.com", meta={
        'splash': {'args': {'url': url}}
    })
    req = mw.process_request(req, None)
    assert json.loads(to_unicode(req.body)) == {'url': url}

def test_splash_request_url_with_fragment():
    mw = _get_mw()
    url = "http://example.com#id1"
    req = SplashRequest(url)
    req = mw.process_request(req, None)
    assert json.loads(to_unicode(req.body)) == {'url': url}

def test_float_wait_arg():
    mw = _get_mw()
    req1 = scrapy.Request("http://example.com", meta={
        'splash': {
            'endpoint': 'render.html',
            'args': {'wait': 0.5}
        }
    })
    req = mw.process_request(req1, None)
    assert json.loads(to_unicode(req.body)) == {'url': req1.url, 'wait': 0.5}

def test_slot_policy_single_slot():
    mw = _get_mw()
    meta = {'splash': {
        'slot_policy': scrapy_splash.SlotPolicy.SINGLE_SLOT
    }}

    req1 = scrapy.Request("http://example.com/path?key=value", meta=meta)
    req1 = mw.process_request(req1, None)

    req2 = scrapy.Request("http://fooexample.com/path?key=value", meta=meta)
    req2 = mw.process_request(req2, None)

    assert req1.meta.get('download_slot')
    assert req1.meta['download_slot'] == req2.meta['download_slot']

def test_slot_policy_per_domain():
    mw = _get_mw()
    meta = {'splash': {
        'slot_policy': scrapy_splash.SlotPolicy.PER_DOMAIN
    }}

    req1 = scrapy.Request("http://example.com/path?key=value", meta=meta)
    req1 = mw.process_request(req1, None)

    req2 = scrapy.Request("http://example.com/path2", meta=meta)
    req2 = mw.process_request(req2, None)

    req3 = scrapy.Request("http://fooexample.com/path?key=value", meta=meta)
    req3 = mw.process_request(req3, None)

    assert req1.meta.get('download_slot')
    assert req3.meta.get('download_slot')

    assert req1.meta['download_slot'] == req2.meta['download_slot']
    assert req1.meta['download_slot'] != req3.meta['download_slot']

def test_slot_policy_scrapy_default():
    mw = _get_mw()
    req = scrapy.Request("http://example.com", meta = {'splash': {
        'slot_policy': scrapy_splash.SlotPolicy.SCRAPY_DEFAULT
    }})
    req = mw.process_request(req, None)
    assert 'download_slot' not in req.meta

def test_adjust_timeout():
    mw = _get_mw()
    req1 = scrapy.Request("http://example.com", meta = {
        'splash': {'args': {'timeout': 60, 'html': 1}},

        # download_timeout is always present,
        # it is set by DownloadTimeoutMiddleware
        'download_timeout': 30,
    })
    req1 = mw.process_request(req1, None)
    assert req1.meta['download_timeout'] > 60

    req2 = scrapy.Request("http://example.com", meta = {
        'splash': {'args': {'html': 1}},
        'download_timeout': 30,
    })
    req2 = mw.process_request(req2, None)
    assert req2.meta['download_timeout'] == 30


text:
.class public final Landroid/R$integer;
.super Ljava/lang/Object;
.source "R.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/R;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = "integer"
.end annotation

# static fields
.field public static final config_longAnimTime:I = 0x10e0002

.field public static final config_mediumAnimTime:I = 0x10e0001

.field public static final config_shortAnimTime:I = 0x10e0000

.field public static final status_bar_notification_info_maxnum:I = 0x10e0003

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 10686
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


text:
var Input = require('/lib/form-builder/model/input');
var InputMapper = require('/lib/form-builder/mapper/input-mapper');

exports.map = function(inputConfig) {
  return InputMapper.map(inputConfig)
    .setPlaceholder(inputConfig.data.placeholder);
};


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';

class Square extends Component {
	render() {
		let fillColor = this.props.light ? this.props.lightSquareColor : this.props.darkSquareColor;
		return (
			<rect
				fill={fillColor}
				height={this.props.squareSize}
				stroke="black"
				strokeWidth="1"
				width={this.props.squareSize}
				x={this.props.x}
				y={this.props.y}
			/>
		);
	}
}

Square.propTypes = {
	darkSquareColor: PropTypes.string.isRequired,
	light: PropTypes.bool.isRequired,
	lightSquareColor: PropTypes.string.isRequired,
	squareSize: PropTypes.number.isRequired,
	x: PropTypes.number.isRequired,
	y: PropTypes.number.isRequired,
};
Square.displayName = 'Square';

class SquareHighlight extends Component {
	render() {
		return <rect x={this.props.x} y={this.props.y} width={this.props.squareSize} height={this.props.squareSize} stroke={this.props.highlightColor} fill="none" strokeWidth="3" />;
	}
}

SquareHighlight.propTypes = {
	highlightColor: PropTypes.string.isRequired,
	squareSize: PropTypes.number.isRequired,
	x: PropTypes.number.isRequired,
	y: PropTypes.number.isRequired,
};

SquareHighlight.defaultProps = {
	highlightColor: 'yellow'
};

class RankLabels extends Component {

	_fileRankToCoords(file, rank) { // convert zero-based file and rank values to coordinates
		if(this.props.flip) {
			let	x = this.props.squareSize * (this.props.files - file);
			let y = this.props.squareSize * rank;
			return [x,y];
		} else {
			let	x = this.props.squareSize * (1 + file);
			let y = this.props.squareSize * (this.props.ranks - rank -1);
			return [x,y];
		}
	}

	render() {

		let rankLabels = [];
		for (let rank=0; rank < this.props.ranks; rank++) {
			let y0 = this.props.flip ? rank : this.props.ranks - rank -1;
			rankLabels.push({y: this.props.squareSize / 2 + y0 * this.props.squareSize, label: rank + 1});
		}

		return (
			<g>
				{rankLabels.map((rankLabel, i) =>
					<text x={this.props.squareSize / 2} y={rankLabel.y} key={i} fontFamily="Verdana" fontSize={this.props.squareSize / 3} textAnchor="middle">
						{rankLabel.label}
					</text>)}
			</g>
		);
	}
}

class FileLabels extends Component {

	render() {

		let fileLabels = [];
		for (let file=0; file < this.props.files; file++) {
			let x0 = this.props.flip ? this.props.files - file : 1 + file;
			fileLabels.push({x: this.props.squareSize / 2 + x0 * this.props.squareSize, label: String.fromCharCode(97 + file)});
		}

		return (
			<g>
				{fileLabels.map((fileLabel, i) =>
					<text x={fileLabel.x} y={this.props.squareSize / 2 + this.props.ranks * this.props.squareSize} key={i} fontFamily="Verdana" fontSize={this.props.squareSize / 3} textAnchor="middle">
						{fileLabel.label}
					</text>)}
			</g>
		);
	}
}

const LabelPropTypes = {
	files: PropTypes.number,
	flip: PropTypes.bool.isRequired,
	ranks: PropTypes.number,
	squareSize: PropTypes.number.isRequired,
};

RankLabels.propTypes = LabelPropTypes;
FileLabels.propTypes = LabelPropTypes;

/** Board : draws a chess board with given square size, square colors, and number of files and ranks */
class Board extends Component {

		// coordinate conversion functions ////

	_squareToCoords(square) { // convert a square name (eg 'e4') to coordinates
		if(this.props.flip) {
			let x = this.props.squareSize * (this.props.files - (square.toLowerCase().charCodeAt(0)-97));
			let y = (Number(square.slice(1))-1) * this.props.squareSize;
			return [x,y];
		} else {
			let x = this.props.squareSize * (1 + square.toLowerCase().charCodeAt(0)-97);
			let y = (this.props.ranks-Number(square.slice(1))) * this.props.squareSize;
			return [x,y];
		}
	}

	_fileRankToCoords(file, rank) { // convert zero-based file and rank values to coordinates
		if(this.props.flip) {
			let	x = this.props.squareSize * (this.props.files - file);
			let y = this.props.squareSize * rank;
			return [x,y];
		} else {
			let	x = this.props.squareSize * (1 + file);
			let y = this.props.squareSize * (this.props.ranks - rank -1);
			return [x,y];
		}
	}

	// 0-based index to algebraic notation (0 == 'a1', 1 == 'a2', ... 63 == 'h8' on an 8x8)
	_indexToSquare(index) {
		const file = "abcdefghijklmno"[Math.floor(index / this.props.files)];
		const rank = (index % this.props.files) + 1;
		return file + rank;
	}

	shouldComponentUpdate(nextProps) {
		return ( // note: put most likely changes towards the top ...
			nextProps.selectedSquare !== this.props.selectedSquare ||
			nextProps.flip !== this.props.flip ||
			nextProps.squareSize !== this.props.squareSize ||
			nextProps.lightSquareColor !== this.props.lightSquareColor ||
			nextProps.darkSquareColor !== this.props.darkSquareColor ||
			nextProps.ranks !== this.props.ranks ||
			nextProps.files !== this.props.files
		);
	}

	// the render() function

	render() {
		let squares = [];

		// push coordinates into array
		for (let file=0; file < this.props.files; file++){
			for (let rank=0; rank < this.props.ranks; rank++) {
				let [x,y] = this._fileRankToCoords(file, rank);
				squares.push({x: x, y: y, light: (file ^ rank) & 1});
			}
		}
		return (

			<svg>
				{squares.map((square,i) =>
					<Square
						id={this._indexToSquare(i)}
						square={this._indexToSquare(i)}
						x={square.x} y={square.y} key={i} light={!!square.light} squareSize={this.props.squareSize}
						lightSquareColor={this.props.lightSquareColor} darkSquareColor={this.props.darkSquareColor}
					/>
				)}

				<RankLabels ranks={this.props.ranks} files={this.props.files} squareSize={this.props.squareSize} flip={this.props.flip}/>
				<FileLabels ranks={this.props.ranks} files={this.props.files} squareSize={this.props.squareSize} flip={this.props.flip}/>
				{Object.keys(this.props.highlights).map(square => {
					const [x, y] = this._squareToCoords(square);
					return (
						<SquareHighlight
							key={square}
							highlightColor={this.props.highlights[square]}
							squareSize={this.props.squareSize}
							x={x}
							y={y}
						/>);
				})}
			</svg>
		);
	}
}

Board.propTypes = {
	darkSquareColor: PropTypes.string.isRequired,
	files: PropTypes.number.isRequired,
	flip: PropTypes.bool.isRequired,
	highlights: PropTypes.object,
	lightSquareColor: PropTypes.string.isRequired,
	ranks: PropTypes.number.isRequired,
	selectedSquare: PropTypes.string,
	squareSize: PropTypes.number.isRequired,
};

Board.defaultProps = {
	darkSquareColor:  "#005EBB",
	files: 8,
	flip: false,
	highlights: {},
	lightSquareColor: "#2492FF",
	ranks: 8,
	squareSize: 45,
};

export default Board;


text:
/**
 * @provides phabricator-action-list-view-css
 */

.device-desktop .phabricator-action-list-view {
  font-size: 12px;
}

.phuix-dropdown-menu .phabricator-action-list-view {
  font-size: 13px;
}

.device .phabricator-action-list-view {
  padding: 4px 0;
  display: none;
}

.device .phuix-dropdown-menu .phabricator-action-list-view {
  /* When an action list view appears inside a dropdown menu, don't hide it
     by default. */
  display: block;
}

.device .phabricator-action-list-view.phabricator-action-list-toggle {
  display: block;
}

.device .phui-property-list-view
  .phabricator-action-view button.phabricator-action-view-item,
.device .phui-property-list-view .phabricator-action-view-item {
  font-size: 14px;
  line-height: 22px;
  padding-bottom: 4px;
  border-bottom: 1px solid {$thinblueborder};
  padding-left: 30px;
}

.device .phui-property-list-actions .phabricator-action-view .phui-icon-view {
  font-size: 14px;
  line-height: 18px;
}

.phabricator-action-view {
  position: relative;
}

.phabricator-action-view button.phabricator-action-view-item {
  border: none;
  background: transparent;
  box-shadow: none;
  outline: 0;
  padding: 0;
  margin: 0;
  font-weight: normal;
  width: 100%;
  text-align: left;
  text-shadow: none;

  border-radius: 0;
  color: #18559D;
  font: inherit;
  display: inline;
  min-width: 0;
}

.phabricator-action-view button.phabricator-action-view-item,
.phabricator-action-view-item {
  padding: 3px 4px 3px 28px;
  line-height: 18px;
  display: block;
  text-decoration: none;
  color: {$darkgreytext};
}

.phabricator-action-view-icon {
  width: 14px;
  height: 14px;
  position: absolute;
  top: 5px;
  left: 9px;
  font-size: 13px;
}

.device-desktop .phabricator-action-view:hover .phabricator-action-view-item {
  text-decoration: none;
  background-color: {$sky};
  color: #fff;
}

.device-desktop .phabricator-action-view:hover .phabricator-action-view-icon {
  color: #fff;
}

.phabricator-action-view-disabled .phabricator-action-view-item,
.phabricator-action-view-disabled button.phabricator-action-view-item {
  color: {$lightgreytext};
}

.phabricator-action-view-selected {
  border-left: 3px solid {$sky};
  background: {$hoverblue};
}

.phabricator-action-view-selected .phabricator-action-view-item {
  padding-left: 25px;
}

.phabricator-action-view-selected .phabricator-action-view-icon {
  left: 6px;
}

.phabricator-action-view button[disabled] {
  opacity: 1.0;
}

.device-desktop .phabricator-action-view-disabled:hover
  .phabricator-action-view-item,
.device-desktop .phabricator-action-view-disabled:hover
  button.phabricator-action-view-item,
.device-desktop .phabricator-action-view-disabled:hover
  .phabricator-action-view-icon,
.device-desktop .phabricator-action-view-disabled:hover
  button.phabricator-action-view-icon {
  background-color: {$greybackground};
  color: {$lightgreytext};
}


text:
import {Issue} from "../issue";
import {IFile} from "../files/_ifile";

export interface IIncludeGraph {
  getIssues(): Issue[];
  listMainForInclude(filename: string): string[];
  getIssuesFile(file: IFile): Issue[]
}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = softmax;

var _ndarrayOps = require('ndarray-ops');

var _ndarrayOps2 = _interopRequireDefault(_ndarrayOps);

var _cwise = require('cwise');

var _cwise2 = _interopRequireDefault(_cwise);

var _Tensor = require('../Tensor');

var _Tensor2 = _interopRequireDefault(_Tensor);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Softmax activation function. In-place operation.
 * @param {Tensor} x
 * @returns {Tensor} `this`
 */
function softmax(x) {
  if (x.tensor.shape.length === 1) {
    var maxval = _ndarrayOps2.default.sup(x.tensor);
    _ndarrayOps2.default.subseq(x.tensor, maxval);
    _ndarrayOps2.default.expeq(x.tensor);
    var sum = _ndarrayOps2.default.sum(x.tensor);
    _ndarrayOps2.default.divseq(x.tensor, sum);
  } else if (x.tensor.shape.length === 2) {
    for (var i = 0; i < x.tensor.shape[0]; i++) {
      var _maxval = _ndarrayOps2.default.sup(x.tensor.pick(i, null));
      _ndarrayOps2.default.subseq(x.tensor.pick(i, null), _maxval);
      _ndarrayOps2.default.expeq(x.tensor.pick(i, null));
      var _sum = _ndarrayOps2.default.sum(x.tensor.pick(i, null));
      _ndarrayOps2.default.divseq(x.tensor.pick(i, null), _sum);
    }
  } else {
    throw new Error(`[activations.softmax] tensor shape ${x.tensor.shape} not supported.`);
  }
  return this;
}


text:
{% extends '../default.html' %}
{%
set page = {
	tag: 'panel',
	root: 'admin',
}
%}

{% block head %}
{% parent %}

	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
	<link rel="stylesheet" href="{{ assetUrl('css/bundle.css') }}">
	<link rel="stylesheet" href='http://fonts.googleapis.com/css?family=Lora:400,400italic,700|PT+Serif:400,400i,700,700i'>
{% endblock %}

{% block body %}

	{% block preBody %}{% endblock %}

				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
					Toggle navigation

				</button>
				QI Labs · Admin

						Logado como {{ user.name }}

Sair do Painel

Logout

R&D (News and Feature Logs)

			{{ worklog }}

Invitations

{% endblock %}


text:
<?php

namespace JMS\SecurityExtraBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Collects after invocation providers.
 *
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 */
class AddAfterInvocationProvidersPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('security.access.after_invocation_manager')) {
            return;
        }

        $providers = array();
        foreach (array_keys($container->findTaggedServiceIds('security.after_invocation.provider')) as $id) {
            if ('security.access.after_invocation.acl_provider' === $id && !$container->has('security.acl.provider')) {
                continue;
            }

            $providers[] = new Reference($id);
        }

        $container
            ->getDefinition('security.access.after_invocation_manager')
            ->setArguments(array($providers))
        ;
    }
}


text:
using namespace px;

const glm::mat4 Item::IDENTITY_MODEL_MAT;
const Light Item::LIGHT_STUB{};
const glm::vec3 Item::X_AXIS(1.f, 0.f, 0.f);
const glm::vec3 Item::Y_AXIS(0.f, 1.f, 0.f);
const glm::vec3 Item::Z_AXIS(0.f, 0.f, 1.f);

std::vector<ItemInfo> Item::_items;
std::vector<ItemGenFn> Item::_item_gen_fn;

static std::shared_ptr<Item> emptyItemGenFn()
{
    return nullptr;
}

ItemInfo::ItemInfo(std::string const &name, std::string const &description,
                   int weight, bool stackable, bool collectible, bool placeable)
    : name(name), description(description), weight(weight),
      stackable(stackable), collectible(collectible), placeable(placeable)
{}

std::size_t Item::reg(ItemInfo &item, ItemGenFn fn)
{
    auto s = _items.size();
    if (s == 0)
    {
        _items.reserve(ITEM_REGISTER_CAPACITY);
        _item_gen_fn.reserve(ITEM_REGISTER_CAPACITY);
        _items.push_back(ItemInfo("", "", 0, false, false, false));
        _items.back()._id = 0;
        _item_gen_fn.push_back(emptyItemGenFn);
        ++s;
    }
    item._id = s;
    _items.push_back(item);
    _item_gen_fn.push_back(fn);
    return s;
}

ItemInfo const &Item::lookup(std::size_t const &index)
{
    if (_items.size() > index)
        return _items[index];
    else
        return _items[0];
}

std::shared_ptr<Item> Item::gen(std::size_t const &index)
{
    if (_items.size() > index)
        return _item_gen_fn[index]();
    else
        return nullptr;
}

Item::Item(std::size_t id)
    : attribute(Item::lookup(id))
{
    if (id == 0)
        err("Invalid Item id");
}

[[noreturn]]
void Item::err(std::string const &msg)
{
    throw ItemError(msg);
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<build>
  <actions>
    <hudson.model.CauseAction>
      <causes>
        <hudson.model.Cause_-UserIdCause/>
      </causes>
    </hudson.model.CauseAction>
    <org.jenkinsci.plugins.linenumbers.BuildStepAction plugin="linenumbers@1.1">
      <buildStep>3</buildStep>
    </org.jenkinsci.plugins.linenumbers.BuildStepAction>
    <hudson.plugins.claim.ClaimBuildAction plugin="claim@2.8-SNAPSHOT">
      <claimed>true</claimed>
      <claimedBy>guest</claimedBy>
      <assignedBy>guest</assignedBy>
      <claimDate>2015-05-21 04:14:53.518 UTC</claimDate>
      <transientClaim>false</transientClaim>
      <owner class="build" reference="../../.."/>
      <reason>HW</reason>
    </hudson.plugins.claim.ClaimBuildAction>
    <com.sonyericsson.jenkins.plugins.bfa.model.FailureCauseBuildAction plugin="build-failure-analyzer@1.13.0">
      <foundFailureCauses class="java.util.Collections$SynchronizedList" serialization="custom">
        <java.util.Collections_-SynchronizedCollection>
          <default>
            <c class="linked-list"/>
            <mutex class="java.util.Collections$SynchronizedList" reference="../../.."/>
          </default>
        </java.util.Collections_-SynchronizedCollection>
        <java.util.Collections_-SynchronizedList>
          <default>
            <list class="linked-list" reference="../../../java.util.Collections_-SynchronizedCollection/default/c"/>
          </default>
        </java.util.Collections_-SynchronizedList>
      </foundFailureCauses>
      <build class="build" reference="../../.."/>
    </com.sonyericsson.jenkins.plugins.bfa.model.FailureCauseBuildAction>
  </actions>
  <queueId>2</queueId>
  <timestamp>1432181674912</timestamp>
  <startTime>1432181674913</startTime>
  <result>FAILURE</result>
  <duration>27</duration>
  <charset>US-ASCII</charset>
  <keepLog>false</keepLog>
  <builtOn></builtOn>
  <workspace>/opt/jenkins/data/jobs/smx-demo2/workspace</workspace>
  <hudsonVersion>1.613</hudsonVersion>
  <scm class="hudson.scm.NullChangeLogParser"/>
  <culprits class="com.google.common.collect.EmptyImmutableSortedSet"/>
</build>