text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):

        # Adding model 'Milestone'
        db.create_table(u'medtrics_milestone', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=60, null=True, blank=True)),
        ))
        db.send_create_signal(u'medtrics', ['Milestone'])

        # Adding model 'MedForm'
        db.create_table(u'medtrics_medform', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=60)),
        ))
        db.send_create_signal(u'medtrics', ['MedForm'])

        # Adding model 'FormSubmission'
        db.create_table(u'medtrics_formsubmission', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='submissions', null=True, to=orm['auth.User'])),
            ('form', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='submissions', null=True, to=orm['medtrics.MedForm'])),
            ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
        ))
        db.send_create_signal(u'medtrics', ['FormSubmission'])

        # Adding model 'Section'
        db.create_table(u'medtrics_section', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('order', self.gf('django.db.models.fields.PositiveIntegerField')()),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=50)),
            ('description', self.gf('django.db.models.fields.TextField')(max_length=300, null=True, blank=True)),
            ('medform', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='sections', null=True, to=orm['medtrics.MedForm'])),
        ))
        db.send_create_signal(u'medtrics', ['Section'])

        # Adding model 'Question'
        db.create_table(u'medtrics_question', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('order', self.gf('django.db.models.fields.PositiveIntegerField')()),
            ('question', self.gf('django.db.models.fields.CharField')(max_length=200)),
            ('choices', self.gf('django.db.models.fields.CharField')(max_length=500, null=True, blank=True)),
            ('answer_type', self.gf('django.db.models.fields.CharField')(max_length=6)),
            ('max_length', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
            ('section', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='questions', null=True, to=orm['medtrics.Section'])),
        ))
        db.send_create_signal(u'medtrics', ['Question'])

        # Adding unique constraint on 'Question', fields ['section', 'order']
        db.create_unique(u'medtrics_question', ['section_id', 'order'])

        # Adding M2M table for field milestone on 'Question'
        db.create_table(u'medtrics_question_milestone', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('question', models.ForeignKey(orm[u'medtrics.question'], null=False)),
            ('milestone', models.ForeignKey(orm[u'medtrics.milestone'], null=False))
        ))
        db.create_unique(u'medtrics_question_milestone', ['question_id', 'milestone_id'])

        # Adding model 'Answer'
        db.create_table(u'medtrics_answer', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('answer', self.gf('django.db.models.fields.CharField')(max_length=300, null=True, blank=True)),
            ('text_answer', self.gf('django.db.models.fields.TextField')(max_length=3000, null=True, blank=True)),
            ('num_answer', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
            ('question', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='answers', null=True, to=orm['medtrics.Question'])),
            ('submission', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='answers', null=True, to=orm['medtrics.FormSubmission'])),
        ))
        db.send_create_signal(u'medtrics', ['Answer'])

    def backwards(self, orm):

        # Removing unique constraint on 'Question', fields ['section', 'order']
        db.delete_unique(u'medtrics_question', ['section_id', 'order'])

        # Deleting model 'Milestone'
        db.delete_table(u'medtrics_milestone')

        # Deleting model 'MedForm'
        db.delete_table(u'medtrics_medform')

        # Deleting model 'FormSubmission'
        db.delete_table(u'medtrics_formsubmission')

        # Deleting model 'Section'
        db.delete_table(u'medtrics_section')

        # Deleting model 'Question'
        db.delete_table(u'medtrics_question')

        # Removing M2M table for field milestone on 'Question'
        db.delete_table('medtrics_question_milestone')

        # Deleting model 'Answer'
        db.delete_table(u'medtrics_answer')

    models = {
        u'auth.group': {
            'Meta': {'object_name': 'Group'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        u'auth.permission': {
            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        u'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 3, 15, 11, 25, 41, 175631)'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 3, 15, 11, 25, 41, 174877)'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        u'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        u'medtrics.answer': {
            'Meta': {'ordering': "['question__section__order', 'question__order']", 'object_name': 'Answer'},
            'answer': ('django.db.models.fields.CharField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'num_answer': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'question': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'answers'", 'null': 'True', 'to': u"orm['medtrics.Question']"}),
            'submission': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'answers'", 'null': 'True', 'to': u"orm['medtrics.FormSubmission']"}),
            'text_answer': ('django.db.models.fields.TextField', [], {'max_length': '3000', 'null': 'True', 'blank': 'True'})
        },
        u'medtrics.formsubmission': {
            'Meta': {'ordering': "['user', 'created']", 'object_name': 'FormSubmission'},
            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'form': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submissions'", 'null': 'True', 'to': u"orm['medtrics.MedForm']"}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'submissions'", 'null': 'True', 'to': u"orm['auth.User']"})
        },
        u'medtrics.medform': {
            'Meta': {'object_name': 'MedForm'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'})
        },
        u'medtrics.milestone': {
            'Meta': {'object_name': 'Milestone'},
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'})
        },
        u'medtrics.question': {
            'Meta': {'unique_together': "[['section', 'order']]", 'object_name': 'Question'},
            'answer_type': ('django.db.models.fields.CharField', [], {'max_length': '6'}),
            'choices': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'max_length': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'milestone': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['medtrics.Milestone']", 'null': 'True', 'blank': 'True'}),
            'order': ('django.db.models.fields.PositiveIntegerField', [], {}),
            'question': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
            'section': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'questions'", 'null': 'True', 'to': u"orm['medtrics.Section']"})
        },
        u'medtrics.section': {
            'Meta': {'ordering': "('order',)", 'object_name': 'Section'},
            'description': ('django.db.models.fields.TextField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'medform': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'sections'", 'null': 'True', 'to': u"orm['medtrics.MedForm']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
            'order': ('django.db.models.fields.PositiveIntegerField', [], {})
        }
    }

    complete_apps = ['medtrics']


text:
[code.fireboltjs.com](https://code.fireboltjs.com/)
===================================================

Website for distributing [Firebolt](https://github.com/woollybogger/Firebolt) releases

[![devDependency Status](https://david-dm.org/woollybogger/code.fireboltjs.com/dev-status.svg)](https://david-dm.org/woollybogger/code.fireboltjs.com#info=devDependencies)

redpajama_set_name: RedPajamaGithub


text:
require 'test_helper'
require 'piwik_tracker/piwik'

module PiwikTracker
  class PiwikTest < Test::Unit::TestCase

    # piwik = Piwik.new('http://yoursite.com/piwik', 6)
    # piwik.request(auth_token).
    #   url('http://yoursite.com/some-page.html').
    #   custom_variable(:foobar, 'value').
    #   track_page_view('Page Title')
    def setup
      @piwik = Piwik.new ENV['piwik'], ENV['site']
      @piwik.debug = true
      @request = @piwik.request(ENV['auth'])
    end

    test "should track pageview" do
      assert resp = @request.url('http://test.com/track_pageview').track_pageview( 'somwhere' )
      pp resp
    end

    test "should track action" do
      assert r = @request.url('http://test.com/track_action').track_action( 'http://targetsite.com/test.html', 'link' )
      pp r
    end

    test "should track goal" do
      assert r = @request.url('http://test.com/track_goal').track_goal( 1, 99 )
      pp r
    end

  end
end


text:
package org.vinesrobotics.bot.utils.curves;

public class ExponentialCurve extends CurveBase {
    private double base = 0;

    public ExponentialCurve(double base) {
        this.base = base;
    }
    @Override
    public double getValue(double x) {
        return Math.pow(base,x);
    }
}


text:
package org.drools.workbench.screens.testscenario.client;

public interface RuleSelectionEvent {
    void ruleSelected(String name);
}


text:
#ifndef SimTK_CPODES_NVECTOR_SimTK_H_
#define SimTK_CPODES_NVECTOR_SimTK_H_

/** @file
 * This header defines a Sundials N_Vector implementation which uses
 * SimTK's Vector class internally.
 */

#include "SimTKcommon.h"
#include "simmath/internal/common.h"

#include "sundials/sundials_nvector.h"

#include <cassert>

using SimTK::Vector;

// This is the object to which the generic N_Vector struct's "content"
// entry points.
class N_VectorContent_SimTK {
public:
    N_VectorContent_SimTK()
      : treatAsConst(false), ownVector(true), data(new Vector()) {
    }

    N_VectorContent_SimTK(const Vector& v)
      : treatAsConst(true), ownVector(false),
        data(const_cast<Vector*>(&v)) {
    }

    N_VectorContent_SimTK(Vector& v)
      : treatAsConst(false), ownVector(false), data(&v) {
    }

    // Copy constructor makes a deep (new) copy.
    N_VectorContent_SimTK(const N_VectorContent_SimTK& nv)
      : treatAsConst(false), ownVector(true), data(new Vector(*nv.data)) {
    }

    // Assignment fails if target is const, otherwise reallocates as needed.
    N_VectorContent_SimTK& operator=(const N_VectorContent_SimTK& nv) {
        if (&nv != this) {
            assert(!treatAsConst);
            *data = *nv.data;
        }
        return *this;
    }

    ~N_VectorContent_SimTK() {
        if (ownVector) delete data;
        data = 0;
    }

    const Vector& getVector() const {
        assert(data);
        return *data;
    }

    Vector& updVector() {
        assert(data);
        assert(!treatAsConst);
        return *data;
    }

private:
    bool treatAsConst;  // is this logically const?
    bool ownVector;     // if true, destruct Vector along with this
    Vector* data;

};

// This singleton class defines the operations needed by the abstract
// N_Vector in terms of operations performed on SimTK Vectors.
// The "virtual function table" is filled in once and used
// in *all* N_Vector_SimTK objects.
class N_Vector_Ops_SimTK : public _generic_N_Vector_Ops {
public:
    // Return a reference to the singleton object. You can use
    // the address of this reference to check whether a given N_Vector
    // is really an N_Vector_SimTK.
    static const _generic_N_Vector_Ops& getOps() {
        return Ops;
    }

    // Sundials isn't const correct so it is going to want a
    // non-const pointer to the Ops class here, which is const.
    // We'll just have to trust it.
    static _generic_N_Vector_Ops* getSundialsOpsPtr() {
        return const_cast<N_Vector_Ops_SimTK*>(&Ops);
    }

private:
    N_Vector_Ops_SimTK(); // initialize
    SUNDIALS_EXPORT static const N_Vector_Ops_SimTK Ops;
};

// This is the object to which an N_Vector points when we are using
// SimTK's N_Vector implementation.
class N_Vector_SimTK : public _generic_N_Vector {
public:
    // Default constructor creates an owned, empty, resizable vector.
    N_Vector_SimTK() {
        content = (void*)new N_VectorContent_SimTK();
        ops = N_Vector_Ops_SimTK::getSundialsOpsPtr();
    }

    // This constructor produces a read-only *reference* to an existing Vector.
    // Destruction of the N_Vector_SimTK leaves the original Vector as it was.
    N_Vector_SimTK(const Vector& v) {
       content = (void*)new N_VectorContent_SimTK(v);
       ops = N_Vector_Ops_SimTK::getSundialsOpsPtr();
    }

    // This constructor produces a writable *reference* to an existing
    // Vector. Destruction of the N_Vector_SimTK leaves the original
    // Vector in existence, although its value may have changed.
    N_Vector_SimTK(Vector& v) {
       content = (void*)new N_VectorContent_SimTK(v);
       ops = N_Vector_Ops_SimTK::getSundialsOpsPtr();
    }

    // Copy constructor makes a deep copy. The result will be an owned,
    // resizable vector that will evaporate upon destruction of the
    // N_Vector_SimTK object.
    N_Vector_SimTK(const N_Vector_SimTK& nv) {
        assert(nv.ops == &N_Vector_Ops_SimTK::getOps());
        content = (void*)new N_VectorContent_SimTK(nv.getContent());
        ops = N_Vector_Ops_SimTK::getSundialsOpsPtr();
    }

    // Assignment will fail if this isn't writable.
    N_Vector_SimTK& operator=(const N_Vector_SimTK& nv) {
        assert(   ops    == &N_Vector_Ops_SimTK::getOps()
               && nv.ops == &N_Vector_Ops_SimTK::getOps());
        if (&nv != this)
            updContent() = nv.getContent();
        return *this;
    }

    ~N_Vector_SimTK() {
        assert(ops == &N_Vector_Ops_SimTK::getOps());
        delete reinterpret_cast<N_VectorContent_SimTK*>(content);
        content = 0;
        ops = 0;
    }

    static bool isA(const N_Vector nv) {
        return nv && (nv->ops == &N_Vector_Ops_SimTK::getOps());
    }

    static const N_Vector_SimTK* downcast(const N_Vector nv) {
        assert(isA(nv));
        return reinterpret_cast<const N_Vector_SimTK*>(nv);
    }

    static N_Vector_SimTK* updDowncast(N_Vector nv) {
        assert(isA(nv));
        return reinterpret_cast<N_Vector_SimTK*>(nv);
    }

    static N_Vector_SimTK* nvclone(const N_Vector nv) {
        assert(isA(nv));
        const N_Vector_SimTK& nvs = *reinterpret_cast<const N_Vector_SimTK*>(nv);
        return new N_Vector_SimTK(nvs);
    }

    static const Vector& getVector(const N_Vector nv) {
        assert(isA(nv));
        const N_Vector_SimTK& nvs = *reinterpret_cast<const N_Vector_SimTK*>(nv);
        return nvs.getContent().getVector();
    }

    static Vector& updVector(N_Vector nv) {
        assert(isA(nv));
        N_Vector_SimTK& nvs = *reinterpret_cast<N_Vector_SimTK*>(nv);
        return nvs.updContent().updVector();
    }

private:
    const N_VectorContent_SimTK& getContent() const {
        return *reinterpret_cast<const N_VectorContent_SimTK*>(content);
    }
    N_VectorContent_SimTK& updContent() {
        return *reinterpret_cast<N_VectorContent_SimTK*>(content);
    }

};

#endif // SimTK_NVECTOR_SimTK_H_


text:
<?php
namespace inklabs\kommerce\EntityDTO;

class OptionProductDTO
{
    use IdDTOTrait, TimeDTOTrait;

    /** @var int */
    public $sortOrder;

    /** @var ProductDTO */
    public $product;

    /** @var OptionDTO */
    public $option;
}


text:
import {Controller} from "../core/controller";
import {User} from "./user.model";
import {UserQuery} from "./user.query";

export interface UserController extends Controller<User, UserQuery> {}


text:
extern CInstructionTable *g_pInstructionTable;
extern CStructTable* g_pStructTable;
extern CLabelTable* g_pLabelTable;
extern CVarTable* g_pVarTable;

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CStatementList::CStatementList()
{
	// Reference Vars
	m_pFileData=NULL;
	m_pFileDataEnd=NULL;
	m_pFileDataPointer=NULL;
	m_FileDataSize=0;

	m_dwLastCharInDataPosition=0;
	m_dwTokenLineNumber=0;
	m_dwLineNumber=0;
	m_dwTempVariableIndex=0;

	m_dwVarOffsetCounter=0;
	m_pCurrentUserFunctionName.SetText("");
	m_pCurrentUserFunctionDecChain=NULL;

	m_dwDataIndexCounter=0;
	m_dwStringIndexCounter=0;

	m_dwDLLIndexCounter=0;
	m_dwCommandIndexCounter=0;

	m_dwLabelIndexCounter=0;
	m_dwLabelQtyCounter=0;
	m_dwVarQtyCounter=0;

	m_pInstructionRef=NULL;
	m_dwInstructionType=0;
	m_dwInstructionValue=0;
	m_dwInstructionParamMax=0;

	m_bParseVariableAdds=false;
	m_bParseImplementation=false;
	m_bDisableParsingToCR=false;
	m_bDisableParsingFull=false;
	m_bPermitLabelAsValue=false;

	m_dwLastLineNumber=0;

	m_pLatestLoopExitLabelRef=NULL;//ref only

	m_pPreScanStatements=NULL;
	m_pProgramStatements=NULL;
	m_pMiniStatements=NULL;
}

CStatementList::~CStatementList()
{
	// FileData Pointers are REFERENCE POINTERS
	if(m_pPreScanStatements)
	{
		m_pPreScanStatements->Free();
		m_pPreScanStatements=NULL;
	}
	if(m_pProgramStatements)
	{
		m_pProgramStatements->Free();
		m_pProgramStatements=NULL;
	}
	if(m_pMiniStatements)
	{
		m_pMiniStatements->Free();
		m_pMiniStatements=NULL;
	}
}

void CStatementList::UpdateLineDBMData(CStatement* pStatementAt)
{
	// Add DBM position data to label information
	DWORD dwBytePositionOfLastInstruction=g_pASMWriter->GetBytePosOfLastInstruction();
	g_pLabelTable->UpdateDataIndexOfLabelsAtLine(pStatementAt, dwBytePositionOfLastInstruction);

	// For reference only (the writedbm error uses it to catch unknown local structures)
	m_pRefStatementDuringWrite = pStatementAt;
}

void CStatementList::SetLineNumber(DWORD line)
{
	// New Line
	m_dwLineNumber=line;
}

void CStatementList::IncLineNumber(void)
{
	// New Line
	m_dwLineNumber++;
}

bool CStatementList::MakeStatements(LPSTR pData, DWORD Size)
{
	// Init Pointers and Vars
	m_pFileData=pData;
	m_pFileDataEnd=(pData+Size)-1;
	m_FileDataSize=Size;

	// Place pointer to start of File Data
	ResetParserPointers();

	// Initialise prior to parsing
	SetLabelQtyCounter(0);
	SetVarQtyCounter(0);
	g_pVarTable->SetVarDefaults();

	// Create first statement
	SAFE_DELETE(m_pPreScanStatements);
	SAFE_DELETE(m_pProgramStatements);
	m_pPreScanStatements = new CStatement;
	m_pProgramStatements = new CStatement;

	// PreScan (handles recording of user function names, labels, data, etc)
	m_iNestCount = 0;
	SetImplementationParse(false);
	if(m_pPreScanStatements->DoPreScanBlock(ENDTK)==false)
	{
		g_pErrorReport->AddErrorString("Failed to 'DoPreScanBlock(0)'");
		return false;
	}

	// Calculate sizes of structures (all typedefs parsed)
	if(g_pStructTable->CalculateAllSizes()==false)
	{
		g_pErrorReport->AddErrorString("Failed to 'CalculateAllSizes'");
		return false;
	}

	// Reset Parser for another run
	ResetParserPointers();

	// Init Code for Program (store stack ptr)
	if(m_pProgramStatements->DoInitCode()==false)
	{
		g_pErrorReport->AddErrorString("Failed to 'EndCode'");
		return false;
	}

	// Process all statements starting at beginning
	m_iNestCount = 0;
	SetImplementationParse(true);
	if(m_pProgramStatements->DoBlock(ENDTK,NULL)==false)
	{
		g_pErrorReport->AddErrorString("Failed to 'DoBlock(0)'");
		return false;
	}

	// End Code for Program (restore stack ptr)
	if(m_pProgramStatements->DoEndCode()==false)
	{
		g_pErrorReport->AddErrorString("Failed to 'EndCode'");
		return false;
	}

	// Calculate sizes of structures (again for function structures)
	if(g_pStructTable->CalculateAllSizes()==false)
	{
		g_pErrorReport->AddErrorString("Failed to 'CalculateAllSizes'");
		return false;
	}

	// Complete
	return true;
}

bool CStatementList::AddMiniStatements(LPSTR pData, DWORD Size)
{
	// Init Pointers and Vars to MiniProgram
	m_pFileData=pData;
	m_pFileDataEnd=(pData+Size)-1;
	m_FileDataSize=Size;
	SetFileDataPointer(m_pFileData);

	// Create first statement
	SAFE_DELETE(m_pMiniStatements);
	m_pMiniStatements = new CStatement;

	// Init Code for Program (store stack ptr)
	if(m_pMiniStatements->DoInitCode()==false)
	{
		g_pErrorReport->AddErrorString("Failed to m_pMiniStatements 'InitCode'");
		return false;
	}

	// Process all statements starting at beginning
	SetImplementationParse(true);
	if(m_pMiniStatements->DoBlock(ENDTK,NULL)==false)
	{
		g_pErrorReport->AddErrorString("Failed to m_pMiniStatements 'DoBlock(0)'");
		return false;
	}

	// End Code for Program (restore stack ptr)
	if(m_pMiniStatements->DoEndCode()==false)
	{
		g_pErrorReport->AddErrorString("Failed to m_pMiniStatements 'EndCode'");
		return false;
	}

	// Calculate sizes of structures
	if(g_pStructTable->CalculateAllSizes()==false)
	{
		g_pErrorReport->AddErrorString("Failed to m_pMiniStatements 'CalculateAllSizes'");
		return false;
	}

	// Complete
	return true;
}

void CStatementList::ResetParserPointers(void)
{
	// Place pointer to start of File Data
	m_pFileDataPointer=m_pFileData;

	// Set starting vars
	SetLineNumber(1);
	SetTokenLineNumber(0);
	SetDataIndexCounter(0);
	SetStringIndexCounter(0);
	SetDLLIndexCounter(0);
	SetCommandIndexCounter(0);
	SetLabelIndexCounter(0);
	SetVariableAddParse(true);
	SetLastLine(0);
}

bool CStatementList::FindStartOfFileDataProgramLine(DWORD dwFindLineNumber, LPSTR* pReturnText)
{
#ifdef __AARON_PERFIMPROVE__
	size_t len;

	len = GetLineText(dwFindLineNumber, nullptr, 0);
	if (!len)
		return false;

	*pReturnText = new char[len];
	if (!*pReturnText)
		return false;

	return !!GetLineText(dwFindLineNumber, *pReturnText, len);
#else
	DWORD dwCountLine=1;
	LPSTR pPointer=m_pFileData;
	while(pPointer<m_pFileDataEnd)
	{
		if(*(pPointer+0)==13 && *(pPointer+1)==10) dwCountLine++;
		if(dwCountLine>=dwFindLineNumber) break;
		pPointer++;
	}
	if(pPointer>=m_pFileDataEnd)
	{
		// soft fail
		return false;
	}

	// Create String for text from search
	DWORD n=0;
	pPointer+=2;
	CStr* pNewText = new CStr(256);
	while(pPointer<m_pFileDataEnd)
	{
		if(*(pPointer+0)==13 && *(pPointer+1)==10) break;
		if(pPointer>m_pFileDataEnd) break;
		pNewText->AddChar(*pPointer);
		pPointer++;
	}
	DWORD length=pNewText->Length();
	*pReturnText = new char[length+1];
	strcpy(*pReturnText, pNewText->GetStr());
	SAFE_DELETE(pNewText);

	return true;
#endif
}
size_t CStatementList::GetLineText(DWORD dwLineNumber, char *pDst, size_t DstLen)
{
	static bool didInitLines = false;

	if (!didInitLines)
	{
		static db3::CLock lock;
		db3::CAutolock autolock(lock);
		char *p, *q;

		m_LinePtrs.Push(m_pFileData);

		for(p=m_pFileData; p < m_pFileDataEnd; p=q)
		{
			bool nl = false;

			if (*p=='\r')
			{
				nl = true;
				p++;
			}

			if (*p=='\n')
			{
				nl = true;
				p++;
			}

			if (nl)
			{
				q = p;
				m_LinePtrs.Push(p);
			}
			else
				q = p + 1;
		}

		m_LinePtrs.Push(m_pFileDataEnd);

		didInitLines = true;
	}

	if (dwLineNumber - 1 >= m_LinePtrs.Size())
		return 0;

	char *s, *e;

	s = m_LinePtrs[dwLineNumber - 1];
	e = m_LinePtrs[dwLineNumber];

	size_t len = static_cast<size_t>(e - s + 1);

	if (!pDst)
		return len;

	if (len > DstLen)
		return 0;

	memcpy(pDst, s, e - s);
	pDst[e - s] = '\0';

	if (e - s > 1 && pDst[e - s - 2]=='\r')
		pDst[e - s - 2] = '\0';
	else if(e - s > 0 && pDst[e - s - 1]=='\n')
		pDst[e - s - 1] = '\0';

	return len;
}

bool CStatementList::WriteDBM(void)
{
	// Write out text
	CStr strDBMLine(256);
	strDBMLine.SetText("######CODE:");
	if(g_pDBMWriter->OutputDBM(&strDBMLine)==false) return false;

	return true;
}


text:
const root = this;

// Schemas object
root.Schemas = {};

AutoForm.hooks({
  InsertCodeForm: {
    onSuccess() {

      // Success message
      toastr.success('Function created successfully');

      // go index
      Router.go('Index');
    }
  },
  UpdateCodeForm: {
    onSuccess() {
      const doc = this.currentDoc;

      // Success message
      toastr.success('Function update successfully');

      // go document
      Router.go(doc.absoluteUrl());
    }
  }
});

// Register Template
Template.registerHelper('Schemas', Schemas);


text:
  #let(:book) { Book.new(title: "Jack and Jill", author: "Old Guy", isbn: 12345, publish_date: (DateTime.now - 60)) }
  #let(:presenter) { BookPresenter.new(book) }

  #it "#as_json returns a hash of the serializable attributes" do
    #presenter.as_json.should == { title: book.title, author: book.author }
  #end

#end


text:
<?php

namespace Pheasant\Tests\Relationships;

use \Pheasant\Tests\Examples\Hero;
use \Pheasant\Tests\Examples\Power;
use \Pheasant\Tests\Examples\SecretIdentity;

class RelationshipTest extends \Pheasant\Tests\MysqlTestCase
{
    public function setUp()
    {
        parent::setUp();

        $migrator = new \Pheasant\Migrate\Migrator();
        $migrator
            ->create('hero', Hero::schema())
            ->create('power', Power::schema())
            ->create('secretidentity', SecretIdentity::schema())
            ;
    }

    public function testOneToManyViaPropertySetting()
    {
        $hero = new Hero(array('alias'=>'Spider Man'));
        $hero->save();
        $this->assertEquals(count($hero->Powers), 0);

        // save via property access
        $power = new Power(array('description'=>'Spider Senses'));
        $power->heroid = $hero->id;
        $power->save();
        $this->assertEquals(count($hero->Powers), 1);
        $this->assertTrue($hero->Powers[0]->equals($power));
    }

    public function testOneToManyViaArrayAccess()
    {
        $hero = new Hero(array('alias'=>'Spider Man'));
        $hero->save();
        $this->assertEquals(count($hero->Powers), 0);

        // save via adding
        $power = new Power(array('description'=>'Super-human Strength'));
        $hero->Powers[] = $power;
        $power->save();
        $this->assertEquals(count($hero->Powers), 1);
        $this->assertEquals($power->heroid, 1);
        $this->assertTrue($hero->Powers[0]->equals($power));
    }

    public function testHasOneRelationship()
    {
        $hero = new Hero(array('alias'=>'Spider Man'));
        $hero->save();

        $identity = new SecretIdentity(array('realname'=>'Peter Parker'));
        $identity->Hero = $hero;
        $identity->save();

        $this->assertEquals($hero->identityid, $identity->id);
        $this->assertTrue($hero->SecretIdentity->equals($identity));
        $this->assertTrue($identity->Hero->equals($hero));
    }

    public function testPropertyReferencesResolvedInMapping()
    {
        $identity = new SecretIdentity(array('realname'=>'Peter Parker'));
        $hero = new Hero(array('alias'=>'Spider Man'));

        // set the identityid before it's been saved, still null
        $hero->identityid = $identity->id;

        $identity->save();
        $hero->save();

        $this->assertEquals($identity->id, 1);
        $this->assertEquals($hero->identityid, 1);
    }

    public function testFilteringCollectionsReturnedByRelationships()
    {
        $spiderman = Hero::createHelper('Spider Man', 'Peter Parker', array(
            'Super-human Strength', 'Spider Senses'
        ));
        $superman = Hero::createHelper('Super Man', 'Clark Kent', array(
            'Super-human Strength', 'Invulnerability'
        ));
        $batman = Hero::createHelper('Batman', 'Bruce Wayne', array(
            'Richness', 'Super-human Intellect'
        ));

        $this->assertCount(2, $spiderman->Powers);
        $this->assertCount(1, $spiderman->Powers->filter('description LIKE ?', 'Super-human%')->toArray());
    }

    public function testEmptyRelationshipsWithAllowEmpty()
    {
        $hero = new Hero(array('alias'=>'Spider Man'));
        $hero->save();

        $this->assertNull($hero->SecretIdentity);
    }

    public function testEmptyRelationshipsWithoutAllowEmpty()
    {
        $power = new Power(array('description'=>'Spider Senses'));
        $power->save();

        $this->expectException('\Pheasant\Exception');
        $foo = $power->Hero;
    }
}


text:
<?php
namespace org\shypl\sna;

use Exception;

class PaymentException extends Exception {
	const INVALID_REQUEST = 1;
	const BAD_REQUEST_PARAMETERS = 2;
	const USER_NOT_FOUND = 3;
	const PRODUCT_NOT_FOUND = 4;
	const SERVER_UNAVAILABLE = 5;
	const SERVER_ERROR = 100;

	private $critical;

	/**
	 * @param int        $code
	 * @param \Exception $previous
	 */
	public function __construct($code, \Exception $previous = null) {

		switch ($code) {
			case self::INVALID_REQUEST:
				$message = 'Invalid request';
				$critical = true;
				break;

			case self::BAD_REQUEST_PARAMETERS:
				$message = 'Request parameters do not meet specifications';
				$critical = true;
				break;

			case self::USER_NOT_FOUND:
				$message = 'User not found';
				$critical = true;
				break;

			case self::PRODUCT_NOT_FOUND:
				$message = 'Product not found';
				$critical = true;
				break;

			case self::SERVER_UNAVAILABLE:
				$message = 'Server unavailable';
				$critical = false;
				break;

			case self::SERVER_ERROR:
			default:
				$message = 'Server error';
				$critical = false;
				break;
		}

		parent::__construct($message, $code, $previous);
		$this->critical = $critical;
	}

	/**
	 * @return boolean
	 */
	public function isCritical() {
		return $this->critical;
	}
}


text:
import base64
import datetime
import sys

from protorpc import message_types
from protorpc import messages
import six
from six.moves import urllib_parse
import unittest2

from apitools.base.py import base_api
from apitools.base.py import encoding
from apitools.base.py import http_wrapper

class SimpleMessage(messages.Message):
    field = messages.StringField(1)
    bytes_field = messages.BytesField(2)

class MessageWithTime(messages.Message):
    timestamp = message_types.DateTimeField(1)

class MessageWithRemappings(messages.Message):

    class AnEnum(messages.Enum):
        value_one = 1
        value_two = 2

    str_field = messages.StringField(1)
    enum_field = messages.EnumField('AnEnum', 2)

encoding.AddCustomJsonFieldMapping(
    MessageWithRemappings, 'str_field', 'remapped_field')
encoding.AddCustomJsonEnumMapping(
    MessageWithRemappings.AnEnum, 'value_one', 'ONE/TWO')

class StandardQueryParameters(messages.Message):
    field = messages.StringField(1)
    prettyPrint = messages.BooleanField(
        5, default=True)  # pylint: disable=invalid-name
    pp = messages.BooleanField(6, default=True)
    nextPageToken = messages.BytesField(7)  # pylint:disable=invalid-name

class FakeCredentials(object):

    def authorize(self, _):  # pylint: disable=invalid-name
        return None

class FakeClient(base_api.BaseApiClient):
    MESSAGES_MODULE = sys.modules[__name__]
    _PACKAGE = 'package'
    _SCOPES = ['scope1']
    _CLIENT_ID = 'client_id'
    _CLIENT_SECRET = 'client_secret'

class FakeService(base_api.BaseApiService):

    def __init__(self, client=None):
        client = client or FakeClient(
            'http://www.example.com/', credentials=FakeCredentials())
        super(FakeService, self).__init__(client)

class BaseApiTest(unittest2.TestCase):

    def __GetFakeClient(self):
        return FakeClient('', credentials=FakeCredentials())

    def testUrlNormalization(self):
        client = FakeClient('http://www.googleapis.com', get_credentials=False)
        self.assertTrue(client.url.endswith('/'))

    def testNoCredentials(self):
        client = FakeClient('', get_credentials=False)
        self.assertIsNotNone(client)
        self.assertIsNone(client._credentials)

    def testIncludeEmptyFieldsClient(self):
        msg = SimpleMessage()
        client = self.__GetFakeClient()
        self.assertEqual('{}', client.SerializeMessage(msg))
        with client.IncludeFields(('field',)):
            self.assertEqual('{"field": null}', client.SerializeMessage(msg))

    def testJsonResponse(self):
        method_config = base_api.ApiMethodInfo(
            response_type_name='SimpleMessage')
        service = FakeService()
        http_response = http_wrapper.Response(
            info={'status': '200'}, content='{"field": "abc"}',
            request_url='http://www.google.com')
        response_message = SimpleMessage(field='abc')
        self.assertEqual(response_message, service.ProcessHttpResponse(
            method_config, http_response))
        with service.client.JsonResponseModel():
            self.assertEqual(
                http_response.content,
                service.ProcessHttpResponse(method_config, http_response))

    def testAdditionalHeaders(self):
        additional_headers = {'Request-Is-Awesome': '1'}
        client = self.__GetFakeClient()

        # No headers to start
        http_request = http_wrapper.Request('http://www.example.com')
        new_request = client.ProcessHttpRequest(http_request)
        self.assertFalse('Request-Is-Awesome' in new_request.headers)

        # Add a new header and ensure it's added to the request.
        client.additional_http_headers = additional_headers
        http_request = http_wrapper.Request('http://www.example.com')
        new_request = client.ProcessHttpRequest(http_request)
        self.assertTrue('Request-Is-Awesome' in new_request.headers)

    def testQueryEncoding(self):
        method_config = base_api.ApiMethodInfo(
            request_type_name='MessageWithTime', query_params=['timestamp'])
        service = FakeService()
        request = MessageWithTime(
            timestamp=datetime.datetime(2014, 10, 0o7, 12, 53, 13))
        http_request = service.PrepareHttpRequest(method_config, request)

        url_timestamp = urllib_parse.quote(request.timestamp.isoformat())
        self.assertTrue(http_request.url.endswith(url_timestamp))

    def testPrettyPrintEncoding(self):
        method_config = base_api.ApiMethodInfo(
            request_type_name='MessageWithTime', query_params=['timestamp'])
        service = FakeService()
        request = MessageWithTime(
            timestamp=datetime.datetime(2014, 10, 0o7, 12, 53, 13))

        global_params = StandardQueryParameters()
        http_request = service.PrepareHttpRequest(method_config, request,
                                                  global_params=global_params)
        self.assertFalse('prettyPrint' in http_request.url)
        self.assertFalse('pp' in http_request.url)

        global_params.prettyPrint = False  # pylint: disable=invalid-name
        global_params.pp = False

        http_request = service.PrepareHttpRequest(method_config, request,
                                                  global_params=global_params)
        self.assertTrue('prettyPrint=0' in http_request.url)
        self.assertTrue('pp=0' in http_request.url)

    def testQueryBytesRequest(self):
        method_config = base_api.ApiMethodInfo(
            request_type_name='SimpleMessage', query_params=['bytes_field'])
        service = FakeService()
        non_unicode_message = b''.join((six.int2byte(100),
                                        six.int2byte(200)))
        request = SimpleMessage(bytes_field=non_unicode_message)
        global_params = StandardQueryParameters()
        http_request = service.PrepareHttpRequest(method_config, request,
                                                  global_params=global_params)
        want = urllib_parse.urlencode({
            'bytes_field': base64.urlsafe_b64encode(non_unicode_message),
        })
        self.assertIn(want, http_request.url)

    def testQueryBytesGlobalParams(self):
        method_config = base_api.ApiMethodInfo(
            request_type_name='SimpleMessage', query_params=['bytes_field'])
        service = FakeService()
        non_unicode_message = b''.join((six.int2byte(100),
                                        six.int2byte(200)))
        request = SimpleMessage()
        global_params = StandardQueryParameters(
            nextPageToken=non_unicode_message)
        http_request = service.PrepareHttpRequest(method_config, request,
                                                  global_params=global_params)
        want = urllib_parse.urlencode({
            'nextPageToken': base64.urlsafe_b64encode(non_unicode_message),
        })
        self.assertIn(want, http_request.url)

    def testQueryRemapping(self):
        method_config = base_api.ApiMethodInfo(
            request_type_name='MessageWithRemappings',
            query_params=['remapped_field', 'enum_field'])
        request = MessageWithRemappings(
            str_field='foo', enum_field=MessageWithRemappings.AnEnum.value_one)
        http_request = FakeService().PrepareHttpRequest(method_config, request)
        result_params = urllib_parse.parse_qs(
            urllib_parse.urlparse(http_request.url).query)
        expected_params = {'enum_field': 'ONE%2FTWO', 'remapped_field': 'foo'}
        self.assertTrue(expected_params, result_params)

    def testPathRemapping(self):
        method_config = base_api.ApiMethodInfo(
            relative_path='parameters/{remapped_field}/remap/{enum_field}',
            request_type_name='MessageWithRemappings',
            path_params=['remapped_field', 'enum_field'])
        request = MessageWithRemappings(
            str_field='gonna',
            enum_field=MessageWithRemappings.AnEnum.value_one)
        service = FakeService()
        expected_url = service.client.url + 'parameters/gonna/remap/ONE%2FTWO'
        http_request = service.PrepareHttpRequest(method_config, request)
        self.assertEqual(expected_url, http_request.url)

        method_config.relative_path = (
            'parameters/{+remapped_field}/remap/{+enum_field}')
        expected_url = service.client.url + 'parameters/gonna/remap/ONE/TWO'
        http_request = service.PrepareHttpRequest(method_config, request)
        self.assertEqual(expected_url, http_request.url)

    def testColonInRelativePath(self):
        method_config = base_api.ApiMethodInfo(
            relative_path='path:withJustColon',
            request_type_name='SimpleMessage')
        service = FakeService()
        request = SimpleMessage()
        http_request = service.PrepareHttpRequest(method_config, request)
        self.assertEqual('http://www.example.com/path:withJustColon',
                         http_request.url)


text:
<?xml version="1.0" encoding="UTF-8"?>

<document>
    <properties>
        <title>
            Lutèce : Guide utilisateur : Administration du site
        </title>
    </properties>

                Le guide utilisateur décrivant les fonctionnalité d'un webmestre est en cours de refonte.

                Vous pouvez néanmoins trouver ce guide dans une version plus ancienne sur le lien suivant :
                Guide utilisateur

</document>


text:
namespace System.Activities.Core.Presentation
{
    using System.Activities.Presentation;
    using System.Activities.Presentation.Annotations;
    using System.Activities.Presentation.Metadata;
    using System.Activities.Presentation.Model;
    using System.Activities.Presentation.View;
    using System.Activities.Statements;
    using System.ComponentModel;
    using System.Runtime;
    using System.Windows;
    using System.Windows.Input;

    partial class CaseDesigner
    {
        public CaseDesigner()
        {
            this.InitializeComponent();
            this.DragHandle = null;
            this.Loaded += (sender, e) =>
            {
                Selection selection = this.Context.Items.GetValue<Selection>();
                if (selection != null)
                {
                    ModelItem primarySelection = selection.PrimarySelection;
                    this.ExpandState = SwitchDesigner.IsDescendantOfCase(this.ModelItem, primarySelection);

                    if (this.ExpandState)
                    {
                        // If current focus is at another part, we need to focus this designer
                        // to trigger selection changed, then this part will expand and another
                        // expanded part will collapse. Then we focus on the activity it contains
                        // if there is one.

                        this.ModelItem.Highlight();
                        if (this.ModelItem != primarySelection && primarySelection.View != null)
                        {
                            primarySelection.Highlight();
                        }
                    }
                }
            };
        }

        // When the CaseDesigner is collapsed, its CaseKeyBox will be disabled. Thus CaseKeyBox.RegainFocus() doesn't
        // work in such situation, we must re-focus the CaseDesigner to expand it first to re-enable the CaseKeyBox.
        // This situation happens when inputting and invalid case key value and clicking on another Case or Default in
        // the same parent SwitchDesigner.
        public Action<CaseKeyBox> FocusSelf
        {
            get
            {
                return (ckb) =>
                    {
                        Keyboard.Focus((IInputElement)this);
                    };
            }
        }

        public static void RegisterMetadata(AttributeTableBuilder builder)
        {
            Type type = typeof(ModelItemKeyValuePair<,>);
            builder.AddCustomAttributes(type, new DesignerAttribute(typeof(CaseDesigner)));
            builder.AddCustomAttributes(type, type.GetProperty("Value"), BrowsableAttribute.No);
            builder.AddCustomAttributes(type, new ActivityDesignerOptionsAttribute { AllowDrillIn = false });
        }

        void AttachDisplayName()
        {
            AttachedPropertiesService attachedPropertiesService = this.Context.Services.GetService<AttachedPropertiesService>();
            Fx.Assert(attachedPropertiesService != null, "AttachedPropertiesService is not available.");
            Type modelItemType = this.ModelItem.ItemType;
            foreach (AttachedProperty property in attachedPropertiesService.GetAttachedProperties(modelItemType))
            {
                if (property.Name == "DisplayName" && property.OwnerType == modelItemType)
                {
                    return;
                }
            }
            AttachedProperty<string> displayNameProperty = new AttachedProperty<string>
            {
                Name = "DisplayName",
                OwnerType = modelItemType,
                Getter = (modelItem) => { return "Case"; }
            };
            attachedPropertiesService.AddProperty(displayNameProperty);
        }

        protected override void OnModelItemChanged(object newItem)
        {
            base.OnModelItemChanged(newItem);
            this.AttachDisplayName();
        }

        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 2)
            {
                SwitchTryCatchDesignerHelper.MakeParentRootDesigner<SwitchDesigner>(this);
                e.Handled = true;
            }
            else if (e.LeftButton == MouseButtonState.Pressed)
            {
                Keyboard.Focus(this);
                e.Handled = true;
                this.Designer.ShouldStillAllowRubberBandEvenIfMouseLeftButtonDownIsHandled = true;
            }
            else if (e.RightButton == MouseButtonState.Pressed)
            {
                if (this.ShowExpanded)
                {
                    Keyboard.Focus(this);
                }
                e.Handled = true;
            }
        }

        protected override void OnMouseUp(MouseButtonEventArgs e)
        {
            // avoid context menu upon right-click when it's collapsed
            if (!this.ShowExpanded && e.RightButton == MouseButtonState.Released)
            {
                e.Handled = true;
            }
        }

        void OnAddAnnotationCommandCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            if (EditingContextUtilities.GetSingleSelectedModelItem(this.Context) == this.ModelItem)
            {
                ContextMenuUtilities.OnAddAnnotationCommandCanExecute(e, this.Context, this.FindSwitch());
            }
        }

        void OnAddAnnotationCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            ContextMenuUtilities.OnAddAnnotationCommandExecuted(e, this.FindSwitch());
        }

        void OnEditAnnotationCommandCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            if (EditingContextUtilities.GetSingleSelectedModelItem(this.Context) == this.ModelItem)
            {
                // call the same method as delete annotation command
                ContextMenuUtilities.OnDeleteAnnotationCommandCanExecute(e, this.Context, this.FindSwitch());
            }
        }

        void OnEditAnnotationCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            ContextMenuUtilities.OnEditAnnotationCommandExecuted(e, this.FindSwitch());
        }

        void OnDeleteAnnotationCommandCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            if (EditingContextUtilities.GetSingleSelectedModelItem(this.Context) == this.ModelItem)
            {
                ContextMenuUtilities.OnDeleteAnnotationCommandCanExecute(e, this.Context, this.FindSwitch());
            }
        }

        void OnDeleteAnnotationCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            ContextMenuUtilities.OnDeleteAnnotationCommandExecuted(e, this.FindSwitch());
        }

        private ModelItem FindSwitch()
        {
            return this.ModelItem.FindParent((ModelItem item) =>
                {
                    return item.ItemType.IsGenericType && item.ItemType.GetGenericTypeDefinition() == typeof(Switch<>);
                });
        }
    }
}


text:
package s3_test

import (
	"testing"

	"github.com/ncw/rclone/backend/s3"
	"github.com/ncw/rclone/fstest/fstests"
)

// TestIntegration runs integration tests against the remote
func TestIntegration(t *testing.T) {
	fstests.Run(t, &fstests.Opt{
		RemoteName: "TestS3:",
		NilObject:  (*s3.Object)(nil),
	})
}


text:
"""
Copied+modified from rest_framework.response, which is licensed under the BSD license:
*******************************************************************************
Copyright (c) 2011-2016, Tom Christie
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************

The Response class in REST framework is similar to HTTPResponse, except that
it is initialized with unrendered data, instead of a pre-rendered string.
The appropriate renderer is called during Django's template response rendering.

Simple response classes used mainly by internal api views.

Have a look in to api.task.response for more response classes and wider information about API response convention.
"""
from __future__ import unicode_literals

from django.http import HttpResponse
from django.template.response import SimpleTemplateResponse
from django.utils import six
# noinspection PyUnresolvedReferences
from django.utils.six.moves.http_client import responses

from api import status
from api.renderers import JSONRenderer
from core.version import __version__

class Response(SimpleTemplateResponse):
    """
    An HttpResponse that allows its data to be rendered into arbitrary media types.
    """
    # noinspection PyShadowingNames
    def __init__(self, data=None, status=None, template_name=None, headers=None, exception=False, content_type=None,
                 request=None):
        """
        Alters the init arguments slightly.
        For example, drop 'template_name', and instead use 'data'.
        Setting 'renderer' and 'media_type' will typically be deferred,
        For example being set automatically by the `APIView`.
        """
        super(Response, self).__init__(None, status=status)
        self.data = data
        self.template_name = template_name
        self.exception = exception
        self.content_type = content_type

        if headers:
            for name, value in six.iteritems(headers):
                self[name] = value

        if request:
            self.set_response_headers(request)

    @property
    def rendered_content(self):
        renderer = getattr(self, 'accepted_renderer', None)
        accepted_media_type = getattr(self, 'accepted_media_type', None)
        context = getattr(self, 'renderer_context', None)

        assert renderer, ".accepted_renderer not set on Response"
        assert accepted_media_type, ".accepted_media_type not set on Response"
        assert context, ".renderer_context not set on Response"
        context['response'] = self

        media_type = renderer.media_type
        charset = renderer.charset
        content_type = self.content_type

        if content_type is None and charset is not None:
            content_type = "{0}; charset={1}".format(media_type, charset)
        elif content_type is None:
            content_type = media_type
        self['Content-Type'] = content_type

        ret = renderer.render(self.data, accepted_media_type, context)

        if isinstance(ret, six.text_type):
            assert charset, 'renderer returned unicode, and did not specify a charset value.'
            return bytes(ret.encode(charset))

        if not ret:
            del self['Content-Type']

        return ret

    @property
    def status_text(self):
        """
        Returns reason text corresponding to our HTTP response status code.
        Provided for convenience.
        """
        # TODO: Deprecate and use a template tag instead
        # TODO: Status code text for RFC 6585 status codes
        return responses.get(self.status_code, '')

    def __getstate__(self):
        """
        Remove attributes from the response that shouldn't be cached.
        """
        state = super(Response, self).__getstate__()

        for key in ('accepted_renderer', 'renderer_context', 'resolver_match', 'client', 'request',
                    'json', 'wsgi_request'):
            if key in state:
                del state[key]

        state['_closable_objects'] = []

        return state

    def set_response_headers(self, request, **headers):
        """Set custom Danube Cloud headers."""
        self['es_version'] = __version__

        try:
            self['es_username'] = request.user.username
        except AttributeError:
            pass

        try:
            self['es_dc'] = request.dc.name
        except AttributeError:
            pass

        for key, val in headers.items():
            self[key] = val

class BadRequestResponse(Response):
    """
    Response class for bad requests.
    """
    # noinspection PyUnusedLocal
    def __init__(self, request, detail='Bad request', *args, **kwargs):
        msg = {'detail': detail}
        if 'status' not in kwargs:
            kwargs['status'] = status.HTTP_400_BAD_REQUEST
        super(BadRequestResponse, self).__init__(msg, *args, **kwargs)

class OKRequestResponse(Response):
    """
    Response class for good requests.
    """
    # noinspection PyUnusedLocal
    def __init__(self, request, detail='OK', *args, **kwargs):
        msg = {'detail': detail}
        if 'status' not in kwargs:
            kwargs['status'] = status.HTTP_200_OK
        super(OKRequestResponse, self).__init__(msg, *args, **kwargs)

class JSONResponse(HttpResponse):
    """
    An HttpResponse that renders it's content into JSON.
    """
    def __init__(self, data, **kwargs):
        content = JSONRenderer().render(data)
        kwargs['content_type'] = 'application/json'
        super(JSONResponse, self).__init__(content, **kwargs)


text:
<?php

if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine

$lang = array_merge($lang, array(
	'CLI_CONFIG_CANNOT_CACHED'			=> 'Set this option if the configuration option changes too frequently to be efficiently cached.',
	'CLI_CONFIG_CURRENT'				=> 'Current configuration value, use 0 and 1 to specify boolean values',
	'CLI_CONFIG_DELETE_SUCCESS'			=> 'Successfully deleted config %s.',
	'CLI_CONFIG_NEW'					=> 'New configuration value, use 0 and 1 to specify boolean values',
	'CLI_CONFIG_NOT_EXISTS'				=> 'Config %s does not exist',
	'CLI_CONFIG_OPTION_NAME'			=> 'The configuration option's name',
	'CLI_CONFIG_PRINT_WITHOUT_NEWLINE'	=> 'Set this option if the value should be printed without a new line at the end.',
	'CLI_CONFIG_INCREMENT_BY'			=> 'Amount to increment by',
	'CLI_CONFIG_INCREMENT_SUCCESS'		=> 'Successfully incremented config %s',
	'CLI_CONFIG_SET_FAILURE'			=> 'Could not set config %s',
	'CLI_CONFIG_SET_SUCCESS'			=> 'Successfully set config %s',

	'CLI_DESCRIPTION_CRON_LIST'					=> 'Prints a list of ready and unready cron jobs.',
	'CLI_DESCRIPTION_CRON_RUN'					=> 'Runs all ready cron tasks.',
	'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1'		=> 'Name of the task to be run',
	'CLI_DESCRIPTION_DB_MIGRATE'				=> 'Updates the database by applying migrations.',
	'CLI_DESCRIPTION_DELETE_CONFIG'				=> 'Deletes a configuration option',
	'CLI_DESCRIPTION_DISABLE_EXTENSION'			=> 'Disables the specified extension.',
	'CLI_DESCRIPTION_ENABLE_EXTENSION'			=> 'Enables the specified extension.',
	'CLI_DESCRIPTION_FIND_MIGRATIONS'			=> 'Finds migrations that are not depended upon.',
	'CLI_DESCRIPTION_GET_CONFIG'				=> 'Gets a configuration option's value',
	'CLI_DESCRIPTION_INCREMENT_CONFIG'			=> 'Increments a configuration option's integer value',
	'CLI_DESCRIPTION_LIST_EXTENSIONS'			=> 'Lists all extensions in the database and on the filesystem.',
	'CLI_DESCRIPTION_OPTION_SAFE_MODE'			=> 'Run in Safe Mode (without extensions).',
	'CLI_DESCRIPTION_OPTION_SHELL'				=> 'Launch the shell.',
	'CLI_DESCRIPTION_PURGE_EXTENSION'			=> 'Purges the specified extension.',
	'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH'	=> 'Recalculates the user_email_hash column of the users table.',
	'CLI_DESCRIPTION_SET_ATOMIC_CONFIG'			=> 'Sets a configuration option's value only if the old matches the current value',
	'CLI_DESCRIPTION_SET_CONFIG'				=> 'Sets a configuration option's value',

	'CLI_EXTENSION_DISABLE_FAILURE'		=> 'Could not disable extension %s',
	'CLI_EXTENSION_DISABLE_SUCCESS'		=> 'Successfully disabled extension %s',
	'CLI_EXTENSION_ENABLE_FAILURE'		=> 'Could not enable extension %s',
	'CLI_EXTENSION_ENABLE_SUCCESS'		=> 'Successfully enabled extension %s',
	'CLI_EXTENSION_NAME'				=> 'Name of the extension',
	'CLI_EXTENSION_PURGE_FAILURE'		=> 'Could not purge extension %s',
	'CLI_EXTENSION_PURGE_SUCCESS'		=> 'Successfully purged extension %s',
	'CLI_EXTENSION_NOT_FOUND'			=> 'No extensions were found.',
	'CLI_EXTENSIONS_AVAILABLE'			=> 'Available',
	'CLI_EXTENSIONS_DISABLED'			=> 'Disabled',
	'CLI_EXTENSIONS_ENABLED'			=> 'Enabled',

	'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS'	=> 'Successfully recalculated all email hashes.',
));

// Additional help for commands.
$lang = array_merge($lang, array(
	'CLI_HELP_CRON_RUN'			=> $lang['CLI_DESCRIPTION_CRON_RUN'] . ' Optionally you can specify a cron task name to run only the specified cron task.',
));


text:
/*eslint no-undef:0*/
/*eslint no-unused-vars:0*/

//
// CONFLICT EVENT HANDLER
//
// -- Will be called whenever two objects are competing for interaction with the source
//
function onConflictForBasicDemoScene($srcObj, $tgtObj0, $tgtObj1) {
    var arr = [ $tgtObj0, $tgtObj1, ], i;
    for (i=0; i<2; ++i) {
        // We give highest priority for the
 element on the dialog
        if (arr[i].is("#basic-dialog p"))
            return arr[i];
    }
    for (i=0; i<2; ++i) {
        // We give the 2nd highest for the dialog itself
        if (arr[i].is(".ui-dialog"))
            return arr[i];
    }
    // "First come, first served" for others
    return $tgtObj0;
}

function createBasicDemoScene($) {
    $("#basic-new-src-btn").button().on("click", function() {
        var draggables = $(".draggable"), newId = draggables.length;
        draggables.last().after("
"+newId+"
");

        // This demonstrates what you should do when a new element which takes part in drag & drop interactions is inserted to the DOM tree
        dndx("#draggable0", ".row1").newPair("#draggable"+newId, ".droppable");

        return false;
    });

    $("#basic-dialog")
        .dialog({
            autoOpen: false,
            width: 400,
            buttons: [
                {
                    text: "Ok",
                    click: function() {
                        $(this).dialog("close");
                    },
                },
                {
                    text: "Cancel",
                    click: function() {
                        $(this).dialog("close");
                    },
                },
            ],
        })
        .find("input").on("click", function(e) {
            if ($(e.target).prop("checked")) {
                // Fallback to the default (NOT SMART, RANDOM) behavior of conflict resolution.
                // In this mode, the outcome behavior is quite unstable.
                dndx().onconflict();
            }
            else {
                // Restore the DESIRABLE conflict resolution
                dndx().onconflict(onConflictForBasicDemoScene);
            }
        })
        ;

    $("#basic-dialog-link").on("click", function(event) {
        $("#basic-dialog").dialog("open");

        event.preventDefault();

        // .newPair() API lets you make a new pair which copies settings of an existing pair
        dndx("#draggable0", ".row1").newPair("#draggable0", "#basic-dialog p").newPair("#draggable1", "#basic-dialog p");

        // We need to let the entire frame of the dialog interact with source objects even though the frame doesn't need to accept them.
        // Without this invisible interaction, some hidden target objects behind the dialog may accept the source object where the users cannot notice it, and most of time, this behavior will surprise the users!
        // .nullify() API is for dealing with this kind of issue
        // But notice that just calling .nullify() is not enough. See the CONFLICT EVENT HANDLER below
        // Read https://github.com/suewonjp/DNDX.JS/wiki/DNDX.JS-Topic---Drag-&-Drop-Conflict-Resolution
        dndx("#draggable0", ".ui-dialog").nullify().newPair("#draggable1", ".ui-dialog");
    });

    $("#basic-visualcue-menu")
        .selectmenu()
        .on("selectmenuselect", function(e, ui) {
            // Switch the current effective visual cue
            dndx().visualcue(ui.item.value);
        });

    $(".check-to-reject-row")
        .on("click", function(e) {
            // these checkboxes are to make some targets enable or disable temporarily.
            // See PAIR CHECKING EVENT HANDLER below
            var $btn = $(e.target);
            if ($btn.prop("checked")) {
                $btn.closest("tr").find("div.droppable").addClass("blocked");
            }
            else {
                $btn.closest("tr").find("div.droppable").removeClass("blocked");
            }
        });

    var src = ["#draggable0", "#draggable1",], tgt = [".row1", ".row2", ".row3",], s, t;

    //
    // GENERATION OF EACH PAIR
    //
    for (s=0; s<src.length; ++s) {
        for (t=0; t<tgt.length; ++t) {
            dndx(src[s], tgt[t]);
        }
    }
}

function enterBasicDemoScene($, $panel) {
    //
    // DROP EVENT HANDLER
    //
    // -- This will be called as soon as a source object is dropped on a target object
    //
    function onDrop(eventType, $srcObj, $tgtObj) {
        if ($tgtObj.is(".ui-dialog") === false)
            $tgtObj.animateCss("bounce");
    }

    //
    // PAIR CHECKING EVENT HANDLER
    //
    // -- Will be called whenever a pair of (source/target) objects is detected.
    // -- Your job is determining whether to send it down for subsequent events.
    // -- Useful when you want to temporarily rule out some particular pairs
    //
    function onCheckPair($srcObj, $tgtObj, srcSelector, tgtSelector) {
        // Ignore any of elements having the following class name.
        return ! $tgtObj.hasClass("blocked");
    }

    //
    // SETTINGS FOR THE GLOBAL LEVEL
    //
    // -- These settings will affect every pair
    //
    dndx()
        //.draggableOptions({ helper: "clone", })
        .visualcue("Overlay")
        .oncheckpair(onCheckPair)
        .onconflict(onConflictForBasicDemoScene)
        .ondrop(onDrop);

    var dlg = $("#basic-dialog");
    if ($panel.data("restoreDialog")) {
        // Restore the dialog when we come back to this demo scene
        dlg.dialog("open");
    }

    dlg.find("input").prop("checked", false);
}

function leaveBasicDemoScene($, $panel) {
    dndx()
        .visualcue(null)
        .oncheckpair(null)
        .onconflict(null)
        .ondrop(null);

    var dlg = $("#basic-dialog"), opened = dlg.dialog("isOpen");
    dlg.dialog("close");
    $panel.data("restoreDialog", opened);
}


text:
package cloud.orbit.actors.test.actors;

import cloud.orbit.actors.runtime.AbstractActor;
import cloud.orbit.concurrent.Task;

import java.util.HashMap;
import java.util.Map;

import static com.ea.async.Async.await;
/**
 * Created by jefft on 11/18/2015.
 */
public class ReferenceMapStorageActor extends AbstractActor<ReferenceMapStorageActor.State> implements ReferenceMapStorage
{
    public static class State
    {
        Map<Integer, SomePlayer> playerMap = new HashMap<>();
    }

    @Override
    public Task<Void> addPlayerToMap(SomePlayer player)
    {
        state().playerMap.put(player.hashCode(), player);
        await(writeState());
        return Task.done();
    }

    @Override
    public Task<Map<Integer, SomePlayer>> getPlayers()
    {
        return Task.fromValue(state().playerMap);
    }
}


text:
import os
from flask.ext.script import Shell, Server, Manager

from check import app

app.debug = True
port = os.environ.get('PORT', 8000)

manager = Manager(app)
manager.add_command('server', Server(host="0.0.0.0", port=port))

if __name__ == '__main__':
    manager.run()


text:
import 'styles//TrackingDetailsContainer.scss';

import React from 'react';
import StatusUpdate from './StatusUpdateComponent';

class TrackingDetailsContainer extends React.Component {

  constructor(props) {
    super(props);
  }

  getStatusUpdates(){
    let updates = this.props.tracking.status_updates.sort((a, b) => {
      return a.time - b.time;
    }).reverse();
    return updates.map((update, index) => {
      return (

          <StatusUpdate status={update} />

      );
    });
  }

  render() {
    let updates = this.getStatusUpdates();
    return (

          Status Updates

          {updates}

    );
  }
}

export default TrackingDetailsContainer;


text:
sap.ui.define(["exports", "sap/ui/webc/common/thirdparty/base/config/Theme", "./v5/comment", "./v4/comment"], function (_exports, _Theme, _comment, _comment2) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  Object.defineProperty(_exports, "accData", {
    enumerable: true,
    get: function () {
      return _comment.accData;
    }
  });
  _exports.default = void 0;
  Object.defineProperty(_exports, "ltr", {
    enumerable: true,
    get: function () {
      return _comment.ltr;
    }
  });
  _exports.pathData = void 0;
  const pathData = (0, _Theme.isThemeFamily)("sap_horizon") ? _comment.pathData : _comment2.pathData;
  _exports.pathData = pathData;
  var _default = "comment";
  _exports.default = _default;
});


text:
class iState;

class iFSM : public cocos2d::CCObject {

public:
    virtual void setState(CommonEnum::State targetState, bool dontRemoveCurrentState=false) = 0;
    virtual void update(float dt) = 0;

protected:
    virtual iState* create(CommonEnum::State targetState, bool dontRemoveCurrentState=false) = 0;
    virtual void start() = 0;
};