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

namespace Foundatio.Extensions {
    internal static class EnumerableExtensions {
        public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action) {
            if (collection == null || action == null)
                return;

            foreach (var item in collection)
                action(item);
        }

        public static void AddRange<T>(this ICollection<T> list, IEnumerable<T> range) {
            foreach (var r in range)
                list.Add(r);
        }
    }
}


text:
package org.apache.hadoop.fs.azurebfs.services;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.azurebfs.AbfsConfiguration;
import org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys;
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.KeyProviderException;
import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidConfigurationValueException;
import org.apache.hadoop.fs.azurebfs.diagnostics.Base64StringConfigurationBasicValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Key provider that simply returns the storage account key from the
 * configuration as plaintext.
 */
public class SimpleKeyProvider implements KeyProvider {
  private static final Logger LOG = LoggerFactory.getLogger(SimpleKeyProvider.class);

  @Override
  public String getStorageAccountKey(String accountName, Configuration rawConfig)
      throws KeyProviderException {
    String key = null;

    try {
      AbfsConfiguration abfsConfig = new AbfsConfiguration(rawConfig, accountName);
      key = abfsConfig.getPasswordString(ConfigurationKeys.FS_AZURE_ACCOUNT_KEY_PROPERTY_NAME);

      // Validating the key.
      validateStorageAccountKey(key);
    } catch (IllegalAccessException | InvalidConfigurationValueException e) {
      throw new KeyProviderException("Failure to initialize configuration", e);
    } catch(IOException ioe) {
      LOG.warn("Unable to get key from credential providers. {}", ioe);
    }

    return key;
  }

  /**
   * A method to validate the storage key.
   *
   * @param key the key to be validated.
   * @throws InvalidConfigurationValueException
   */
  private void validateStorageAccountKey(String key)
      throws InvalidConfigurationValueException {
    Base64StringConfigurationBasicValidator validator = new Base64StringConfigurationBasicValidator(
        ConfigurationKeys.FS_AZURE_ACCOUNT_KEY_PROPERTY_NAME, "", true);

    validator.validate(key);
  }
}

redpajama_set_name: RedPajamaGithub


text:
require 'chef/expander/logger'
require 'mixlib/log'

module Chef
  module Expander
    module Loggable

      # TODO: it's admittedly janky to set up the default logging this way.
      STDOUT.sync = true
      LOGGER = Logger.new(STDOUT)
      LOGGER.level = :debug

      def log
        LOGGER
      end

    end
  end
end


text:
package com.siyeh.ipp.annotation;

import javax.annotation.Nonnull;

import com.intellij.openapi.editor.CaretModel;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.util.IncorrectOperationException;
import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ipp.base.MutablyNamedIntention;
import com.siyeh.ipp.base.PsiElementPredicate;

public class ExpandToNormalAnnotationIntention extends MutablyNamedIntention {

  @Override
  protected String getTextForElement(PsiElement element) {
    final PsiNameValuePair annotation = (PsiNameValuePair)element;
    final String text = buildReplacementText(annotation);
    return IntentionPowerPackBundle.message(
      "expand.to.normal.annotation.name", text);
  }

  @Nonnull
  @Override
  protected PsiElementPredicate getElementPredicate() {
    return new ExpandToNormalAnnotationPredicate();
  }

  public static String buildReplacementText(PsiNameValuePair attribute) {
    final StringBuilder text = new StringBuilder();
    final PsiAnnotationMemberValue value = attribute.getValue();
    text.append("value = ");
    if (value != null) {
      text.append(value.getText());
    }
    return text.toString();
  }

  @Override
  protected void processIntention(@Nonnull PsiElement element) throws IncorrectOperationException {
    final PsiNameValuePair attribute = (PsiNameValuePair)element;
    final int textOffset = attribute.getTextOffset();
    final Project project = attribute.getProject();
    final String text = buildReplacementText(attribute);
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
    final PsiAnnotation newAnnotation = factory.createAnnotationFromText("@A(" + text +" )", attribute);
    attribute.replace(newAnnotation.getParameterList().getAttributes()[0]);
    final FileEditorManager editorManager = FileEditorManager.getInstance(project);
    final Editor editor = editorManager.getSelectedTextEditor();
    if (editor == null) {
      return;
    }
    final CaretModel caretModel = editor.getCaretModel();
    caretModel.moveToOffset(textOffset + text.length() - 1);
  }
}


text:
<?php

namespace EnliteSitemap\Exception;

class OutOfRangeException extends RuntimeException
{

}


text:
layout: page
permalink: /all-base-R/file-dot-show/
---

## __file.show__

#### _Display One or More Files_

### Usage

### Arguments

### Notes


text:
var Key = require('satoshi-key');
var sjcl = require('satoshi-sjcl');
var ecc = sjcl.ecc;
var curve = ecc.curves.k256;
var b = sjcl.bitArray;

var toBits = sjcl.codec.bytes.toBits;
var toBytes = sjcl.codec.bytes.fromBits;
var bn = function (buffer) {
  return sjcl.bn.fromBits(toBits(buffer));
};

function pubToPoint(pubUncompressed) {
  var x = new Buffer(33);
  var y = new Buffer(33);
  x[0] = 0;
  y[0] = 0;
  pubUncompressed.copy(x, 1, 1, 33);
  pubUncompressed.copy(y, 1, 33, 65);
  return ecc.curves.k256.fromBits(new ecc.point(curve, bn(x), bn(y)).toBits());
};

exports.derivePrivate = function (IL, prv) {
  IL = bn(IL);
  if (IL.greaterEquals(curve.r)) return;
  prv = bn(prv);
  var ki = IL.add(prv).mod(curve.r);
  if (ki.equals(0)) return;

  return new Buffer(toBytes(ki.toBits()));
};

exports.derivePublic = function (IL, pubUncompressed) {
  IL = bn(IL);
  if (IL.greaterEquals(curve.r)) return;
  var pubPoint = pubToPoint(pubUncompressed);

  var ILMult = curve.G.mult(IL);
  var Ki = pubPoint.toJac().add(ILMult).toAffine();

  var x = toBytes(Ki.x.toBits());
  var y = toBytes(Ki.y.toBits());
  return new Buffer([0x04].concat(x, y));
};


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

namespace X_UniTMX
{
	/// <summary>
	/// A simple key-value property pair.
	/// </summary>
	public class Property
	{
		// cached values to avoid parsing multiple times
		private float? cachedFloat;
		private int? cachedInt;
		private bool? cachedBool;

		/// <summary>
		/// Gets the name of the property.
		/// </summary>
		public string Name { get; private set; }

		/// <summary>
		/// Gets the raw value string of the property.
		/// </summary>
		public string RawValue { get; private set; }

		/// <summary>
		/// Creates a new Property with a given name and initial value.
		/// </summary>
		/// <param name="name">The name of the property.</param>
		/// <param name="value">The initial value of the property.</param>
		public Property(string name, string value)
		{
			if (string.IsNullOrEmpty(name))
				throw new ArgumentException(null, "name");

			Name = name;
			RawValue = value ?? string.Empty;
		}

		/// <summary>
		/// Sets the value of the property as an integer.
		/// </summary>
		/// <param name="value">The new value of the property.</param>
		public void SetValue(int value)
		{
			RawValue = value.ToString(CultureInfo.InvariantCulture);
			cachedInt = value;
			cachedFloat = null;
			cachedBool = null;
		}

		/// <summary>
		/// Sets the value of the property as a floating point number.
		/// </summary>
		/// <param name="value">The new value of the property.</param>
		public void SetValue(float value)
		{
			RawValue = value.ToString(CultureInfo.InvariantCulture);
			cachedInt = null;
			cachedFloat = value;
			cachedBool = null;
		}

		/// <summary>
		/// Sets the value of the property as a boolean.
		/// </summary>
		/// <param name="value">The new value of the property.</param>
		public void SetValue(bool value)
		{
			RawValue = value.ToString();
			cachedInt = null;
			cachedFloat = null;
			cachedBool = value;
		}

		/// <summary>
		/// Sets the value of the property as a string.
		/// </summary>
		/// <param name="value">The new value of the property.</param>
		public void SetValue(string value)
		{
			RawValue = value;
			cachedInt = null;
			cachedFloat = null;
			cachedBool = null;
		}

		/* [TiledLib]
		 * define some explicit conversion operators that just reference our methods.
		 * this is very much based on the way XDocument handles attributes through
		 * explicit casts rather than parsing string values.
		 *
		 * this lets us do things like:
		 *	  Property p = ...
		 *	  int value = (int)p;
		 * instead of
		 *    Property p = ...
		 *    int value = p.AsInt();
		 *
		 * The other benefit is that we can also cast to other types that can be
		 * cast from these three types. for instance we can do this:
		 *    Property p = ...
		 *    byte value = (byte)p;
		 *    double value = (double)p;
		 *
		 * and so on. I'm removing the AsX methods because these are cleaner, have
		 * more functions, and I want to keep redundant code to a minimum.
		 */

		public static explicit operator int(Property prop)
		{
			if (!prop.cachedInt.HasValue)
				prop.cachedInt = int.Parse(prop.RawValue, CultureInfo.InvariantCulture);
			return prop.cachedInt.Value;
		}

		public static explicit operator float(Property prop)
		{
			if (!prop.cachedFloat.HasValue)
				prop.cachedFloat = float.Parse(prop.RawValue, CultureInfo.InvariantCulture);
			return prop.cachedFloat.Value;
		}

		public static explicit operator bool(Property prop)
		{
			if (!prop.cachedBool.HasValue)
				prop.cachedBool = bool.Parse(prop.RawValue);
			return prop.cachedBool.Value;
		}

		public static explicit operator string(Property prop)
		{
			return prop.RawValue;
		}
	}
}


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!-- Generated Jul 4, 2016 12:16:50 PM by Hibernate Tools 4.0.0.Final -->
<hibernate-mapping>
    <class name="entidades.Dispprofesores" table="dispprofesores" catalog="gaha">
        <composite-id name="id" class="entidades.DispprofesoresId">
        	<key-many-to-one class="entidades.Profesores" lazy="false" name="profesores">
        		<column name="ID_Profesor" not-null="true" />
        	</key-many-to-one>
		    <key-many-to-one class="entidades.Dias" lazy="false" name="dias">
        		<column name="ID_Dia" not-null="true" />
        	</key-many-to-one>
        	<key-many-to-one class="entidades.Horas" lazy="false" name="horas">
        		 <column name="ID_Hora" not-null="true" />
        	</key-many-to-one>
        </composite-id>
        <many-to-one name="estados" class="entidades.Estados" fetch="select">
            <column name="ID_Estado" not-null="true" />
        </many-to-one>
        <property name="fechaCreacion" type="timestamp">
            <column name="FechaCreacion" length="19" not-null="true" />
        </property>
        <property name="usuarioCrea" type="int">
            <column name="UsuarioCrea" not-null="true" />
        </property>
        <property name="fechaModificacion" type="timestamp">
            <column name="FechaModificacion" length="19" />
        </property>
        <property name="usuarioModifica" type="java.lang.Integer">
            <column name="UsuarioModifica" />
        </property>
    </class>
</hibernate-mapping>


text:
<?php
namespace test\db;
/**
 * Findが先に必要
 * @var string $order @['cond'=>'@value']
 */
class RefFindExt extends RefFind{
	protected $order;
}


text:
Biographical notes adapted from Facebook's Relay Starter Kit, a kit that includes an app server, a GraphQL server, and a transpiler that you can use to get started building an app with Relay. For a walkthrough, see the [Relay tutorial](https://facebook.github.io/relay/docs/tutorial.html).

## Installation

```
npm install
```

## Running

Start a local server:

```
npm start
```

## Developing

Any changes you make to files in the `js/` directory will cause the server to
automatically rebuild the app and refresh your browser.

If at any time you make changes to `data/schema.js`, stop the server,
regenerate `data/schema.json`, and restart the server:

```
npm run update-schema
npm start
```

## Testing
Using the `react-addons-test-utils` and `jest` run the tests using:
```
npm tests
```

## License

Relay Starter Kit is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS).


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scringoQuizButtonLayout"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:background="@drawable/scringo_quiz_timer_bg" >

    <com.scringo.features.quiz.timer.ScringoQuizTimerCircle
        android:id="@+id/scringoQuizTimerCircle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true" />

    <ImageView
        android:layout_width="55dp"
        android:layout_height="55dp"
        android:layout_centerInParent="true"
        android:src="@drawable/scringo_quiz_timer_front" />

    <TextView
        android:id="@+id/scringoQuizTimerText"
        style="@style/blackBoldText"
        android:layout_width="43dp"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:ellipsize="none"
        android:gravity="center"
        android:maxLines="1"
        android:singleLine="true"
        android:textSize="22dp" />

</RelativeLayout>


text:
/** \file
 * Helper classes for serial 3D multiblock lattice -- header file.
 */
#ifndef SERIAL_MULTI_BLOCK_LATTICE_3D_H
#define SERIAL_MULTI_BLOCK_LATTICE_3D_H

#include "core/globalDefs.h"
#include "multiBlock/multiBlockLattice3D.h"
#include <vector>

namespace plb {

template<typename T, template<typename U> class Descriptor>
class SerialCellAccess3D : public MultiCellAccess3D<T,Descriptor> {
public:
    SerialCellAccess3D();
    virtual void broadCastCell(Cell<T,Descriptor>& cell, plint fromBlock,
                               MultiBlockManagement3D const& multiBlockManagement) const;
    Cell<T,Descriptor>& getDistributedCell (
            plint iX, plint iY, plint iZ,
            MultiBlockManagement3D const& multiBlockManagement,
            std::map<plint,BlockLattice3D<T,Descriptor>*>& lattices );
    Cell<T,Descriptor> const& getDistributedCell (
            plint iX, plint iY, plint iZ,
            MultiBlockManagement3D const& multiBlockManagement,
            std::map<plint,BlockLattice3D<T,Descriptor>*> const& lattices ) const;
    virtual SerialCellAccess3D<T,Descriptor>* clone() const;
private:
    mutable plint locatedBlock;
};

}  // namespace plb

#endif  // SERIAL_MULTI_BLOCK_LATTICE_3D_H


text:
var chai = require('chai');
var spies = require('chai-spies');
chai.use(spies);
chai.should();

var BusProperty = require('../kefir-bus-property');

describe('kefir-bus-property', function () {
    it('emits last value on subscribe', function () {
        var prop = BusProperty();
        prop.emit('foo');
        var spy = chai.spy();
        prop.onValue(spy);
        spy.should.have.been.called.exactly(1);
        spy.should.have.been.called.with('foo');
    });

    it('emits new value', function () {
        var prop = BusProperty();
        var spy = chai.spy();
        prop.onValue(spy);
        prop.emit('foo');
        spy.should.have.been.called.exactly(1);
        spy.should.have.been.called.with('foo');
    });

    it('emits default value and then new value', function () {
        var prop = BusProperty(function () {
            return 'bar';
        });
        var spy = chai.spy();
        prop.onValue(spy);
        spy.should.have.been.called.exactly(1);
        spy.should.have.been.called.with('bar');
        prop.emit('foo');
        spy.should.have.been.called.exactly(2);
        spy.should.have.been.called.with('foo');
    });

    it('emits last value overriding default', function () {
        var prop = BusProperty(function () {
            return 'bar';
        });
        prop.emit('foo');
        var spy = chai.spy();
        prop.onValue(spy);
        spy.should.have.been.called.exactly(1);
        spy.should.have.been.called.with('foo');
    });
});


text: define("dojox/editor/plugins/nls/pt-pt/Blockquote",{blockquote:"Blockquote"});


text:
<!DOCTYPE html>

  <link rel="stylesheet" href="styles.css">
  <link rel="stylesheet" href="network_summary.css">

Networks

    <network-list-item id="ethernet"></network-list-item>
    <network-list-item id="wifi"></network-list-item>
    <network-list-item id="mobile"></network-list-item>
    <network-list-item id="vpn"></network-list-item>


text:
Classic Tetris recreated for an Arduino MEGA 2560 driving a Adafruit 32x16 LED matrix.

This project was proposed, approved, and completed for the final design project requirement in ENEE 4710 (Embedded Systems) at the University of Tennessee at Chattanooga, Fall 2015 semester.

Team Members:
- Matt Webb
- Geoff Nelson
- Ben Evans


text:
<?xml version="1.0" encoding="UTF-8"?>
<portlet xmlns="http://www.unioninvestment.de/eai/portal/crud-portlet"
	title="Beispiel für dynamischen Schreibschutz einzelner Zellen und ganzer Zeilen">
	<page>
		<tabs>
			<tab id="single-cell-write-protection" title="Einzelne Zellen">

					<database-query datasource="test">
						<query><![CDATA[
					SELECT * FROM test_crud2
				]]></query>
						<insert><![CDATA[
					INSERT INTO TEST_CRUD2
					  (
					    CNUMBER5_2,
					    CDATE,
					    CTIMESTAMP,
					    CVARCHAR5_NN,
					    CNUMBER5_2_NN,
					    CDATE_NN,
					    CTIMESTAMP_NN,
					    TESTDATA
					  )
					  VALUES
					  (
					    $row.values.CNUMBER5_2,
					    $row.values.CDATE,
					    $row.values.YSDATE,
					    $row.values.CVARCHAR5_NN,
					    $row.values.CNUMBER5_2_NN,
					    $row.values.CDATE_NN,
					    SYSDATE,
					    $row.values.TESTDATA
					  )
				]]></insert>
						<update><![CDATA[
					UPDATE TEST_CRUD2 SET
						CNUMBER5_2	  = $row.values.CNUMBER5_2,
						CDATE	      = $row.values.CDATE,
						CVARCHAR5_NN  = $row.values.CVARCHAR5_NN,
						CNUMBER5_2_NN = $row.values.CNUMBER5_2_NN,
						CDATE_NN	  = $row.values.CDATE_NN,
						TESTDATA      = $row.values.TESTDATA
					WHERE ID          = $row.values.ID
				]]></update>
						<delete><![CDATA[
					DELETE FROM TEST_CRUD2
					WHERE ID = $row.values.ID
				]]></delete>
					</database-query>
					<columns>
						<column name="ID" title="ID" primary-key="true" />
						<column name="CNUMBER5_2" title="Zahl" editable="true" display-format="#">
							<select>
								<query>select key , title from TEST_CRUD2_DROP_NUMBER</query>
							</select>
						</column>
						<column name="CDATE" editable="isEditable(table, columnName, row)" />
						<column name="CTIMESTAMP" />
						<column name="CVARCHAR5_NN" editable="isEditable(table, columnName, row)">
							<checkbox checked-value="true" unchecked-value="false" />
						</column>
						<column name="CNUMBER5_2_NN"
							editable="anotherIsEditableHandler(table, columnName, row)" />
						<column name="CDATE_NN" editable="true">
							<select>
								<query>select to_char(dateCol, 'dd.MM.yyyy') as key , to_char(dateCol, 'dd.MM.yyyy') as title from TEST_CRUD2_DROP_DATE</query>
							</select>
						</column>
						<column name="CTIMESTAMP_NN" hidden="true" />
						<column name="TESTDATA" multiline="true" editable="true">
							<select>
								<query>select key , title from TEST_CRUD2_DROP_TEXT</query>
							</select>
						</column>
					</columns>

			</tab>
			<tab id="row-write-protection" title="Ganze Zeile">

					<database-table datasource="test" tablename="test_crud2" />
					<columns>
						<column name="ID" title="ID" primary-key="true" />
						<column name="CNUMBER5_2" title="Zahl" editable="true" />
						<column name="CDATE" editable="true" />
						<column name="CTIMESTAMP" editable="true" />
					</columns>

			</tab>
			<tab id="single-cell-write-protection-formedit" title="Einzelne Zellen (FormEdit)">

					<database-query datasource="test">
						<query><![CDATA[
					SELECT * FROM test_crud2
				]]></query>
						<insert><![CDATA[
					INSERT INTO TEST_CRUD2
					  (
					    CNUMBER5_2,
					    CDATE,
					    CTIMESTAMP,
					    CVARCHAR5_NN,
					    CNUMBER5_2_NN,
					    CDATE_NN,
					    CTIMESTAMP_NN,
					    TESTDATA
					  )
					  VALUES
					  (
					    $row.values.CNUMBER5_2,
					    $row.values.CDATE,
					    $row.values.YSDATE,
					    $row.values.CVARCHAR5_NN,
					    $row.values.CNUMBER5_2_NN,
					    $row.values.CDATE_NN,
					    SYSDATE,
					    $row.values.TESTDATA
					  )
				]]></insert>
						<update><![CDATA[
					UPDATE TEST_CRUD2 SET
						CNUMBER5_2	  = $row.values.CNUMBER5_2,
						CDATE	      = $row.values.CDATE,
						CVARCHAR5_NN  = $row.values.CVARCHAR5_NN,
						CNUMBER5_2_NN = $row.values.CNUMBER5_2_NN,
						CDATE_NN	  = $row.values.CDATE_NN,
						TESTDATA      = $row.values.TESTDATA
					WHERE ID          = $row.values.ID
				]]></update>
						<delete><![CDATA[
					DELETE FROM TEST_CRUD2
					WHERE ID = $row.values.ID
				]]></delete>
					</database-query>
					<columns>
						<column name="ID" title="ID" primary-key="true" />
						<column name="CNUMBER5_2" title="Zahl" editable="true" display-format="#">
							<select>
								<query>select key , title from TEST_CRUD2_DROP_NUMBER</query>
							</select>
						</column>
						<column name="CDATE" editable="isEditable(table, columnName, row)" />
						<column name="CTIMESTAMP" />
						<column name="CVARCHAR5_NN" editable="isEditable(table, columnName, row)">
							<checkbox checked-value="true" unchecked-value="false" />
						</column>
						<column name="CNUMBER5_2_NN"
							editable="anotherIsEditableHandler(table, columnName, row)" />
						<column name="CDATE_NN" editable="true">
							<select>
								<query>select to_char(dateCol, 'dd.MM.yyyy') as key , to_char(dateCol, 'dd.MM.yyyy') as title from TEST_CRUD2_DROP_DATE</query>
							</select>
						</column>
						<column name="CTIMESTAMP_NN" hidden="true" />
						<column name="TESTDATA" multiline="true" editable="true">
							<select>
								<query>select key , title from TEST_CRUD2_DROP_TEXT</query>
							</select>
						</column>
					</columns>

			</tab>
			<tab id="row-write-protection-formedit" title="Ganze Zeile (FormEdit)">

					<database-table datasource="test" tablename="test_crud2" />
					<columns>
						<column name="ID" title="ID" primary-key="true" />
						<column name="CNUMBER5_2" title="Zahl" editable="true" />
						<column name="CDATE" editable="true" />
						<column name="CTIMESTAMP" editable="true" />
					</columns>

			</tab>
		</tabs>
	</page>

</portlet>


text:
require 'yaml'

module CelestinaBot::Config
	@@configuration = begin
		ENV['CELESTINA_BOT_CONFIG_FILE'] ||= File.expand_path('config.yml')
		YAML.load(File.read(ENV['CELESTINA_BOT_CONFIG_FILE']))
	rescue Exception => e
		$stderr.puts "Could not load config from #{ENV['CELESTINA_BOT_CONFIG_FILE']}: #{e.message}"
		exit(1)
	end || {}

	def self.[](key)
		@@configuration[key]
	end
end


text:
__author__ = 'eternnoir'
VERSION = "v0.0.1"

from VSTools.build import MsBuild
from subprocess import Popen, PIPE
import os

FrameworkVersionDic = {"v4.0.30319": r'C:\Windows\Microsoft.NET\Framework\v4.0.30319'}

def get_default_msbuild(debug=False):
    return MsBuild(FrameworkVersionDic["v4.0.30319"] + r'\MSBuild.exe', debug)

def deploy_copy(sourcepath, targetpath):
    if not os.path.isdir(sourcepath):
        raise Exception("Path :" + sourcepath + ". Not Found")
    if not os.path.isdir(targetpath):
        raise Exception("Path :" + targetpath + ". Not Found")
    command = ['xcopy', sourcepath, targetpath, '/D', '/K', '/E', '/Y', '/C', '/I', '/H']
    p = Popen(command, stdout=PIPE, stderr=PIPE)
    output, err = p.communicate()
    if p.returncode == 1:
        return False
    return True

def stop_iis():
    command = ['iisreset', '/stop']
    p = Popen(command, stdout=PIPE, stderr=PIPE)
    output, err = p.communicate()
    if p.returncode == 1:
        return False
    return True

def start_iis():
    command = ['iisreset', '/start']
    p = Popen(command, stdout=PIPE, stderr=PIPE)
    output, err = p.communicate()
    if p.returncode == 1:
        return False
    return True


text:
<?php

namespace Application\Model;

class Contato{
    private $id;
    private $valor;

    public function exchangeArray($data){
        $this->id = (!empty($data['id'])) ? $data['id'] : null;
        $this->valor = (!empty($data['valor'])) ? $data['valor'] : null;
    }
}


text:
from __future__ import unicode_literals
from __future__ import print_function

import os
import sys
import locale
import logging
import warnings

import six
import requests

# Need to check for curses compatibility before performing the rtv imports
try:
    import curses
except ImportError:
    if sys.platform == 'win32':
        sys.exit('Fatal Error: This program is not compatible with Windows '
                 'Operating Systems.')
    else:
        sys.exit('Fatal Error: Your python distribution appears to be missing '
                 '_curses.so.\nWas it compiled without support for curses?')

# If we want to override the $BROWSER variable that the python webbrowser
# references, it needs to be done before the webbrowser module is imported
# for the first time.
webbrowser_import_warning = ('webbrowser' in sys.modules)
RTV_BROWSER, BROWSER = os.environ.get('RTV_BROWSER'), os.environ.get('BROWSER')
if RTV_BROWSER:
    os.environ['BROWSER'] = RTV_BROWSER

from . import docs
from . import packages
from .packages import praw
from .config import Config, copy_default_config, copy_default_mailcap
from .theme import Theme
from .oauth import OAuthHelper
from .terminal import Terminal
from .content import RequestHeaderRateLimiter
from .objects import curses_session, patch_webbrowser
from .subreddit_page import SubredditPage
from .submission_page import SubmissionPage
from .exceptions import ConfigError, SubredditError, SubmissionError
from .__version__ import __version__

_logger = logging.getLogger(__name__)

# Pycharm debugging note:
# You can use pycharm to debug a curses application by launching rtv in a
# console window (python -m rtv) and using pycharm to attach to the remote
# process. On Ubuntu, you may need to allow ptrace permissions by setting
# ptrace_scope to 0 in /etc/sysctl.d/10-ptrace.conf.
# http://blog.mellenthin.de/archives/2010/10/18/gdb-attach-fails

def main():
    """Main entry point"""

    # Squelch SSL warnings
    logging.captureWarnings(True)
    if six.PY3:
        # These ones get triggered even when capturing warnings is turned on
        warnings.simplefilter('ignore', ResourceWarning)  # pylint:disable=E0602

    # Set the terminal title
    if os.getenv('DISPLAY'):
        title = 'rtv {0}'.format(__version__)
        sys.stdout.write('\x1b]2;{0}\x07'.format(title))
        sys.stdout.flush()

    args = Config.get_args()
    fargs, bindings = Config.get_file(args.get('config'))

    # Apply the file config first, then overwrite with any command line args
    config = Config()
    config.update(**fargs)
    config.update(**args)

    # If key bindings are supplied in the config file, overwrite the defaults
    if bindings:
        config.keymap.set_bindings(bindings)

    if config['copy_config']:
        return copy_default_config()
    if config['copy_mailcap']:
        return copy_default_mailcap()
    if config['list_themes']:
        return Theme.print_themes()

    # Load the browsing history from previous sessions
    config.load_history()

    # Load any previously saved auth session token
    config.load_refresh_token()
    if config['clear_auth']:
        config.delete_refresh_token()

    if config['log']:
        # Log request headers to the file (print hack only works on python 3.x)
        # from http import client
        # _http_logger = logging.getLogger('http.client')
        # client.HTTPConnection.debuglevel = 2
        # def print_to_file(*args, **_):
        #     if args[0] != "header:":
        #         _http_logger.info(' '.join(args))
        # client.print = print_to_file
        logging.basicConfig(
            level=logging.DEBUG,
            filename=config['log'],
            format='%(asctime)s:%(levelname)s:%(filename)s:%(lineno)d:%(message)s')
    else:
        # Add an empty handler so the logger doesn't complain
        logging.root.addHandler(logging.NullHandler())

    # Make sure the locale is UTF-8 for unicode support
    default_locale = locale.setlocale(locale.LC_ALL, '')
    try:
        encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
    except ValueError:
        # http://stackoverflow.com/a/19961403
        # OS X on some terminals will set the LC_CTYPE to "UTF-8"
        # (as opposed to something like "en_US.UTF-8") and python
        # doesn't know how to handle it.
        _logger.warning('Error parsing system locale: `%s`,'
                        ' falling back to utf-8', default_locale)
        encoding = 'UTF-8'

    if not encoding or encoding.lower() != 'utf-8':
        text = ('System encoding was detected as (%s) instead of UTF-8'
                ', falling back to ascii only mode' % encoding)
        warnings.warn(text)
        config['ascii'] = True

    if packages.__praw_bundled__:
        praw_info = 'packaged, commit {}'.format(packages.__praw_hash__[:12])
    else:
        praw_info = 'system installed v{}'.format(praw.__version__)

    # Update the webbrowser module's default behavior
    patch_webbrowser()
    if webbrowser_import_warning:
        _logger.warning('webbrowser module was unexpectedly imported before'
                        '$BROWSER could be overwritten')

    # Construct the reddit user agent
    user_agent = docs.AGENT.format(version=__version__)

    debug_info = [
        'rtv version: rtv {}'.format(__version__),
        'rtv module path: {}'.format(os.path.abspath(__file__)),
        'python version: {}'.format(sys.version.replace('\n', ' ')),
        'python executable: {}'.format(sys.executable),
        'praw version: {}'.format(praw_info),
        'locale, encoding: {}, {}'.format(default_locale, encoding),
        'Environment Variables']
    for name, value in [
        ('BROWSER', BROWSER),
        ('DISPLAY', os.getenv('DISPLAY')),
        ('EDITOR', os.getenv('EDITOR')),
        ('LANG', os.getenv('LANG')),
        ('PAGER', os.getenv('PAGER')),
        ('RTV_BROWSER', RTV_BROWSER),
        ('RTV_EDITOR', os.getenv('RTV_EDITOR')),
        ('RTV_PAGER', os.getenv('RTV_PAGER')),
        ('RTV_URLVIEWER', os.getenv('RTV_URLVIEWER')),
        ('TERM', os.getenv('TERM')),
        ('VISUAL', os.getenv('VISUAL')),
        ('XDG_CONFIG_HOME', os.getenv('XDG_CONFIG_HOME')),
        ('XDG_DATA_HOME', os.getenv('XDG_DATA_HOME')),
    ]:
        debug_info.append('  {:<16}: {}'.format(name, value or ''))
    debug_info.append('')
    debug_text = '\n'.join(debug_info)

    _logger.info(debug_text)
    if config['debug_info']:
        print(debug_text)
        return

    try:
        with curses_session() as stdscr:

            term = Terminal(stdscr, config)

            if config['monochrome'] or config['theme'] == 'monochrome':
                _logger.info('Using monochrome theme')
                theme = Theme(use_color=False)
            elif config['theme'] and config['theme'] != 'default':
                _logger.info('Loading theme: %s', config['theme'])
                theme = Theme.from_name(config['theme'])
            else:
                # Set to None to let the terminal figure out which theme
                # to use depending on if colors are supported or not
                theme = None
            term.set_theme(theme)

            with term.loader('Initializing', catch_exception=False):
                reddit = praw.Reddit(user_agent=user_agent,
                                     decode_html_entities=False,
                                     disable_update_check=True,
                                     timeout=10,  # 10 second request timeout
                                     handler=RequestHeaderRateLimiter())

            # Dial the request cache up from 30 seconds to 5 minutes
            # I'm trying this out to make navigation back and forth
            # between pages quicker, it may still need to be fine tuned.
            reddit.config.api_request_delay = 300

            # Authorize on launch if the refresh token is present
            oauth = OAuthHelper(reddit, term, config)
            if config['autologin'] and config.refresh_token:
                oauth.authorize(autologin=True)

            # Open the supplied submission link before opening the subreddit
            if config['link']:
                # Expand shortened urls like https://redd.it/
                # Praw won't accept the shortened versions, add the reddit
                # headers to avoid a 429 response from reddit.com
                url = requests.head(
                    config['link'],
                    headers=reddit.http.headers,
                    allow_redirects=True
                ).url

                page = None
                with term.loader('Loading submission'):
                    try:
                        page = SubmissionPage(reddit, term, config, oauth, url)
                    except Exception as e:
                        _logger.exception(e)
                        raise SubmissionError('Unable to load {0}'.format(url))
                while page:
                    page = page.loop()

            page = None
            name = config['subreddit']
            with term.loader('Loading subreddit'):
                try:
                    page = SubredditPage(reddit, term, config, oauth, name)
                except Exception as e:
                    # If we can't load the subreddit that was requested, try
                    # to load the "popular" page instead so at least the
                    # application still launches. This used to use the user's
                    # front page, but some users have an empty front page.
                    _logger.exception(e)
                    page = SubredditPage(reddit, term, config, oauth, 'popular')
                    raise SubredditError('Unable to load {0}'.format(name))

            # Launch the subreddit page
            while page:
                page = page.loop()

    except ConfigError as e:
        _logger.exception(e)
        print(e)
    except Exception as e:
        _logger.exception(e)
        import traceback
        exit_message = '\n'.join([
            debug_text,
            traceback.format_exc(),
            'rtv has crashed. Please report this traceback at:',
            'https://github.com/michael-lazar/rtv/issues\n'])
        sys.stderr.write(exit_message)
        return 1  # General error exception code
    except KeyboardInterrupt:
        pass
    finally:
        # Try to save the browsing history
        config.save_history()
        # Ensure sockets are closed to prevent a ResourceWarning
        if 'reddit' in locals():
            reddit.handler.http.close()

sys.exit(main())


text:
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="day_view_left_margin">20dp</dimen>
    <dimen name="text_line_padding">2dp</dimen>

</resources>


text:
using System;
using Newtonsoft.Json;

namespace Cedar.Foundation.WeChat.Entities.WeChat
{
    public class GetRecordModel
    {
        /// <summary>
        /// </summary>
        [JsonProperty("account")]
        public string Account { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty("starttime")]
        public DateTime StartTime { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty("endtime")]
        public DateTime EndTime { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty("openid")]
        public string OpenId { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty("pagesize")]
        public int PageSize { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty("pageindex")]
        public int PageIndex { get; set; }
    }
}


text:
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Prometheus
{
    /// <summary>
    /// Maintains references to a set of collectors, from which data for metrics is collected at data export time.
    ///
    /// Use methods on the <see cref="Metrics"/> class to add metrics to a collector registry.
    /// </summary>
    /// <remarks>
    /// To encourage good concurrency practices, registries are append-only. You can add things to them but not remove.
    /// If you wish to remove things from the registry, create a new registry with only the things you wish to keep.
    /// </remarks>
    public sealed class CollectorRegistry : ICollectorRegistry
    {
        #region "Before collect" callbacks
        /// <summary>
        /// Registers an action to be called before metrics are collected.
        /// This enables you to do last-minute updates to metric values very near the time of collection.
        /// Callbacks will delay the metric collection, so do not make them too long or it may time out.
        ///
        /// The callback will be executed synchronously and should not take more than a few milliseconds.
        /// To execute longer-duration callbacks, register an asynchronous callback (Func<Task>).
        ///
        /// If the callback throws <see cref="ScrapeFailedException"/> then the entire metric collection will fail.
        /// This will result in an appropriate HTTP error code or a skipped push, depending on type of exporter.
        ///
        /// If multiple concurrent collections occur, the callback may be called multiple times concurrently.
        /// </summary>
        public void AddBeforeCollectCallback(Action callback)
        {
            if (callback == null)
                throw new ArgumentNullException(nameof(callback));

            _beforeCollectCallbacks.Add(callback);
        }

        /// <summary>
        /// Registers an action to be called before metrics are collected.
        /// This enables you to do last-minute updates to metric values very near the time of collection.
        /// Callbacks will delay the metric collection, so do not make them too long or it may time out.
        ///
        /// Asynchronous callbacks will be executed concurrently and may last longer than a few milliseconds.
        ///
        /// If the callback throws <see cref="ScrapeFailedException"/> then the entire metric collection will fail.
        /// This will result in an appropriate HTTP error code or a skipped push, depending on type of exporter.
        ///
        /// If multiple concurrent collections occur, the callback may be called multiple times concurrently.
        /// </summary>
        public void AddBeforeCollectCallback(Func<CancellationToken, Task> callback)
        {
            if (callback == null)
                throw new ArgumentNullException(nameof(callback));

            _beforeCollectAsyncCallbacks.Add(callback);
        }

        private readonly ConcurrentBag<Action> _beforeCollectCallbacks = new ConcurrentBag<Action>();
        private readonly ConcurrentBag<Func<CancellationToken, Task>> _beforeCollectAsyncCallbacks = new ConcurrentBag<Func<CancellationToken, Task>>();
        #endregion

        #region Static labels
        /// <summary>
        /// The set of static labels that are applied to all metrics in this registry.
        /// Enumeration of the returned collection is thread-safe.
        /// </summary>
        public IEnumerable<KeyValuePair<string, string>> StaticLabels => _staticLabels;

        /// <summary>
        /// Defines the set of static labels to apply to all metrics in this registry.
        /// The static labels can only be set once on startup, before adding or publishing any metrics.
        /// </summary>
        public void SetStaticLabels(Dictionary<string, string> labels)
        {
            if (labels == null)
                throw new ArgumentNullException(nameof(labels));

            // Read lock is taken when creating metrics, so we know that no metrics can be created while we hold this lock.
            _staticLabelsLock.EnterWriteLock();

            try
            {
                if (_staticLabels.Length != 0)
                    throw new InvalidOperationException("Static labels have already been defined - you can only do it once per registry.");

                if (_collectors.Count != 0)
                    throw new InvalidOperationException("Metrics have already been added to the registry - cannot define static labels anymore.");

                // Keep the lock for the duration of this method to make sure no publishing happens while we are setting labels.
                lock (_firstCollectLock)
                {
                    if (_hasPerformedFirstCollect)
                        throw new InvalidOperationException("The metrics registry has already been published - cannot define static labels anymore.");

                    foreach (var pair in labels)
                    {
                        if (pair.Key == null)
                            throw new ArgumentException("The name of a label cannot be null.");

                        if (pair.Value == null)
                            throw new ArgumentException("The value of a label cannot be null.");

                        Collector.ValidateLabelName(pair.Key);
                    }

                    _staticLabels = labels.ToArray();
                }
            }
            finally
            {
                _staticLabelsLock.ExitWriteLock();
            }
        }

        private KeyValuePair<string, string>[] _staticLabels = new KeyValuePair<string, string>[0];
        private readonly ReaderWriterLockSlim _staticLabelsLock = new ReaderWriterLockSlim();

        /// <summary>
        /// Executes an action while holding a read lock on the set of static labels (provided as parameter).
        /// </summary>
        internal TReturn WhileReadingStaticLabels<TReturn>(Func<Labels, TReturn> action)
        {
            _staticLabelsLock.EnterReadLock();

            try
            {
                var labels = new Labels(_staticLabels.Select(item => item.Key).ToArray(), _staticLabels.Select(item => item.Value).ToArray());

                return action(labels);
            }
            finally
            {
                _staticLabelsLock.ExitReadLock();
            }
        }
        #endregion

        /// <summary>
        /// Collects all metrics and exports them in text document format to the provided stream.
        ///
        /// This method is designed to be used with custom output mechanisms that do not use an IMetricServer.
        /// </summary>
        public Task CollectAndExportAsTextAsync(Stream to, CancellationToken cancel = default)
        {
            if (to == null)
                throw new ArgumentNullException(nameof(to));

            return CollectAndSerializeAsync(new TextSerializer(to), cancel);
        }

        // We pass this thing to GetOrAdd to avoid allocating a collector or a closure.
        // This reduces memory usage in situations where the collector is already registered.
        internal readonly struct CollectorInitializer<TCollector, TConfiguration>
            where TCollector : Collector
            where TConfiguration : MetricConfiguration
        {
            private readonly Func<string, string, TConfiguration, TCollector> _createInstance;
            private readonly string _name;
            private readonly string _help;
            private readonly TConfiguration _configuration;

            public string Name => _name;
            public TConfiguration Configuration => _configuration;

            public CollectorInitializer(Func<string, string, TConfiguration, TCollector> createInstance,
                string name, string help, TConfiguration configuration)
            {
                _createInstance = createInstance;
                _name = name;
                _help = help;
                _configuration = configuration;
            }

            public TCollector CreateInstance(string _) => _createInstance(_name, _help, _configuration);
        }

        /// <summary>
        /// Adds a collector to the registry, returning an existing instance if one with a matching name was already registered.
        /// </summary>
        internal TCollector GetOrAdd<TCollector, TConfiguration>(in CollectorInitializer<TCollector, TConfiguration> initializer)
            where TCollector : Collector
            where TConfiguration : MetricConfiguration
        {
            var collectorToUse = _collectors.GetOrAdd(initializer.Name, initializer.CreateInstance);

            if (!(collectorToUse is TCollector))
                throw new InvalidOperationException("Collector of a different type with the same name is already registered.");

            if ((initializer.Configuration.LabelNames?.Length ?? 0) != collectorToUse.LabelNames.Length
                || (!initializer.Configuration.LabelNames?.SequenceEqual(collectorToUse.LabelNames) ?? false))
                throw new InvalidOperationException("Collector matches a previous registration but has a different set of label names.");

            return (TCollector)collectorToUse;
        }

        private readonly ConcurrentDictionary<string, Collector> _collectors = new ConcurrentDictionary<string, Collector>();

        internal void SetBeforeFirstCollectCallback(Action a)
        {
            lock (_firstCollectLock)
            {
                if (_hasPerformedFirstCollect)
                    return; // Avoid keeping a reference to a callback we won't ever use.

                _beforeFirstCollectCallback = a;
            }
        }

        /// <summary>
        /// Allows us to initialize (or not) the registry with the default metrics before the first collection.
        /// </summary>
        private Action? _beforeFirstCollectCallback;
        private bool _hasPerformedFirstCollect;
        private readonly object _firstCollectLock = new object();

        /// <summary>
        /// Collects metrics from all the registered collectors and sends them to the specified serializer.
        /// </summary>
        internal async Task CollectAndSerializeAsync(IMetricsSerializer serializer, CancellationToken cancel)
        {
            lock (_firstCollectLock)
            {
                if (!_hasPerformedFirstCollect)
                {
                    _hasPerformedFirstCollect = true;
                    _beforeFirstCollectCallback?.Invoke();
                    _beforeFirstCollectCallback = null;
                }
            }

            foreach (var callback in _beforeCollectCallbacks)
                callback();

            await Task.WhenAll(_beforeCollectAsyncCallbacks.Select(callback => callback(cancel)));

            foreach (var collector in _collectors.Values)
                await collector.CollectAndSerializeAsync(serializer, cancel);

            await serializer.FlushAsync(cancel);
        }
    }
}


text:
package org.geogit.osm.cli.commands;

import java.io.File;

import jline.UnsupportedTerminal;
import jline.console.ConsoleReader;

import org.geogit.api.GeoGIT;
import org.geogit.api.GlobalContextBuilder;
import org.geogit.api.RevFeature;
import org.geogit.api.RevTree;
import org.geogit.api.TestPlatform;
import org.geogit.api.plumbing.RevObjectParse;
import org.geogit.cli.GeogitCLI;
import org.geogit.cli.test.functional.CLITestContextBuilder;
import org.geogit.osm.internal.OSMImportOp;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;

public class OSMUnmapTest extends Assert {

    private GeogitCLI cli;

    @Rule
    public TemporaryFolder tempFolder = new TemporaryFolder();

    @Before
    public void setUp() throws Exception {
        ConsoleReader consoleReader = new ConsoleReader(System.in, System.out,
                new UnsupportedTerminal());
        cli = new GeogitCLI(consoleReader);
        File workingDirectory = tempFolder.getRoot();
        TestPlatform platform = new TestPlatform(workingDirectory);
        GlobalContextBuilder.builder = new CLITestContextBuilder(platform);
        cli.setPlatform(platform);
        cli.execute("init");
        cli.execute("config", "user.name", "Gabriel Roldan");
        cli.execute("config", "user.email", "groldan@opengeo.org");
        assertTrue(new File(workingDirectory, ".geogit").exists());
        // import with mapping
        String filename = OSMImportOp.class.getResource("nodes.xml").getFile();
        File file = new File(filename);
        String mappingFilename = OSMMap.class.getResource("nodes_mapping_with_aliases.json")
                .getFile();
        File mappingFile = new File(mappingFilename);
        cli.execute("osm", "import", file.getAbsolutePath(), "--mapping",
                mappingFile.getAbsolutePath());
        GeoGIT geogit = cli.newGeoGIT();
        Optional<RevFeature> revFeature = geogit.command(RevObjectParse.class)
                .setRefSpec("WORK_HEAD:busstops/507464799").call(RevFeature.class);
        assertTrue(revFeature.isPresent());
        geogit.getRepository().workingTree().delete("node");
        Optional<RevTree> tree = geogit.command(RevObjectParse.class).setRefSpec("WORK_HEAD:node")
                .call(RevTree.class);
        assertFalse(tree.isPresent());
        geogit.close();
    }

    @Test
    public void testUnMapping() throws Exception {
        cli.execute("osm", "unmap", "busstops");
        GeoGIT geogit = cli.newGeoGIT();
        Optional<RevTree> tree = geogit.command(RevObjectParse.class).setRefSpec("HEAD:node")
                .call(RevTree.class);
        assertTrue(tree.isPresent());
        assertTrue(tree.get().size() > 0);
        Optional<RevFeature> unmapped = geogit.command(RevObjectParse.class)
                .setRefSpec("HEAD:node/507464799").call(RevFeature.class);
        assertTrue(unmapped.isPresent());
        ImmutableList<Optional<Object>> values = unmapped.get().getValues();
        assertEquals("POINT (7.1959361 50.739397)", values.get(6).get().toString());
        assertEquals(
                "VRS:gemeinde:BONN|VRS:ortsteil:Hoholz|VRS:ref:68566|bus:yes|highway:bus_stop|name:Gielgen|public_transport:platform",
                values.get(3).get().toString());
        geogit.close();
    }

}


text:
extern "C" {
#endif

// Fast estimate of a potentially good filter.
WEBP_FILTER_TYPE WebPEstimateBestFilter(const uint8_t* data,
                                        int width, int height, int stride);

#ifdef __cplusplus
}    // extern "C"
#endif

#endif  // WEBP_UTILS_FILTERS_UTILS_H_


text:
import renderer from "react-test-renderer";
import Svg from "../index";

describe("Svg Component", () => {
  it("should exist", () => {
    const svg = renderer.create(
      <Svg name={"home"} />
    );
    expect(svg).toBeDefined();
  });

  it ("should render a home svg", () => {
    const homeSvg = renderer.create(
      <Svg name={"home"} />
    );
    expect(homeSvg).toMatchSnapshot();
  })
})


text:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xml:base="http://comicmeta.org/cbo"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:skos="http://www.w3.org/2004/02/skos/core#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:dct="http://purl.org/dc/terms/"
  xmlns:owl="http://www.w3.org/2002/07/owl#"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
  xmlns:reg="http://metadataregistry.org/uri/profile/RegAp/"
  xmlns:status="http://metadataregistry.org/uri/RegStatus/">

  <!-- Element Set: Comic Book Schema (Core) -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo">
    <dc:title xml:lang="en">Comic Book Schema (Core)</dc:title>
    <foaf:homepage rdf:resource="http://comicmeta.org/cbo"/>
    <skos:note  xml:lang="en">A minimal list of elements for implementing the Comic Book Ontology metadata vocabulary.</skos:note>
  </rdf:Description>

  <!-- Classes -->

  <!-- Class: Collection -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/Collection">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">Collection</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class" />
    <reg:name xml:lang="en">Collection</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/Collection.en" />
  </rdf:Description>

  <!-- Class: Collector -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/Collector">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">Collector</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class" />
    <reg:name xml:lang="en">Collector</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/Collector.en" />
  </rdf:Description>

  <!-- Class: Comic -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/Comic">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">Comic</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class" />
    <reg:name xml:lang="en">Comic</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/Comic.en" />
  </rdf:Description>

  <!-- Properties -->

  <!-- Property: certification number -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/certNumber">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">certification number</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">certNumber</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/certNumber.en" />
  </rdf:Description>

  <!-- Property: condition -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/condition">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">condition</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">condition</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/condition.en" />
  </rdf:Description>

  <!-- Property: country -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/country">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">country</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">country</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/country.en" />
  </rdf:Description>

  <!-- Property: edition -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/edition">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">edition</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">edition</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/edition.en" />
  </rdf:Description>

  <!-- Property: format -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/format">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">format</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">format</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/format.en" />
  </rdf:Description>

  <!-- Property: grade -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/grade">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">grade</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">grade</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/grade.en" />
  </rdf:Description>

  <!-- Property: imprint name -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/imprintName">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">imprint name</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">imprintName</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/imprintName.en" />
  </rdf:Description>

  <!-- Property: issue number -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/issueNumber">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">issue number</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">issueNumber</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/issueNumber.en" />
  </rdf:Description>

  <!-- Property: language -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/language">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">language</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">language</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/language.en" />
  </rdf:Description>

  <!-- Property: printing -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/printing">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">printing</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">printing</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/printing.en" />
  </rdf:Description>

  <!-- Property: series title -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/seriesTitle">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">series title</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">seriesTitle</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/seriesTitle.en" />
  </rdf:Description>

  <!-- Property: series year -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/seriesYear">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">series year</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">seriesYear</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/seriesYear.en" />
  </rdf:Description>

  <!-- Property: variance -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/variance">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">variance</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">variance</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/variance.en" />
  </rdf:Description>

  <!-- Property: volume number -->
  <rdf:Description rdf:about="http://comicmeta.org/cbo/volumeNumber">
    <rdfs:isDefinedBy rdf:resource="http://comicmeta.org/cbo" />
    <reg:status rdf:resource="http://metadataregistry.org/uri/RegStatus/1001" />
    <rdfs:label xml:lang="en">volume number</rdfs:label>
    <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property" />
    <reg:name xml:lang="en">volumeNumber</reg:name>
    <reg:lexicalAlias rdf:resource="http://comicmeta.org/cbo/volumeNumber.en" />
  </rdf:Description>

  <!-- Status properties used in this document  -->
  <skos:Concept rdf:about="http://metadataregistry.org/uri/RegStatus/1001">
    <skos:prefLabel xml:lang="en">Published</skos:prefLabel>
  </skos:Concept>
</rdf:RDF>


text:
class Emitter {
  public:
    virtual void emit(Particle &particle);
};

#endif


text:
import StoreUser from './StoreUser';
import ContextualIdentitiesEvents from './ContextualIdentitiesEvents';
import { validateSettings } from '../redux/Actions';
import { cadLog, siteDataToBrowser, SITEDATATYPES } from './Libs';
import { checkIfProtected, setGlobalIcon } from './BrowserActionService';
import ContextMenuEvents from './ContextMenuEvents';
import { ReduxConstants } from '../typings/ReduxConstants';

export default class SettingService extends StoreUser {
  public static init(): void {
    SettingService.current = StoreUser.store.getState().settings;
    SettingService.isInitialized = true;
  }

  public static async onSettingsChange(): Promise<void> {
    if (!SettingService.isInitialized) {
      SettingService.init();
    }
    const previous = SettingService.current;
    SettingService.current = StoreUser.store.getState().settings;

    // Container Mode Changes
    if (SettingService.hasNewValue(previous, SettingID.CONTEXTUAL_IDENTITIES)) {
      if (SettingService.getCurrent(SettingID.CONTEXTUAL_IDENTITIES)) {
        await ContextualIdentitiesEvents.init();
      } else {
        await ContextualIdentitiesEvents.deInit();
      }
    }

    // BrowsingData Settings Check
    for (const siteData of SITEDATATYPES) {
      const sd = `${siteDataToBrowser(siteData)}Cleanup`;
      if (
        (previous[sd] === undefined || !previous[sd].value) &&
        SettingService.current[sd].value
      ) {
        // Migration Check to prevent LocalStorage from being cleaned again.
        // Only if migrating from 3.4.0 to 3.5.1+
        if (
          siteData === SiteDataType.LOCALSTORAGE &&
          previous[SettingID.CLEANUP_LOCALSTORAGE_OLD] !== undefined &&
          previous[SettingID.CLEANUP_LOCALSTORAGE_OLD].value
        ) {
          continue;
        }
        await browser.browsingData.remove(
          { since: 0 },
          { [siteDataToBrowser(siteData)]: true },
        );
        cadLog(
          {
            msg: `${siteData} setting activated.  All previous ${siteData} has been cleared for a clean slate.`,
            type: 'info',
          },
          SettingService.getCurrent(SettingID.DEBUG_MODE) as boolean,
        );
      }
    }

    // Active Mode (Automatic Cleanup) changes
    if (SettingService.hasNewValue(previous, SettingID.ACTIVE_MODE)) {
      const active = SettingService.getCurrent(
        SettingID.ACTIVE_MODE,
      ) as boolean;
      if (!active) {
        await browser.alarms.clear('activeModeAlarm');
      }
      await setGlobalIcon(active);
      ContextMenuEvents.updateMenuItemCheckbox(
        ContextMenuEvents.MenuID.ACTIVE_MODE,
        active,
      );
    }

    // Context Menu Changes
    if (SettingService.hasNewValue(previous, SettingID.CONTEXT_MENUS)) {
      if (SettingService.getCurrent(SettingID.CONTEXT_MENUS)) {
        ContextMenuEvents.menuInit();
      } else {
        await ContextMenuEvents.menuClear();
      }
    }

    // Deprecated Setting Adjustments
    // Only for localstorageCleanup <-> localStorageCleanup
    SettingService.updateDeprecatedSetting(
      previous,
      SettingID.CLEANUP_LOCALSTORAGE,
      SettingID.CLEANUP_LOCALSTORAGE_OLD,
    );
    SettingService.updateDeprecatedSetting(
      previous,
      SettingID.CLEANUP_LOCALSTORAGE_OLD,
      SettingID.CLEANUP_LOCALSTORAGE,
    );

    await checkIfProtected(StoreUser.store.getState());

    // Validate Settings Again
    StoreUser.store.dispatch<any>(validateSettings());
  }

  private static getCurrent(s: SettingID): boolean | number | string {
    return SettingService.current[s].value;
  }

  private static hasNewValue(p: MapToSettingObject, s: SettingID): boolean {
    return p[s].value !== SettingService.current[s].value;
  }

  private static updateDeprecatedSetting(
    p: MapToSettingObject,
    a: SettingID,
    b: SettingID,
  ): void {
    if (p[a] && SettingService.current[a] && SettingService.hasNewValue(p, a)) {
      StoreUser.store.dispatch({
        payload: {
          name: b,
          value: SettingService.getCurrent(a),
        },
        type: ReduxConstants.UPDATE_SETTING,
      });
    }
  }

  protected static current: MapToSettingObject;
  protected static delaySave = false;
  protected static isInitialized = false;
}


text:
package org.apache.mesos.chronos.scheduler.jobs.constraints

import java.util.regex.PatternSyntaxException

import org.specs2.mutable.SpecificationWithJUnit

class LikeConstraintSpec extends SpecificationWithJUnit
  with ConstraintSpecHelper {
  "matches attributes of type text" in {
    val attributes = List(createTextAttribute("dc", "north"), createTextAttribute("rack", "rack-1"))
    val constraint = LikeConstraint("rack", "rack-[1-3]")

    constraint.matches(attributes) must_== true

    val attributes2 = List(createTextAttribute("dc", "north"))
    val constraint2 = LikeConstraint("dc", "north|south")

    constraint2.matches(attributes2) must_== true
  }

  "matches attributes of type scalar" in {
    val attributes = List(createScalarAttribute("number", 1))
    val constraint = LikeConstraint("number", """\d\.\d""")

    constraint.matches(attributes) must_== true
  }

  "matches attributes of type set" in {
    val attributes = List(createSetAttribute("dc", Array("north")))
    val constraint = LikeConstraint("dc", "^n.*")

    constraint.matches(attributes) must_== true

    val attributes2 = List(createSetAttribute("dc", Array("south")))

    constraint.matches(attributes2) must_== false
  }

  "does not match attributes" in {
    val attributes = List(createTextAttribute("dc", "north"), createTextAttribute("rack", "rack-1"))

    val constraint = LikeConstraint("rack", "rack-[2-3]")

    constraint.matches(attributes) must_== false
  }

  "fails in case of an invalid regular expression" in {
    LikeConstraint("invalid-regex", "[[[") must throwA[PatternSyntaxException]
  }
}