text:
SQL Anywhere domain metadata repository management

## Define Types

```sql
-- default datatype is STRING and not nulllable
meta.defineType 'inv.name';

-- with default value of 0
meta.defineType 'inv.qty',
    @options = 'INT,0'
;

-- nullable Type with no default value
meta.defineType 'inv.flag',
    'BOOL,,nullable'
;

-- use : to separate name and options in only one argument
meta.defineType 'inv.price:MONEY';
meta.defineType 'inv.code:,,nullable';
```

## Define Entities

```sql
meta.defineEntity 'inv.Vendor',
  @properties = 'name'
;

meta.defineEntity 'inv.Article',
  @properties = 'name;serialNumber,code;isFluid,flag;price',
  @roles = 'Vendor'
;
```

## Create Tables

```sql
meta.createTable 'inv.Vendor';
meta.createTable 'inv.Article';
```

Console output:
```sql
create table [inv].[Vendor] (
    id ID,

    [name] STRING not null,

    author IDREF, xid GUID, ts TS, cts CTS,
    primary key(id), unique(xid)
)

create index [XK_inv_Vendor_ts] on [inv].[Vendor] (ts)
create index [XK_inv_Vendor_cts] on [inv].[Vendor] (cts)

create table [inv].[Article] (
    id ID,

    [vendor] IDREF not null,
    [serialNumber] STRING null,
    [isFluid] BOOL null,
    [price] MONEY not null,
    [name] STRING not null,

    author IDREF, xid GUID, ts TS, cts CTS,
    primary key(id), unique(xid)
)

create index [XK_inv_Article_ts] on [inv].[Article] (ts)
create index [XK_inv_Article_cts] on [inv].[Article] (cts)

alter table [inv].[Article] add foreign key ([vendor])
    references [inv].[Vendor]
```


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.logging.v2.model;

/**
 * The parameters to CopyLogEntries.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Logging API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class CopyLogEntriesRequest extends com.google.api.client.json.GenericJson {

  /**
   * Required. Destination to which to copy log entries.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String destination;

  /**
   * Optional. A filter specifying which log entries to copy. The filter must be no more than 20k
   * characters. An empty filter matches all log entries.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String filter;

  /**
   * Required. Log bucket from which to copy log entries.For example:"projects/my-
   * project/locations/global/buckets/my-source-bucket"
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String name;

  /**
   * Required. Destination to which to copy log entries.
   * @return value or {@code null} for none
   */
  public java.lang.String getDestination() {
    return destination;
  }

  /**
   * Required. Destination to which to copy log entries.
   * @param destination destination or {@code null} for none
   */
  public CopyLogEntriesRequest setDestination(java.lang.String destination) {
    this.destination = destination;
    return this;
  }

  /**
   * Optional. A filter specifying which log entries to copy. The filter must be no more than 20k
   * characters. An empty filter matches all log entries.
   * @return value or {@code null} for none
   */
  public java.lang.String getFilter() {
    return filter;
  }

  /**
   * Optional. A filter specifying which log entries to copy. The filter must be no more than 20k
   * characters. An empty filter matches all log entries.
   * @param filter filter or {@code null} for none
   */
  public CopyLogEntriesRequest setFilter(java.lang.String filter) {
    this.filter = filter;
    return this;
  }

  /**
   * Required. Log bucket from which to copy log entries.For example:"projects/my-
   * project/locations/global/buckets/my-source-bucket"
   * @return value or {@code null} for none
   */
  public java.lang.String getName() {
    return name;
  }

  /**
   * Required. Log bucket from which to copy log entries.For example:"projects/my-
   * project/locations/global/buckets/my-source-bucket"
   * @param name name or {@code null} for none
   */
  public CopyLogEntriesRequest setName(java.lang.String name) {
    this.name = name;
    return this;
  }

  @Override
  public CopyLogEntriesRequest set(String fieldName, Object value) {
    return (CopyLogEntriesRequest) super.set(fieldName, value);
  }

  @Override
  public CopyLogEntriesRequest clone() {
    return (CopyLogEntriesRequest) super.clone();
  }

}

redpajama_set_name: RedPajamaGithub


text:
from example import stack

# in order to decrease simulation times, some metal layers can be removed from
# the stack, allowing more oxide layers to be merged in the next step
stack.remove_metal_layer_by_name('PO1')
stack.remove_metal_layer_by_name('ME1')
stack.remove_metal_layer_by_name('ME2')
stack.remove_metal_layer_by_name('ME3')
stack.remove_metal_layer_by_name('ME4')
#stack.remove_metal_layer_by_name('ME5')
#stack.remove_metal_layer_by_name('ME6')

if __name__ == '__main__':
    # Print the standardized stack to example_ME5ME6_std.pdf
    stack.draw('example_ME5ME6_std', pages=3, single_page=True)

# Merge oxide layers to reduce the stack's complexity, decreasing simulation
# times
stack.simplify()

if __name__ == '__main__':
    # Print the simplified stack to example_ME5ME6.pdf
    stack.draw('example_ME5ME6', pages=3, single_page=True)

    # Write out a Momentum subtrate definition file of the simplified stack
    # write_momentum_substrate argument: filename (without extension),
    #                                    infinite ground plane
    # NOTE: this might produce bad output when the stack has not been
    #   simplified before!
    stack.write_momentum_substrate('example_ME5ME6', True)

    # Write out a Sonnet project that includes the simplified subtrate stack
    # write_sonnet_technology argument: filename (without extension)
    # NOTE: this might produce bad output when the stack has not been
    #   simplified before!
    stack.write_sonnet_technology('example_ME5ME6')


text:
<?php namespace Gcphost\LaravelCP;

use Illuminate\Support\ServiceProvider;

class UserServiceProvider extends ServiceProvider {

	public function register()
	{
		$this->app->bind(
			'Gcphost\LaravelCP\User\UserRepository',
			'Gcphost\LaravelCP\User\EloquentUserRepository',
			'Gcphost\LaravelCP\User\UserService'
		);
	}
}


text:
/**
 *
 * @author User
 */
define('FirstStep', ['orm', 'forms', 'ui', 'rpc', 'Bill', 'Services'],
        function (Orm, Forms, Ui, Rpc, Bill, Services, ModuleName) {
            function module_constructor() {
                var self = this
                        , model = Orm.loadModel(ModuleName)
                        , form = Forms.loadForm(ModuleName, model);

                var BillFunc = new Rpc.Proxy('BillApiFunctions');
                var FormBill = new Bill();
                var FormServices = new Services();

                self.show = function () {
                    form.show();
                };

                form.btnNewAc.onActionPerformed = function () {
                    BillFunc.createAccount(function (res) {
                        form.tfRes.text = res.account_id;
                        FormBill.setParams(res.account_id);
                        FormBill.show();
                    });
                };

                form.btnOpenAc.onActionPerformed = function () {
                    BillFunc.checkExistAccount(form.tfRes.text, function (success_chek) {
                        console.log(success_chek);
                        FormBill.setParams(success_chek.id);
                        FormBill.show();
                    }, function (chek_error) {
                        console.log(chek_error);
                        //В 'e' какая то дичь)
                        md.alert("Неверный id счёта!");
                    });
                };

                form.btnServices.onActionPerformed = function () {
                    FormServices.setParams();
                    FormServices.show();
                };

                window.onkeyup = function (e) {
                    if (e.keyCode == 13)
                        ;
//                    md.alert("Ес");
//                    else md.alert("Ноу");
                    //document.getElementById("go").click();
                };
            }
            return module_constructor;
        });


text:
package net.ymate.framework.unpack;

import net.ymate.framework.unpack.annotation.Unpacker;
import net.ymate.framework.unpack.handle.UnpackerHandler;
import net.ymate.framework.unpack.impl.DefaultUnpackerModuleCfg;
import net.ymate.platform.core.Version;
import net.ymate.platform.core.YMP;
import net.ymate.platform.core.module.IModule;
import net.ymate.platform.core.module.annotation.Module;
import net.ymate.platform.core.util.FileUtils;
import net.ymate.platform.core.util.RuntimeUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 刘镇 (suninformation@163.com) on 2017/08/02 下午 22:27
 * @version 1.0
 */
@Module
public class Unpackers implements IModule, IUnpackers {

    private static final Log _LOG = LogFactory.getLog(Unpackers.class);

    public static final Version VERSION = new Version(2, 0, 8, Unpackers.class.getPackage().getImplementationVersion(), Version.VersionType.Release);

    private static volatile IUnpackers __instance;

    private YMP __owner;

    private IUnpackersModuleCfg __moduleCfg;

    private boolean __inited;

    private Map<String, Class<? extends IUnpacker>> __unpackers = new HashMap<String, Class<? extends IUnpacker>>();

    public static IUnpackers get() {
        if (__instance == null) {
            synchronized (VERSION) {
                if (__instance == null) {
                    __instance = YMP.get().getModule(Unpackers.class);
                }
            }
        }
        return __instance;
    }

    @Override
    public String getName() {
        return IUnpackers.MODULE_NAME;
    }

    @Override
    public void init(YMP owner) {
        if (!__inited) {
            //
            _LOG.info("Initializing ymate-framework-unpack-" + VERSION);
            //
            __owner = owner;
            __moduleCfg = new DefaultUnpackerModuleCfg(owner);
            //
            if (!__moduleCfg.isDisabled()) {
                __owner.registerHandler(Unpacker.class, new UnpackerHandler(this));
            }
            //
            __inited = true;
        }
    }

    @Override
    public boolean isInited() {
        return __inited;
    }

    @Override
    public void registerUnpacker(String name, Class<? extends IUnpacker> targetClass) {
        if (!__moduleCfg.isDisabled() && StringUtils.isNotBlank(name) && targetClass != null) {
            __unpackers.put(name, targetClass);
        }
    }

    @Override
    public void registerUnpacker(Class<? extends IUnpacker> targetClass) {
        if (!__moduleCfg.isDisabled() && targetClass != null) {
            Unpacker _anno = targetClass.getAnnotation(Unpacker.class);
            if (_anno != null) {
                for (String _name : _anno.value()) {
                    __unpackers.put(_name, targetClass);
                }
            }
        }
    }

    @Override
    public synchronized void unpack() {
        boolean _flag = false;
        File _targetFile = new File(RuntimeUtils.getRootPath(false));
        String _rootPath = RuntimeUtils.getRootPath();
        for (Map.Entry<String, Class<? extends IUnpacker>> _entry : __unpackers.entrySet()) {
            if (!ArrayUtils.contains(__moduleCfg.getDisabledUnpackers(), _entry.getKey())) {
                File _locker = new File(_rootPath, ".unpack" + File.separator + _entry.getKey());
                if (!_locker.exists()) {
                    try {
                        _flag = true;
                        _LOG.info("Unpacking " + _entry.getValue() + "...");
                        if (FileUtils.unpackJarFile(_entry.getKey(), _targetFile, _entry.getValue())) {
                            _locker.getParentFile().mkdirs();
                            _locker.createNewFile();
                        }
                    } catch (Exception e) {
                        _LOG.warn("Synchronizing resource [" + _entry.getKey() + "] exception", RuntimeUtils.unwrapThrow(e));
                    }
                }
            }
        }
        if (_flag) {
            _LOG.info("Synchronizing resource completed.");
        }
    }

    @Override
    public void destroy() {
        if (__inited) {
            __inited = false;
            //
            __unpackers = null;
            //
            __moduleCfg = null;
            __owner = null;
        }
    }

    @Override
    public YMP getOwner() {
        return __owner;
    }

    @Override
    public IUnpackersModuleCfg getModuleCfg() {
        return __moduleCfg;
    }
}


text:
id: thrift
title: "Thrift"
---

<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

To use this Apache Druid extension, make sure to [include](../../development/extensions.md#loading-extensions) `druid-thrift-extensions`.

This extension enables Druid to ingest thrift compact data online (`ByteBuffer`) and offline (SequenceFile of type `<Writable, BytesWritable>` or LzoThriftBlock File).

You may want to use another version of thrift, change the dependency in pom and compile yourself.

## LZO Support

If you plan to read LZO-compressed Thrift files, you will need to download version 0.4.19 of the [hadoop-lzo JAR](https://mvnrepository.com/artifact/com.hadoop.gplcompression/hadoop-lzo/0.4.19) and place it in your `extensions/druid-thrift-extensions` directory.

## Thrift Parser

| Field       | Type        | Description                              | Required |
| ----------- | ----------- | ---------------------------------------- | -------- |
| type        | String      | This should say `thrift`                 | yes      |
| parseSpec   | JSON Object | Specifies the timestamp and dimensions of the data. Should be a JSON parseSpec. | yes      |
| thriftJar   | String      | path of thrift jar, if not provided, it will try to find the thrift class in classpath. Thrift jar in batch ingestion should be uploaded to HDFS first and configure `jobProperties` with `"tmpjars":"/path/to/your/thrift.jar"` | no       |
| thriftClass | String      | classname of thrift                      | yes      |

- Batch Ingestion example - `inputFormat` and `tmpjars` should be set.

This is for batch ingestion using the HadoopDruidIndexer. The inputFormat of inputSpec in ioConfig could be one of `"org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat"` and `com.twitter.elephantbird.mapreduce.input.LzoThriftBlockInputFormat`. Be careful, when `LzoThriftBlockInputFormat` is used, thrift class must be provided twice.

```json
{
  "type": "index_hadoop",
  "spec": {
    "dataSchema": {
      "dataSource": "book",
      "parser": {
        "type": "thrift",
        "jarPath": "book.jar",
        "thriftClass": "org.apache.druid.data.input.thrift.Book",
        "protocol": "compact",
        "parseSpec": {
          "format": "json",
          ...
        }
      },
      "metricsSpec": [],
      "granularitySpec": {}
    },
    "ioConfig": {
      "type": "hadoop",
      "inputSpec": {
        "type": "static",
        "inputFormat": "org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat",
        // "inputFormat": "com.twitter.elephantbird.mapreduce.input.LzoThriftBlockInputFormat",
        "paths": "/user/to/some/book.seq"
      }
    },
    "tuningConfig": {
      "type": "hadoop",
      "jobProperties": {
        "tmpjars":"/user/h_user_profile/du00/druid/test/book.jar",
        // "elephantbird.class.for.MultiInputFormat" : "${YOUR_THRIFT_CLASS_NAME}"
      }
    }
  }
}
```


text:
package edu.incense.android.comm;

import java.io.DataInputStream;
import java.io.File;
import java.io.FileOutputStream;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.util.Log;
import edu.incense.android.R;

public class Downloader extends Connection {

    private String serverProjectAddress;
    private String serverProjectPath;
    private String serverProjectConfigPath;

    public Downloader(Context context) {
        super(context);
    }

    protected void setServersFromPreferences() {
        SharedPreferences sp = PreferenceManager
                .getDefaultSharedPreferences(context);
        serverProjectAddress = sp.getString("editTextProjectServerAddress",
                "http://urbanmoments.dyndns.org:8182");
    }

    @Override
    protected void setPathsFromResource() {
        super.setPathsFromResource();
        serverProjectPath = context.getResources().getString(
                R.string.server_project_signature_path);
        serverProjectConfigPath = context.getResources().getString(
                R.string.server_project_path);
    }

    public boolean getProjectDataTo(String filePath) {
        if (!connect(serverProjectAddress + serverProjectPath,
                ConnectionType.INPUT, JSON_TYPE))
            return false;
        return getData(filePath, false);
    }

    public boolean getProjectConfigTo(String filePath) {
        if (!connect(serverProjectAddress + serverProjectConfigPath,
                ConnectionType.INPUT, JSON_TYPE))
            return false;
        return getData(filePath, false);
    }

    // GET implemented with HttpURLConnection
    private boolean getData(String filePath, boolean isResource) {

        if (!isConnected()) {
            Log.i(getClass().getName(), "File transmistion failed.");
            return false;
        }

        try {

            // Set streams
            FileOutputStream fos;
            if (!isResource) {
                File parent = new File(Environment.getExternalStorageDirectory(), parentDirectory);
                parent.mkdirs();
                File file = new File(parent, filePath);
                fos = new FileOutputStream(file);
            } else {
                fos = context.openFileOutput(filePath, 0);
            }

            DataInputStream dis = new DataInputStream(
                    connection.getInputStream());

            // GET
            // Read bytes until EOF to write
            int bytesAvailable = dis.available();
            int bufferSize = Math.min(bytesAvailable, MAX_BUFFER_SIZE);
            byte[] buffer = new byte[bufferSize];

            // How many bytes in buffer
            int bytes_read;
            while ((bytes_read = dis.read(buffer)) != -1) {
                fos.write(buffer, 0, bytes_read);
            }

            // Close streams
            fos.flush();
            fos.close();
            dis.close();

            // Responses from the server (code and message)
            int serverResponseCode = connection.getResponseCode();
            String serverResponseMessage = connection.getResponseMessage();

            Log.i("HTTP", serverResponseCode + " : " + serverResponseMessage);
            Log.i(getClass().getName(), "Succesful file transmistion.");
            return true;
        } catch (Exception e) {
            // Exception handling
            Log.i(getClass().getName(), "File transmistion failed.");
            Log.e(getClass().getName(), "File transmistion failed.", e);
            return false;
        } finally {
            disconnect();
            Log.i(getClass().getName(), "Disconnected after file transmition.");
        }
    }

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: tonigurski
 * Date: 03.02.16
 * Time: 16:56
 */

namespace MandarinMedien\MMCmfContentBundle\Entity;

use MandarinMedien\MMCmfNodeBundle\Entity\NodeInterface;

class RowContentNode extends ContentNode
{
    protected $draggable = false;

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

    /**
     * @param boolean $draggable
     * @return RowContentNode
     */
    public function setDraggable($draggable)
    {
        $this->draggable = $draggable;
        return $this;
    }

    /**
     * @param NodeInterface $node
     *
     * @return bool
     */
    protected function checkChildNode(NodeInterface $node)
    {
        if($node instanceof RowContentNode)
        {
            trigger_error('You cant append a RowContentNode underneath another RowContentNode ', E_USER_WARNING);
            return false;
        }

        return true;
    }

}


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

goog.provide('gamebuilder.games.go');

goog.require('gamebuilder.games');

/**
 * Represents the color of a Go piece (or the color used by a player).
 *
 * @param {string} color
 * @constructor
 */
gamebuilder.games.go.PieceColor = function(color) {
  /**
   * @type {string}
   * @private
   */
  this.color_ = color;
};

/** type {gamebuilder.games.go.PieceColor} */
gamebuilder.games.go.PieceColor.WHITE =
    new gamebuilder.games.go.PieceColor('white');

/** type {gamebuilder.games.go.PieceColor} */
gamebuilder.games.go.PieceColor.BLACK =
    new gamebuilder.games.go.PieceColor('black');

/**
 * Represents a Go piece.
 *
 * @param {gamebuilder.games.go.PieceColor} color
 * @constructor
 * @extends {gamebuilder.games.Piece}
 */
gamebuilder.games.go.Piece = function(color) {
  // A hack to call the base ctor and satisfy Closure Compiler.
  var base_color = /** @type {gamebuilder.games.PieceColor} */ color;
  gamebuilder.games.Piece.call(this, base_color);

  /**
   * @type {gamebuilder.games.go.PieceColor}
   * @protected
   */
  this.color_ = color;
};

goog.inherits(gamebuilder.games.go.Piece,
              gamebuilder.games.Piece);

/**
 * Returns the color of this piece.
 *
 * @return {gamebuilder.games.go.PieceColor} The color of this piece.
 */
gamebuilder.games.go.Piece.prototype.color = function() {
  return this.color_;
};

/**
 * Defines a generic MxN Go board.
 *
 * @param {number} m
 * @param {number} n
 * @constructor
 * @extends {gamebuilder.games.BoardMxN}
 */
gamebuilder.games.go.BoardMxN = function(m, n) {
  gamebuilder.games.BoardMxN.call(this, m, n);
};

goog.inherits(gamebuilder.games.go.BoardMxN, gamebuilder.games.BoardMxN);

/**
 * Places a new piece with a given color at the specified position.
 *
 * @param {gamebuilder.games.go.PieceColor} color
 * @param {string} pos string location, e.g. 'c10' or 'f9'
 * @public
 */
gamebuilder.games.go.BoardMxN.prototype.setPieceColorAtPos =
    function(color, pos) {
  this.setPieceAtPos_(new gamebuilder.games.go.Piece(color), pos);
};

/**
 * Returns the piece at the given coordinates (or null if none).
 *
 * @param {Array.<number>} coords A pair of numbers representing the coordinates.
 * @return {?gamebuilder.games.go.Piece} The piece at the coords, if any, or null.
 * @public
 */
gamebuilder.games.go.BoardMxN.prototype.getPieceAtCoords = function(coords) {
  // Downcast to the right piece type: this is safe because we only store
  // objects of type go.Piece in the board ourselves.
  var piece = /** @type {?gamebuilder.games.go.Piece} */
      this.getPieceAtCoords_(coords);
  return piece;
}

/**
 * Returns the piece at the given position (or null if none).
 *
 * @param {string} pos The coordinate on the board, e.g. 'e7' or 'g10'.
 * @return {?gamebuilder.games.go.Piece} The piece at the coords, if any, or null.
 * @public
 */
gamebuilder.games.go.BoardMxN.prototype.getPieceAtPos = function(pos) {
  var coords = gamebuilder.games.stringPosToCoords(pos);
  return this.getPieceAtCoords(coords);
}

// =============================================================================
// NxN Go board
// =============================================================================

/**
 * TODO: document.
 *
 * @param {number} n
 * @constructor
 * @extends {gamebuilder.games.go.BoardMxN}
 */
gamebuilder.games.go.BoardNxN = function(n) {
  gamebuilder.games.go.BoardMxN.call(this, n, n);
};
goog.inherits(gamebuilder.games.go.BoardNxN, gamebuilder.games.go.BoardMxN);

// =============================================================================
// 19x19 Go board
// =============================================================================

/**
 * TODO: document.
 *
 * @constructor
 * @extends {gamebuilder.games.go.BoardNxN}
 */
gamebuilder.games.go.Board19 = function() {
  gamebuilder.games.go.BoardNxN.call(this, 19);
};
goog.inherits(gamebuilder.games.go.Board19, gamebuilder.games.go.BoardNxN);

// =============================================================================
// 13x13 Go board
// =============================================================================

/**
 * TODO: document.
 *
 * @constructor
 * @extends {gamebuilder.games.go.BoardNxN}
 */
gamebuilder.games.go.Board13 = function() {
  gamebuilder.games.go.BoardNxN.call(this, 13);
};
goog.inherits(gamebuilder.games.go.Board13, gamebuilder.games.go.BoardNxN);

// =============================================================================
// 9x9 Go board
// =============================================================================

/**
 * TODO: document.
 *
 * @constructor
 * @extends {gamebuilder.games.go.BoardNxN}
 */
gamebuilder.games.go.Board9 = function() {
  gamebuilder.games.go.BoardNxN.call(this, 9);
};
goog.inherits(gamebuilder.games.go.Board9, gamebuilder.games.go.BoardNxN);


text:
class SASParserTestsFixture
{
	protected:
		SASParserTestsFixture()
		:	m_blocksworldTestFile(readFile("data/blocksworld.sas")),
			m_cavedivingTestFile(readFile("data/cavediving.sas")),
			m_freecellTestFile(readFile("data/freecell.sas")),
			m_philosophersTestFile(readFile("data/philosophers.sas"))
		{
		}

		static std::stringstream readFile(const std::string &path)
		{
			std::ifstream fileStream(path, std::ios::in);

			std::stringstream outputStream;

			if (!fileStream.is_open())
				throw std::runtime_error("Could not open file "" + path + """);

			outputStream << fileStream.rdbuf();

			return outputStream;
		}

		std::stringstream m_blocksworldTestFile;
		std::stringstream m_cavedivingTestFile;
		std::stringstream m_freecellTestFile;
		std::stringstream m_philosophersTestFile;
};

////////////////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE_METHOD(SASParserTestsFixture, "[SAS parser] A valid SAS file is parsed correctly", "[SAS parser]")
{
	try
	{
		const auto description = plasp::sas::Description::fromStream(m_philosophersTestFile);

		CHECK_FALSE(description.usesActionCosts());

		REQUIRE(description.variables().size() == 37u);
		CHECK(description.variables()[0].axiomLayer() == -1);
		CHECK(description.variables()[0].values()[0].sign() == plasp::sas::Value::Sign::Positive);
		CHECK(description.variables()[0].values()[0].name() == "activate(philosopher-0, forks--pid-rfork)");
		CHECK(description.variables()[36].axiomLayer() == -1);
		CHECK(description.variables()[36].values()[1].sign() == plasp::sas::Value::Sign::Negative);
		CHECK(description.variables()[36].values()[1].name() == "queue-tail-msg(forks-1-, fork)");

		REQUIRE(description.mutexGroups().size() == 8u);
		REQUIRE(description.mutexGroups()[0].facts().size() == 9u);
		CHECK(&description.mutexGroups()[0].facts()[0].value() == &description.variables()[0].values()[0]);
		REQUIRE(description.mutexGroups()[7].facts().size() == 2u);
		CHECK(&description.mutexGroups()[7].facts()[1].value() == &description.variables()[34].values()[1]);

		REQUIRE(description.initialState().facts().size() == 37u);
		CHECK(&description.initialState().facts()[0].value() == &description.variables()[0].values()[8]);
		CHECK(&description.initialState().facts()[36].value() == &description.variables()[36].values()[1]);

		REQUIRE(description.goal().facts().size() == 2u);
		CHECK(&description.goal().facts()[0].value() == &description.variables()[6].values()[0]);
		CHECK(&description.goal().facts()[1].value() == &description.variables()[7].values()[0]);

		REQUIRE(description.operators().size() == 34u);
		CHECK(description.operators()[0].predicate().name() == "activate-trans");
		REQUIRE(description.operators()[0].predicate().arguments().size() == 5u);
		CHECK(description.operators()[0].predicate().arguments()[0] == "philosopher-0");
		CHECK(description.operators()[0].predicate().arguments()[4] == "state-3");
		REQUIRE(description.operators()[0].preconditions().size() == 3u);
		CHECK(&description.operators()[0].preconditions()[0].value() == &description.variables()[4].values()[4]);
		CHECK(&description.operators()[0].preconditions()[1].value() == &description.variables()[16].values()[1]);
		CHECK(&description.operators()[0].preconditions()[2].value() == &description.variables()[0].values()[8]);
		REQUIRE(description.operators()[0].effects().size() == 1u);
		REQUIRE(description.operators()[0].effects()[0].conditions().size() == 0u);
		CHECK(&description.operators()[0].effects()[0].postcondition().value() == &description.variables()[0].values()[0]);
		CHECK(description.operators()[33].predicate().name() == "queue-write");
		REQUIRE(description.operators()[33].predicate().arguments().size() == 4u);
		CHECK(description.operators()[33].predicate().arguments()[0] == "philosopher-1");
		CHECK(description.operators()[33].predicate().arguments()[3] == "fork");
		REQUIRE(description.operators()[33].preconditions().size() == 2u);
		CHECK(&description.operators()[33].preconditions()[0].value() == &description.variables()[1].values()[3]);
		CHECK(&description.operators()[33].preconditions()[1].value() == &description.variables()[2].values()[2]);
		REQUIRE(description.operators()[33].effects().size() == 3u);
		REQUIRE(description.operators()[33].effects()[0].conditions().size() == 0u);
		CHECK(&description.operators()[33].effects()[0].postcondition().value() == &description.variables()[1].values()[7]);
		CHECK(&description.operators()[33].effects()[2].postcondition().value() == &description.variables()[35].values()[0]);

		REQUIRE(description.axiomRules().size() == 33u);
		REQUIRE(description.axiomRules()[0].conditions().size() == 4u);
		CHECK(&description.axiomRules()[0].conditions()[0].value() == &description.variables()[0].values()[0]);
		CHECK(&description.axiomRules()[0].conditions()[2].value() == &description.variables()[27].values()[0]);
		CHECK(&description.axiomRules()[0].conditions()[3].value() == &description.variables()[8].values()[1]);
		CHECK(&description.axiomRules()[0].postcondition().value() == &description.variables()[8].values()[0]);
		REQUIRE(description.axiomRules()[32].conditions().size() == 2u);
		CHECK(&description.axiomRules()[32].conditions()[0].value() == &description.variables()[15].values()[0]);
		CHECK(&description.axiomRules()[32].conditions()[1].value() == &description.variables()[25].values()[0]);
		CHECK(&description.axiomRules()[32].postcondition().value() == &description.variables()[25].values()[1]);
	}
	catch (const std::exception &e)
	{
		FAIL(e.what());
	}

	// TODO: add whitespace test
}

////////////////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE_METHOD(SASParserTestsFixture, "[SAS parser] Trailing empty parentheses are removed", "[SAS parser]")
{
	try
	{
		const auto description = plasp::sas::Description::fromStream(m_blocksworldTestFile);

		CHECK(description.variables()[4].values()[0].name() == "handempty");
		CHECK(description.variables()[5].values()[0].name() == "holding(a)");
	}
	catch (const std::exception &e)
	{
		FAIL(e.what());
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE_METHOD(SASParserTestsFixture, "[SAS parser] "none" values are correctly parsed", "[SAS parser]")
{
	try
	{
		const auto description = plasp::sas::Description::fromStream(m_freecellTestFile);

		// TODO: compare by identity, not value
		CHECK(description.variables()[0].values()[3] == plasp::sas::Value::None);
		CHECK(description.variables()[5].values()[6] == plasp::sas::Value::None);
	}
	catch (const std::exception &e)
	{
		FAIL(e.what());
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE_METHOD(SASParserTestsFixture, "[SAS parser] SAS requirements are parsed correctly", "[SAS parser]")
{
	try
	{
		const auto description = plasp::sas::Description::fromStream(m_cavedivingTestFile);

		CHECK(description.usesActionCosts());
		CHECK(description.usesConditionalEffects());
		CHECK_FALSE(description.usesAxiomRules());

		REQUIRE(description.operators().size() == 496u);

		CHECK(description.operators()[0].costs() == 1u);
		CHECK(description.operators()[172].costs() == 10u);
		CHECK(description.operators()[173].costs() == 63u);

		REQUIRE(description.operators()[172].effects().size() == 3u);
		REQUIRE(description.operators()[172].effects()[1].conditions().size() == 1u);
		CHECK(&description.operators()[172].effects()[1].conditions()[0].value() == &description.variables()[1].values()[4]);
	}
	catch (const std::exception &e)
	{
		FAIL(e.what());
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE("[SAS parser] Former issues are fixed", "[SAS parser]")
{
	// Check issue where unexpected whitespaces in SAS files led to a parsing error
	CHECK_NOTHROW(plasp::sas::Description::fromFile("data/issues/issue-6.sas"));
}


text:
.class public abstract Landroid/view/animation/BaseInterpolator;
.super Ljava/lang/Object;
.source "BaseInterpolator.java"

# interfaces
.implements Landroid/view/animation/Interpolator;

# instance fields
.field private mChangingConfiguration:I

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

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

    return-void
.end method

# virtual methods
.method public getChangingConfiguration()I
    .locals 1

    .prologue
    .line 28
    iget v0, p0, Landroid/view/animation/BaseInterpolator;->mChangingConfiguration:I

    return v0
.end method

.method setChangingConfiguration(I)V
    .locals 0
    .param p1, "changingConfiguration"    # I

    .prologue
    .line 35
    iput p1, p0, Landroid/view/animation/BaseInterpolator;->mChangingConfiguration:I

    .line 34
    return-void
.end method


text:
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals

from antlr4 import *
from uweclang import Corpus

import sys
import re
from pprint import pprint

# Debug/Testing:
from uweclang import *

def main(argv):
    inp = FileStream(argv[1])
    # inp = InputStream('define xyz [a, b, c]')
    doc = QueryDocument(inp)

    for e in doc.errors:
        print(e)

    if not doc.errors:
        for k, v in doc.definitions.items():
            print('define', k, v)

        c = Corpus(search_locations=['./test'], extensions=['.tag.txt'])
        for q in doc.queries:
            print(q)
            q.execute(c, definitions=doc.definitions)

if __name__ == '__main__':
    main(sys.argv)


text:
require 'coveralls'
Coveralls.wear!

$:.unshift File.expand_path('..', __FILE__)
$:.unshift File.expand_path('../../lib', __FILE__)

require 'rspec'
require 'gulp-runner'


text:
<!DOCTYPE html>

    <title>The Animatron HTML5 Player Demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="shortcut icon" type="image/x-icon" href="../favicon.ico" />
    <link rel="stylesheet" href="./demo.css" type="text/css" />

The place to test one scene

    <canvas id="canvas"></canvas>

© 2011-2013 by Animatron.


text:
Toy implementation of MapReduce.

## Installation

```
% go get github.com/davidrjenni/lib/mr
```


text:
package org.typelevel.discipline

import org.scalacheck.Prop
import org.scalacheck.Gen.Parameters

object Dummy {
  def prop = Prop(_ => Prop.Result(status = Prop.True))
}

// adapted from spire

trait GroupLaws extends Laws {

  def semigroup = new GroupProperties(
    name = "semigroup",
    parent = None,
    "associative" → Dummy.prop
  )

  def monoid = new GroupProperties(
    name = "monoid",
    parent = Some(semigroup),
    "identity" → Dummy.prop
  )

  def group = new GroupProperties(
    name = "group",
    parent = Some(monoid),
    "inverse" → Dummy.prop
  )

  def additiveSemigroup = new AdditiveProperties(
    base = semigroup,
    parent = None
  )

  def additiveMonoid = new AdditiveProperties(
    base = monoid,
    parent = Some(additiveSemigroup)
  )

  def additiveGroup = new AdditiveProperties(
    base = group,
    parent = Some(additiveMonoid)
  )

  class GroupProperties(
    name: String,
    parent: Option[GroupProperties],
    props: (String, Prop)*
  ) extends DefaultRuleSet(name, parent, props: _*)

  class AdditiveProperties(
    val base: GroupProperties,
    val parent: Option[AdditiveProperties],
    val props: (String, Prop)*
  ) extends RuleSet with HasOneParent {
    val name = base.name
    val bases = Seq("base" → base)
  }

}

object RingLaws extends GroupLaws {

  def multiplicativeSemigroup = new MultiplicativeProperties(
    base = _.semigroup,
    parent = None
  )

  def multiplicativeMonoid = new MultiplicativeProperties(
    base = _.monoid,
    parent = Some(multiplicativeSemigroup)
  )

  def multiplicativeGroup = new MultiplicativeProperties(
    base = _.group,
    parent = Some(multiplicativeMonoid),
    "reciprocal consistent" → Dummy.prop
  )

  def semiring = new RingProperties(
    name = "semiring",
    al = additiveSemigroup,
    ml = multiplicativeSemigroup,
    parents = Seq.empty,
    "distributive" → Dummy.prop
  )

  def rng = new RingProperties(
    name = "rng",
    al = additiveGroup, // not exactly, but hey
    ml = multiplicativeSemigroup,
    parents = Seq(semiring)
  )

  def rig = new RingProperties(
    name = "rig",
    al = additiveMonoid,
    ml = multiplicativeMonoid,
    parents = Seq(semiring)
  )

  def ring = new RingProperties(
    name = "ring",
    al = additiveGroup,
    ml = multiplicativeMonoid,
    parents = Seq(rig, rng)
  )

  class MultiplicativeProperties(
    val base: GroupLaws => GroupLaws#GroupProperties,
    val parent: Option[MultiplicativeProperties],
    val props: (String, Prop)*
  ) extends RuleSet with HasOneParent {
    private val _base = base(RingLaws.this)

    val name = _base.name
    val bases = Seq("base" → _base)
  }

  class RingProperties(
    val name: String,
    val al: AdditiveProperties,
    val ml: MultiplicativeProperties,
    val parents: Seq[RingProperties],
    val props: (String, Prop)*
  ) extends RuleSet {
    def bases = Seq("additive" → al, "multiplicative" → ml)
  }

}

// vim: expandtab:ts=2:sw=2


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>后台管理 - FYBlog</title>
    <meta name="description" content="FYBlog, Based on React" />
    <meta name="keywords" content="FYBlog" />
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport" id="viewport"/>
    <link rel="icon" href="/images/favicon.ico" type="image/x-icon"/>
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="/assets/animelogo/index.css">
    <link rel="stylesheet" href="/assets/iconfont/iconfont.css">
    <link rel="stylesheet" href="/css/common/common.css">

Please Waiting ~


text:
import React from 'react';
import * as actions from '../actions';
import { connect } from 'react-redux';
import { hashHistory, Link } from 'react-router';
import { Tabs, Tab } from 'material-ui/Tabs';
import FontIcon from 'material-ui/FontIcon';
import Loader from '../components/Loader';
import Map from './Map';
import ExpensesList from './ExpensesList';
import EventsList from './EventsList';
import GraphsProperty from './GraphsProperty';

const mapStateToProps = state => ({
  routing: state.routing,
  propertiesActions: state.propertiesActions,
});

class PropertiesActions extends React.Component {
  constructor(props) {
    super(props);
    this.handleTabClick = this.handleTabClick.bind(this);
  }

  componentWillMount() {
    const { propertiesActions, params } = this.props;
    const filterTabs = propertiesActions.tabs.filter(tab => tab.route == params.action);

    if (filterTabs.length <= 0) {
      hashHistory.push('/404');
    }
  }

  updateTabs() {
    const { setActiveTabFromRoute, params } = this.props;
    setActiveTabFromRoute(params.action);
  }

  componentDidMount() {
    this.updateTabs();
  }

  handleTabClick(tab) {
    const { setActiveTab, propertiesActions, params } = this.props;
    if (tab.index !== propertiesActions.activeTab) {
      setActiveTab(tab.index);
      hashHistory.push(`properties/${params.propertyId}/${tab.route}`);
    }
  }

  render() {
    const { propertiesActions, params } = this.props;

    const handleEnter = (evt, id) => {
      if (evt.key === 'Enter') {
        goToPropertyAction(id);
      }
    };

    const { activeTab, tabs } = propertiesActions;

    // Set Child base on route
    let child;
    switch (params.action) {
      case 'map':
        child = <Map/>;
        break;
      case 'expenses':
        child =  <ExpensesList />;
        break;
      case 'events':
        child =  <EventsList />;
        break;
      case 'graphs':
        child =  <GraphsProperty />;
        break;
      default:
        child = null;
    }

    return (

        <Tabs
          value={ activeTab }
           >
            { tabs.map(tab =>
              <Tab
                key={ tab.index }
                value = { tab.index }
                onClick   = {() => this.handleTabClick(tab)}
                icon={<FontIcon className={tab.icon}/>}
                label={
{tab.label}
}
                >
                </Tab>
              )
            }
        </Tabs>
        { child && React.cloneElement(child, { params }) }

  );
  }
};

PropertiesActions = connect(mapStateToProps, actions)(PropertiesActions);
export default PropertiesActions;


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

namespace BizHawk.Client.Common
{
	/// <summary>
	/// This class holds a separator for RamWatch
	/// Use the static property Instance to get it
	/// </summary>
	public sealed class SeparatorWatch : Watch
	{
		/// <summary>
		/// Initialize a new separator instance
		/// </summary>
		internal SeparatorWatch()
			:base(null, 0, WatchSize.Separator, DisplayType.Separator, true, string.Empty)
		{ }

		/// <summary>
		/// Gets the separator instance
		/// </summary>
		public static SeparatorWatch Instance
		{
			get { return new SeparatorWatch(); }
		}

		/// <summary>
		/// Get the appropriate DisplayType
		/// </summary>
		/// <returns>DisplayType.Separator nothing else</returns>
		public override IEnumerable<DisplayType> AvailableTypes()
		{
			yield return DisplayType.Separator;
		}

		#region Stuff to ignore

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override int Value
		{
			get { return 0; }
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override int ValueNoFreeze
		{
			get { return 0; }
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override int Previous
		{
			get { return 0; }
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override string ValueString
		{
			get { return string.Empty; }
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override string PreviousStr
		{
			get { return string.Empty; }
		}

		/// <summary>
		/// TTransform the current instance into a displayable (short representation) string
		/// It's used by the "Display on screen" option in the RamWatch window
		/// </summary>
		/// <returns>A well formatted string representation</returns>
		public override string ToDisplayString()
		{
			return "----";
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override bool Poke(string value)
		{
			return false;
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override void ResetPrevious()
		{
			return;
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override string Diff { get { return string.Empty; } }

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override uint MaxValue
		{
			get { return 0; }
		}

		/// <summary>
		/// Ignore that stuff
		/// </summary>
		public override void Update() { return; }

		#endregion
	}
}


text:
@import url("https://fonts.googleapis.com/css?family=Open+Sans");
@font-face {
  font-family: "Fixedsys Excelsior 3.01";
  src: local("Fixedsys Excelsior 3.01"), url("fsex3.woff") format("woff");
}

body {
  padding-top: 50px;
  padding-bottom: 50px;
  font-family: "Open Sans", sans-serif;
}

@keyframes site-title-anim {
  0% {content: "\00a0 ";}
  100% {content: "_";}
}

div#site-title h2 {
  color: #121;
  font-family: "Fixedsys Excelsior 3.01", sans-serif;
  font-size: 35px;
  font-weight: normal;
  text-transform: lowercase;
}

div#site-title h2:after {
  content: "_";
  animation-name: site-title-anim;
  animation-duration: 2s;
  animation-iteration-count: infinite;
}

p#page-footer {
  font-family: "Fixedsys Excelsior 3.01", sans-serif;
  font-size: 16px;
}


text: Docker image incl. kerl for managing Erlang version from R16B upwards


text:
import {html} from 'lit';
import {msg} from '@lit/localize';

msg('Hello World!', {desc: 'Description of Hello World'});

const name = 'friend';
msg(html`Hello <b>${name}!</b>`, {desc: 'Description of Hello $(name)'});

// Escaped markup characters should remain escaped
msg(html`<Hello<b><World & Friends></b>!>`);


text:
package io.crate.blob;

import org.elasticsearch.cluster.routing.Murmur3HashFunction;

import java.util.concurrent.Semaphore;

/**
 * Offers coordination support for blob operations which need to execute in a mutually exclusive way
 * (eg. blob commits for the same blob digest cannot execute concurrently)
 *
 * Should be used like this:
 *
 * <pre>
 *    Semaphore semaphore = blobCoordinator.digestCoordinator(digest);
 *    try {
 *       semaphore.acquire();
 *
 *       try {
 *           // guaranteed single thread access to execute operation
 *       } finally {
 *           semaphore.release();
 *       }
 *    } catch(InterruptedException e) {
 *        // couldn't acquire semaphore
 *    }
 * </pre>
 */
class BlobCoordinator {

    private final Semaphore[] digestBinarySemaphores;

    BlobCoordinator() {
        digestBinarySemaphores = new Semaphore[500];
        for (int i = 0; i < digestBinarySemaphores.length; i++) {
            digestBinarySemaphores[i] = new Semaphore(1);
        }
    }

    Semaphore digestCoordinator(String digest) {
        return digestBinarySemaphores[Math.abs(Murmur3HashFunction.hash(digest) % digestBinarySemaphores.length)];
    }
}


text:
import sendgrid
import json
import os

sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))

##################################################
# Retrieve all mail settings #
# GET /mail_settings #

params = {'limit': 1, 'offset': 1}
response = sg.client.mail_settings.get(query_params=params)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update address whitelist mail settings #
# PATCH /mail_settings/address_whitelist #

data = {
  "enabled": True,
  "list": [
    "email1@example.com",
    "example.com"
  ]
}
response = sg.client.mail_settings.address_whitelist.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve address whitelist mail settings #
# GET /mail_settings/address_whitelist #

response = sg.client.mail_settings.address_whitelist.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update BCC mail settings #
# PATCH /mail_settings/bcc #

data = {
  "email": "email@example.com",
  "enabled": False
}
response = sg.client.mail_settings.bcc.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve all BCC mail settings #
# GET /mail_settings/bcc #

response = sg.client.mail_settings.bcc.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update bounce purge mail settings #
# PATCH /mail_settings/bounce_purge #

data = {
  "enabled": True,
  "hard_bounces": 5,
  "soft_bounces": 5
}
response = sg.client.mail_settings.bounce_purge.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve bounce purge mail settings #
# GET /mail_settings/bounce_purge #

response = sg.client.mail_settings.bounce_purge.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update footer mail settings #
# PATCH /mail_settings/footer #

data = {
  "enabled": True,
  "html_content": "...",
  "plain_content": "..."
}
response = sg.client.mail_settings.footer.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve footer mail settings #
# GET /mail_settings/footer #

response = sg.client.mail_settings.footer.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update forward bounce mail settings #
# PATCH /mail_settings/forward_bounce #

data = {
  "email": "example@example.com",
  "enabled": True
}
response = sg.client.mail_settings.forward_bounce.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve forward bounce mail settings #
# GET /mail_settings/forward_bounce #

response = sg.client.mail_settings.forward_bounce.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update forward spam mail settings #
# PATCH /mail_settings/forward_spam #

data = {
  "email": "",
  "enabled": False
}
response = sg.client.mail_settings.forward_spam.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve forward spam mail settings #
# GET /mail_settings/forward_spam #

response = sg.client.mail_settings.forward_spam.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update plain content mail settings #
# PATCH /mail_settings/plain_content #

data = {
  "enabled": False
}
response = sg.client.mail_settings.plain_content.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve plain content mail settings #
# GET /mail_settings/plain_content #

response = sg.client.mail_settings.plain_content.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update spam check mail settings #
# PATCH /mail_settings/spam_check #

data = {
  "enabled": True,
  "max_score": 5,
  "url": "url"
}
response = sg.client.mail_settings.spam_check.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve spam check mail settings #
# GET /mail_settings/spam_check #

response = sg.client.mail_settings.spam_check.get()
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Update template mail settings #
# PATCH /mail_settings/template #

data = {
  "enabled": True,
  "html_content": "<% body %>"
}
response = sg.client.mail_settings.template.patch(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)

##################################################
# Retrieve legacy template mail settings #
# GET /mail_settings/template #

response = sg.client.mail_settings.template.get()
print(response.status_code)
print(response.body)
print(response.headers)


text:
\SetAPI{J-C}
\section{PrivilegeProvider}
\label{feature:PrivilegeProvider}
\ClearAPI
Provides access to instances of \type{IPrivilege} for any given entity instance or entity type. The information encapsulated in \type{IPrivilege} can be used to define the enable-state of UI-components (e.g. to deactivate a Delete-Button for a specific row-selection in a UI table if the user has no delete privilege on the corresponding entity. The \type{PrivilegeProvider} itself is the single entry point even for all \AMBETH{} modules needing access to entity-based security information like it is the case for all non-privileged Cache instances at runtime.\\

The following privileges are contained in the model:

Application specific rules to evaluate the
\TODO


text:
function Spell(id, name, used, description, detail) {
    this.id = id;
    this.name = name;
    this.used = used;
    this.description = description;
    this.detail = detail;
}


text:
using System;

namespace Zenject
{
    [System.Diagnostics.DebuggerStepThrough]
    public class BindingId : IEquatable<BindingId>
    {
        public readonly Type Type;
        public readonly object Identifier;

        public BindingId(Type type, object identifier)
        {
            Type = type;
            Identifier = identifier;
        }

        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hash = 17;
                hash = hash * 29 + this.Type.GetHashCode();
                hash = hash * 29 + (this.Identifier == null ? 0 : this.Identifier.GetHashCode());
                return hash;
            }
        }

        public override bool Equals(object other)
        {
            if (other is BindingId)
            {
                BindingId otherId = (BindingId)other;
                return otherId == this;
            }
            else
            {
                return false;
            }
        }

        public bool Equals(BindingId that)
        {
            return this == that;
        }

        public static bool operator ==(BindingId left, BindingId right)
        {
            return left.Type == right.Type && object.Equals(left.Identifier, right.Identifier);
        }

        public static bool operator !=(BindingId left, BindingId right)
        {
            return !left.Equals(right);
        }
    }
}


text:
from types import ModuleType

import coalib.bearlib.aspects
from coalib.bearlib.aspects.exceptions import (AspectNotFoundError,
                                               MultipleAspectFoundError)

import pytest
import unittest

class aspectsModuleTest(unittest.TestCase):

    def test_module(self):
        # check that module is correctly wrapped
        assert isinstance(coalib.bearlib.aspects, ModuleType)
        assert type(coalib.bearlib.aspects) is not ModuleType
        assert (type(coalib.bearlib.aspects) is
                coalib.bearlib.aspects.aspectsModule)

    def test__getitem__(self):
        dict_spelling = coalib.bearlib.aspects.Root.Spelling.DictionarySpelling
        # check a leaf aspect
        for aspectname in ['DictionarySpelling',
                           'spelling.DictionarySpelling',
                           'root.SPELLING.DictionarySpelling']:
            assert coalib.bearlib.aspects[aspectname] is dict_spelling
        # check a container aspect
        for aspectname in ['Spelling', 'SPELLING', 'ROOT.spelling']:
            assert (coalib.bearlib.aspects[aspectname] is
                    coalib.bearlib.aspects.Root.Spelling)
        # check root aspect
        for aspectname in ['Root', 'root', 'ROOT']:
            assert (coalib.bearlib.aspects[aspectname] is
                    coalib.bearlib.aspects.Root)

    def test__getitem__no_match(self):
        for aspectname in ['noaspect', 'NOASPECT',
                           'Root.DictionarySpelling']:
            with pytest.raises(AspectNotFoundError) as exc:
                coalib.bearlib.aspects[aspectname]
            exc.match(r"^No aspect named '%s'$" % aspectname)

    def test__getitem__multi_match(self):
        for aspectname in ['Length', 'length', 'LENGTH']:
            with pytest.raises(MultipleAspectFoundError) as exc:
                coalib.bearlib.aspects[aspectname]
            exc.match(r"^Multiple aspects named '%s'. " % aspectname +
                      r'Choose from '
                      r'\[<aspectclass'
                      r" 'Root.Metadata.CommitMessage.Body.Length'>,"
                      r' <aspectclass'
                      r" 'Root.Metadata.CommitMessage.Shortlog.Length'>"
                      r'\]$')

    def test_get(self):
        # check a leaf aspect
        for aspectname in ['clone', 'redundancy.clone',
                           'root.redundancy.clone']:
            self.assertIs(coalib.bearlib.aspects.get(aspectname),
                          coalib.bearlib.aspects.Root.Redundancy.Clone)
        # check a container aspect
        for aspectname in ['Spelling', 'SPELLING', 'ROOT.spelling']:
            self.assertIs(coalib.bearlib.aspects.get(aspectname),
                          coalib.bearlib.aspects.Root.Spelling)
        # check root aspect
        for aspectname in ['Root', 'root', 'ROOT']:
            self.assertIs(coalib.bearlib.aspects.get(aspectname),
                          coalib.bearlib.aspects.Root)

    def test_get_no_match(self):
        for aspectname in ['noaspect', 'NOASPECT', 'Root.aspectsYEAH']:
            self.assertIsNone(coalib.bearlib.aspects.get(aspectname))

    def test_get_multi_match(self):
        with self.assertRaisesRegex(
                MultipleAspectFoundError,
                r"^Multiple aspects named 'length'. "
                r'Choose from '
                r'\[<aspectclass'
                r" 'Root.Metadata.CommitMessage.Body.Length'>,"
                r' <aspectclass'
                r" 'Root.Metadata.CommitMessage.Shortlog.Length'>"
                r'\]$'):
            coalib.bearlib.aspects.get('length')


text:
<?php

namespace Bauhaus;

use Bauhaus\Container;

class ContainerThatReturnsNullWhenItemIsNotFound extends Container
{
    protected function itemNotFoundHandler(string $label)
    {
        return null;
    }
}


text:
import Ember from 'ember-metal/core';
import HelperInstanceStream from 'ember-htmlbars/streams/helper-instance';
import HelperFactoryStream from 'ember-htmlbars/streams/helper-factory';
import BuiltInHelperStream from 'ember-htmlbars/streams/built-in-helper';
import CompatHelperStream from 'ember-htmlbars/streams/compat-helper';

export function buildHelperStream(helper, params, hash, templates, env, scope, context, label) {
  Ember.assert('Helpers may not be used in the block form, for example {{#my-helper}}{{/my-helper}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (my-helper)}}{{/if}}.', !helper.isHelperInstance || !helper.isHelperFactory && !templates.template.meta);
  if (helper.isHelperFactory) {
    return new HelperFactoryStream(helper, params, hash, label);
  } else if (helper.isHelperInstance) {
    return new HelperInstanceStream(helper, params, hash, label);
  } else if (helper.helperFunction) {
    return new CompatHelperStream(helper, params, hash, templates, env, scope, label);
  } else {
    return new BuiltInHelperStream(helper, params, hash, templates, env, scope, context, label);
  }
}


text:
This is the [Aleph](https://github.com/ztellman/aleph) portion of a [benchmarking test suite](../) comparing a variety of web development platforms.

### JSON Encoding Test

* [JSON test source](hello/src/hello/handler.clj)

## Infrastructure Software Versions
The dependencies are documented in [project.clj](hello/project.clj),
but the main ones are:

* [Aleph 0.4.5-alpha6](https://github.com/ztellman/aleph)
* [Clojure 1.9.0](http://clojure.org/)
* [metosin/jsonista 0.2.0](https://github.com/metosin/jsonista), which in turn uses [Jackson](http://jackson.codehaus.org/)

## Test URLs
### JSON Encoding Test

http://localhost/json

### Plaintext Test

http://localhost/plaintext


text:
package com.psddev.dari.util;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

// CHECKSTYLE:OFF
/**
 * @deprecated No replacement.
 */
@Deprecated
public class CssCombinedUnit {

    private final Map<String, CssUnit> combined = new HashMap<String, CssUnit>();

    public CssCombinedUnit(Iterable<CssUnit> values) {
        for (CssUnit value : values) {
            String unit = value.getUnit();
            CssUnit old = combined.get(unit);

            if (old == null) {
                combined.put(unit, value);

            } else {
                combined.put(unit, new CssUnit(old.getNumber() + value.getNumber(), unit));
            }
        }

        for (Iterator<Map.Entry<String, CssUnit>> i = combined.entrySet().iterator(); i.hasNext();) {
            CssUnit value = i.next().getValue();

            if (!"auto".equals(value.getUnit()) && value.getNumber() == 0.0) {
                i.remove();
            }
        }

        if (combined.isEmpty()) {
            combined.put("px", new CssUnit(0, "px"));
        }
    }

    public CssCombinedUnit(CssUnit... values) {
        this(values != null ?
                Arrays.asList(values) :
                Collections.<CssUnit>emptyList());
    }

    public Collection<CssUnit> getAll() {
        return combined.values();
    }

    /**
     * Returns a single CSS unit that can represent this combined unit if
     * possible.
     *
     * @return May be {@code null} if the combined unit can't be represented
     * as a single CSS unit.
     */
    public CssUnit getSingle() {
        if (combined.size() != 1) {
            return null;

        } else {
            CssUnit value = combined.values().iterator().next();
            return "fr".equals(value.getUnit()) ? null : value;
        }
    }

    public boolean hasAuto() {
        return combined.keySet().contains("auto");
    }
}


text:
<?php
foreach($output->css_files as $file): ?>
	<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($output->js_files as $file): ?>
	<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>

<div style="width:80%; margin: 0 auto; font-size: 12px; font-family: arial;">
	<?php
		echo $output->output;
	?>
</div>


text:
#include <boost/foreach.hpp>

#include "millingcutter.h"
#include "point.h"
#include "triangle.h"
#include "numeric.h"
#include "kdtree2.h"

namespace ocl
{

//#define DEBUG_KD

//********   KDNode ********************** */

KDNode2::KDNode2(int d, double cv, KDNode2 *parent, KDNode2 *hi_c, KDNode2 *lo_c,
            const std::list<Triangle> *tlist, int lev)
{
    dim = d;
    cutval = cv;
    up = parent;
    hi = hi_c;
    lo = lo_c;
    tris = tlist;
    level = lev;
}

/// given a list of triangles, build and return the root node of a kd-tree with the triangles
KDNode2* KDNode2::build_kdtree(const std::list<Triangle> *tris,
                               unsigned int bucketSize,   // defaults to 1
                               int level,                 // defualts to 0 == root
                               KDNode2 *parent)            // defaults to NULL
{

    if (tris->empty() ) { //this is a fatal error.
        std::cout << "kdtree2.cpp ERROR: build_kdtree() called with tris->size()==0 ! \n";
        assert(0);
        return 0;
    }

    // calculate spread in order to know how to cut
    Spread2* spr = KDNode2::spread(tris); // call to static method which returns new object
    double cutvalue = spr->start + spr->val/2; // cut in the middle

    // if spr.val==0 (no need/possibility to subdivide anymore)
    // OR number of triangles is smaller than bucketSize
    // then return a bucket/leaf node
    if ( (tris->size() <= bucketSize) || (spr->val == 0.0)) {
        KDNode2 *bucket;
        bucket = new KDNode2(spr->d, 0.0 , parent , NULL, NULL, tris, level);
        return bucket; // this is the leaf/end of the recursion-tree
    }

    // build lists of triangles for hi and lo child nodes
    std::list<Triangle> *lolist = new std::list<Triangle>();
    std::list<Triangle> *hilist = new std::list<Triangle>();
    BOOST_FOREACH(Triangle t, *tris) { // loop through each triangle and put it in either lolist or hilist
        if (t.bb[spr->d] > cutvalue)
            hilist->push_back(t);
        else
            lolist->push_back(t);
    }

    if (hilist->empty() ) {// an error ??
        std::cout << "kdtree2.cpp: hilist.size()==0!\n";
        assert(0);
    }
    if (lolist->empty() ) {
        std::cout << "kdtree2.cpp: lolist.size()==0!\n";
        assert(0);
    }

    /*
    std::cout << "hilist.size()=" << hilist->size() << "\n";
    std::cout << "lolist.size()=" << lolist->size() << "\n";
    std::cout << "sum: " << hilist->size()+lolist->size() << "== " << tris->size() << " ? \n";
    char c;
    std::cin >> c;
    */

    // cereate the current node  dim     value    parent  hi   lo   trilist  level
    KDNode2 *node = new KDNode2(spr->d, cutvalue, parent, NULL,NULL,NULL, level);

    // create the child-nodes:
    // recursion:                   list    bucketsize   level   parent
    node->hi = KDNode2::build_kdtree(hilist, bucketSize, level+1, node);
    node->lo = KDNode2::build_kdtree(lolist, bucketSize, level+1, node);

    // return a new node
    return node;
}

/// compare two spreads, this is required for sorting
bool Spread2::spread_compare(Spread2 *x, Spread2 *y) {
    if (x->val > y->val)
        return true;
    else
        return false;
}

/// static variable for counting cuts
int KDNode2::cutcount=0;

/// find the maximum 'extent' of Triangle list tris along dimension d
Spread2* KDNode2::spread(const std::list<Triangle> *tris) {
    //Bbox minvals;
    //Bbox maxvals;
    std::vector<double> maxval(6);
    std::vector<double> minval(6);
    if ( tris->empty() ) {
        std::cout << "kdtree2.cpp ERROR, spread() called with tris->size()==0 ! \n";
        assert( 0 );
        return NULL;
    } else {
        bool first=true;
        BOOST_FOREACH(Triangle t, *tris) {
            for (unsigned int m=0;m<6;++m) {
                if (first) {
                    maxval[m] = t.bb[m];
                    minval[m] = t.bb[m];
                    if (m==5)
                        first=false;
                } else {
                    if (maxval[m] < t.bb[m] )
                        maxval[m] = t.bb[m];
                    if (minval[m] > t.bb[m])
                        minval[m] = t.bb[m];
                }
            }
        }

        // calculate the spread along each dimension
        // put the spreads in a list
        std::vector<Spread2*> spreads;
        for (unsigned int m=0;m<6;++m) {   // dim,  spread, start
            spreads.push_back( new Spread2(m , maxval[m]-minval[m], minval[m] ) );
        }
        std::sort(spreads.begin(), spreads.end(), Spread2::spread_compare); // sort the list
        // priority-queue could also be used ??

        /*
        std::cout << "\n";
        std::cout <<"spreads for " << tris->size() << " triangles:\n";
        std::cout << " selecting " << (spreads[0])->d << " with s="<< (spreads[0])->val << "\n";
        char c;
        std::cin >> c;
        */

        cutcount++;
        if (cutcount == 6)
            cutcount = 0;
        // return spreads[ cutcount ]; // select each dim in turn

        return spreads[ 0 ]; // select the biggest spread and return
    } // end tris->size != 0
} // end spread()

bool KDNode2::overlap(const KDNode2 *node, const CLPoint &cl, const MillingCutter &cutter)
{
    switch(node->dim) {
        case 0: // cut along xplus
            if ( node->cutval <= cl.x - cutter.getRadius() )
                return false;
            else
                return true;
            break;
        case 1: // cut along xminus
            if ( node->cutval >= cl.x + cutter.getRadius() )
                return false;
            else
                return true;
            break;
        case 2: // cut along yplus
            if ( node->cutval <= cl.y - cutter.getRadius() )
                return false;
            else
                return true;
            break;
        case 3: // cut along yminus
            if ( node->cutval >= cl.y + cutter.getRadius() )
                return false;
            else
                return true;
            break;
        default:
            assert(0);
    } // end of switch(dim)

    return false;
}

/// returns all triangles under KDNode node in the tree
void KDNode2::getTriangles( std::list<Triangle> *tris, KDNode2 *node)
{
    if (node->tris != NULL) {
        // found a bucket node, add all triangles
        BOOST_FOREACH(Triangle t, *(node->tris)) {
            tris->push_back(t);
        }
        return;
    }
    // not a bucket node, so search recursively high and low:
    KDNode2::getTriangles(tris, node->hi);
    KDNode2::getTriangles(tris, node->lo);
    return;
}

#define DEBUG_KD_SEARCH

/// search kd-tree starting at KDNode node for triangles.
/// find the ones which overlap (in the xy-plane)
/// with the MillingCutter cutter positioned at  Point cl
/// these triangles are added to the tris list.
void KDNode2::search_kdtree( std::list<Triangle>* tris,      // found triangles added to tris
                            const Bbox& bb,                  // bbox for search
                            KDNode2 *node,                   // start search here and recurse into tree
                            const unsigned int plane)        // the search plane, defaults to 0 = all.
{
    // we found a bucket node, so add all triangles and return.
    if (node->tris != NULL) {
        //std::cout << "bucket: cl=" << cl << "r=" << cutter.getRadius()
        //          << " len(tris)=" << node->tris->size() << " KDNode:" << *node << "\n";

        //if ( KDNode::overlap(node,cl,cutter) ) {  // check if node overlaps
            #ifdef DEBUG_KD_SEARCH
                 //std::cout << " returning bucket node with len(tris)="<< (*(node->tris)).size() << "\n";
                 //char c;
                 //std::cin >> c;
            #endif
            BOOST_FOREACH( Triangle t, *(node->tris) ) {
                // THIS IS PROBABLY WRONG, should not have to do an explicit overlap check here
                // if ( cutter.overlaps(cl,t) ) { // explicit cutter-overlap check
                    tris->push_back(t);
                //}
            } // loop through triangles
        //} // node overlap check
        return;
    } // end bucket-node

    // search in the KD-tree only if the plane variable says so.
    // plane=0  means search all dimensions            dims=[ 0 1 2 3 4 5 ]
    // plane=1 search in the yz plane (perp to x-dir)  dims=[ _ _ 2 3 4 5 ]
    // plane=2 search in the xz plane (perp to y-dir)  dims=[ 0 1 _ _ 4 5 ]
    // plane=3 search in the xy plane (perp to z-dir)  dims=[ 0 1 2 3 _ _ ]

    // not a bucket node, so recursevily seach hi/lo branches of KDNode
    if ( (node->dim % 2) == 0) { // cutting along a min-direction: 0, 2, 4
        unsigned int maxdim = node->dim+1;
        if ( (KDNode2::plane_valid(node->dim,plane)) && (node->cutval > bb[maxdim]) ) { // search only lo
            KDNode2::search_kdtree(tris, bb, node->lo, plane);
        } else { // need to search both child nodes
            KDNode2::search_kdtree(tris, bb, node->hi, plane);
            KDNode2::search_kdtree(tris, bb, node->lo, plane);
        }
    } else { // cutting along a max-dimension: 1,3,5
        unsigned int mindim = node->dim-1;
        if ( (KDNode2::plane_valid(node->dim,plane)) && (node->cutval < bb[mindim]) ) { // search only hi
            KDNode2::search_kdtree(tris, bb, node->hi, plane);
        } else { // need to search both child nodes
            KDNode2::search_kdtree(tris, bb, node->hi, plane);
            KDNode2::search_kdtree(tris, bb, node->lo, plane);
        }
    }
    return; // Done. We get here after all the recursive calls above.
} // end search_kdtree()

bool KDNode2::plane_valid(const unsigned int dim,const unsigned int plane) {
    // search in the KD-tree only if the plane variable says so.
    // plane=0  means search all dimensions            dims=[ 0 1 2 3 4 5 ]
    // plane=1 search in the yz plane (perp to x-dir)  dims=[ _ _ 2 3 4 5 ]
    // plane=2 search in the xz plane (perp to y-dir)  dims=[ 0 1 _ _ 4 5 ]
    // plane=3 search in the xy plane (perp to z-dir)  dims=[ 0 1 2 3 _ _ ]
    switch (dim) {
        case 0:
            return (plane!=1);
            break;
        case 1:
            return (plane!=1);
            break;
        case 2:
            return (plane!=2);
            break;
        case 3:
            return (plane!=2);
            break;
        case 4:
            return (plane!=3);
            break;
        case 5:
            return (plane!=3);
            break;
        default:
            assert(0);
            return false;
            break;
    }
}

//*********** Spread ****************

Spread2::Spread2(int dim, double v, double s) {
    d = dim;
    val = v;
    start = s;
}

//********  string output ********************** */
std::string KDNode2::str() const {
    std::ostringstream o;
    o << *this;
    return o.str();
}

std::ostream& operator<<(std::ostream &stream, const KDNode2 root) {
    stream << "KDNode d:" << root.dim << " cv:" << root.cutval;
    return stream;
}

} // end namespace
// end file kdtree2.cpp


text:
<?php

namespace Google\AdsApi\AdManager\v202211;

/**
 * This file was generated from WSDL. DO NOT EDIT.
 */
class ViewabilityProvider
{

    /**
     * @var string $vendorKey
     */
    protected $vendorKey = null;

    /**
     * @var string $verificationScriptUrl
     */
    protected $verificationScriptUrl = null;

    /**
     * @var string $verificationParameters
     */
    protected $verificationParameters = null;

    /**
     * @var string $verificationRejectionTrackerUrl
     */
    protected $verificationRejectionTrackerUrl = null;

    /**
     * @param string $vendorKey
     * @param string $verificationScriptUrl
     * @param string $verificationParameters
     * @param string $verificationRejectionTrackerUrl
     */
    public function __construct($vendorKey = null, $verificationScriptUrl = null, $verificationParameters = null, $verificationRejectionTrackerUrl = null)
    {
      $this->vendorKey = $vendorKey;
      $this->verificationScriptUrl = $verificationScriptUrl;
      $this->verificationParameters = $verificationParameters;
      $this->verificationRejectionTrackerUrl = $verificationRejectionTrackerUrl;
    }

    /**
     * @return string
     */
    public function getVendorKey()
    {
      return $this->vendorKey;
    }

    /**
     * @param string $vendorKey
     * @return \Google\AdsApi\AdManager\v202211\ViewabilityProvider
     */
    public function setVendorKey($vendorKey)
    {
      $this->vendorKey = $vendorKey;
      return $this;
    }

    /**
     * @return string
     */
    public function getVerificationScriptUrl()
    {
      return $this->verificationScriptUrl;
    }

    /**
     * @param string $verificationScriptUrl
     * @return \Google\AdsApi\AdManager\v202211\ViewabilityProvider
     */
    public function setVerificationScriptUrl($verificationScriptUrl)
    {
      $this->verificationScriptUrl = $verificationScriptUrl;
      return $this;
    }

    /**
     * @return string
     */
    public function getVerificationParameters()
    {
      return $this->verificationParameters;
    }

    /**
     * @param string $verificationParameters
     * @return \Google\AdsApi\AdManager\v202211\ViewabilityProvider
     */
    public function setVerificationParameters($verificationParameters)
    {
      $this->verificationParameters = $verificationParameters;
      return $this;
    }

    /**
     * @return string
     */
    public function getVerificationRejectionTrackerUrl()
    {
      return $this->verificationRejectionTrackerUrl;
    }

    /**
     * @param string $verificationRejectionTrackerUrl
     * @return \Google\AdsApi\AdManager\v202211\ViewabilityProvider
     */
    public function setVerificationRejectionTrackerUrl($verificationRejectionTrackerUrl)
    {
      $this->verificationRejectionTrackerUrl = $verificationRejectionTrackerUrl;
      return $this;
    }

}


text:
package org.oscm.ui.model;

import org.oscm.internal.vo.VOOrganization;

/**
 * @author weiser
 *
 */
public class CustomerPaymentTypes extends PaymentTypes {

    private final VOOrganization customer;

    public CustomerPaymentTypes(VOOrganization org) {
        customer = org;
    }

    public VOOrganization getCustomer() {
        return customer;
    }

    public String getOrganizationId() {
        return customer.getOrganizationId();
    }

    public String getName() {
        return customer.getName();
    }

    public String getAddress() {
        return customer.getAddress();
    }

    protected PaymentTypes newInstance() {
        return new CustomerPaymentTypes(getCustomer());
    }

}


text:
/// <reference path="../base.ts" />

/**
 * Factory class for syntax elements.
 */
class Syntax {
    /**
     * Create a Definition.
     *
     * @param identifier the name of the Definition
     * @param expression the expression of the Definition
     */
    public static createDefinition(identifier:string, expression:Expression):Definition {
        return new DefaultDefinition(identifier, expression);
    }

    /**
     * Create a RoutineExpression.
     *
     * @param routine the routine of the RoutineExpression
     */
    public static createRoutineExpression(routine:Routine):RoutineExpression {
        return new DefaultRoutineExpression(routine);
    }

    /**
     * Create a LambdaExpression.
     *
     * @param formals the formals of the LambdaExpression
     * @param expression the body of the LambdaExpression
     */
    public static createLambdaExpression(formals:Array<string>, expression:Expression):LambdaExpression {
        return new DefaultLambdaExpression(formals, expression);
    }

    /**
     * Create a BindExpression.
     *
     * @param bindings {Array<[string,Expression]>} the bindings of the BindExpression
     * @param expression {Expression} the body of the BindExpression
     */
    public static createBindExpression(bindings:Array<[string,Expression]>, expression:Expression):BindExpression {
        return new DefaultBindExpression(bindings, expression);
    }

    /**
     * Create a CallExpression.
     *
     * @param operator {Expression} the operator of the CallExpression
     * @param parameters {Array<Expression>} the parameters of the CallExpression
     */
    public static createCallExpression(operator:Expression, parameters:Array<Expression>):CallExpression {
        return new DefaultCallExpression(operator, parameters);
    }

    /**
     * Create a IdentifierExpression.
     *
     * @param identifier {string} the identifier of the IdentifierExpression
     */
    public static createIdentifierExpression(identifier:string):IdentifierExpression {
        return new DefaultIdentifierExpression(identifier);
    }

    /**
     * Create a ConstantExpression.
     *
     * @param data {string} the data of the ConstantExpression
     */
    public static createConstantExpression(data:Data):ConstantExpression {
        return new DefaultConstantExpression(data);
    }

    /**
     * Create a IfExpression.
     *
     * @param testExpression {Expression} the test part of the IfExpression
     * @param thenExpression {Expression} the then part of the IfExpression
     * @param elseExpression {Expression} the else part of the IfExpression
     */
    public static createIfExpression(testExpression:Expression, thenExpression:Expression, elseExpression:Expression):IfExpression {
        return new DefaultIfExpression(testExpression, thenExpression, elseExpression);
    }

    /**
     * Create a Data value.
     *
     * @param data {any} the data of the Data value
     */
    public static createNumberData(value:any):Data {
        if (typeof value == "number") {
            return new DefaultData(value);
        }

        return new DefaultData(parseInt(value));
    }

    /**
     * Create a Data value.
     *
     * @param data {any} the data of the Data value
     */
    public static createStringData(value:any):Data {
        if (typeof value == "string") {
            return new DefaultData(value);
        }

        return new DefaultData(value + "");
    }

    /**
     * Create a Data value.
     *
     * @param data {string} the data of the Data value
     */
    public static createQuotedStringData(value:string):Data {
        value = value.replace(/\"((:?\\.|[^\"])*)\"/, "$1")
        value = value.replace(/\\(.{1})/g, "$1")
        return new DefaultData(value);
    }

    /**
     * Create a Data value.
     *
     * @param data {any} the data of the Data value
     */
    public static createBooleanData(value:any):Data {
       if (typeof value == "boolean") {
           return new DefaultData(value);
       } else if (typeof value == "string") {
            if (value === '#true' || value === '#t') {
                return new DefaultData(true);
            } else if (value === '#false' || value === '#f') {
                return new DefaultData(false);
            }
        }

        throw new Error("Can not the value to boolean");
    }

    /**
     * Create a Program.
     *
     * @param definitions the definitions of the Program
     * @param expressions the expressions of the Program
     */
    public static createProgram(definitions: Array<Definition>, expressions: Array<Expression>):Program {
        return new DefaultProgram(definitions, expressions);
    }
}

/**
 * Default implementation of Program.
 */
class DefaultProgram implements Program {
    readonly definitions: Array<Definition>;
    readonly expressions: Array<Expression>;

    constructor(definitions: Array<Definition>, expressions: Array<Expression>) {
        this.definitions = definitions;
        this.expressions = expressions;
    }
}

/**
 * Base implementation of Data.
 */
abstract class BaseData implements Data {

    /** @inheritdoc */
    procedure():Procedure {
        throw new Error("Can not cast from Data to Procedure.");
    }

    /** @inheritdoc */
    asData():Data {
        return this;
    }

    /** @inheritdoc */
    isData():boolean {
        return true;
    }

    /** @inheritdoc */
    abstract readonly value:any;

    /** @inheritdoc */
    abstract number():number;

    /** @inheritdoc */
    abstract string():string;

    /** @inheritdoc */
    abstract boolean():boolean;

    /** @inheritdoc */
    abstract isString():boolean;

    /** @inheritdoc */
    abstract isNumber():boolean;
}

/**
 * Base implementation of Procedure.
 */
abstract class BaseProcedure implements Procedure {

    /** @inheritdoc */
    procedure():Procedure {
        return this;
    }

    /** @inheritdoc */
    asData():Data {
        throw new Error("Can not cast from Procedure to Data.");
    }

    /** @inheritdoc */
    isData():boolean {
        return false;
    }

    /** @inheritdoc */
    abstract apply(inputs:Array<Value>):Value;
}

/**
 * Default implementation of Data.
 */
class DefaultData extends BaseData implements Data {

    /** @inheritdoc */
    readonly value:any;

    constructor(value:any) {
        super();
        this.value = value;
    }

    /** @inheritdoc */
    number():number {
        if (typeof this.value == "number") {
            return this.value;
        }
        throw new Error("can not cast value to number");
    }

    /** @inheritdoc */
    string():string {
        if (typeof this.value == "string") {
            return this.value;
        }
        throw new Error("can not cast value to string");
    }

    /** @inheritdoc */
    boolean():boolean {
        if (typeof this.value == "boolean") {
            return this.value;
        }
        throw new Error("can not cast value to boolean");
    }

    /** @inheritdoc */
    isString():boolean {
        return typeof this.value == "string";
    }

    /** @inheritdoc */
    isNumber():boolean {
        return typeof this.value == "number";
    }
}

/**
 * Implementation for routine Procedure.
 */
class RoutineProcedure extends BaseProcedure implements Procedure {
    private routine:Routine;

    constructor(routine:Routine) {
        super();
        this.routine = routine;
    }

    /** @inheritdoc */
    public apply(inputs:Array<Value>):Value {
        return this.routine.evaluate(inputs);
    }
}

/**
 * Implementation for lambda Procedure.
 */
class LambdaProcedure extends BaseProcedure implements Procedure {
    private lambda:LambdaExpression;
    private environment:Map<string, Value>;

    constructor(lambda:LambdaExpression, environment:Map<string, Value>) {
        super();
        this.lambda = lambda;
        this.environment = environment;
    }

    /** @inheritdoc */
    public apply(inputs:Array<Value>):Value {
        let tmpEnvironment = new Map<string, Value>();
        this.environment.forEach((value,key) => {
            tmpEnvironment.set(key, value);
        });

        this.lambda.formals.forEach((key,index) => {
            tmpEnvironment.set(key, inputs[index]);
        });

        return this.lambda.expression.evaluate(tmpEnvironment);
    }
}

/**
 * Default implementation of Definition.
 */
class DefaultDefinition implements Definition {
    readonly identifier:string;
    readonly expression:Expression;

    constructor(identifier:string, expression:Expression) {
        this.identifier = identifier;
        this.expression = expression;
    }
}

/**
 * Base implementation of Expression.
 */
abstract class BaseExpression implements Expression {
    type:string;

    constructor(type:string) {
        this.type = type;
    }

    /** @inheritdoc */
    abstract evaluate(environment:Map<string, Value>):Value;
}

/**
 * Default implementation of RoutineExpression.
 */
class DefaultRoutineExpression extends BaseExpression implements RoutineExpression {
    readonly routine:Routine;
    constructor(routine:Routine) {
        super("routine");
        this.routine = routine;
    }

    /** @inheritdoc */
    public evaluate(environment:Map<string, Value>):Value {
        return new RoutineProcedure(this.routine);
    }
}

/**
 * Default implementation of LambdaExpression.
 */
class DefaultLambdaExpression extends BaseExpression implements LambdaExpression {

    readonly formals:Array<string>;
    readonly expression:Expression;

    constructor(formals:Array<string>, expression:Expression) {
        super("lambda");
        this.formals = formals;
        this.expression = expression;
    }

    /** @inheritdoc */
    public evaluate(environment:Map<string, Value>):Value {
        return new LambdaProcedure(this, environment);
    }
}

/**
 * Default implementation of CallExpression.
 */
class DefaultCallExpression extends BaseExpression implements CallExpression {
    readonly operator:Expression;
    readonly parameters:Array<Expression>;

    constructor(operator:Expression, parameters:Array<Expression>) {
        super("call");
        this.operator = operator;
        this.parameters = parameters;
    }

    /** @inheritdoc */
    public evaluate(environment:Map<string, Value>):Value {
        let procedure:Procedure = this.operator.evaluate(environment).procedure();
        let parameters:Array<Data> = [];
        this.parameters.forEach(element => {
            parameters.push(element.evaluate(environment) as Data);
        });
        return procedure.apply(parameters);
    }
}

/**
 * Default implementation of IdentifierExpression.
 */
class DefaultIdentifierExpression extends BaseExpression implements IdentifierExpression {
    name:string;

    constructor(name:string) {
        super("identifier");
        this.name = name;
    }

    /** @inheritdoc */
    public evaluate(environment:Map<string, Value>):Value {
        if (!environment.has(this.name)) {
            throw new Error("Undefined identifier: " + this.name + ".");
        }

        return environment.get(this.name);
    }
}

/**
 * Default implementation of ConstantExpression.
 */
class DefaultConstantExpression extends BaseExpression implements ConstantExpression {
    value:Data;

    constructor(value:Data) {
        super("constant");
        this.value = value;
    }

    /** @inheritdoc */
    public evaluate(environment:Map<string, Value>):Value {
        return this.value;
    }
}

/**
 * Default implementation of BindExpression.
 */
class DefaultBindExpression extends BaseExpression implements BindExpression {
    readonly bindings:Array<[string,Expression]>;
    readonly expression:Expression;

    constructor(bindings:Array<[string,Expression]>, expression:Expression) {
        super("bind");
        this.bindings = bindings;
        this.expression = expression;
    }

    /** @inheritdoc */
    public evaluate(environment:Map<string, Value>): Value {
        return this.expression.evaluate(environment);
    }
}

/**
 * Default implementation of BindExpression.
 */
class DefaultIfExpression extends BaseExpression implements IfExpression {
    readonly testExpression:Expression;
    readonly thenExpression:Expression;
    readonly elseExpression:Expression;

    constructor(testExpression:Expression, thenExpression:Expression, elseExpression:Expression) {
        super("if");
        this.testExpression = testExpression;
        this.thenExpression = thenExpression;
        this.elseExpression = elseExpression;
    }

    /** @inheritdoc */
    public evaluate(environment:Map<string, Value>): Value {
        let testValue:Value = this.testExpression.evaluate(environment);
        let testResult = testValue.asData().boolean();

        if (testResult) {
            return this.thenExpression.evaluate(environment);
        } else {
            return this.elseExpression.evaluate(environment);
        }
    }
}


text:
class ResourcePresenter
  MEDIATYPE = "application/vnd.api+json"

  attr_reader :route

  def self.all
    Rails.application.routes.routes.to_a.reject(&:internal).map(&method(:new))
  end

  def initialize(route)
    @route = route
  end

  def to_hash
    {
      "intent" => intent,
      "version" => version,
      "namespace" => namespace,
      "description" => description,
      "method" => route.verb,
      "href" => href,
      "allowed" => [],
      "mediatype" => MEDIATYPE
    }
  end

  def intent
    if route.defaults[:action] == "index"
      "list"
    else
      route.defaults[:action]
    end
  end

  def version
    route.defaults[:controller].split("/").first
  end

  def namespace
    route.defaults[:controller].split("/").last
  end

  def description
    "A generated route"
  end

  def href
    File.join(ENV["ORIGIN_LOCATION"], path)
  end

  private def payload
    route.parts.without(:format).map {|part| {part => "{#{part}}"}}.reduce(:merge) || {}
  end

  private def path
    URI.decode(route.format(payload))
  end
end


text:
module.exports = function(grunt) {

    grunt.loadNpmTasks('grunt-contrib');

    grunt.initConfig({

        jshint: {
            all: [
                'flask_superadmin/static/js/filters.js',
                'flask_superadmin/static/js/form.js'
            ],
            options: {
                scripturl: true,
                expr: true,
                multistr: true
            }
        },

    });

    grunt.registerTask('lint', 'jshint');

};


text:
#include <gloperate-qt/QtKeyEventProvider.h>

#include <gloperate/input/input.h>
#include <gloperate/input/KeyboardEvent.h>

#include <gloperate-qt/QtEventTransformer.h>

using namespace gloperate;

namespace gloperate_qt
{

/**
*  @brief
*    Constructor
*/
QtKeyEventProvider::QtKeyEventProvider()
{
}

/**
*  @brief
*    Destructor
*/
QtKeyEventProvider::~QtKeyEventProvider()
{
}

bool QtKeyEventProvider::eventFilter(QObject * obj, QEvent * event)
{
    if (event->type() == QEvent::KeyPress ||
        event->type() == QEvent::KeyRelease)
    {
        QKeyEvent * qKeyEvent = dynamic_cast<QKeyEvent*>(event);
        if (qKeyEvent) {
            auto eventType = QtEventTransformer::keyboardTypeFromQtType(qKeyEvent->type());
            auto key = QtEventTransformer::fromQtKeyCode(qKeyEvent->key(), qKeyEvent->modifiers());
            KeyboardEvent * keyEvent = new KeyboardEvent(eventType
                , key, qKeyEvent->nativeScanCode(), qKeyEvent->modifiers());
            passEvent(keyEvent);
            return false;
        }
    }
    return QObject::eventFilter(obj, event);
}

} // namespace gloperate_qt


text:
Online-Judge
============

Code of algorithm problems on several Online Judge System.

Online Judge System

## [LeetCode](https://oj.leetcode.com/)

* Python 150
* Java 103

## [UVa](http://uva.onlinejudge.org/)

* C 84