text:
package org.apache.sis.referencing.operation.matrix;

import org.opengis.referencing.operation.Matrix;
import org.apache.sis.internal.util.Numerics;

/**
 * A matrix of fixed {@value #SIZE}×{@value #SIZE} size,
 * typically resulting from {@link org.opengis.referencing.operation.MathTransform1D} derivative computation.
 * The matrix member is:
 *
 *

 ┌     ┐
 * │ {@linkplain #m00} │
 * └     ┘

 *
 * @author  Martin Desruisseaux (IRD, Geomatys)
 * @version 0.4
 *
 * @see Matrix2
 * @see Matrix3
 * @see Matrix4
 *
 * @since 0.4
 * @module
 */
@SuppressWarnings("CloneableClassWithoutClone")             // No field in this class needs clone.
public final class Matrix1 extends MatrixSIS {
    /**
     * Serial number for inter-operability with different versions.
     */
    private static final long serialVersionUID = -4829171016106097031L;

    /**
     * The matrix size, which is {@value}.
     */
    public static final int SIZE = 1;

    /**
     * The only element in this matrix.
     */
    public double m00;

    /**
     * Creates a new identity matrix.
     */
    public Matrix1() {
        m00 = 1;
    }

    /**
     * Creates a new matrix filled with only zero values.
     *
     * @param ignore  shall always be {@code false} in current version.
     */
    Matrix1(final boolean ignore) {
    }

    /**
     * Creates a new matrix initialized to the specified value.
     *
     * @param m00 The element in this matrix.
     */
    public Matrix1(final double m00) {
        this.m00 = m00;
    }

    /**
     * Creates a new matrix initialized to the specified values.
     * The length of the given array must be 1.
     *
     * @param  elements  elements of the matrix.
     * @throws IllegalArgumentException if the given array does not have the expected length.
     *
     * @see #setElements(double[])
     * @see Matrices#create(int, int, double[])
     */
    public Matrix1(final double[] elements) throws IllegalArgumentException {
        setElements(elements);
    }

    /**
     * Creates a new matrix initialized to the same value than the specified one.
     * The specified matrix size must be {@value #SIZE}×{@value #SIZE}.
     * This is not verified by this constructor, since it shall be verified by {@link Matrices}.
     *
     * @param  matrix  the matrix to copy.
     */
    Matrix1(final Matrix matrix) {
        m00 = matrix.getElement(0,0);
    }

    /**
     * Casts or copies the given matrix to a {@code Matrix1} implementation. If the given {@code matrix}
     * is already an instance of {@code Matrix1}, then it is returned unchanged. Otherwise this method
     * verifies the matrix size, then copies the element in a new {@code Matrix1} object.
     *
     * @param  matrix  the matrix to cast or copy, or {@code null}.
     * @return the matrix argument if it can be safely casted (including {@code null} argument),
     *         or a copy of the given matrix otherwise.
     * @throws MismatchedMatrixSizeException if the size of the given matrix is not {@value #SIZE}×{@value #SIZE}.
     */
    public static Matrix1 castOrCopy(final Matrix matrix) throws MismatchedMatrixSizeException {
        if (matrix == null || matrix instanceof Matrix1) {
            return (Matrix1) matrix;
        }
        ensureSizeMatch(SIZE, SIZE, matrix);
        return new Matrix1(matrix);
    }

    /*
     * The 'final' modifier in following method declarations is redundant with the 'final' modifier
     * in this class declaration, but we keep them as a reminder of which methods should stay final
     * if this class was modified to a non-final class. Some methods should stay final because:
     *
     *  - returning a different value would make no-sense for this class (e.g. 'getNumRow()');
     *  - they are invoked by a constructor or by an other method expecting this exact semantic.
     */

    /**
     * Returns the number of rows in this matrix, which is always {@value #SIZE} in this implementation.
     *
     * @return always {@value #SIZE}.
     */
    @Override
    public final int getNumRow() {
        return SIZE;
    }

    /**
     * Returns the number of columns in this matrix, which is always {@value #SIZE} in this implementation.
     *
     * @return always {@value #SIZE}.
     */
    @Override
    public final int getNumCol() {
        return SIZE;
    }

    /**
     * Retrieves the value at the specified row and column of this matrix.
     * This method can be invoked when the matrix size or type is unknown.
     * If the matrix is known to be an instance of {@code Matrix1},
     * then the {@link #m00} field can be read directly for efficiency.
     *
     * @param  row     the row index, which can only be 0.
     * @param  column  the column index, which can only be 0.
     * @return the current value.
     */
    @Override
    public final double getElement(final int row, final int column) {
        if (row == 0 && column == 0) {
            return m00;
        } else {
            throw indexOutOfBounds(row, column);
        }
    }

    /**
     * Modifies the value at the specified row and column of this matrix.
     * This method can be invoked when the matrix size or type is unknown.
     * If the matrix is known to be an instance of {@code Matrix1},
     * then the {@link #m00} field can be set directly for efficiency.
     *
     * @param  row     the row index, which can only be 0.
     * @param  column  the column index, which can only be 0.
     * @param  value   the new value to set.
     */
    @Override
    public final void setElement(final int row, final int column, final double value) {
        if (row == 0 && column == 0) {
            m00 = value;
        } else {
            throw indexOutOfBounds(row, column);
        }
    }

    /**
     * Returns all matrix elements in a flat, row-major (column indices vary fastest) array.
     * The array length is 1.
     *
     * @return {@inheritDoc}
     */
    @Override
    public final double[] getElements() {
        final double[] elements = new double[SIZE*SIZE];
        getElements(elements);
        return elements;
    }

    /**
     * Copies the matrix elements in the given flat array.
     * The array length shall be at least 1, may also be 2.
     */
    @Override
    final void getElements(final double[] elements) {
        elements[0] = m00;
    }

    /**
     * Sets all matrix elements from a flat, row-major (column indices vary fastest) array.
     * The array length shall be 1.
     */
    @Override
    public final void setElements(final double[] elements) {
        ensureLengthMatch(SIZE*SIZE, elements);
        m00 = elements[0];
    }

    /**
     * {@inheritDoc}
     *
     * @return {@inheritDoc}
     */
    @Override
    public final boolean isAffine() {
        return m00 == 1;
    }

    /**
     * {@inheritDoc}
     *
     * @return {@inheritDoc}
     */
    @Override
    public final boolean isIdentity() {
        return m00 == 1;
    }

    /**
     * For a 1×1 matrix, this method does nothing.
     */
    @Override
    public void transpose() {
        // Nothing to do for a 1x1 matrix.
    }

    /**
     * Normalizes all columns in-place.
     * For a 1×1 matrix, this method just sets unconditionally the {@link #m00} value to 1.
     */
    @Override
    public void normalizeColumns() {
        m00 = 1;
    }

    /**
     * Returns {@code true} if the specified object is of type {@code Matrix1} and
     * all of the data members are equal to the corresponding data members in this matrix.
     *
     * @param  object  the object to compare with this matrix for equality.
     * @return {@code true} if the given object is equal to this matrix.
     */
    @Override
    public boolean equals(final Object object) {
        if (object instanceof Matrix1) {
            final Matrix1 that = (Matrix1) object;
            return Numerics.equals(m00, that.m00);
        }
        return false;
    }

    /**
     * Returns a hash code value based on the data values in this object.
     *
     * @return {@inheritDoc}
     */
    @Override
    public int hashCode() {
        return Numerics.hashCode(Double.doubleToLongBits(m00) ^ serialVersionUID);
    }
}


text:
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
# License: PROPRIETARY. See LICENSE.txt.
# frozen_string_literal: true

# vim:tw=0:ts=2:sw=2:et:ai
# Unauthorized copying of this file is strictly prohibited.

#require 'erb'
require 'fileutils'
#require 'tempfile'
require 'MrMurano/version'
require 'MrMurano/Config'
require 'MrMurano/ProjectFile'
require '_workspace'

RSpec.describe MrMurano::ProjectFile do
  context 'Basics ' do
    include_context 'WORKSPACE'
    before(:example) do
      $cfg = MrMurano::Config.new
      $cfg.load
      $cfg['user.name'] = 'bob@builder.co'
      $project = nil
    end

    context 'No files to load' do
      context 'Defaults' do
        before(:example) do
          @pjf = MrMurano::ProjectFile.new
          #@pjf.load
        end
        it 'Info' do
          expect(@pjf.get('info.name')).to eq('project')
          expect(@pjf.get('info.summary')).to eq('One line summary of project')
          expect(@pjf.get('info.description')).to eq("In depth description of project\n\nWith lots of details.")
          expect(@pjf.get('info.authors')).to eq(['bob@builder.co'])
          expect(@pjf.get('info.version')).to eq('1.0.0')
        end

        it 'Assets' do
          # Because defaults before load() are all nil, the default_value_for method
          # is called.
          expect(@pjf).to receive(:default_value_for).with('assets.location').and_return('here')
          expect(@pjf.get('assets.location')).to eq('here')

          expect(@pjf).to receive(:default_value_for).with('assets.include').and_return(['here'])
          expect(@pjf.get('assets.include')).to eq(['here'])

          expect(@pjf).to receive(:default_value_for).with('assets.exclude').and_return(['here'])
          expect(@pjf.get('assets.exclude')).to eq(['here'])

          expect(@pjf).to receive(:default_value_for).with('assets.default_page').and_return('here')
          expect(@pjf.get('assets.default_page')).to eq('here')
        end

        it 'Modules' do
          # Because defaults before load() are all nil, the default_value_for method
          # is called.
          expect(@pjf).to receive(:default_value_for).with('modules.location').and_return('here')
          expect(@pjf.get('modules.location')).to eq('here')

          expect(@pjf).to receive(:default_value_for).with('modules.include').and_return(['here'])
          expect(@pjf.get('modules.include')).to eq(['here'])

          expect(@pjf).to receive(:default_value_for).with('modules.exclude').and_return(['here'])
          expect(@pjf.get('modules.exclude')).to eq(['here'])
        end

        it 'Routes' do
          # Because defaults before load() are all nil, the default_value_for method
          # is called.
          expect(@pjf).to receive(:default_value_for).with('routes.location').and_return('here')
          expect(@pjf.get('routes.location')).to eq('here')

          expect(@pjf).to receive(:default_value_for).with('routes.include').and_return(['here'])
          expect(@pjf.get('routes.include')).to eq(['here'])

          expect(@pjf).to receive(:default_value_for).with('routes.exclude').and_return(['here'])
          expect(@pjf.get('routes.exclude')).to eq(['here'])
        end

        it 'Services' do
          # Because defaults before load() are all nil, the default_value_for method
          # is called.
          expect(@pjf).to receive(:default_value_for).with('services.location').and_return('here')
          expect(@pjf.get('services.location')).to eq('here')

          expect(@pjf).to receive(:default_value_for).with('services.include').and_return(['here'])
          expect(@pjf.get('services.include')).to eq(['here'])

          expect(@pjf).to receive(:default_value_for).with('services.exclude').and_return(['here'])
          expect(@pjf.get('services.exclude')).to eq(['here'])
        end
      end

      context 'Bad Keys' do
        before(:example) do
          @pjf = MrMurano::ProjectFile.new
        end
        it 'Empty' do
          expect { @pjf.get('') }.to raise_error('Empty key')
        end
        it 'No dot' do
          expect { @pjf.get('info') }.to raise_error('Missing dot')
        end
        it 'Undefined key' do
          expect { @pjf.get('info.bob') }.to raise_error("no member 'bob' in struct")
        end
        it 'Undefined section' do
          expect { @pjf.get('sob.include') }.to raise_error(NameError)
        end
        it 'Missing key' do
          expect { @pjf.get('info.') }.to raise_error('Missing key')
        end
        it 'Missing section' do
          expect { @pjf.get('.include') }.to raise_error("no member '' in struct")
        end
      end

      context 'default_value_for mapping' do
        before(:example) do
          @pjf = MrMurano::ProjectFile.new
        end

        it 'returns nil for unmapped key.' do
          expect(@pjf.default_value_for('foooood')).to be_nil
        end

        it 'hits $cfg if mapped key' do
          expect($cfg).to receive(:get).with('location.endpoints').and_return('beef')
          expect(@pjf.default_value_for('routes.location')).to eq('beef')
        end

        it 'returns array for split values' do
          expect($cfg).to receive(:get).with('endpoints.searchFor').and_return('beef')
          expect(@pjf.default_value_for('routes.include')).to eq(['beef'])

          expect($cfg).to receive(:get).with('endpoints.searchFor').and_return('beef and potatoes')
          expect(@pjf.default_value_for('routes.include')).to eq(%w[beef and potatoes])
        end
      end
    end

    context 'Calling load' do
      before(:example) do
        @pjf = MrMurano::ProjectFile.new
      end

      context 'load just meta' do
        before(:example) do
          src = File.join(@testdir, 'spec/fixtures/ProjectFiles/only_meta.yaml')
          dst = File.join(@project_dir, 'meta.murano')
          FileUtils.copy(src, dst)
          @pjf.load
        end
        it 'has the name' do
          expect(@pjf.get('info.name')).to eq('tested')
        end
        it 'has version' do
          expect(@pjf.get('info.version')).to eq('1.56.12')
        end

        it 'fails back to $cfg' do
          expect(@pjf).to receive(:default_value_for).with('routes.include').and_return(['here'])
          expect(@pjf.get('routes.include')).to eq(['here'])
        end
      end

      context 'load custom routes' do
        before(:example) do
          src = File.join(@testdir, 'spec/fixtures/ProjectFiles/with_routes.yaml')
          dst = File.join(@project_dir, 'meta.murano')
          FileUtils.copy(src, dst)
          @pjf.load
        end
        it 'has the name' do
          expect(@pjf.get('info.name')).to eq('tested')
        end
        it 'has version' do
          expect(@pjf.get('info.version')).to eq('1.56.12')
        end
        it 'does not fail back to $cfg' do
          expect(@pjf).to_not receive(:default_value_for)
          expect(@pjf.get('routes.include')).to eq(['custom_api.lua'])
        end
      end

      it 'reports validation errors' do
        src = File.join(@testdir, 'spec/fixtures/ProjectFiles/invalid.yaml')
        dst = File.join(@project_dir, 'meta.murano')
        FileUtils.copy(src, dst)

        saved = $stderr
        $stderr = StringIO.new
        expect(@pjf.load).to eq(-5)
        expect($stderr.string).to match(
          %r{The property '#/info' did not contain a required property of 'description'}
        )
        $stderr = saved
      end
    end
  end

  context 'Solutionfile 0.2.0' do
    include_context 'WORKSPACE'
    before(:example) do
      $cfg = MrMurano::Config.new
      $cfg.load
      $cfg['user.name'] = 'bob@builder.co'
      $project = nil
      @pjf = MrMurano::ProjectFile.new
    end

    it 'Reports validation errors' do
      src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.2.0_invalid.json')
      dst = File.join(@project_dir, 'Solutionfile.json')
      FileUtils.copy(src, dst)
      saved = $stderr
      $stderr = StringIO.new
      @pjf.load
      expect($stderr.string).to match(
        %r{The property '#/' did not contain a required property of 'custom_api'}
      )
      $stderr = saved
    end

    it 'loads with truncated version' do
      src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.2.json')
      dst = File.join(@project_dir, 'Solutionfile.json')
      FileUtils.copy(src, dst)
      saved = $stderr
      $stderr = StringIO.new
      @pjf.load
      expect($stderr.string).to eq('')
      $stderr = saved
    end

    context 'loads' do
      before(:example) do
        src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.2.0.json')
        dst = File.join(@project_dir, 'Solutionfile.json')
        FileUtils.copy(src, dst)
        @pjf.load
      end
      it 'defines assets' do
        expect(@pjf.get('assets.default_page')).to eq('index.html')
        expect(@pjf.get('assets.location')).to eq('public')
        expect(@pjf.get('assets.include')).to eq(['**/*'])
      end

      it 'defines routes' do
        expect(@pjf['routes.location']).to eq('.')
        expect(@pjf.get('routes.include')).to eq(['sample_api.lua'])
      end

      it 'defines modules' do
        expect(@pjf['modules.location']).to eq('.')
        expect(@pjf['modules.include']).to match_array(
          ['modules/debug.lua', 'modules/listen.lua', 'modules/util.lua']
        )
      end

      it 'defines services' do
        expect(@pjf['services.location']).to eq('.')
        expect(@pjf['services.include']).to match_array(
          ['event_handler/product.lua', 'event_handler/timer.lua']
        )
      end
    end
  end

  context 'Solutionfile 0.3.0' do
    include_context 'WORKSPACE'
    before(:example) do
      $cfg = MrMurano::Config.new
      $cfg.load
      $cfg['user.name'] = 'bob@builder.co'
      $project = nil
      @pjf = MrMurano::ProjectFile.new
    end

    it 'Reports validation errors' do
      src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.3.0_invalid.json')
      dst = File.join(@project_dir, 'Solutionfile.json')
      FileUtils.copy(src, dst)
      saved = $stderr
      $stderr = StringIO.new
      @pjf.load
      expect($stderr.string).to match(
        %r{The property '#/' did not contain a required property of 'routes'}
      )
      $stderr = saved
    end

    it 'loads with truncated version' do
      src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.3.json')
      dst = File.join(@project_dir, 'Solutionfile.json')
      FileUtils.copy(src, dst)
      saved = $stderr
      $stderr = StringIO.new
      @pjf.load
      expect($stderr.string).to eq('')
      $stderr = saved
    end

    context 'loads' do
      before(:example) do
        src = File.join(@testdir, 'spec/fixtures/SolutionFiles/0.3.0.json')
        dst = File.join(@project_dir, 'Solutionfile.json')
        FileUtils.copy(src, dst)
        @pjf.load
      end
      it 'defines assets' do
        expect(@pjf.get('assets.default_page')).to eq('index.html')
        expect(@pjf.get('assets.location')).to eq('public')
        expect(@pjf.get('assets.include')).to eq(['**/*'])
      end

      it 'defines routes' do
        expect(@pjf['routes.location']).to eq('.')
        expect(@pjf.get('routes.include')).to eq(['sample_api.lua'])
      end

      it 'defines modules' do
        expect(@pjf['modules.location']).to eq('.')
        expect(@pjf['modules.include']).to match_array(
          [
            'modules/debug.lua',
            'modules/listen.lua',
            'modules/util.lua',
          ]
        )
      end

      it 'defines services' do
        expect(@pjf['services.location']).to eq('.')
        expect(@pjf['services.include']).to match_array(
          [
            'event_handler/product.lua',
            'event_handler/timer.lua',
          ]
        )
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace App\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
	/*
	|--------------------------------------------------------------------------
	| Register Controller
	|--------------------------------------------------------------------------
	|
	| This controller handles the registration of new users as well as their
	| validation and creation. By default this controller uses a trait to
	| provide this functionality without requiring any additional code.
	|
	*/

	use RegistersUsers;

	/**
	 * Where to redirect users after login / registration.
	 *
	 * @var string
	 */
	protected $redirectTo = '/home';

	/**
	 * Create a new controller instance.
	 *
	 * @return void
	 */
	public function __construct()
	{
		$this->middleware('guest');
	}

	/**
	 * Get a validator for an incoming registration request.
	 *
	 * @param  array  $data
	 * @return \Illuminate\Contracts\Validation\Validator
	 */
	protected function validator(array $data)
	{
		$message = array(
			'username.min'		=> 'Username must contains atleast 5 characters',
			'password.min' 		=> 'Password must contains atleast 8 characters',
			'password.regex'	=> 'Password must contains letter and number'
		);
		return Validator::make($data, [
			'username' =>   'required|
							max:255|
							min:5|
							unique:users',
			'email' 	=> 'required|
							email|
							max:255|
							unique:users',
			'password' 	=>  'required|
							min:8|
							max:16|
							regex:/^(?=.*[A-Za-z])(?=.*[0-9]).+$/|
							confirmed',
		], $message);
	}

	/**
	 * Create a new user instance after a valid registration.
	 *
	 * @param  array  $data
	 * @return User
	 */
	protected function create(array $data)
	{
		return User::create([
			'username' => $data['username'],
			'email' => $data['email'],
			'password' => bcrypt($data['password']),
		]);
	}
}


text:
package me.iromzy.juggernaut.Commands;

import org.bukkit.entity.Player;

public class GiveGemCommand extends SubCommand  {

	@Override
	public void onCommand(Player p, String args) {

	}

	@Override
	public String name() {
		return "givegem";
	}

	@Override
	public String info() {
		return "This command allows admins to give gems to players.";
	}

	@Override
	public String aliases() {
		return null;
	}

}


text:
#include <boost/algorithm/string/trim.hpp>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <votca/tools/rangeparser.h>
#include <votca/tools/table.h>
#include <boost/lexical_cast.hpp>
#include <votca/tools/tokenizer.h>
#include <votca/tools/getline.h>
#include <iostream>
#include <votca/csg/imcio.h>

namespace votca { namespace csg {

typedef ub::matrix<double> group_matrix;
using namespace std;

void imcio_write_dS(const string &file, ub::vector<double> &r, ub::vector<double> &dS, std::list<int> *list)
{
    // write the dS
    ofstream out_dS;
    out_dS.open(file.c_str());
    out_dS << setprecision(8);
    if (!out_dS)
        throw runtime_error(string("error, cannot open file ") + file);

    if(list == NULL) {
        for (size_t i = 0; i < dS.size(); ++i) {
            out_dS << r[i] << " " << dS[i] << endl;
        }
    }
    else {
        for(std::list<int>::iterator i = list->begin(); i!=list->end(); ++i) {
            out_dS << r[*i] << " " << dS[*i] << endl;
        }
    }

    out_dS.close();
    cout << "written " << file << endl;
}

void imcio_write_matrix(const string &file, ub::matrix<double> &gmc, std::list<int> *list)
{
    ofstream out_A;
    out_A.open(file.c_str());
    out_A << setprecision(8);

    if (!out_A)
        throw runtime_error(string("error, cannot open file ") + file);

    if(list == NULL) {
        for (group_matrix::size_type i = 0; i < gmc.size1(); ++i) {
            for (group_matrix::size_type j = 0; j < gmc.size2(); ++j) {
                out_A << gmc(min(i,j), max(i,j)) << " ";
            }
            out_A << endl;
        }
    }
    else {
        for(std::list<int>::iterator i = list->begin(); i!=list->end(); ++i) {
            for(std::list<int>::iterator j = list->begin(); j!=list->end(); ++j) {
                out_A << gmc(*i, *j) << " ";
            }
            out_A << endl;
        }
    }
out_A.close();
    cout << "written " << file << endl;
}

void imcio_write_index(const string &file, vector<string> &names, vector<RangeParser> &ranges)
{
    // write the index

    ofstream out_idx;
    out_idx.open(file.c_str());

    if (!out_idx)
        throw runtime_error(string("error, cannot open file ") + file);

    for (size_t i = 0; i < names.size(); ++i)
        out_idx << names[i] << " " << ranges[i] << endl;

    out_idx.close();
    cout << "written " << file << endl;
}

void imcio_read_dS(const string &filename, ub::vector<double> &r, ub::vector<double> &dS)
{
    Table tbl;
    tbl.Load(filename);

    r.resize(tbl.size());
    dS.resize(tbl.size());

    for(unsigned int i=0; i<tbl.size(); ++i) {
        r(i) = tbl.x(i);
        dS(i) = tbl.y(i);
    }
}

void imcio_read_matrix(const string &filename, ub::matrix<double> &gmc)
{
    ifstream in;
    in.open(filename.c_str());

    bool is_initialized = false;
    if(!in)
        throw runtime_error(string("error, cannot open file ") + filename);

    size_t line_count =0;
    string line;
    // read till the first data line
    while(getline(in, line)) {
        // remove comments and xmgrace stuff
        line = line.substr(0, line.find("#"));
        line = line.substr(0, line.find("@"));

        // tokenize string and put it to vector
        Tokenizer tok(line, " \t");
        vector<string> tokens;
        tok.ToVector(tokens);

        // skip empty lines
        if(tokens.size()==0) continue;
        if(!is_initialized)
            gmc.resize(tokens.size(),tokens.size());
        is_initialized=true;

        if(gmc.size1()!=tokens.size())
            throw runtime_error(string("error loading ")
                    + filename + ": size mismatchm, number of columns differ");
        for(size_t i=0; i<tokens.size(); ++i)
            gmc(line_count,i) = boost::lexical_cast<double>(tokens[i]);
        ++line_count;
    }
    if(line_count != gmc.size1())
            throw runtime_error(string("error loading ")
                    + filename + ": size mismatch, not enough lines");
    in.close();
}

void imcio_read_index(const string &filename, vector<string> &names, vector<RangeParser> &ranges)
{
    ifstream in;
    in.open(filename.c_str());
    if(!in)
        throw runtime_error(string("error, cannot open file ") + filename);

    names.clear();
    ranges.clear();
    string line;

    // read till the first data line
    while(getline(in, line)) {
        // remove comments and xmgrace stuff
        line = line.substr(0, line.find("#"));
        line = line.substr(0, line.find("@"));

        boost::trim(line);

        size_t found;
        found = line.find(" ");
        if(found==string::npos)
            throw runtime_error(string("wrong format in ") + filename);

        string name = line.substr(0, found);

        string range = line.substr(found);

        RangeParser rp;
        rp.Parse(range);
        names.push_back(name);
        ranges.push_back(rp);

    }
    in.close();
}

}}


text:
module RailsAjaxFormhandler
  VERSION = "1.0.0"
end


text:
let sinon       = require('sinon');
let chai        = require('chai');
let expect      = chai.expect;
let factory     = require('../../src/index');
let Application = require('../../src/application');

describe('Goodly factory', () => {

  describe('with object params', () => {
    it('should return service', () => {
      let app = factory({ name: 'test' });
      expect(app instanceof Application);
    });
    it('should assign the name', () => {
      let app = factory({ name: 'test' });
      expect(app.name).to.equal('test');
    });
    it('should not start service', () => {
      let app = factory({ name: 'test' });
      expect(app._channel).to.be.undefined;
    });
  });

  describe('with string', () => {
    it('should return service', () => {
      let app = factory('test');
      expect(app instanceof Application);
    });
    it('should assign the name', () => {
      let app = factory('test');
      expect(app.name).to.equal('test');
    });
    it('should not start service', () => {
      let app = factory('test');
      expect(app._channel).to.be.undefined;
    });
  });

  describe('with no param', () => {
    it('should return service', () => {
      let app = factory();
      expect(app instanceof Application);
    });
    it('should not assign name', () => {
      let app = factory();
      expect(app.name).to.not.be.undefined;
    });
    it('should not start service', () => {
      let app = factory();
      expect(app._channel).to.be.undefined;
    });
  });

});


text:
namespace Gu.Units.Tests.Internals.Parsing
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using NUnit.Framework;

    public class DoubleReaderTests
    {
        private static readonly string[] PadFormats = { "abc{0}def", "abcd{0}ef", "{0}" };
        private static readonly CultureInfo En = CultureInfo.GetCultureInfo("en-US");
        private static readonly CultureInfo Sv = CultureInfo.GetCultureInfo("sv-SE");

        private static readonly IReadOnlyList<TestCase> HappyPaths = new[]
        {
            CreateTestCase("0", NumberStyles.Float, En),
            CreateTestCase("0.", NumberStyles.Float, En),
            CreateTestCase(".0", NumberStyles.Float, En),
            CreateTestCase("0.0", NumberStyles.Float, En),
            CreateTestCase("1.2", NumberStyles.Float, En),
            CreateTestCase("0.012", NumberStyles.Float, En),
            CreateTestCase("0.0012", NumberStyles.Float, En),
            CreateTestCase("0.001", NumberStyles.Float, En),
            CreateTestCase("1", NumberStyles.Float, En),
            CreateTestCase(" 1", NumberStyles.Float, En),
            CreateTestCase("-1", NumberStyles.Float, En),
            CreateTestCase("+1", NumberStyles.Float, En),
            CreateTestCase(".1", NumberStyles.Float, En),
            CreateTestCase("-.1", NumberStyles.Float, En),
            CreateTestCase("1.", NumberStyles.Float, En),
            CreateTestCase("-1.", NumberStyles.Float, En),
            CreateTestCase("12,345.67", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("-12,345.67", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("+1.2", NumberStyles.Float, En),
            CreateTestCase("+1,2", NumberStyles.Float, Sv),
            CreateTestCase("+1.2e3", NumberStyles.Float, En),
            CreateTestCase("-1.2E3", NumberStyles.Float, En),
            CreateTestCase("+1.2e-3", NumberStyles.Float, En),
            CreateTestCase("+1.2E-3", NumberStyles.Float, En),
            CreateTestCase("-1.2e+3", NumberStyles.Float, En), //// 1,,2,3,4,5,,,.00
            CreateTestCase("1,,2,3,4,5,,,.00", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("12345678910123456789", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("1.2345678910123456789", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("1234567891012345678.9", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase(new string('1', 307), NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase(new string('1', 308), NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase(new string('1', 309), NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("0." + new string('0', 15) + "1", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("0." + new string('0', 16) + "1", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("0." + new string('0', 299) + "1", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase("0." + new string('0', 300) + "1", NumberStyles.Float | NumberStyles.AllowThousands, En),
            CreateTestCase(-12345.678910, NumberStyles.Float, En, "e"),
            CreateTestCase(12345.678910, NumberStyles.Float, En, "E"),
            CreateTestCase(12345.678910, NumberStyles.Float, En, "E5"),
            CreateTestCase(-12345.678910, NumberStyles.Float, En, "f"),
            CreateTestCase(12345.678910, NumberStyles.Float, En, "F"),
            CreateTestCase(12345.678912, NumberStyles.Float, En, "F20"),
            CreateTestCase(12345.678910, NumberStyles.Float, En, "G"),
            CreateTestCase(-12345.678910, NumberStyles.Float, En, "g"),
            CreateTestCase(12345.678910, NumberStyles.Float, En, "g5"),
            CreateTestCase(12345.678910, NumberStyles.Float | NumberStyles.AllowThousands, En, "n"),
            CreateTestCase(12345.678910, NumberStyles.Float | NumberStyles.AllowThousands, En, "N"),
            CreateTestCase(12345.678910, NumberStyles.Float | NumberStyles.AllowThousands, En, "N5"),
            CreateTestCase(12345.678910, NumberStyles.Float, En, "R"),
            CreateTestCase(-12345.678910, NumberStyles.Float, En, "r"),
            CreateTestCase(-Math.PI, NumberStyles.Float, En, "f15"),
            CreateTestCase(-Math.PI, NumberStyles.Float, En, "f16"),
            CreateTestCase(-Math.PI, NumberStyles.Float, En, "f17"),
            CreateTestCase(Math.PI, NumberStyles.Float, En, "f25"),
            CreateTestCase("3.141592653589793238", NumberStyles.Float, En),
            CreateTestCase("-3.141592653589793238", NumberStyles.Float, En),
            CreateTestCase("0.017453292519943295", NumberStyles.Float, En),
            CreateTestCase(-Math.PI, NumberStyles.Float, En, "r"),
            CreateTestCase(Sv.NumberFormat.NaNSymbol, NumberStyles.Float, Sv),
            CreateTestCase(Sv.NumberFormat.PositiveInfinitySymbol, NumberStyles.Float, Sv),
            CreateTestCase(Sv.NumberFormat.NegativeInfinitySymbol, NumberStyles.Float, Sv),
        };

        private static readonly IReadOnlyList<TestCase> Errors = new[]
        {
            CreateTestCase("e1", NumberStyles.Float, En),
            CreateTestCase(" 1", NumberStyles.None, En),
            CreateTestCase("-1", NumberStyles.None, En),
            CreateTestCase(".1", NumberStyles.None, En),
            CreateTestCase(",.1", NumberStyles.Float, En),
            CreateTestCase(new string('1', 311), NumberStyles.Float, En),
            ////Add("1.", NumberStyles.Float | NumberStyles.AllowHexSpecifier, en),
            CreateTestCase(".", NumberStyles.Float, En),
            ////Add("+1,2", NumberStyles.Float, en),
            ////Add("+1.2", NumberStyles.Float, sv),
            CreateTestCase("+1.2e3", NumberStyles.None | NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, En),
        };

        [TestCaseSource(nameof(HappyPaths))]
        public void ReadSuccess(TestCase data)
        {
            var culture = data.Culture;
            var style = data.Styles;
            foreach (var format in PadFormats)
            {
                var text = string.Format(format, data.Text);
                var pos = format.IndexOf('{');
                var start = pos;
                double expected = double.Parse(data.Text, style, culture);
                var actual = DoubleReader.Read(text, ref pos, style, culture);
                Assert.AreEqual(expected, actual);
                var expectedEnd = start + data.Text.Length;
                Assert.AreEqual(expectedEnd, pos);
            }
        }

        [TestCaseSource(nameof(Errors))]
        public void ReadError(TestCase data)
        {
            var culture = data.Culture;
            var style = data.Styles;
            var text = data.Text;
            foreach (var format in PadFormats)
            {
                var ns = string.Format(format, text);
                var pos = format.IndexOf('{');
                var start = pos;
                Exception parseException = null;
                try
                {
                    // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
                    double.Parse(text, style, culture);
                }
                catch (Exception e)
                {
                    parseException = e;
                }

                Exception readException = null;
                try
                {
                    DoubleReader.Read(ns, ref pos, style, culture);
                }
                catch (Exception e)
                {
                    readException = e;
                }

                Assert.AreEqual(start, pos);
                Assert.NotNull(parseException);
                Assert.NotNull(readException);
            }
        }

        [Test]
        public void ReadException()
        {
            var text = "abcdef";
            var culture = CultureInfo.InvariantCulture;
            var pos = 3;
            var e = Assert.Throws<FormatException>(() => DoubleReader.Read(text, ref pos, NumberStyles.Float, culture));
            var expected = "Expected to find a double starting at index 3\r\n" +
                           "String: abcdef\r\n" +
                           "           ^";
            Assert.AreEqual(expected, e.Message);
        }

        [TestCaseSource(nameof(HappyPaths))]
        public void TryReadSuccess(TestCase data)
        {
            var culture = data.Culture;
            var style = data.Styles;
            var pos = 0;
            Assert.IsTrue(double.TryParse(data.Text, style, culture, out double expected));
            Assert.IsTrue(DoubleReader.TryRead(data.Text, ref pos, style, culture, out double actual));
            Assert.AreEqual(expected, actual);
            var expectedEnd = data.Text.Length;
            Assert.AreEqual(expectedEnd, pos);
        }

        [TestCaseSource(nameof(HappyPaths))]
        public void TryReadPaddedSuccess(TestCase data)
        {
            var culture = data.Culture;
            var style = data.Styles;
            foreach (var format in PadFormats)
            {
                var text = string.Format(format, data.Text);
                var pos = format.IndexOf('{');
                var start = pos;
                Assert.IsTrue(double.TryParse(data.Text, style, culture, out double expected));
                Assert.IsTrue(DoubleReader.TryRead(text, ref pos, style, culture, out double actual));
                Assert.AreEqual(expected, actual);
                var expectedEnd = start + data.Text.Length;
                Assert.AreEqual(expectedEnd, pos);
            }
        }

        [TestCaseSource(nameof(Errors))]
        public void TryReadErrorPadded(TestCase data)
        {
            var culture = data.Culture;
            var style = data.Styles;
            var s = data.Text;
            foreach (var format in PadFormats)
            {
                var ns = string.Format(format, s);
                var pos = format.IndexOf('{');
                var start = pos;
                Assert.IsFalse(double.TryParse(s, style, culture, out double expected));
                Assert.IsFalse(DoubleReader.TryRead(ns, ref pos, style, culture, out double actual));
                Assert.AreEqual(expected, actual);
                Assert.AreEqual(start, pos);
            }
        }

        [TestCaseSource(nameof(Errors))]
        public void TryReadError(TestCase data)
        {
            var culture = data.Culture;
            var style = data.Styles;
            var pos = 0;
            Assert.IsFalse(double.TryParse(data.Text, style, culture, out double expected));
            Assert.IsFalse(DoubleReader.TryRead(data.Text, ref pos, style, culture, out double actual));
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(0, pos);
        }

        private static TestCase CreateTestCase(double value, NumberStyles styles, IFormatProvider culture, string format)
        {
            return new TestCase(value.ToString(format, culture), styles, culture);
        }

        private static TestCase CreateTestCase(string text, NumberStyles styles, CultureInfo culture)
        {
            return new TestCase(text, styles, culture);
        }

        public class TestCase
        {
            public TestCase(string text, NumberStyles styles, IFormatProvider culture)
            {
                this.Text = text;
                this.Styles = styles;
                this.Culture = culture;
            }

            public string Text { get; }

            public NumberStyles Styles { get; }

            public IFormatProvider Culture { get; }

            public override string ToString()
            {
                return $"Text: {this.Text}, Styles: {this.Styles}, Culture: {this.Culture}";
            }
        }
    }
}


text:
using Sensus.Probes.User.Scripts;
using Xamarin.Forms;

namespace Sensus.UI
{
    /// <summary>
    /// Displays script runners for a script probe.
    /// </summary>
    public class ScriptRunnersPage : ContentPage
    {
        private ScriptProbe _probe;
        private ListView _scriptRunnersList;

        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptRunnersPage"/> class.
        /// </summary>
        /// <param name="probe">Probe to display.</param>
        public ScriptRunnersPage(ScriptProbe probe)
        {
            _probe = probe;

            Title = "Scripts";

            _scriptRunnersList = new ListView();
            _scriptRunnersList.ItemTemplate = new DataTemplate(typeof(TextCell));
            _scriptRunnersList.ItemTemplate.SetBinding(TextCell.TextProperty, "Name");
            _scriptRunnersList.ItemTapped += async (o, e) =>
            {
                if (_scriptRunnersList.SelectedItem == null)
                    return;

                ScriptRunner selectedScriptRunner = _scriptRunnersList.SelectedItem as ScriptRunner;

                string selectedAction = await DisplayActionSheet(selectedScriptRunner.Name, "Cancel", null, "Edit", "Delete");

                if (selectedAction == "Edit")
                {
                    ScriptRunnerPage scriptRunnerPage = new ScriptRunnerPage(selectedScriptRunner);
                    scriptRunnerPage.Disappearing += (oo, ee) =>
                    {
                        Bind();
                    };

                    await Navigation.PushAsync(scriptRunnerPage);
                }
                else if (selectedAction == "Delete")
                {
                    if (await DisplayAlert("Delete " + selectedScriptRunner.Name + "?", "This action cannot be undone.", "Delete", "Cancel"))
                    {
                        selectedScriptRunner.Stop();
                        selectedScriptRunner.Enabled = false;
                        selectedScriptRunner.Triggers.Clear();

                        _probe.ScriptRunners.Remove(selectedScriptRunner);
                        _scriptRunnersList.SelectedItem = null;  // reset manually since it's not done automatically
                    }
                }
            };

            ToolbarItems.Add(new ToolbarItem(null, "plus.png", () =>
                    {
                        _probe.ScriptRunners.Add(new ScriptRunner("New Script", _probe));
                    }));

            Bind();
            Content = _scriptRunnersList;
        }

        private void Bind()
        {
            _scriptRunnersList.ItemsSource = null;
            _scriptRunnersList.ItemsSource = _probe.ScriptRunners;
        }
    }
}


text:
function getCookie(cname) {
  var name = cname + "=";
  var ca = document.cookie.split(';');
  for(var i=0; i<ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1);
    if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
  }
  return "";
}
function deleteCookie( name ) {
  document.cookie = name + '=; expires=Fri, 20 Jan 2002 11:11:11 GMT;';
}
function setExpireDate(cname, date) {
    document.cookie = cname + "=" + getCookie(cname) + "; expires=" + date;
}


text:
/*
 * Minio Cloud Storage, (C) 2015 Minio, 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.
 */

package disk

// Info stat fs struct is container which holds following values
// Total - total size of the volume / disk
// Free - free size of the volume / disk
// Type - file system type string
type Info struct {
	Total  int64
	Free   int64
	FSType string
}


text:
A sample demonstrates asyncronous loading of resource with Observable.

* AsAsyncOperationObservable
* Last
* Do


text:
from ctypes import *
from ctypes import util

security = cdll.LoadLibrary(util.find_library("Security"))

class Keychain(object):
    def __init__(self, service):
        self.service = c_char_p(service)
        self.serviceLen = c_ulong(len(service))

    def storePassword(self, account, password):
        acctLen = c_ulong(len(account))
        pwLen = c_ulong(len(password))
        acctData = c_char_p(account)
        pwData = create_string_buffer(password)
        security.SecKeychainAddGenericPassword(
                    None,
                    self.serviceLen,
                    self.service,
                    acctLen,
                    acctData,
                    pwLen,
                    pwData,
                    None
            )

    def retrievePassword(self, account):
        acctLen = c_ulong(len(account))
        acctData = c_char_p(account)
        pwLen = pointer(c_ulong())
        pwData = pointer(c_char_p())

        security.SecKeychainFindGenericPassword(
                    None,
                    self.serviceLen,
                    self.service,
                    acctLen,
                    acctData,
                    pwLen,
                    pwData,
                    None
            )

        intendedLen = pwLen.contents.value
        if pwData.contents.value != None:
            return pwData.contents.value[0:intendedLen]
        else:
            return None

    def modifyPassword(self, account, newPassword):
        acctLen = c_ulong(len(account))
        newPwLen = c_ulong(len(newPassword))
        itemRef = pointer(c_void_p())
        newPwData = create_string_buffer(newPassword)

        security.SecKeychainFindGenericPassword(
                    None,
                    self.serviceLen,
                    self.service,
                    acctLen,
                    account,
                    None,
                    None,
                    itemRef
            )
        security.SecKeychainItemModifyAttributesAndData(
                itemRef.contents,
                None,
                newPwLen,
                newPwData
        )

    def deletePassword(self, account):
        acctLen = c_ulong(len(account) + 1)
        itemRef = c_void_p()
        security.SecKeychainFindGenericPassword(
                    None,
                    self.serviceLen,
                    self.service,
                    acctLen,
                    account,
                    None,
                    None,
                    byref(itemRef)
            )
        security.SecKeychainItemDelete(itemRef)


text:
class CefEndTracingCallbackCToCpp
    : public CefCToCpp<CefEndTracingCallbackCToCpp, CefEndTracingCallback,
        cef_end_tracing_callback_t> {
 public:
  explicit CefEndTracingCallbackCToCpp(cef_end_tracing_callback_t* str)
      : CefCToCpp<CefEndTracingCallbackCToCpp, CefEndTracingCallback,
          cef_end_tracing_callback_t>(str) {}
  virtual ~CefEndTracingCallbackCToCpp() {}

  // CefEndTracingCallback methods
  virtual void OnEndTracingComplete(const CefString& tracing_file) OVERRIDE;
};

#endif  // BUILDING_CEF_SHARED
#endif  // CEF_LIBCEF_DLL_CTOCPP_END_TRACING_CALLBACK_CTOCPP_H_


text:
require "ec2ctl/version"
require "ec2ctl/cli"
require "ec2ctl/client"


text:
<?php

/*
V4.80 8 Mar 2006  (c) 2000-2007 John Lim (jlim#natsoft.com.my). All rights reserved.
  Released under both BSD license and Lesser GPL library license.
  Whenever there is any discrepancy between the two licenses,
  the BSD license will take precedence.
  Set tabs to 4 for best viewing.

  Latest version is available at http://adodb.sourceforge.net
*/

function NotifyExpire($ref,$key)
{
	print "
Notify Expiring=$ref, sessionkey=$key
";
}

//-------------------------------------------------------------------

error_reporting(E_ALL);

ob_start();
include('../session/adodb-cryptsession2.php');

$options['debug'] = 99;
$db = 'postgres';

#### CONNECTION
switch($db) {
case 'oci8':
	$options['table'] = 'adodb_sessions2';
	ADOdb_Session::config('oci8', '', 'jcollect', 'natsoft', '',$options);
	break;

case 'postgres':
	ADOdb_Session::config('postgres', 'localhost', 'tester', 'test', 'test',$options);
	break;

case 'mysql':
default:
	ADOdb_Session::config('mysql', 'localhost', 'root', '', 'xphplens_2',$options);
	break;

}

#### SETUP NOTIFICATION
	$USER = 'JLIM'.rand();
	$ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire');

	adodb_session_create_table();
	session_start();

	adodb_session_regenerate_id();

### SETUP SESSION VARIABLES
	if (empty($_SESSION['MONKEY'])) $_SESSION['MONKEY'] = array(1,'abc',44.41);
	else $_SESSION['MONKEY'][0] += 1;
	if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1;

### START DISPLAY
	print "
PHP ".PHP_VERSION."
";
	print "
\$_SESSION['AVAR']={$_SESSION['AVAR']}
";

	print "
 Cookies: ";
	print_r($_COOKIE);

	var_dump($_SESSION['MONKEY']);

### RANDOMLY PERFORM Garbage Collection
### In real-production environment, this is done for you
### by php's session extension, which calls adodb_sess_gc()
### automatically for you. See php.ini's
### session.cookie_lifetime and session.gc_probability

	if (rand() % 5 == 0) {

		print "

Garbage Collection
";
		adodb_sess_gc(10);

		if (rand() % 2 == 0) {
			print "
Random session destroy
";
			session_destroy();
		}
	}
?>


text:
body {
    font-weight: 400;
    /*text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);*/
}

pre, code, pre code {
    font-family: 'Fira Mono', monospace;
    border: none;
    border-radius: 0;
    background-color: #eaeaea;
    font-size: 0.85em;
}

pre {
    font-size: 0.9em;
}

header {
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

header a:hover {
    text-decoration: none;
}

h3:first-child {
    margin-top: 0;
}

h4:nth-child(n+2) {
    margin-top: 20px;
}

footer {
    margin: 20px 0;
    font-size: 0.85em;
    color: #999;
    text-align: center;
}

nav {
    font-size: 0.9em;
}

nav .nav-header {
    padding: 5px 0;
    border-bottom: solid 1px #f0f0f0;
}

nav > ul.nav > li > a {
    padding: 5px 10px;
}

nav li.active {
    font-weight: bold;
    background: #f6f6f6;
    border-left: solid 2px #999;
}

nav > ul.nav > li.active > a {
    padding-left: 8px;
}

table {
  margin-bottom: 1rem;
  border: 1px solid #e5e5e5;
  border-collapse: collapse;
}

td, th {
  padding: .25rem .5rem;
  border: 1px solid #e5e5e5;
}

img {
    max-width: 80%;
    margin: 0 auto;
    display: block;
}

.critical {
    font-weight: bold;
    color: #e20000;
}

.highlight .hll { background-color: #ffffcc }
.highlight  { background: #eaeaea; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */


text:
describe('ColHeader', function() {
  var id = 'testContainer';

  beforeEach(function() {
    this.$container = $('

').appendTo('body');
  });

  afterEach(function() {
    if (this.$container) {
      destroy();
      this.$container.remove();
    }
  });

  it('should not show col headers by default', function() {
    var that = this;
    handsontable();

    expect(that.$container.find('thead th').length).toEqual(0);
  });

  it('should show col headers if true', function() {
    var that = this;
    handsontable({
      colHeaders: true
    });

    expect(that.$container.find('thead th').length).toBeGreaterThan(0);
  });

  it('should show default columns headers labelled A-(Z * n)', function() {
    var that = this;
    var startCols = 5;

    handsontable({
      startCols: startCols,
      colHeaders: true
    });

    var ths = getHtCore().find('thead th');
    expect(ths.length).toEqual(startCols);
    expect($.trim(ths.eq(0).text())).toEqual('A');
    expect($.trim(ths.eq(1).text())).toEqual('B');
    expect($.trim(ths.eq(2).text())).toEqual('C');
    expect($.trim(ths.eq(3).text())).toEqual('D');
    expect($.trim(ths.eq(4).text())).toEqual('E');
  });

  it('should show default columns headers labelled A-(Z * n) when columns as an array is present', function() {
    var that = this;
    var startCols = 5;

    handsontable({
      startCols: startCols,
      colHeaders: true,
      columns: [{}, {}, {}, {}, {}]
    });

    var ths = getHtCore().find('thead th');
    expect(ths.length).toEqual(startCols);
    expect($.trim(ths.eq(0).text())).toEqual('A');
    expect($.trim(ths.eq(1).text())).toEqual('B');
    expect($.trim(ths.eq(2).text())).toEqual('C');
    expect($.trim(ths.eq(3).text())).toEqual('D');
    expect($.trim(ths.eq(4).text())).toEqual('E');
  });

  it('should show default columns headers labelled A-(Z * n) when columns as a function is present', function() {
    var that = this;
    var startCols = 5;

    handsontable({
      startCols: startCols,
      colHeaders: true,
      columns: function (column) {
        return {};
      }
    });

    var ths = getHtCore().find('thead th');
    expect(ths.length).toEqual(startCols);
    expect($.trim(ths.eq(0).text())).toEqual('A');
    expect($.trim(ths.eq(1).text())).toEqual('B');
    expect($.trim(ths.eq(2).text())).toEqual('C');
    expect($.trim(ths.eq(3).text())).toEqual('D');
    expect($.trim(ths.eq(4).text())).toEqual('E');
  });

  it('should show col headers with custom label', function() {
    var that = this;
    var startCols = 5;
    handsontable({
      startCols: startCols,
      colHeaders: ['First', 'Second', 'Third']
    });

    var ths = getHtCore().find('thead th');
    expect(ths.length).toEqual(startCols);
    expect($.trim(ths.eq(0).text())).toEqual('First');
    expect($.trim(ths.eq(1).text())).toEqual('Second');
    expect($.trim(ths.eq(2).text())).toEqual('Third');
    expect($.trim(ths.eq(3).text())).toEqual('D');
    expect($.trim(ths.eq(4).text())).toEqual('E');
  });

  it('should not show col headers if false', function() {
    var that = this;
    handsontable({
      colHeaders: false
    });

    expect(that.$container.find('th.htColHeader').length).toEqual(0);
  });

  it('should hide columns headers after updateSettings', function() {
    var hot = handsontable({
      startCols: 5,
      colHeaders: true
    });

    expect(getHtCore().find('thead th').length).toEqual(5);
    expect(getTopClone().find('thead th').length).toEqual(5);

    hot.updateSettings({
      colHeaders: false
    });

    expect(getHtCore().find('thead th').length).toEqual(0);
    expect(getTopClone().width()).toEqual(0);
  });

  it('should show/hide columns headers after updateSettings', function() {
    var hot = handsontable({
      startCols: 5,
      colHeaders: true
    });

    expect(getHtCore().find('thead th').length).toEqual(5);
    expect(getTopClone().find('thead th').length).toEqual(5);

    hot.updateSettings({
      colHeaders: false
    });

    expect(getHtCore().find('thead th').length).toEqual(0);
    expect(getTopClone().width()).toEqual(0);

    hot.updateSettings({
      colHeaders: true
    });

    expect(getHtCore().find('thead th').length).toEqual(5);
    expect(getTopClone().width()).toBeGreaterThan(0);

    hot.updateSettings({
      colHeaders: false
    });

    expect(getHtCore().find('thead th').length).toEqual(0);
    expect(getTopClone().width()).toEqual(0);
  });

  it('should show columns headers after updateSettings', function() {
    var hot = handsontable({
      startCols: 5,
      colHeaders: false
    });

    expect(getHtCore().find('thead th').length).toEqual(0);
    expect(getTopClone().find('thead th').length).toEqual(0);

    hot.updateSettings({
      colHeaders: true
    });

    expect(getHtCore().find('thead th').length).toEqual(5);
    expect(getTopClone().find('thead th').length).toEqual(5);
  });

  it('should show new columns headers after updateSettings', function() {
    var hot = handsontable({
      startCols: 3,
      colHeaders: ['A', 'B', 'C']
    });

    var htCore = getHtCore();
    expect(htCore.find('thead th:eq(0)').text()).toEqual('A');
    expect(htCore.find('thead th:eq(1)').text()).toEqual('B');
    expect(htCore.find('thead th:eq(2)').text()).toEqual('C');

    hot.updateSettings({
      colHeaders: ['X', 'Y', 'Z']
    });

    expect(htCore.find('thead th:eq(0)').text()).toEqual('X');
    expect(htCore.find('thead th:eq(1)').text()).toEqual('Y');
    expect(htCore.find('thead th:eq(2)').text()).toEqual('Z');

  });

  it('should be possible to define colHeaders with a function', function() {
    var hot = handsontable({
      startCols: 2,
      colHeaders: function(col) {
        switch (col) {
          case 0:
            return 'One';

          case 1:
            return 'Two';
        }
      }
    });

    var htCore = getHtCore();

    expect(htCore.find('thead th:eq(0)').text()).toEqual('One');
    expect(htCore.find('thead th:eq(1)').text()).toEqual('Two');
  });

  it('should be possible to set HTML in colHeaders', function() {
    var hot = handsontable({
      startCols: 2,
      colHeaders: ['One <input type="checkbox">', 'Two <input type="checkbox">']
    });

    var htCore = getHtCore();

    expect(htCore.find('thead th:eq(0) input[type=checkbox]').length).toEqual(1);
    expect(htCore.find('thead th:eq(1) input[type=checkbox]').length).toEqual(1);
  });

  it('should be possible to set colHeaders when columns array is present', function() {
    var hot = handsontable({
      startCols: 2,
      colHeaders: ['One', 'Two'],
      columns: [
        {type: 'text'},
        {type: 'text'}
      ]
    });

    var htCore = getHtCore();

    expect(htCore.find('thead th:eq(0)').text()).toEqual('One');
    expect(htCore.find('thead th:eq(1)').text()).toEqual('Two');
  });

  it('should be possible to set colHeaders when columns function is present', function() {
    var hot = handsontable({
      startCols: 2,
      colHeaders: ['One', 'Two'],
      columns: function(column) {
        var colMeta = {type: 'text'};

        if ([0, 1].indexOf(column) < 0) {
          colMeta = null;
        }

        return colMeta;
      }
    });

    var htCore = getHtCore();

    expect(htCore.find('thead th:eq(0)').text()).toEqual('One');
    expect(htCore.find('thead th:eq(1)').text()).toEqual('Two');
  });

  it('should be possible to set colHeaders using columns title property', function() {
    var hot = handsontable({
      startCols: 2,
      colHeaders: ['One', 'Two'],
      columns: [
        {type: 'text', title: 'Special title'},
        {type: 'text'}
      ]
    });

    var htCore = getHtCore();

    expect(htCore.find('thead th:eq(0)').text()).toEqual('Special title');
    expect(htCore.find('thead th:eq(1)').text()).toEqual('Two');
  });

  it('should be possible to set colHeaders using columns title property when columns is a function', function() {
    var hot = handsontable({
      startCols: 2,
      colHeaders: ['One', 'Two'],
      columns: function(column) {
        var colMeta = {type: 'text'};

        if (column === 0) {
          colMeta.title = 'Special title';
        }
        if ([0, 1].indexOf(column) < 0) {
          colMeta = null;
        }

        return colMeta;
      }
    });

    var htCore = getHtCore();

    expect(htCore.find('thead th:eq(0)').text()).toEqual('Special title');
    expect(htCore.find('thead th:eq(1)').text()).toEqual('Two');
  });

  it("should resize all the column headers in the overlays, according to the other overlays' height", function() {
    var hot = handsontable({
      startCols: 5,
      colHeaders: ['a', 'a', 'a', 'a
a', 'a'],
      fixedColumnsLeft: 2
    });

    var topHeaderExample = $(".ht_clone_top").find('thead tr:first-child th:nth-child(1)'),
      masterHeaderExample = $(".ht_master").find('thead tr:first-child th:nth-child(3)');

    expect(topHeaderExample.height()).toEqual(masterHeaderExample.height());
  });

  it('should allow defining custom column header height using the columnHeaderHeight config option', function() {
    var hot = handsontable({
      startCols: 3,
      colHeaders: true,
      columnHeaderHeight: 40
    });

    hot.render();

    expect(this.$container.find('th').eq(0).height()).toEqual(40);
  });

  it('should allow defining custom column header heights using the columnHeaderHeight config option, when multiple column header levels are defined', function() {
    var hot = handsontable({
      startCols: 3,
      colHeaders: true,
      columnHeaderHeight: [45, 65],
      afterGetColumnHeaderRenderers: function(array) {
          array.push(function(index, TH) {
            TH.innerHTML = '';

            var div = document.createElement('div');
            var span = document.createElement('span');

            div.className = 'relative';
            span.className = 'colHeader';

            span.innerText = index;

            div.appendChild(span);
            TH.appendChild(div);
          });

          return array;
      }
    });
    hot.render();

    expect(this.$container.find('.handsontable.ht_clone_top tr:nth-child(1) th:nth-child(1)').height()).toEqual(45);
    expect(this.$container.find('.handsontable.ht_clone_top tr:nth-child(2) th:nth-child(1)').height()).toEqual(65);
  });
});


text:
'use strict';

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

var _SVGSkeleton = require('./SVGSkeleton');

var _SVGSkeleton2 = _interopRequireDefault(_SVGSkeleton);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var attributes = {
    x1: 0,
    x2: 0,
    y1: 0,
    y2: 0,
    style: {},
    transform: ''
};

var childrensTagName = 'Line';

function Lines(props) {
    return _react2.default.createElement(
        'g',
        null,
        props.children
    );
}

exports.default = (0, _SVGSkeleton2.default)(Lines, childrensTagName, attributes);


text:
package ru.lotnyk.delete;

import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
/**
 * Class DeleteForbiddenWords.
 * @author Roman Lotnyk(romanlotnik@yandex.ru)
 * @version 1
 * @since 27.03.2017
 */
public class DeleteForbiddenWords {

    /**
     * Method delete words.
     * @param in in
     * @param out out
     * @param abuse abuse
     * @return return
     */
    public String dropAbuses(InputStream in, OutputStream out, String[] abuse) {
        String string = "";
        try {

            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
            while (reader.ready()) {
                string = reader.readLine();
                for (String text : abuse) {
                    string = string.replace(text, "");
                }
                writer.write(string);
            }

        } catch (IOException ioe) {
            ioe.printStackTrace();
        }

        return string;
    }
}


text:
namespace device {

class HidConnection;

template<typename T, void func(T*)>
void DiscardReturnType(T* arg) { func(arg); }
template<typename T, T* func(T*)>
void DiscardReturnType(T* arg) { func(arg); }

template<typename T, void func(T*)>
struct Deleter {
  void operator()(T* enumerate) const {
    if (enumerate != NULL)
      func(enumerate);
  }
};

typedef Deleter<
    udev_enumerate,
    DiscardReturnType<udev_enumerate, udev_enumerate_unref> >
    UdevEnumerateDeleter;
typedef Deleter<
    udev_device,
    DiscardReturnType<udev_device, udev_device_unref> > UdevDeviceDeleter;
typedef Deleter<udev, DiscardReturnType<udev, udev_unref> > UdevDeleter;
typedef Deleter<
    udev_monitor,
    DiscardReturnType<udev_monitor, udev_monitor_unref> > UdevMonitorDeleter;

typedef scoped_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr;
typedef scoped_ptr<udev_enumerate, UdevEnumerateDeleter> ScopedUdevEnumeratePtr;

class HidServiceLinux : public HidService,
                        public base::MessagePumpLibevent::Watcher {
 public:
  HidServiceLinux();

  virtual scoped_refptr<HidConnection> Connect(std::string device_id) OVERRIDE;

  // Implements base::MessagePumpLibevent::Watcher
  virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
  virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;

 private:
  virtual ~HidServiceLinux();

  void Enumerate();
  void PlatformDeviceAdd(udev_device* device);
  void PlatformDeviceRemove(udev_device* raw_dev);

  scoped_ptr<udev, UdevDeleter> udev_;
  scoped_ptr<udev_monitor, UdevMonitorDeleter> monitor_;
  int monitor_fd_;
  base::MessagePumpLibevent::FileDescriptorWatcher monitor_watcher_;

  DISALLOW_COPY_AND_ASSIGN(HidServiceLinux);
};

}  // namespace device

#endif  // DEVICE_HID_HID_SERVICE_LINUX_H_


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var preconditions_1 = require("../utils/preconditions");
var logger_1 = require("../utils/logger");
var Listeners = (function () {
    function Listeners() {
        this._listeners = [];
    }
    /**
     * @memberOf Listeners#
     */
    Listeners.prototype.fire = function (data) {
        var listeners = this._listeners.slice(); // copy to prevent concurrent modifications
        listeners.forEach(function (listener) {
            var callback = listener.callback;
            var context = listener.context;
            if (callback) {
                try {
                    if (context) {
                        callback.apply(context, [data]);
                    }
                    else {
                        callback(data);
                    }
                }
                catch (error) {
                    logger_1.Logger.error('Unable to forward event: {0}', error);
                }
            }
        });
    };
    /**
     * @memberOf Listeners#
     * @param callback
     * @param context
     */
    Listeners.prototype.add = function (callback, context) {
        var listener = {
            callback: callback,
            context: context
        };
        preconditions_1.Preconditions.checkNotNull(listener, 'listener cannot be null');
        preconditions_1.Preconditions.checkExpression(this._listeners.indexOf(listener) === -1, 'listener already exists');
        this._listeners.push(listener);
    };
    /**
     * @memberOf Listeners#
     * @param callback
     * @param context
     */
    Listeners.prototype.remove = function (callback, context) {
        var listener = {
            callback: callback,
            context: context
        };
        preconditions_1.Preconditions.checkNotNull(listener, 'listener cannot be null');
        var indexOf = this._listeners.indexOf(listener);
        preconditions_1.Preconditions.checkExpression(indexOf >= 0, 'listener not exists');
        this._listeners.splice(indexOf, 1);
    };
    return Listeners;
}());
exports.Listeners = Listeners;
//# sourceMappingURL=listeners.js.map


text:
//
//  WTURLImageView.h
//  WTURLImageViewDemo
//
//  Created by Water Lou on 14/2/13.
//  Copyright (c) 2013 First Water Tech Ltd. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UIImage+WTExtension.h"

// default fillType, will not resize image, user can set aspect ratio of the image using view contentMode
#define UIImageResizeFillTypeNoResize ((UIImageResizeFillType)(16))

typedef NS_OPTIONS(NSUInteger, WTURLImageViewOptions) {
    WTURLImageViewOptionDontUseDiskCache            = 1 << 0,  // dont use disk cache
    WTURLImageViewOptionDontUseConnectionCache      = 1 << 1,  // dont use system wide cache
    WTURLImageViewOptionDontUseCache                = (WTURLImageViewOptionDontUseDiskCache | WTURLImageViewOptionDontUseConnectionCache),
    WTURLImageViewOptionDontSaveDiskCache           = 1 << 2, // (DEPRECATED) dont save to disk cache
    WTURLImageViewOptionShowActivityIndicator       = 1 << 3, // show activity indicator when loading
    WTURLImageViewOptionAnimateEvenCache            = 1 << 4, // by default no animation for cache image, force if set this
    WTURLImageViewOptionDontClearImageBeforeLoading = 1 << 5, // will not clear old image when loading
    // load disk image in background, sometimes when you load image in table view cell, loading image
    // in foreground will also make the scrolling not smooth, set this to load disk cache in background
    WTURLImageViewOptionsLoadDiskCacheInBackground  = 1 << 6, // (DEPRECATED), always do in background now

    // transition effects
    WTURLImageViewOptionTransitionNone              = 0 << 20, // default
    WTURLImageViewOptionTransitionCrossDissolve     = 1 << 20,

    WTURLImageViewOptionTransitionScaleDissolve     = 2 << 20,
    WTURLImageViewOptionTransitionPerspectiveDissolve  = 3 << 20,

    WTURLImageViewOptionTransitionSlideInTop        = 4 << 20,
    WTURLImageViewOptionTransitionSlideInLeft       = 5 << 20,
    WTURLImageViewOptionTransitionSlideInBottom     = 6 << 20,
    WTURLImageViewOptionTransitionSlideInRight      = 7 << 20,

    WTURLImageViewOptionTransitionFlipFromLeft      = 8 << 20,
    WTURLImageViewOptionTransitionFlipFromRight     = 9 << 20,

    WTURLImageViewOptionTransitionRipple            = 10 << 20,
    WTURLImageViewOptionTransitionCubeFromTop       = 11 << 20,
    WTURLImageViewOptionTransitionCubeFromLeft      = 12 << 20,
    WTURLImageViewOptionTransitionCubeFromBottom    = 13 << 20,
    WTURLImageViewOptionTransitionCubeFromRight     = 14 << 20,

};

@class WTURLImageView;
@class WTURLImageViewPreset;

// with userInteraction is set in the view, user can receive click event
@protocol WTURLImageViewDelegate <NSObject>
- (void) URLImageViewDidClicked : (WTURLImageView*)imageView;
@end

@interface UIImageView(WTURLImageView)

- (void) wt_makeTransition : (UIImage *)image effect : (WTURLImageViewOptions) effect;

@end

@interface WTURLImageView : UIImageView

- (void)setURLRequest:(NSURLRequest *)urlRequest
             fillType:(UIImageResizeFillType)fillType
              options:(WTURLImageViewOptions)options
     placeholderImage:(UIImage *)placeholderImage
          failedImage:(UIImage *)failedImage
diskCacheTimeoutInterval:(NSTimeInterval)diskCacheTimeInterval  // set to 0 will use default one
              success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
              failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure;

- (void)setURL:(NSURL *)url
      fillType:(UIImageResizeFillType)fillType
       options:(WTURLImageViewOptions)options
placeholderImage:(UIImage *)placeholderImage
   failedImage:(UIImage *)failedImage
diskCacheTimeoutInterval:(NSTimeInterval)diskCacheTimeInterval;  // set to 0 will use default one

- (void) setURL:(NSURL*)url;
- (void) setURL:(NSURL*)url withPreset:(WTURLImageViewPreset*) preset;
- (void) reloadWithPreset : (WTURLImageViewPreset*)preset;

@property (nonatomic, weak) id <WTURLImageViewDelegate> delegate;
@property (nonatomic, copy) NSString *urlString;    // will store this only when WTURLImageViewOptionRecordURLString is set

- (UIActivityIndicatorView *) activityIndicator;

/* clear all cache, for invalidate cache */
+ (void) clearAllCache;

+ (UIImage*) getCachedImageByUrlString : (NSString*) urlString;

/* limit max number of download concurrently */
+ (void) setMaxConcurrentDownload : (NSInteger) c;

/* set the default expiry interval for disk cache */
+ (void) setDiskCacheDefaultTimeOutInterval : (NSTimeInterval) timeout;

@end

@interface WTURLImageViewPreset : NSObject

+ (WTURLImageViewPreset*) defaultPreset;

@property (nonatomic, assign) UIImageResizeFillType fillType;
@property (nonatomic, assign) WTURLImageViewOptions options;
@property (nonatomic, strong) UIImage *placeholderImage;
@property (nonatomic, strong) UIImage *failedImage;
@property (nonatomic, assign) NSTimeInterval diskCacheTimeInterval;

@end


text:
from smart.interfaces.gtk.packageview import GtkPackageView
from smart.interfaces.gtk import getPixbuf
from smart.util.strtools import sizeToStr
from smart.report import Report
from smart import *
import gobject, gtk

class GtkChanges(gtk.Window):

    def __init__(self):
        gtk.Window.__init__(self)
        self.__gobject_init__()

        self.set_icon(getPixbuf("smart"))
        self.set_title(_("Change Summary"))
        self.set_modal(True)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_geometry_hints(min_width=600, min_height=400)
        def delete(widget, event):
            gtk.main_quit()
            return True
        self.connect("delete-event", delete)

        self._vbox = gtk.VBox()
        self._vbox.set_border_width(10)
        self._vbox.set_spacing(10)
        self._vbox.show()
        self.add(self._vbox)

        self._label = gtk.Label()
        self._vbox.pack_start(self._label, expand=False)

        self._pv = GtkPackageView()
        self._pv.getTreeView().set_headers_visible(False)
        self._pv.setExpandPackage(True)
        self._pv.show()
        self._vbox.pack_start(self._pv)

        self._sizelabel = gtk.Label()
        self._vbox.pack_start(self._sizelabel, expand=False)

        self._confirmbbox = gtk.HButtonBox()
        self._confirmbbox.set_spacing(10)
        self._confirmbbox.set_layout(gtk.BUTTONBOX_END)
        self._vbox.pack_start(self._confirmbbox, expand=False)

        self._cancelbutton = gtk.Button(stock="gtk-cancel")
        self._cancelbutton.show()
        self._cancelbutton.connect("clicked", lambda x: gtk.main_quit())
        self._confirmbbox.pack_start(self._cancelbutton)

        self._okbutton = gtk.Button(stock="gtk-ok")
        self._okbutton.show()
        def clicked(x):
            self._result = True
            gtk.main_quit()
        self._okbutton.connect("clicked", clicked)
        self._confirmbbox.pack_start(self._okbutton)

        self._closebbox = gtk.HButtonBox()
        self._closebbox.set_spacing(10)
        self._closebbox.set_layout(gtk.BUTTONBOX_END)
        self._vbox.pack_start(self._closebbox, expand=False)

        self._closebutton = gtk.Button(stock="gtk-close")
        self._closebutton.show()
        self._closebutton.connect("clicked", lambda x: gtk.main_quit())
        self._closebbox.pack_start(self._closebutton)

    def showChangeSet(self, changeset, keep=None, confirm=False, label=None):

        report = Report(changeset)
        report.compute()

        class Sorter(str):
            ORDER = [_("Remove"), _("Downgrade"), _("Reinstall"),
                     _("Install"), _("Upgrade")]
            def _index(self, s):
                i = 0
                for os in self.ORDER:
                    if os.startswith(s):
                        return i
                    i += 1
                return i
            def __cmp__(self, other):
                return cmp(self._index(str(self)), self._index(str(other)))
            def __lt__(self, other):
                return cmp(self, other) < 0

        packages = {}

        if report.install:
            install = {}
            reinstall = {}
            upgrade = {}
            downgrade = {}
            lst = report.install.keys()
            lst.sort()
            for pkg in lst:
                package = {}
                done = {}
                if pkg in report.upgrading:
                    for upgpkg in report.upgrading[pkg]:
                        package.setdefault(_("Upgrades"), []).append(upgpkg)
                        done[upgpkg] = True
                if pkg in report.downgrading:
                    for dwnpkg in report.downgrading[pkg]:
                        package.setdefault(_("Downgrades"), []).append(dwnpkg)
                        done[dwnpkg] = True
                if pkg in report.requires:
                    for reqpkg in report.requires[pkg]:
                        package.setdefault(_("Requires"), []).append(reqpkg)
                if pkg in report.requiredby:
                    for reqpkg in report.requiredby[pkg]:
                        package.setdefault(_("Required By"), []).append(reqpkg)
                if pkg in report.conflicts:
                    for cnfpkg in report.conflicts[pkg]:
                        if cnfpkg in done:
                            continue
                        package.setdefault(_("Conflicts"), []).append(cnfpkg)
                if pkg.installed:
                    reinstall[pkg] = package
                elif pkg in report.upgrading:
                    upgrade[pkg] = package
                elif pkg in report.downgrading:
                    downgrade[pkg] = package
                else:
                    install[pkg] = package
            if reinstall:
                packages[Sorter(_("Reinstall (%d)") % len(reinstall))] = \
                                                                    reinstall
            if install:
                packages[Sorter(_("Install (%d)") % len(install))] = install
            if upgrade:
                packages[Sorter(_("Upgrade (%d)") % len(upgrade))] = upgrade
            if downgrade:
                packages[Sorter(_("Downgrade (%d)") % len(downgrade))] = \
                                                                    downgrade

        if report.removed:
            remove = {}
            lst = report.removed.keys()
            lst.sort()
            for pkg in lst:
                package = {}
                done = {}
                if pkg in report.requires:
                    for reqpkg in report.requires[pkg]:
                        package.setdefault(_("Requires"), []).append(reqpkg)
                if pkg in report.requiredby:
                    for reqpkg in report.requiredby[pkg]:
                        package.setdefault(_("Required By"), []).append(reqpkg)
                if pkg in report.conflicts:
                    for cnfpkg in report.conflicts[pkg]:
                        if cnfpkg in done:
                            continue
                        package.setdefault(_("Conflicts"), []).append(cnfpkg)
                remove[pkg] = package
            if remove:
                packages[Sorter(_("Remove (%d)") % len(report.removed))] = \
                                                                        remove

        if keep:
            packages[Sorter(_("Keep (%d)") % len(keep))] = keep

        dsize = report.getDownloadSize() - report.getCachedSize()
        size = report.getInstallSize() - report.getRemoveSize()
        sizestr = ""
        if dsize:
            sizestr += _("%s of package files are needed. ") % sizeToStr(dsize)
        if size > 0:
            sizestr += _("%s will be used.") % sizeToStr(size)
        elif size < 0:
            size *= -1
            sizestr += _("%s will be freed.") % sizeToStr(size)
        if dsize or size:
            self._sizelabel.set_text(sizestr)
            self._sizelabel.show()
        else:
            self._sizelabel.hide()

        if confirm:
            self._confirmbbox.show()
            self._closebbox.hide()
        else:
            self._closebbox.show()
            self._confirmbbox.hide()

        if label:
            self._label.set_text(label)
            self._label.show()
        else:
            self._label.hide()

        self._pv.setPackages(packages, changeset)

        # Expand first level
        self._pv.setExpanded([(x,) for x in packages])

        self._result = False
        self.show()
        gtk.main()
        self.hide()

        return self._result

# vim:ts=4:sw=4:et


text:
package no.priv.bang.ukelonn.mocks;

import java.io.IOException;
import java.io.OutputStream;

/**
 * A handwritten mock {@link OutputStream}.
 *
 * This is an {@link OutputStream} that will throw {@link IOException} on
 * all methods declaring {@link IOException}.
 *
 * @author Steinar Bang
 *
 */
public class MockOutputStreamThatThrowsIOExceptionOnEverything extends OutputStream {

    @Override
    public void write(int b) throws IOException {
        throw new IOException();
    }

    @Override
    public void close() throws IOException {
        throw new IOException();
    }

    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        throw new IOException();
    }

    @Override
    public void write(byte[] b) throws IOException {
        throw new IOException();
    }

}


text:
[![Version](http://cocoapod-badges.herokuapp.com/v/UKPostcodeValidator/badge.png)](http://cocoadocs.org/docsets/UKPostcodeValidator)
[![Platform](http://cocoapod-badges.herokuapp.com/p/UKPostcodeValidator/badge.png)](http://cocoadocs.org/docsets/UKPostcodeValidator)

## Usage

To run the example project; clone the repo, and run `pod install` from the Example directory first.

## Requirements

UKPostcodeValidator should work on both iOS (5.0) and OSX (10.7)

## Installation

UKPostcodeValidator is available through [CocoaPods](http://cocoapods.org), to install
it simply add the following line to your Podfile:

    pod "UKPostcodeValidator"

## Author

Calvin Cestari

## License

UKPostcodeValidator is available under the MIT license. See the LICENSE file for more info.


text:
<?php

namespace SilverStripe\Lumberjack\Tests\Stub\SiteTree;

use SilverStripe\Dev\TestOnly;

class LumberjackShownStub extends LumberjackHiddenStub implements TestOnly
{
    private static $show_in_sitetree = true;
}


text:
package hipstershop;

import hipstershop.Demo.Ad;
import hipstershop.Demo.AdRequest;
import hipstershop.Demo.AdResponse;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.StatusRuntimeException;
import io.opencensus.common.Duration;
import io.opencensus.common.Scope;
import io.opencensus.contrib.grpc.metrics.RpcViews;
import io.opencensus.contrib.grpc.util.StatusConverter;
import io.opencensus.exporter.stats.stackdriver.StackdriverStatsConfiguration;
import io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter;
import io.opencensus.exporter.trace.stackdriver.StackdriverTraceConfiguration;
import io.opencensus.exporter.trace.stackdriver.StackdriverTraceExporter;
import io.opencensus.trace.Span;
import io.opencensus.trace.Tracer;
import io.opencensus.trace.Tracing;
import io.opencensus.trace.samplers.Samplers;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/** A simple client that requests ads from the Ads Service. */
public class AdServiceClient {

  private static final Logger logger = LogManager.getLogger(AdServiceClient.class);
  private static final Tracer tracer = Tracing.getTracer();

  private final ManagedChannel channel;
  private final hipstershop.AdServiceGrpc.AdServiceBlockingStub blockingStub;

  /** Construct client connecting to Ad Service at {@code host:port}. */
  private AdServiceClient(String host, int port) {
    this(
        ManagedChannelBuilder.forAddress(host, port)
            // Channels are secure by default (via SSL/TLS). For the example we disable TLS to avoid
            // needing certificates.
            .usePlaintext()
            .build());
  }

  /** Construct client for accessing RouteGuide server using the existing channel. */
  private AdServiceClient(ManagedChannel channel) {
    this.channel = channel;
    blockingStub = hipstershop.AdServiceGrpc.newBlockingStub(channel);
  }

  private void shutdown() throws InterruptedException {
    channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
  }

  /** Get Ads from Server. */
  public void getAds(String contextKey) {
    logger.info("Get Ads with context " + contextKey + " ...");
    AdRequest request = AdRequest.newBuilder().addContextKeys(contextKey).build();
    AdResponse response;

    Span span =
        tracer
            .spanBuilder("AdsClient")
            .setRecordEvents(true)
            .setSampler(Samplers.alwaysSample())
            .startSpan();
    try (Scope scope = tracer.withSpan(span)) {
      tracer.getCurrentSpan().addAnnotation("Getting Ads");
      response = blockingStub.getAds(request);
      tracer.getCurrentSpan().addAnnotation("Received response from Ads Service.");
    } catch (StatusRuntimeException e) {
      tracer.getCurrentSpan().setStatus(StatusConverter.fromGrpcStatus(e.getStatus()));
      logger.log(Level.WARN, "RPC failed: " + e.getStatus());
      return;
    } finally {
      span.end();
    }
    for (Ad ads : response.getAdsList()) {
      logger.info("Ads: " + ads.getText());
    }
  }

  private static int getPortOrDefaultFromArgs(String[] args, int index, int defaultPort) {
    int portNumber = defaultPort;
    if (index < args.length) {
      try {
        portNumber = Integer.parseInt(args[index]);
      } catch (NumberFormatException e) {
        logger.warn(
            String.format("Port %s is invalid, use default port %d.", args[index], defaultPort));
      }
    }
    return portNumber;
  }

  private static String getStringOrDefaultFromArgs(
      String[] args, int index, @Nullable String defaultString) {
    String s = defaultString;
    if (index < args.length) {
      s = args[index];
    }
    return s;
  }

  /**
   * Ads Service Client main. If provided, the first element of {@code args} is the context key to
   * get the ads from the Ads Service
   */
  public static void main(String[] args) throws InterruptedException {
    // Add final keyword to pass checkStyle.
    final String contextKeys = getStringOrDefaultFromArgs(args, 0, "camera");
    final String host = getStringOrDefaultFromArgs(args, 1, "localhost");
    final int serverPort = getPortOrDefaultFromArgs(args, 2, 9555);

    // Registers all RPC views.
    RpcViews.registerAllGrpcViews();

    // Registers Stackdriver exporters.
    long sleepTime = 10; /* seconds */
    int maxAttempts = 3;

    for (int i = 0; i < maxAttempts; i++) {
      try {
        StackdriverTraceExporter.createAndRegister(StackdriverTraceConfiguration.builder().build());
        StackdriverStatsExporter.createAndRegister(
            StackdriverStatsConfiguration.builder()
                .setExportInterval(Duration.create(15, 0))
                .build());
      } catch (Exception e) {
        if (i == (maxAttempts - 1)) {
          logger.log(
              Level.WARN,
              "Failed to register Stackdriver Exporter."
                  + " Tracing and Stats data will not reported to Stackdriver. Error message: "
                  + e.toString());
        } else {
          logger.info("Attempt to register Stackdriver Exporter in " + sleepTime + " seconds");
          try {
            Thread.sleep(TimeUnit.SECONDS.toMillis(sleepTime));
          } catch (Exception se) {
            logger.log(Level.WARN, "Exception while sleeping" + e.toString());
          }
        }
      }
    }

    // Register Prometheus exporters and export metrics to a Prometheus HTTPServer.
    // PrometheusStatsCollector.createAndRegister();

    AdServiceClient client = new AdServiceClient(host, serverPort);
    try {
      client.getAds(contextKeys);
    } finally {
      client.shutdown();
    }

    logger.info("Exiting AdServiceClient...");
  }
}


text:
package com.vmware.vim25;

/**
@author Steve Jin (sjin@vmware.com)
*/

public class ArrayOfScsiLunDescriptor
{
  public ScsiLunDescriptor[] ScsiLunDescriptor;

  public ScsiLunDescriptor[] getScsiLunDescriptor()
  {
    return this.ScsiLunDescriptor;
  }

  public ScsiLunDescriptor getScsiLunDescriptor(int i)
  {
    return this.ScsiLunDescriptor[i];
  }

  public void setScsiLunDescriptor(ScsiLunDescriptor[] ScsiLunDescriptor)
  {
    this.ScsiLunDescriptor=ScsiLunDescriptor;
  }
}


text:
package de.jformchecker.utils;

import org.junit.Assert;
import org.junit.Test;

import de.jformchecker.FormChecker;
import de.jformchecker.FormCheckerForm;

/**
 * Tests for Forms, that are created from Beans with Validation
 * @author jochen
 *
 */
public class TestBeanValidation {

	@Test
	public void testFormCheckerWithValidation() {
		BeanWithValidation bean = new BeanWithValidation();
		FormCheckerForm form = BeanUtils.fromBean(bean);
		FormChecker fc = RequestBuilders.buildFcWithEmptyRequest();
		fc.addForm(form);
		fc.run();
		Assert.assertTrue(fc.isValid());
	}
}


text:
<?php

$mess = array(
    // will be replaced by the application title
    "Power FS" => "Power FS",
    "This set of extensions assume that you have an administration access to your server: ability to tweak the webserver and the php configuration, ability to access the command line, etc." => "Este conjunto de extensões assume que existe um administrador com acesso ao servidor com a habilidade de fazer alterações ao mesmo, configuração PHP, linha de comandos, etc."
);


text:
package com.thoughtworks.go.domain.notificationdata;

import java.io.Serializable;
import java.util.Date;

public class AgentNotificationData implements Serializable {
    private final String uuid;
    private final String hostName;
    private final boolean isElastic;
    private final String ipAddress;
    private final String operatingSystem;
    private final String freeSpace;
    private final String agentConfigState;
    private final String agentState;
    private final String buildState;
    private final Date transitionTime;

    public AgentNotificationData(String uuid, String hostName, boolean isElastic, String ipAddress,
                                 String operatingSystem, String freeSpace, String agentConfigState, String agentState,
                                 String buildState, Date transitionTime) {
        this.uuid = uuid;
        this.hostName = hostName;
        this.isElastic = isElastic;
        this.ipAddress = ipAddress;
        this.operatingSystem = operatingSystem;
        this.freeSpace = freeSpace;
        this.agentConfigState = agentConfigState;
        this.agentState = agentState;
        this.buildState = buildState;
        this.transitionTime = transitionTime;
    }

    public String getUuid() {
        return uuid;
    }

    public String getHostName() {
        return hostName;
    }

    public boolean isElastic() {
        return isElastic;
    }

    public String getIpAddress() {
        return ipAddress;
    }

    public String getOperatingSystem() {
        return operatingSystem;
    }

    public String getFreeSpace() {
        return freeSpace;
    }

    public String getAgentConfigState() {
        return agentConfigState;
    }

    public String getAgentState() {
        return agentState;
    }

    public String getBuildState() {
        return buildState;
    }

    public Date getTransitionTime() {
        return transitionTime;
    }

    @Override
    public String toString() {
        return "AgentNotificationData{" +
                "uuid='" + uuid + '\'' +
                ", hostName='" + hostName + '\'' +
                ", isElastic=" + isElastic +
                ", ipAddress='" + ipAddress + '\'' +
                ", operatingSystem='" + operatingSystem + '\'' +
                ", freeSpace='" + freeSpace + '\'' +
                ", agentConfigState='" + agentConfigState + '\'' +
                ", agentState='" + agentState + '\'' +
                ", buildState='" + buildState + '\'' +
                ", transitionTime=" + transitionTime +
                '}';
    }
}


text:
<!DOCTYPE html>
<html>
<head>
<title>GBK</title>
<meta name="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8" />
<style>
html, body {
	height: 100%;
	border: 0 0 0 0;
	width: 100%;
	height: 100%;
}
</style>
</head>
<body marginheight="0" marginwidth="0">
	<iframe id="content" src="about:blank" width="99%" height="99%" frameborder="0" scrolling="no"></iframe>
	<script type="text/javascript">
		document.getElementById('content').src = location.search.substring(1);
	</script>
</body>
</html>