text:
package model;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class PointDescriptorSet implements Iterable<PointDescriptor>{
	private List<PointDescriptor> points;
	private List<PointDescriptorPair> collisions;

	private static final Lock LOCK1 = new ReentrantLock();
	private static final Lock LOCK2 = new ReentrantLock();

	public PointDescriptorSet(Collection<PointDescriptor> points){
		this.points = new LinkedList<PointDescriptor>(points);
	}

	public void findCollisionsSweepLine(){
		this.collisions = new LinkedList<PointDescriptorPair>();

		// Erstellen des EventPoint - Suchbaums
		TreeSet<EventPoint> events = new TreeSet<EventPoint>();
		for(PointDescriptor p : points){
			double yStart = p.getBotleft().y;
			double yEnde = p.getBotleft().y + p.getHeight();

			events.add(new EventPoint(true, yStart, p));
			events.add(new EventPoint(false, yEnde, p));
		}

		// Suchen nach Kollisionen
		LinkedList<PointDescriptor> statusCrowd = new LinkedList<PointDescriptor>();
		for(EventPoint e : events){
			if(e.isStartPoint){
				for(PointDescriptor p : statusCrowd){
					if(e.point.collidesWith(p)){
						this.collisions.add(new PointDescriptorPair(p, e.point));
//						System.out.println(e.point.getDescription() + ", " + p.getDescription() + ", " + new PointDescriptorPair(p, e.point).getMinimumScaleFactor());
					}
				}
				statusCrowd.add(e.point);
			}
			else statusCrowd.remove(e.point);
		}
//		System.out.println(this.collisions.size() + " Kollisionen gefunden");
	}

	public void findCollisionsBruteForce(){
		this.collisions = new LinkedList<PointDescriptorPair>();
		PointDescriptor[] pointArray = this.points.toArray(new PointDescriptor[this.points.size()]);
		for(int i = 0; i < pointArray.length; i++){
			PointDescriptor p = pointArray[i];
			for(int j = i + 1; j < pointArray.length; j++){
				if(p.collidesWith(pointArray[j])){
					this.collisions.add(new PointDescriptorPair(p, pointArray[j]));
//					System.out.println(p.getDescription() + ", " + pointArray[j].getDescription() + ", " + new PointDescriptorPair(p, pointArray[j]).getMinimumScaleFactor());
				}
			}
		}
//		System.out.println(this.collisions.size() + " Kollisionen gefunden");
	}

	public void findCollisionsSweepLineMultithreaded(){
		this.collisions = new LinkedList<PointDescriptorPair>();
		TreeSet<EventPoint> events = new TreeSet<EventPoint>();
		PointDescriptor[] pointArray = this.points.toArray(new PointDescriptor[this.points.size()]);
		int[] currentIndex = {0};

		Thread[] t = new Thread[Runtime.getRuntime().availableProcessors()];
		for(int i = 0; i < t.length; i++){
			EventMaker c = new EventMaker(currentIndex, events, pointArray);
			t[i] = new Thread(c);
			t[i].start();
		}
		for(Thread tx : t){
			try {
				tx.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

		ArrayList<PointDescriptor> statusCrowd = new ArrayList<PointDescriptor>();
		LinkedList<Thread> threads = new LinkedList<Thread>();
		for(EventPoint e : events){
			if(e.isStartPoint){
				SweepLineCollisionFinder f = new SweepLineCollisionFinder(e.point, statusCrowd.toArray(new PointDescriptor[statusCrowd.size()]), this.collisions);
				Thread tn = new Thread(f);
				tn.start();

				statusCrowd.add(e.point);
				threads.add(tn);
			}
			else statusCrowd.remove(e.point);
		}
		for(Thread tx : threads){
			try {
				tx.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

//		System.out.println(this.collisions.size() + " Kollisionen gefunden");
	}

	public void findCollisionsBruteForceMultithreaded(){
		int[] currentIndex = {0}; // Implementation als Array, da so Referenzen übergeben werden.
		this.collisions = new LinkedList<PointDescriptorPair>();
		PointDescriptor[] pointArray = this.points.toArray(new PointDescriptor[this.points.size()]);

		Thread[] t = new Thread[Runtime.getRuntime().availableProcessors()];
		for(int i = 0; i < t.length; i++){
			CollisionSearcher c = new CollisionSearcher(currentIndex, collisions, pointArray);
			t[i] = new Thread(c);
			t[i].start();
		}
		for(Thread tx : t){
			try {
				tx.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

//		System.out.println(this.collisions.size() + " Kollisionen gefunden");
	}

	public double findMinimumScaleFactor(){
		if(this.collisions == null) this.findCollisionsSweepLine();
		double minScaleFactor = Double.MIN_VALUE;
		for(PointDescriptorPair p : this.collisions){
			double pScale = p.getMinimumScaleFactor();
			if(pScale > minScaleFactor) minScaleFactor = pScale;
		}
		return minScaleFactor;
	}

	public List<PointDescriptor> getScaledPoints(double scaleFactor){
		LinkedList<PointDescriptor> list = new LinkedList<PointDescriptor>();
		for(PointDescriptor p : this.points){
			PointDescriptor pNeu = new PointDescriptor(p);
			pNeu.getBotleft().x *= scaleFactor;
			pNeu.getBotleft().y *= scaleFactor;
			list.add(pNeu);
		}
		return list;
	}

	private class EventPoint implements Comparable<EventPoint>{
		public boolean isStartPoint;
		public double y;
		public PointDescriptor point;

		public EventPoint(boolean isStartPoint, double y, PointDescriptor point) {
			this.isStartPoint = isStartPoint;
			this.y = y;
			this.point = point;
		}

		@Override
		public int compareTo(EventPoint o) {
			if(this.y > o.y) return  1;
			if(o.y > this.y) return -1;
			return 0;
		}

	}

	private class PointDescriptorPair{
		private PointDescriptor point1;
		private PointDescriptor point2;

		public PointDescriptorPair(PointDescriptor p1, PointDescriptor p2){
			this.point1 = p1;
			this.point2 = p2;
		}

		public double getMinimumScaleFactor(){
			return Math.min(getMinimumScaleFactorX(), getMinimumScaleFactorY());
		}

		private double getMinimumScaleFactorY(){
			double height, y1, y2;
			if(point1.getBotleft().y < point2.getBotleft().y){
				height = point1.getHeight();
				y1 = point1.getBotleft().y;
				y2 = point2.getBotleft().y;
			}
			else if(point1.getBotleft().y > point2.getBotleft().y){
				height = point2.getHeight();
				y1 = point2.getBotleft().y;
				y2 = point1.getBotleft().y;
			}
			else return Double.MAX_VALUE;
			return height/(y2-y1);
		}

		private double getMinimumScaleFactorX(){
			double length, x1, x2;
			if(point1.getBotleft().x < point2.getBotleft().x){
				length = point1.getWidth();
				x1 = point1.getBotleft().x;
				x2 = point2.getBotleft().x;
			}
			else if(point1.getBotleft().x > point2.getBotleft().x){
				length = point2.getWidth();
				x1 = point2.getBotleft().x;
				x2 = point1.getBotleft().x;
			}
			else return Double.MAX_VALUE;
			return length/(x2-x1);
		}
	}

	private class CollisionSearcher implements Runnable{
		private int[] currentIndex;
		private List<PointDescriptorPair> resultList;
		private PointDescriptor[] points;

		public CollisionSearcher(int[] index, List<PointDescriptorPair> collisions, PointDescriptor[] points){
			this.currentIndex = index;
			this.points = points;
			this.resultList = collisions;
		}

		@Override
		public void run() {
			int i;

			LOCK1.lock();
			i = currentIndex[0];
			currentIndex[0] ++ ;
			LOCK1.unlock();

			while(i < points.length){
//				System.out.println(i);
				for(int j = i+1; j < points.length; j++){
					if(points[i].collidesWith(points[j])){
						LOCK2.lock();
						this.resultList.add(new PointDescriptorPair(points[i], points[j]));
						LOCK2.unlock();
					}
				}
				LOCK1.lock();
				i = currentIndex[0];
				currentIndex[0] ++ ;
				LOCK1.unlock();
			}
		}

	}

	private class EventMaker implements Runnable{
		private int[] currentIndex;
		private TreeSet<EventPoint> events;
		private PointDescriptor[] pointArray;

		public EventMaker(int[] currentIndex, TreeSet<EventPoint> events, PointDescriptor[] pointArray) {
			this.currentIndex = currentIndex;
			this.events = events;
			this.pointArray = pointArray;
		}

		@Override
		public void run(){

			LOCK1.lock();
			int i = currentIndex[0];
			currentIndex[0] = i+1;
			LOCK1.unlock();

			while(i < pointArray.length){
				PointDescriptor p = pointArray[i];

				double yStart = p.getBotleft().y;
				double yEnde = p.getBotleft().y + p.getHeight();

				EventPoint start = new EventPoint(true, yStart, p);
				LOCK2.lock();
				events.add(start);
				LOCK2.unlock();

				EventPoint ende  = new EventPoint(false, yEnde, p);
				LOCK2.lock();
				events.add(ende);
				LOCK2.unlock();

				LOCK1.lock();
				i = currentIndex[0];
				currentIndex[0] = i+1;
				LOCK1.unlock();
			}
		}
	}

	private class SweepLineCollisionFinder implements Runnable{
		private List<PointDescriptorPair> resultList;
		private PointDescriptor[] statusCrowd;
		private PointDescriptor p;
		public SweepLineCollisionFinder(PointDescriptor p, PointDescriptor[] statusCrowd, List<PointDescriptorPair> resultList) {
			this.resultList = resultList;
			this.statusCrowd = statusCrowd;
			this.p = p;
		}

		public void run(){
			for(PointDescriptor t : statusCrowd){
				if(p.collidesWith(t)){
					PointDescriptorPair collision = new PointDescriptorPair(p, t);
					LOCK2.lock();
					resultList.add(collision);
					LOCK2.unlock();
				}
			}
		}
	}

	public List<PointDescriptor> getPoints() {
		return points;
	}

	public void setPoints(List<PointDescriptor> points) {
		this.points = points;
	}

	@Override
	public Iterator<PointDescriptor> iterator() {
		return this.points.iterator();
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
   <item>
      <shape android:shape="rectangle">
         <solid android:color="#22000000"/>
         <corners android:radius="3dp" />
      </shape>
   </item>

   <item
      android:left="1dp"
      android:right= "1dp"
      android:top="1dp"
      android:bottom="1dp">
      <shape>
         <solid android:color="@color/mainPurple"/>
         <corners android:radius="3dp"/>
         <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
      </shape>
   </item>
</layer-list>

redpajama_set_name: RedPajamaGithub


text:
/*****************************************************************************/
/* CascLib.h                              Copyright (c) Ladislav Zezula 2014 */
/*---------------------------------------------------------------------------*/
/* CascLib library v 1.00                                                    */
/*                                                                           */
/* Author : Ladislav Zezula                                                  */
/* E-mail : ladik@zezula.net                                                 */
/* WWW    : http://www.zezula.net                                            */
/*---------------------------------------------------------------------------*/
/*   Date    Ver   Who  Comment                                              */
/* --------  ----  ---  -------                                              */
/* 29.04.14  1.00  Lad  Created                                              */
/*****************************************************************************/

#ifndef __CASCLIB_H__
#define __CASCLIB_H__

#ifdef _MSC_VER
#pragma warning(disable:4668)       // 'XXX' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
#pragma warning(disable:4820)       // 'XXX' : '2' bytes padding added after data member 'XXX::yyy'
#endif

#include "CascPort.h"

#ifdef __cplusplus
extern "C" {
#endif

//-----------------------------------------------------------------------------
// Use the apropriate library
//
// The library type is encoded in the library name as the following
// CascLibXYZ.lib
//
//  X - D for Debug version, R for Release version
//  Y - A for ANSI version, U for Unicode version
//  Z - S for static-linked CRT library, D for multithreaded DLL CRT library
//

#if defined(_MSC_VER) && !defined(__CASCLIB_SELF__)

  #ifdef _DEBUG                                 // DEBUG VERSIONS
    #ifndef _UNICODE
      #ifdef _DLL
        #pragma comment(lib, "CascLibDAD.lib") // Debug Ansi CRT-DLL version
      #else
        #pragma comment(lib, "CascLibDAS.lib") // Debug Ansi CRT-LIB version
      #endif
    #else
      #ifdef _DLL
        #pragma comment(lib, "CascLibDUD.lib") // Debug Unicode CRT-DLL version
      #else
        #pragma comment(lib, "CascLibDUS.lib") // Debug Unicode CRT-LIB version
      #endif
    #endif
  #else                                         // RELEASE VERSIONS
    #ifndef _UNICODE
      #ifdef _DLL
        #pragma comment(lib, "CascLibRAD.lib") // Release Ansi CRT-DLL version
      #else
        #pragma comment(lib, "CascLibRAS.lib") // Release Ansi CRT-LIB version
      #endif
    #else
      #ifdef _DLL
        #pragma comment(lib, "CascLibRUD.lib") // Release Unicode CRT-DLL version
      #else
        #pragma comment(lib, "CascLibRUS.lib") // Release Unicode CRT-LIB version
      #endif
    #endif
  #endif

#endif

//-----------------------------------------------------------------------------
// Defines

#define CASCLIB_VERSION                 0x0100  // Current version of CascLib (1.0)
#define CASCLIB_VERSION_STRING          "1.00"  // String version of CascLib version

#define ERROR_UNKNOWN_FILE_KEY           10001  // Returned by encrypted stream when can't find file key
#define ERROR_FILE_INCOMPLETE            10006  // The required file part is missing

// Values for CascOpenStorage
#define CASC_STOR_XXXXX             0x00000001  // Not used

// Values for CascOpenFile
#define CASC_FILE_XXXXX             0x00000001  // Not used

// Flags for file stream
#define BASE_PROVIDER_FILE          0x00000000  // Base data source is a file
#define BASE_PROVIDER_MAP           0x00000001  // Base data source is memory-mapped file
#define BASE_PROVIDER_HTTP          0x00000002  // Base data source is a file on web server
#define BASE_PROVIDER_MASK          0x0000000F  // Mask for base provider value

#define STREAM_PROVIDER_FLAT        0x00000000  // Stream is linear with no offset mapping
#define STREAM_PROVIDER_PARTIAL     0x00000010  // Stream is partial file (.part)
#define STREAM_PROVIDER_ENCRYPTED   0x00000020  // Stream is an encrypted archive
#define STREAM_PROVIDER_BLOCK4      0x00000030  // 0x4000 per block, text MD5 after each block, max 0x2000 blocks per file
#define STREAM_PROVIDER_MASK        0x000000F0  // Mask for stream provider value

#define STREAM_FLAG_READ_ONLY       0x00000100  // Stream is read only
#define STREAM_FLAG_WRITE_SHARE     0x00000200  // Allow write sharing when open for write
#define STREAM_FLAG_USE_BITMAP      0x00000400  // If the file has a file bitmap, load it and use it
#define STREAM_OPTIONS_MASK         0x0000FF00  // Mask for stream options

#define STREAM_PROVIDERS_MASK       0x000000FF  // Mask to get stream providers
#define STREAM_FLAGS_MASK           0x0000FFFF  // Mask for all stream flags (providers+options)

#define CASC_LOCALE_ALL             0xFFFFFFFF
#define CASC_LOCALE_NONE            0x00000000
#define CASC_LOCALE_UNKNOWN1        0x00000001
#define CASC_LOCALE_ENUS            0x00000002
#define CASC_LOCALE_KOKR            0x00000004
#define CASC_LOCALE_RESERVED        0x00000008
#define CASC_LOCALE_FRFR            0x00000010
#define CASC_LOCALE_DEDE            0x00000020
#define CASC_LOCALE_ZHCN            0x00000040
#define CASC_LOCALE_ESES            0x00000080
#define CASC_LOCALE_ZHTW            0x00000100
#define CASC_LOCALE_ENGB            0x00000200
#define CASC_LOCALE_ENCN            0x00000400
#define CASC_LOCALE_ENTW            0x00000800
#define CASC_LOCALE_ESMX            0x00001000
#define CASC_LOCALE_RURU            0x00002000
#define CASC_LOCALE_PTBR            0x00004000
#define CASC_LOCALE_ITIT            0x00008000
#define CASC_LOCALE_PTPT            0x00010000

#define CASC_LOCALE_BIT_ENUS        0x01
#define CASC_LOCALE_BIT_KOKR        0x02
#define CASC_LOCALE_DUAL_LANG       0x03
#define CASC_LOCALE_BIT_FRFR        0x04
#define CASC_LOCALE_BIT_DEDE        0x05
#define CASC_LOCALE_BIT_ZHCN        0x06
#define CASC_LOCALE_BIT_ESES        0x07
#define CASC_LOCALE_BIT_ZHTW        0x08
#define CASC_LOCALE_BIT_ENGB        0x09
#define CASC_LOCALE_BIT_ENCN        0x0A
#define CASC_LOCALE_BIT_ENTW        0x0B
#define CASC_LOCALE_BIT_ESMX        0x0C
#define CASC_LOCALE_BIT_RURU        0x0D
#define CASC_LOCALE_BIT_PTBR        0x0E
#define CASC_LOCALE_BIT_ITIT        0x0F
#define CASC_LOCALE_BIT_PTPT        0x10

#define MAX_CASC_KEY_LENGTH               0x10  // Maximum length of the key (equal to MD5 hash)

#ifndef MD5_HASH_SIZE
#define MD5_HASH_SIZE                     0x10
#define MD5_STRING_SIZE                   0x21
#endif

#ifndef SHA1_DIGEST_SIZE
#define SHA1_DIGEST_SIZE                  0x14  // 160 bits
#endif

#ifndef LANG_NEUTRAL
#define LANG_NEUTRAL                      0x00  // Neutral locale
#endif

// Return value for CascGetFileSize and CascSetFilePointer
#define CASC_INVALID_SIZE           0xFFFFFFFF
#define CASC_INVALID_POS            0xFFFFFFFF

// Flags for CascGetStorageInfo
#define CASC_FEATURE_LISTFILE       0x00000001  // The storage supports listfile

//-----------------------------------------------------------------------------
// Structures

typedef enum _CASC_STORAGE_INFO_CLASS
{
    CascStorageFileCount,
    CascStorageFeatures,
    CascStorageGameInfo,
    CascStorageGameBuild,
    CascStorageInfoClassMax

} CASC_STORAGE_INFO_CLASS, *PCASC_STORAGE_INFO_CLASS;

typedef struct _QUERY_KEY
{
    LPBYTE pbData;
    DWORD cbData;
} QUERY_KEY, *PQUERY_KEY;

// Structure for SFileFindFirstFile and SFileFindNextFile
typedef struct _CASC_FIND_DATA
{
    char   szFileName[MAX_PATH];                // Full name of the found file
    char * szPlainName;                         // Plain name of the found file
    ULONGLONG FileNameHash;                     // File name hash
    BYTE   EncodingKey[MD5_HASH_SIZE];          // Encoding key
    DWORD  dwPackageIndex;                      // File package index (HOTS only)
    DWORD  dwLocaleFlags;                       // Locale flags (WoW only)
    DWORD  dwFileSize;                          // Size of the file

} CASC_FIND_DATA, *PCASC_FIND_DATA;

//-----------------------------------------------------------------------------
// Callback functions

typedef struct TFileStream TFileStream;
typedef void (WINAPI * STREAM_DOWNLOAD_CALLBACK)(void * pvUserData, ULONGLONG ByteOffset, DWORD dwTotalBytes);

//-----------------------------------------------------------------------------
// We have our own qsort implementation, optimized for sorting array of pointers

void qsort_pointer_array(void ** base, size_t num, int (*compare)(const void *, const void *, const void *), const void * context);

//-----------------------------------------------------------------------------
// Functions for storage manipulation

bool  WINAPI CascOpenStorage(const TCHAR * szDataPath, DWORD dwLocaleMask, HANDLE * phStorage);
bool  WINAPI CascGetStorageInfo(HANDLE hStorage, CASC_STORAGE_INFO_CLASS InfoClass, void * pvStorageInfo, size_t cbStorageInfo, size_t * pcbLengthNeeded);
bool  WINAPI CascCloseStorage(HANDLE hStorage);

bool  WINAPI CascOpenFileByIndexKey(HANDLE hStorage, PQUERY_KEY pIndexKey, DWORD dwFlags, HANDLE * phFile);
bool  WINAPI CascOpenFileByEncodingKey(HANDLE hStorage, PQUERY_KEY pEncodingKey, DWORD dwFlags, HANDLE * phFile);
bool  WINAPI CascOpenFile(HANDLE hStorage, const char * szFileName, DWORD dwLocale, DWORD dwFlags, HANDLE * phFile);
DWORD WINAPI CascGetFileSize(HANDLE hFile, PDWORD pdwFileSizeHigh);
DWORD WINAPI CascSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHigh, DWORD dwMoveMethod);
bool  WINAPI CascReadFile(HANDLE hFile, void * lpBuffer, DWORD dwToRead, PDWORD pdwRead);
bool  WINAPI CascCloseFile(HANDLE hFile);

HANDLE WINAPI CascFindFirstFile(HANDLE hStorage, const char * szMask, PCASC_FIND_DATA pFindData, const TCHAR * szListFile);
bool  WINAPI CascFindNextFile(HANDLE hFind, PCASC_FIND_DATA pFindData);
bool  WINAPI CascFindClose(HANDLE hFind);

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

#endif  // __CASCLIB_H__


text:
<?php

Prado::using('System.Data.*');

if(!defined('TEST_DB_FILE'))
	define('TEST_DB_FILE',dirname(__FILE__).'/db/test.db');

/**
 * @package System.Data.PDO
 */
class TDbCommandTest extends PHPUnit_Framework_TestCase
{
	private $_connection;

	public function setUp()
	{
		@unlink(TEST_DB_FILE);
		$this->_connection=new TDbConnection('sqlite:'.TEST_DB_FILE);
		$this->_connection->Active=true;
		$this->_connection->createCommand('CREATE TABLE foo (id INTEGER NOT NULL PRIMARY KEY, name VARCHAR(8))')->execute();
		$this->_connection->createCommand('INSERT INTO foo (name) VALUES (\'my name\')')->execute();
		$this->_connection->createCommand('INSERT INTO foo (name) VALUES (\'my name 2\')')->execute();
	}

	public function tearDown()
	{
		$this->_connection=null;
	}

	public function testGetText()
	{
		$sql='SELECT * FROM foo';
		$command=$this->_connection->createCommand($sql);
		$this->assertEquals($command->Text,$sql);
	}

	public function testSetText()
	{
		$sql='SELECT name FROM foo';
		$command=$this->_connection->createCommand($sql);
		$row=$command->query()->read();
		$this->assertEquals($row['name'],'my name');

		$newSql='SELECT id FROM foo';
		$command->Text=$newSql;
		$this->assertEquals($command->Text,$newSql);
		$row=$command->query()->read();

		$this->assertEquals($row['id'],'1');
	}

	public function testConnection()
	{
		$sql='SELECT name FROM foo';
		$command=$this->_connection->createCommand($sql);
		$this->assertTrue($command->Connection instanceof TDbConnection);
	}

	public function testPrepare()
	{
		$sql='SELECT name FROM foo';
		$command=$this->_connection->createCommand($sql);
		$this->assertTrue($command->PdoStatement===null);
		$command->prepare();
		$this->assertTrue($command->PdoStatement instanceof PDOStatement);

		try
		{
			$command->Text='Bad SQL';
			$command->prepare();
			$this->fail('Expected exception is not raised');
		}
		catch(TDbException $e)
		{
		}
	}

	public function testCancel()
	{
		$sql='SELECT name FROM foo';
		$command=$this->_connection->createCommand($sql);
		$command->prepare();
		$this->assertTrue($command->PdoStatement instanceof PDOStatement);
		$command->cancel();
		$this->assertEquals($command->PdoStatement,null);
	}

	public function testBindParameter()
	{
		$sql='INSERT INTO foo (id,name) VALUES (3,:name)';
		$command=$this->_connection->createCommand($sql);
		$name='new name';
		$command->bindParameter(':name',$name);
		$command->execute();
		$insertedName=$this->_connection->createCommand('SELECT name FROM foo WHERE id=3')->queryScalar();
		$this->assertEquals($name,$insertedName);
	}

	public function testBindValue()
	{
		$sql='INSERT INTO foo (id,name) VALUES (3,:name)';
		$command=$this->_connection->createCommand($sql);
		$command->bindValue(':name','new name');
		$command->execute();
		$insertedName=$this->_connection->createCommand('SELECT name FROM foo WHERE id=3')->queryScalar();
		$this->assertEquals('new name',$insertedName);
	}

	public function testExecute()
	{
		// test unprepared SQL execution
		$sql='INSERT INTO foo (name) VALUES (\'new name\')';
		$command=$this->_connection->createCommand($sql);
		$n=$command->execute();
		$this->assertEquals($n,1);
		$command->execute();
		$count=$this->_connection->createCommand('SELECT COUNT(id) AS id_count FROM foo')->queryScalar();
		$this->assertEquals('4',$count);

		// test prepared SQL execution
		$sql='INSERT INTO foo (name) VALUES (\'new name\')';
		$command=$this->_connection->createCommand($sql);
		$command->prepare();
		$command->execute();
		$command->execute();
		$count=$this->_connection->createCommand('SELECT COUNT(id) AS id_count FROM foo')->queryScalar();
		$this->assertEquals('6',$count);

		// test exception raising
		try
		{
			$command=$this->_connection->createCommand('bad SQL');
			$command->execute();
			$this->fail('Expected exception is not raised');
		}
		catch(TDbException $e)
		{
		}
	}

	public function testQuery()
	{
		// test unprepared SQL query
		$sql='SELECT * FROM foo';
		$reader=$this->_connection->createCommand($sql)->query();
		$this->assertTrue($reader instanceof TDbDataReader);

		// test unprepared SQL query
		$sql='SELECT * FROM foo';
		$command=$this->_connection->createCommand($sql);
		$command->prepare();
		$reader=$command->query();
		$this->assertTrue($reader instanceof TDbDataReader);

		// test exception raising
		try
		{
			$command=$this->_connection->createCommand('bad SQL');
			$command->query();
			$this->fail('Expected exception is not raised');
		}
		catch(TDbException $e)
		{
		}
	}

	public function testQueryRow()
	{
		// test unprepared SQL query
		$sql='SELECT * FROM foo';
		$row=$this->_connection->createCommand($sql)->queryRow();
		$this->assertTrue($row['id']==='1' && $row['name']==='my name');

		// test unprepared SQL query
		$sql='SELECT * FROM foo';
		$command=$this->_connection->createCommand($sql);
		$command->prepare();
		$row=$command->queryRow();
		$this->assertTrue($row['id']==='1' && $row['name']==='my name');

		// test exception raising
		try
		{
			$command=$this->_connection->createCommand('bad SQL');
			$command->queryRow();
			$this->fail('Expected exception is not raised');
		}
		catch(TDbException $e)
		{
		}
	}

	public function testQueryScalar()
	{
		// test unprepared SQL query
		$sql='SELECT * FROM foo';
		$id=$this->_connection->createCommand($sql)->queryScalar();
		$this->assertTrue($id==='1');

		// test unprepared SQL query
		$sql='SELECT * FROM foo';
		$command=$this->_connection->createCommand($sql);
		$command->prepare();
		$row=$command->queryScalar();
		$this->assertTrue($id==='1');

		// test exception raising
		try
		{
			$command=$this->_connection->createCommand('bad SQL');
			$command->queryScalar();
			$this->fail('Expected exception is not raised');
		}
		catch(TDbException $e)
		{
		}
	}
}

?>


text:
module.exports = function(RED) {
    var noble = require('noble');

    function BleUartNode(config) {
        RED.nodes.createNode(this, config);

        // The proprietary UART profile by Nordic Semiconductor
        var uartServiceUuid = '6e400001b5a3f393e0a9e50e24dcca9e';
        var txCharacteristicUuid = '6e400002b5a3f393e0a9e50e24dcca9e';
        var rxCharacteristicUuid = '6e400003b5a3f393e0a9e50e24dcca9e';

        var txCharacteristic = null;
        var rxCharacteristic = null;
        var writeWithoutResponse = false;

        var node = this;
        var localName = config.localName;
        if (localName === "") {
            node.error("Please specify a local name");
        }

        this.on('input', function(msg) {
            if (txCharacteristic) {
                // You can only send at most 20 bytes in a Bluetooth LE packet,
                // so slice the data into 20-byte chunks:
                while (msg.payload.length > 20) {
                    var output = msg.payload.slice(0, 19);
                    txCharacteristic.write(new Buffer(output), writeWithoutResponse);
                    msg.payload = data.slice(20);
                }

                // Send any remainder bytes less than the last 20:
                txCharacteristic.write(new Buffer(msg.payload), writeWithoutResponse);
            }
        });

        noble.on('stateChange', function(state) {
            if (state === 'poweredOn') {
                noble.startScanning([uartServiceUuid], false);
                node.status({ fill: "blue", shape: "ring", text: "BLE powered on" });
            } else {
                noble.stopScanning();
                node.status({ fill: "red", shape: "ring", text: "BLE powered off" });
            }
        });

        noble.on('scanStart', function() {
            node.log('Started scanning');
            node.status({ fill: "blue", shape: "ring", text: "Scanning..." });
        });

        noble.on('scanStop', function() {
            node.log('Stopped scanning');
            node.status({ fill: "blue", shape: "dot", text: "Scanning finished" });
        });

        noble.on('warning', function(message) {
            node.warn(message);
        });

        noble.on('discover', function(peripheral) {
            node.log('Discovered: ' + peripheral);

            if (peripheral.advertisement.localName !== localName) {
                // Ignore non-specified peripherals
                return;
            }

            // We found a peripheral, stop scanning
            noble.stopScanning();
            node.log('Found: ' + peripheral.advertisement.localName);
            node.status({ fill: "green", shape: "ring", text: "Device found" });

            peripheral.connect(function(err) {
                if (err) {
                    node.error('Error connecting: ' + err);
                    return;
                }

                node.log('Connected to ' + peripheral.advertisement.localName);
                node.status({ fill: "green", shape: "ring", text: "Device connected" });

                peripheral.discoverServices(null, function(err, services) {
                    if (err) {
                        node.error('Error discovering services: ' + err);
                        return;
                    }

                    node.log('Services: ' + services.length);
                    services.forEach(function(service) {
                        if (service.uuid !== uartServiceUuid) {
                            // Ignore non-UART services
                            return;
                        } else {
                            node.log('Found a UART service');
                        }

                        service.discoverCharacteristics(null, function(err, characteristics) {
                            characteristics.forEach(function(characteristic) {
                                if (txCharacteristicUuid === characteristic.uuid) {
                                    txCharacteristic = characteristic;

                                    if (characteristic.properties.indexOf("writeWithoutResponse") > -1) {
                                        writeWithoutResponse = true;
                                    }
                                    node.log('writeWithoutResponse: ' + writeWithoutResponse);

                                    node.log('Found a TX characteristic');
                                } else if (rxCharacteristicUuid === characteristic.uuid) {
                                    rxCharacteristic = characteristic;
                                    node.log('Found a RX characteristic');

                                    // Turn on notifications
                                    rxCharacteristic.notify(true);

                                    rxCharacteristic.on('read', function(data, notification) {
                                        node.log(data);

                                        // If you got a notification
                                        if (notification) {
                                            var msg = { "payload": data };
                                            node.send(msg);
                                        }
                                    });
                                }

                                if (txCharacteristic && rxCharacteristic) {
                                    node.log('Ready');
                                    node.status({ fill: "green", shape: "dot", text: "Device ready" });
                                }
                            });
                        });
                    });
                });

                peripheral.once('disconnect', function(err) {
                    node.log('Disconnected');

                    // Reset characteristics
                    txCharacteristic = null;
                    rxCharacteristic = null;

                    // Try to be connected again
                    noble.startScanning([uartServiceUuid], false);
                });
            });
        });
    }

    RED.nodes.registerType("ble uart", BleUartNode);
}


text:
$(function( $ ) {
	'use strict';

	// The Application
	// ---------------

	// Our overall **AppView** is the top-level piece of UI.
	window.app.AppView = Backbone.View.extend({

		// Instead of generating a new element, bind to the existing skeleton of
		// the App already present in the HTML.
		el: $("#todoapp"),

		// Our template for the line of statistics at the bottom of the app.
		statsTemplate: $('#stats-template'),

		// Delegated events for creating new items, and clearing completed ones.
		events: {
			"keypress #new-todo":  			 "createOnEnter",
			"click 		#clear-completed": "clearCompleted",
			"click 		#toggle-all": 		 "toggleAllComplete"
		},

		// At initialization we bind to the relevant events on the `Todos`
		// collection, when items are added or changed. Kick things off by
		// loading any preexisting todos that might be saved in *localStorage*.
		initialize: function() {

			this.input       = this.$("#new-todo");
			this.allCheckbox = this.$("#toggle-all")[0];

			window.app.Todos.on('add',   this.addOne, this);
			window.app.Todos.on('reset', this.addAll, this);
			window.app.Todos.on('all',   this.render, this);

			this.$footer = $('#footer');
			this.$main   = $('#main');

			window.app.Todos.fetch();
		},

		// Re-rendering the App just means refreshing the statistics -- the rest
		// of the app doesn't change.
		render: function() {
			var completed = window.app.Todos.completed().length;
			var remaining = window.app.Todos.remaining().length;

			if (window.app.Todos.length) {
				this.$main.show();
				this.$footer.show();

				this.statsTemplate.render({
					completed:  completed,
					remaining:  remaining,
					items:      (remaining == 1 ? 'item' : 'items')
				});

				this.$('#filters li a')
					.removeClass('selected')
					.filter("[href='#/" + (window.app.TodoFilter || "") + "']")
					.addClass('selected');

			} else {
				this.$main.hide();
				this.$footer.hide();
			}

			this.allCheckbox.checked = !remaining;
		},

		// Add a single todo item to the list by creating a view for it, and
		// appending its element to the `<ul>`.
		addOne: function(todo) {
			var view = new window.app.TodoView({model: todo, el: $('#todo-template li').clone()});
			$("#todo-list").append(view.render().el);
		},

		// Add all items in the **Todos** collection at once.
		addAll: function() {

			this.$("#todo-list").html('');

			switch(window.app.TodoFilter){
				case "active":
					_.each(window.app.Todos.remaining(), this.addOne);
					break;
				case "completed":
					_.each(window.app.Todos.completed(), this.addOne);
					break;
				default:
					window.app.Todos.each(this.addOne, this);
					break;
			}

		},

		// Generate the attributes for a new Todo item.
		newAttributes: function() {
			return {
				title: this.input.val().trim(),
				order: window.app.Todos.nextOrder(),
				completed: false
			};
		},

		// If you hit return in the main input field, create new **Todo** model,
		// persisting it to *localStorage*.
		createOnEnter: function(e) {

			if ( e.keyCode !== ENTER_KEY ){
				return;
			}

			if ( !this.input.val().trim() ){
				return;
			}

			window.app.Todos.create(this.newAttributes());
			this.input.val('');
		},

		// Clear all completed todo items, destroying their models.
		clearCompleted: function() {
			_.each(window.app.Todos.completed(), function(todo){ todo.destroy(); });
			return false;
		},

		toggleAllComplete: function () {
			var completed = this.allCheckbox.checked;
			window.app.Todos.each(function (todo) { todo.save({'completed': completed}); });
		}
	});

});


text:
/*! @license Firebase v4.3.0
Build: rev-bd8265e
Terms: https://firebase.google.com/terms/ */

'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.ArgSpec = undefined;
exports.validate = validate;
exports.and_ = and_;
exports.stringSpec = stringSpec;
exports.uploadDataSpec = uploadDataSpec;
exports.metadataSpec = metadataSpec;
exports.nonNegativeNumberSpec = nonNegativeNumberSpec;
exports.looseObjectSpec = looseObjectSpec;
exports.nullFunctionSpec = nullFunctionSpec;

var _error = require('./error');

var errorsExports = _interopRequireWildcard(_error);

var _metadata = require('./metadata');

var MetadataUtils = _interopRequireWildcard(_metadata);

var _type = require('./type');

var type = _interopRequireWildcard(_type);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

/**
 * @param name Name of the function.
 * @param specs Argument specs.
 * @param passed The actual arguments passed to the function.
 * @throws {fbs.Error} If the arguments are invalid.
 */
function validate(name, specs, passed) {
    var minArgs = specs.length;
    var maxArgs = specs.length;
    for (var i = 0; i < specs.length; i++) {
        if (specs[i].optional) {
            minArgs = i;
            break;
        }
    }
    var validLength = minArgs <= passed.length && passed.length <= maxArgs;
    if (!validLength) {
        throw errorsExports.invalidArgumentCount(minArgs, maxArgs, name, passed.length);
    }
    for (var i = 0; i < passed.length; i++) {
        try {
            specs[i].validator(passed[i]);
        } catch (e) {
            if (e instanceof Error) {
                throw errorsExports.invalidArgument(i, name, e.message);
            } else {
                throw errorsExports.invalidArgument(i, name, e);
            }
        }
    }
}
/**
 * @struct
 */
/**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var ArgSpec = function () {
    function ArgSpec(validator, opt_optional) {
        var self = this;
        this.validator = function (p) {
            if (self.optional && !type.isJustDef(p)) {
                return;
            }
            validator(p);
        };
        this.optional = !!opt_optional;
    }
    return ArgSpec;
}();
exports.ArgSpec = ArgSpec;
function and_(v1, v2) {
    return function (p) {
        v1(p);
        v2(p);
    };
}
function stringSpec(opt_validator, opt_optional) {
    function stringValidator(p) {
        if (!type.isString(p)) {
            throw 'Expected string.';
        }
    }
    var validator;
    if (opt_validator) {
        validator = and_(stringValidator, opt_validator);
    } else {
        validator = stringValidator;
    }
    return new ArgSpec(validator, opt_optional);
}
function uploadDataSpec() {
    function validator(p) {
        var valid = p instanceof Uint8Array || p instanceof ArrayBuffer || type.isNativeBlobDefined() && p instanceof Blob;
        if (!valid) {
            throw 'Expected Blob or File.';
        }
    }
    return new ArgSpec(validator);
}
function metadataSpec(opt_optional) {
    return new ArgSpec(MetadataUtils.metadataValidator, opt_optional);
}
function nonNegativeNumberSpec() {
    function validator(p) {
        var valid = type.isNumber(p) && p >= 0;
        if (!valid) {
            throw 'Expected a number 0 or greater.';
        }
    }
    return new ArgSpec(validator);
}
function looseObjectSpec(opt_validator, opt_optional) {
    function validator(p) {
        var isLooseObject = p === null || type.isDef(p) && p instanceof Object;
        if (!isLooseObject) {
            throw 'Expected an Object.';
        }
        if (opt_validator !== undefined && opt_validator !== null) {
            opt_validator(p);
        }
    }
    return new ArgSpec(validator, opt_optional);
}
function nullFunctionSpec(opt_optional) {
    function validator(p) {
        var valid = p === null || type.isFunction(p);
        if (!valid) {
            throw 'Expected a Function.';
        }
    }
    return new ArgSpec(validator, opt_optional);
}
//# sourceMappingURL=args.js.map


text:
<?php

namespace PAGI\Application;

use PAGI\Client\IClient;
use PAGI\Client\Impl\ClientImpl;

/**
 * Parent class for all PAGIApplications.
 *
 * PHP Version 5
 *
 * @category Pagi
 * @package  Application
 * @author   Marcelo Gornstein <marcelog@gmail.com>
 * @license  http://marcelog.github.com/PAGI/ Apache License 2.0
 * @link     http://marcelog.github.com/PAGI/
 */
abstract class PAGIApplication
{
    /**
     * log4php logger or our own dummy.
     * @var Logger
     */
    protected $logger;

    /**
     * AGI Client.
     * @var IClient
     */
    private $_agiClient;

    /**
     * Called to initialize the application
     *
     * @return void
     */
    public abstract function init();

    /**
     * Called when PHPvm is shutting down.
     *
     * @return void
     */
    public abstract function shutdown();

    /**
     * Called to run the application, after calling init().
     *
     * @return void
     */
    public abstract function run();

    /**
     * Your error handler. Be careful when implementing this one.
     *
     * @param integer $type    PHP Error type constant.
     * @param string  $message Human readable error message string.
     * @param string  $file    File that triggered the error.
     * @param integer $line    Line that triggered the error.
     *
     * @return boolean
     */
    public abstract function errorHandler($type, $message, $file, $line);

    /**
     * Your signal handler. Be careful when implementing this one.
     *
     * @param integer $signal Signal catched.
     *
     * @return void
     */
    public abstract function signalHandler($signal);

    /**
     * Returns AGI Client.
     *
     * @return IClient
     */
    protected function getAgi()
    {
        return $this->_agiClient;
    }

    /**
     * Constructor. Will call set_error_handler() and pcntl_signal() to setup
     * your errorHandler() and signalHandler(). Also will call
     * register_shutdown_function() to register your shutdown() function.
     *
     * @param array $properties Optional additional properties.
     *
     * @return void
     */
    public function __construct(array $properties = array())
    {
        if (isset($properties['log4php.properties'])) {
            \Logger::configure($properties['log4php.properties']);
        }
        $this->logger = \Logger::getLogger('Pagi.PAGIApplication');
        $this->_agiClient = $properties['pagiClient'];
        register_shutdown_function(array($this, 'shutdown'));
        $signalHandler = array($this, 'signalHandler');
        pcntl_signal(SIGINT, $signalHandler);
        pcntl_signal(SIGQUIT, $signalHandler);
        pcntl_signal(SIGTERM, $signalHandler);
        pcntl_signal(SIGHUP, $signalHandler);
        pcntl_signal(SIGUSR1, $signalHandler);
        pcntl_signal(SIGUSR2, $signalHandler);
        pcntl_signal(SIGCHLD, $signalHandler);
        pcntl_signal(SIGALRM, $signalHandler);
        set_error_handler(array($this, 'errorHandler'));
    }
}


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;

namespace osu.Game.Input
{
    /// <summary>
    /// Track whether the end-user is in an idle state, based on their last interaction with the game.
    /// </summary>
    public class IdleTracker : Component, IKeyBindingHandler<PlatformAction>, IHandleGlobalKeyboardInput
    {
        private readonly double timeToIdle;

        private double lastInteractionTime;

        protected double TimeSpentIdle => Clock.CurrentTime - lastInteractionTime;

        /// <summary>
        /// Whether the user is currently in an idle state.
        /// </summary>
        public IBindable<bool> IsIdle => isIdle;

        private readonly BindableBool isIdle = new BindableBool();

        /// <summary>
        /// Whether the game can currently enter an idle state.
        /// </summary>
        protected virtual bool AllowIdle => true;

        /// <summary>
        /// Intstantiate a new <see cref="IdleTracker"/>.
        /// </summary>
        /// <param name="timeToIdle">The length in milliseconds until an idle state should be assumed.</param>
        public IdleTracker(double timeToIdle)
        {
            this.timeToIdle = timeToIdle;
            RelativeSizeAxes = Axes.Both;
        }

        protected override void Update()
        {
            base.Update();
            isIdle.Value = TimeSpentIdle > timeToIdle && AllowIdle;
        }

        public bool OnPressed(PlatformAction action) => updateLastInteractionTime();

        public bool OnReleased(PlatformAction action) => updateLastInteractionTime();

        protected override bool Handle(UIEvent e)
        {
            switch (e)
            {
                case KeyDownEvent _:
                case KeyUpEvent _:
                case MouseDownEvent _:
                case MouseUpEvent _:
                case MouseMoveEvent _:
                    return updateLastInteractionTime();

                default:
                    return base.Handle(e);
            }
        }

        private bool updateLastInteractionTime()
        {
            lastInteractionTime = Clock.CurrentTime;
            return false;
        }
    }
}


text:
LegalPortal.controller('addBlogPostModalController',
    ['$scope', '$modalInstance', '$timeout', 'blogPostRepository',
    function ($scope, $modalInstance, $timeout, blogPostRepository) {
    'use strict';
    $scope.blogPost = {};
    $scope.post = blogPostRepository.post;

    $scope.modal = {
        error: '',
        save: function () {
            // save to API
            $scope.form.isSaving = true;
            $scope.form.validate();
            if ($scope.form.isValid) {
                $scope.blogPost.publishedDate = moment(new Date).format()
                blogPostRepository.saveListItem($scope.blogPost).done(function (data) {
                    $modalInstance.close(data);
                }).fail(function (err) {
                    $scope.form.isSaving = false;
                });
            }
        },
        cancel: function () {
            $modalInstance.dismiss('cancel');
        },
        fileDrop: function () {
            alert('override default drop');
        }
    };

    $scope.form = {
        validate: function () {
            var fields = ['title', 'postCategory', 'body'];
            for (var i = 0; i < fields.length; i++) {
                var field = fields[i];
                if (isUndefined($scope.blogPost[field]) || $scope.blogPost[field] === '') {
                    this.error.message = this.error[field];
                    this.isValid = false;
                    break;
                }
            }
            $timeout(function (form) {
                return function () {
                    form.error.message = '';
                    form.isValid = true;
                }
            }(this), 3500);
        },
        error: {
            title: 'Please add a title for your blog post.',
            body: 'Please add copy for your blog post.',
            category: 'Please select a category.',
            message: ''
        },
        isValid: true,
        isSaving: false
    };
}]);


text:
<?php

namespace spec\Sylius\Bundle\CoreBundle\EventListener;

use PhpSpec\ObjectBehavior;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\OrderItemInterface;
use Sylius\Component\Core\OrderProcessing\InventoryHandlerInterface;
use Symfony\Component\EventDispatcher\GenericEvent;

/**
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class OrderInventoryListenerSpec extends ObjectBehavior
{
    function let(InventoryHandlerInterface $inventoryHandler)
    {
        $this->beConstructedWith($inventoryHandler);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Bundle\CoreBundle\EventListener\OrderInventoryListener');
    }

    function it_throws_exception_if_event_has_non_order_subject(GenericEvent $event, \stdClass $invalidSubject)
    {
        $event->getSubject()->willReturn($invalidSubject);

        $this
            ->shouldThrow('InvalidArgumentException')
            ->duringUpdateInventoryUnits($event)
        ;
    }

    function it_updates_inventory_units(
            InventoryHandlerInterface $inventoryHandler,
            GenericEvent $event,
            OrderInterface $order
    )
    {
        $event->getSubject()->willReturn($order);
        $inventoryHandler->updateInventory($order)->shouldBeCalled();

        $this->updateInventoryUnits($event);
    }

    function it_creates_inventory_units(
            InventoryHandlerInterface $inventoryHandler,
            GenericEvent $event,
            OrderItemInterface $item
    )
    {
        $event->getSubject()->willReturn($item);

        $inventoryHandler->processInventoryUnits($item)->shouldBeCalled();

        $this->processInventoryUnits($event);
    }
}


text:
module.exports = {
	process: async message => {
		if(message.args[0]) {
			let command = Object.keys(bot.commands)
				.map(key => bot.commands[key])
				.find(cmd => message.args[0] === cmd.name || ~cmd.aliases.indexOf(message.args[0]));
			if(!command) return __("commands.default.help.commandNotFound", message);

			let helpMsg = `__**Command Name**__: ${command.name}\n`;
			helpMsg += `Category: ${command.type}\n`;
			helpMsg += `Usage: ${command.usage}\n`;
			helpMsg += `Aliases: ${command.aliases.length ? command.aliases.join(", ") : "None"}\n`;
			helpMsg += `Description: ${command.description || "None provided"}\n`;
			if(command.perm) helpMsg += `Required Permission: ${command.perm}\n`;
			else if(command.guildOnly) helpMsg += `This command will only work in guilds\n`;
			helpMsg += `Uses: ${command.uses}`;

			return __("commands.default.help.commandInfo", message, {
				command: command.name,
				category: command.type,
				usage: command.usage,
				aliases: command.aliases.length ? command.aliases.join(", ") : __("words.none", message, {}, true),
				description: command.description || __("phrases.noneProvided", message),
				perm: command.perm || __("phrases.noneRequired", message)
			});
		} else {
			let disabled;
			if(message.channel.guild) {
				disabled = await r.table("editedCommands")
					.getAll(message.channel.guild.id, { index: "guildID" })
					.filter({ enabled: false }).getField("command").run();
			} else {
				disabled = [];
			}

			let commandMsg = "", commandTypes = {};
			for(let cmd in bot.commands) {
				cmd = bot.commands[cmd];
				if(cmd.type === "creator") continue;
				else if(~disabled.indexOf(cmd.name)) continue;
				else if(!commandTypes[cmd.type]) commandTypes[cmd.type] = [];
				commandTypes[cmd.type].push(cmd.name);
				commandTypes[cmd.type].concat(cmd.aliases);
			}

			for(let category in commandTypes) {
				commandTypes[category].sort();
				commandMsg += `\n__${category.charAt(0).toUpperCase() + category.substring(1)}__\n`;
				commandMsg += commandTypes[category].join(", ");
				commandMsg += `\n`;
			}

			return __("commands.default.help.commandList", message, {
				count: Object.keys(bot.commands).length,
				commands: commandMsg
			});
		}
	},
	description: "List commands, or get info on one",
	args: [{
		type: "text",
		label: "command",
		optional: true
	}]
};


text:
require 'spec_helper'

module IsbnTool
  class FakeValidator
    def initialize(*)
    end

    def valid?
    end
  end

  class FakeHyphenatizor
    def initialize(*)
    end

    def hyphenate
      "test"
    end
  end

  describe Isbn do
    describe "#valid?" do
      it "successfull validation" do
        FakeValidator.any_instance.stub(:valid?) { true }

        isbn = Isbn.new("1234", FakeValidator)
        expect(isbn).to be_valid
      end

      it "unsuccessfull validation" do
        FakeValidator.any_instance.stub(:valid?) { false }

        isbn = Isbn.new("1234", FakeValidator)
        expect(isbn).not_to be_valid
      end
    end

    describe "#hyphenate" do
      it "calls the injected hyphenatizor class" do
        isbn = Isbn.new("9783639514957", FakeValidator, FakeHyphenatizor)
        expect(isbn.hyphenate).to eql("test")
      end
    end

    describe '#without_checksum' do
      let(:isbn) { Isbn.new("9783639514957") }

      it "returns the isbn without the checksum" do
        expect(isbn.without_checksum).to eql("978363951495")
      end
    end

    describe '#last_digit' do
      let(:isbn) { Isbn.new("9783639514957") }

      it "returns the last digit of the isbn" do
        expect(isbn.last_digit).to eql("7")
      end
    end

    describe '#not_extracted_numbers' do
      context "returns the not extracted/parsed part of the isbn" do
        let(:isbn) { Isbn.new("9783639514957") }

        it do
          isbn.prefix_element = "978"
          expect(isbn.not_extracted_numbers).to eql("3639514957")
        end

        it do
          isbn.prefix_element = "978"
          isbn.registration_group_element = "3"
          expect(isbn.not_extracted_numbers).to eql("639514957")
        end
      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright 2021 Google LLC
  ~
  ~ 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
  ~
  ~      https://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.
  ~
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/sms_notice_card"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:padding="@dimen/padding_normal"
  android:background="@drawable/semantic_banner_background"
  android:orientation="vertical">

  <ImageView
    android:layout_width="@dimen/active_app_screen_card_icon_size"
    android:layout_height="@dimen/active_app_screen_card_icon_size"
    android:layout_marginStart="@dimen/padding_micro"
    android:layout_gravity="start"
    android:contentDescription="@null"
    android:importantForAccessibility="no"
    app:srcCompat="@drawable/ic_check_filled"
    app:tint="@color/semantic_banner_tint_color"/>

  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_marginStart="@dimen/padding_micro"
    android:layout_marginTop="@dimen/padding_medium"
    android:orientation="vertical"
    android:layout_weight="1">

    <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="start"
      android:text="@string/sms_intercept_notice_card_title"
      android:textAppearance="?attr/textAppearanceSubtitle1" />

    <TextView
      android:id="@+id/sms_notice_content"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="start"
      android:layout_marginTop="@dimen/padding_micro"
      android:textAppearance="?attr/textAppearanceBody2"
      android:text="@string/sms_intercept_notice_card_content"
      android:textColor="?attr/colorControlNormal" />

  </LinearLayout>

</LinearLayout>


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

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

import org.flowable.engine.common.impl.interceptor.CommandContext;
import org.flowable.engine.delegate.event.FlowableSignalEvent;
import org.flowable.engine.impl.persistence.entity.EventLogEntryEntity;

/**
 * @author Joram Barrez
 */
public class ActivitySignaledEventHandler extends AbstractDatabaseEventLoggerEventHandler {

    @Override
    public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {
        FlowableSignalEvent signalEvent = (FlowableSignalEvent) event;

        Map<String, Object> data = new HashMap<>();
        putInMapIfNotNull(data, Fields.ACTIVITY_ID, signalEvent.getActivityId());
        putInMapIfNotNull(data, Fields.ACTIVITY_NAME, signalEvent.getActivityName());
        putInMapIfNotNull(data, Fields.PROCESS_DEFINITION_ID, signalEvent.getProcessDefinitionId());
        putInMapIfNotNull(data, Fields.PROCESS_INSTANCE_ID, signalEvent.getProcessInstanceId());
        putInMapIfNotNull(data, Fields.EXECUTION_ID, signalEvent.getExecutionId());
        putInMapIfNotNull(data, Fields.ACTIVITY_TYPE, signalEvent.getActivityType());

        putInMapIfNotNull(data, Fields.SIGNAL_NAME, signalEvent.getSignalName());
        putInMapIfNotNull(data, Fields.SIGNAL_DATA, signalEvent.getSignalData());

        return createEventLogEntry(signalEvent.getProcessDefinitionId(), signalEvent.getProcessInstanceId(), signalEvent.getExecutionId(), null, data);
    }

}


text:
import { PAGES_MENU } from './../pages.menu';
import { Routes } from '@angular/router';
import { BaMenuService } from './../../theme/services/baMenu/baMenu.service';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-projects',
  templateUrl: './projects.component.html',
  styleUrls: ['./projects.component.scss']
})
export class ProjectsComponent implements OnInit {

  constructor(private _menuService: BaMenuService) { }

  ngOnInit() {
    this._menuService.updateMenuByRoutes(<Routes>PAGES_MENU);
  }

}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<dt-example table-type="html" order="3">

<css lib="datatables tabletools" />
<js lib="jquery datatables tabletools">
<![CDATA[
$(document).ready(function() {
	var table = $('#example').DataTable();
	var tt = new $.fn.dataTable.TableTools( table, {
		sRowSelect: 'single'
	} );

	$( tt.fnContainer() ).insertAfter('div.info');
} );
]]>
</js>

<title lib="TableTools">Initialisation with `new`</title>

<info><![CDATA[

Typically when working with TableTools, the initialisation and insertion into the DOM will be done automatically by DataTables, through the use of the `dt-init dom` parameter. However, it is also possible to initialise TableTools manually as shown in the example below using `new $.fn.dataTable.TableTools();`. The constructor for TableTools takes two parameters:

1. The DataTable that the newly created TableTools instance should attach to
2. Optionally - A list of options

Once initialised you can insert the TableTools tool bar node anywhere you wish into the DOM using the `fnContainer()` API method to get the node.

]]></info>

</dt-example>


text:
window.R = require('ramda')
window.RamdaScript = module.exports = require('./ramdascript')
window.RamdaScript.run = run

function run(src) {
    var result = RamdaScript.compile(src, {format: 'iife'})
    var fn     = new Function(result.js)
    return fn()
}

function runScripts() {
    var i
    var scripts = window.document.getElementsByTagName('script')

    for (i = 0; i < scripts.length; i++) {
        if (scripts[i].type === 'text/ramdascript') {
            run(scripts[i].innerHTML)
        }
    }
}

if (window.addEventListener) {
    window.addEventListener('DOMContentLoaded', runScripts, false)
} else {
    window.attachEvent('onload', runScripts)
}


text:
package jp.itnav.r4r.ardrill;

import android.content.res.AssetManager;

// Wrapper for native library

public class ARdrillJNILib {

     static {
         System.loadLibrary("ARdrill");
     }

    /**
     * @param width the current view width
     * @param height the current view height
     */
     public static native void setUp(String extPath, AssetManager assetManager, int avatarType);
     public static native void init(int width, int height);
     public static native void step();
     public static native void gainedFocus();
     public static native void resume();
     public static native void pause();
     public static native void setCameraAxis(float x, float y, float z, float w);
     public static native void setAnimationNumber(int number);
     public static native void setWaterLevel(float level);
     public static native void setAnimationSpeed(float speed);
}


text:
import React, { Component } from 'react';
import {Toolbar, ToolbarGroup, ToolbarTitle} from 'material-ui/Toolbar';

export class StatusBar extends Component {
  render () {
    return (
      <Toolbar>
        <ToolbarGroup>
          <ToolbarTitle text='Status' />
        </ToolbarGroup>
      </Toolbar>
    );
  }
}

export default StatusBar;


text:
extern crate tikv_util;

extern crate slog_global;

extern crate serde_derive;

extern crate raft;

mod engine;
pub use engine::{RaftEngineConfig, RaftLogBatch, RaftLogEngine, RecoveryMode};


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.resourcemanager.keyvault.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.http.HttpPipeline;
import com.azure.resourcemanager.keyvault.KeyVaultManager;
import com.azure.resourcemanager.keyvault.fluent.models.VaultInner;
import com.azure.resourcemanager.resources.fluentcore.arm.models.GroupableResource;
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsListingPrivateLinkResource;
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsUpdatingPrivateEndpointConnection;
import com.azure.resourcemanager.resources.fluentcore.model.Appliable;
import com.azure.resourcemanager.resources.fluentcore.model.Creatable;
import com.azure.resourcemanager.resources.fluentcore.model.Refreshable;
import com.azure.resourcemanager.resources.fluentcore.model.Updatable;
import com.azure.security.keyvault.keys.KeyAsyncClient;
import com.azure.security.keyvault.secrets.SecretAsyncClient;
import java.util.List;

/** An immutable client-side representation of an Azure Key Vault. */
@Fluent
public interface Vault
    extends GroupableResource<KeyVaultManager, VaultInner>, Refreshable<Vault>, Updatable<Vault.Update>,
    SupportsListingPrivateLinkResource,
    SupportsUpdatingPrivateEndpointConnection {

    /** @return an authenticated Key Vault secret client */
    SecretAsyncClient secretClient();

    /** @return an authenticated Key Vault key client */
    KeyAsyncClient keyClient();

    /** @return an authenticated Key Vault rest client */
    HttpPipeline vaultHttpPipeline();

    /** @return the Key Vault key API entry point */
    Keys keys();

    /** @return the Key Vault secret API entry point */
    Secrets secrets();

    /** @return the URI of the vault for performing operations on keys and secrets. */
    String vaultUri();

    /**
     * @return the Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
     */
    String tenantId();

    /** @return SKU details. */
    Sku sku();

    /**
     * @return an array of 0 to 16 identities that have access to the key vault. All identities in the array must use
     *     the same tenant ID as the key vault's tenant ID.
     */
    List<AccessPolicy> accessPolicies();

    /**
     * @return whether role based access control (RBAC) for authorization of data access is enabled.
     */
    boolean roleBasedAccessControlEnabled();

    /**
     * @return whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key
     *     vault.
     */
    boolean enabledForDeployment();

    /** @return whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. */
    boolean enabledForDiskEncryption();

    /** @return whether Azure Resource Manager is permitted to retrieve secrets from the key vault. */
    boolean enabledForTemplateDeployment();

    /** @return whether soft delete is enabled for this key vault. */
    boolean softDeleteEnabled();

    /**
     * @return whether purge protection is enabled for this key vault. Purge protection can only be enabled if soft
     *     delete is enabled.
     */
    boolean purgeProtectionEnabled();

    /**
     * Get the createMode value.
     *
     * @return the createMode value
     */
    CreateMode createMode();

    /**
     * Get the networkAcls value.
     *
     * @return the networkAcls value
     */
    NetworkRuleSet networkRuleSet();

    /**************************************************************
     * Fluent interfaces to provision a Vault
     **************************************************************/

    /** Container interface for all the definitions that need to be implemented. */
    interface Definition
        extends DefinitionStages.Blank,
            DefinitionStages.WithGroup,
            DefinitionStages.WithAccessPolicy,
            DefinitionStages.WithCreate {
    }

    /** Grouping of all the key vault definition stages. */
    interface DefinitionStages {
        /** The first stage of the key vault definition. */
        interface Blank extends DefinitionWithRegion<WithGroup> {
        }

        /** A key vault definition allowing resource group to be set. */
        interface WithGroup extends GroupableResource.DefinitionStages.WithGroup<WithAccessPolicy> {
        }

        /** A key vault definition allowing the sku to be set. */
        interface WithSku {
            /**
             * Specifies the sku of the key vault.
             *
             * @param skuName the sku
             * @return the next stage of key vault definition
             */
            WithCreate withSku(SkuName skuName);
        }

        /** A key vault definition allowing access policies to be attached. */
        interface WithAccessPolicy {
            /**
             * Attach no access policy.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withEmptyAccessPolicy();

            /**
             * Attach an existing access policy.
             *
             * @param accessPolicy the existing access policy
             * @return the next stage of key vault definition
             */
            WithCreate withAccessPolicy(AccessPolicy accessPolicy);

            /**
             * Begins the definition of a new access policy to be added to this key vault.
             *
             * @return the first stage of the access policy definition
             */
            AccessPolicy.DefinitionStages.Blank<WithCreate> defineAccessPolicy();

            /**
             * Enables role based access control (RBAC) for authorization of data access.
             *
             * It overrides access policies configure.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withRoleBasedAccessControl();
        }

        /** A key vault definition allowing the networkAcl to be set. */
        interface WithNetworkRuleSet {

            /**
             * Specifies that by default access to key vault should be allowed from all networks.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withAccessFromAllNetworks();

            /**
             * Specifies that by default access to key vault should be denied from all networks. except from those
             * networks specified via withVirtualNetworkRules, withAccessFromIpAddressRange, withAccessFromIpAddress
             *
             * @return the next stage of key vault definition
             */
            WithCreate withAccessFromSelectedNetworks();

            /**
             * Specifies that access to the key vault from the specific ip address should be allowed.
             *
             * @param ipAddress the ip address
             * @return the next stage of key vault definition
             */
            WithCreate withAccessFromIpAddress(String ipAddress);

            /**
             * Specifies that access to the key vault from the specific ip range should be allowed.
             *
             * @param ipAddressCidr the ip address CIDR
             * @return the next stage of key vault definition
             */
            WithCreate withAccessFromIpAddressRange(String ipAddressCidr);

            /**
             * Specifies that access to the key vault should be allowed from applications running on Microsoft azure
             * services.
             *
             * @return the next stage of key vault definition.
             */
            WithCreate withAccessFromAzureServices();

            /**
             * Set the bypass value.
             *
             * @param bypass the bypass value to set
             * @return the next stage of key vault definition.
             */
            WithCreate withBypass(NetworkRuleBypassOptions bypass);

            /**
             * Set the defaultAction value.
             *
             * @param defaultAction the defaultAction value to set
             * @return the next stage of key vault definition.
             */
            WithCreate withDefaultAction(NetworkRuleAction defaultAction);

            /**
             * Get the virtualNetworkRules value.
             *
             * @param virtualNetworkRules the virtual network rules
             * @return the next stage of key vault definition.
             */
            WithCreate withVirtualNetworkRules(List<VirtualNetworkRule> virtualNetworkRules);
        }

        /** A key vault definition allowing various configurations to be set. */
        interface WithConfigurations {
            /**
             * Enable Azure Virtual Machines to retrieve certificates stored as secrets from the key vault.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withDeploymentEnabled();

            /**
             * Enable Azure Disk Encryption to retrieve secrets from the vault and unwrap keys.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withDiskEncryptionEnabled();

            /**
             * Enable Azure Resource Manager to retrieve secrets from the key vault.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withTemplateDeploymentEnabled();

            /**
             * Enable soft delete for the key vault.
             *
             * @deprecated soft-delete protection is enabled by default.
             * Users will no longer be able to opt out of or turn off soft-delete.
             *
             * @return the next stage of key vault definition
             */
            @Deprecated
            WithCreate withSoftDeleteEnabled();

            /**
             * Enable purge protection for the key vault; valid only if soft delete is also enabled.
             *
             * @return the next stage of key vault definition.
             */
            WithCreate withPurgeProtectionEnabled();

            /**
             * Disable Azure Virtual Machines to retrieve certificates stored as secrets from the key vault.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withDeploymentDisabled();

            /**
             * Disable Azure Disk Encryption to retrieve secrets from the vault and unwrap keys.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withDiskEncryptionDisabled();

            /**
             * Disable Azure Resource Manager to retrieve secrets from the key vault.
             *
             * @return the next stage of key vault definition
             */
            WithCreate withTemplateDeploymentDisabled();
        }

        /**
         * A key vault definition with sufficient inputs to create a new storage account in the cloud, but exposing
         * additional optional inputs to specify.
         */
        interface WithCreate
            extends Creatable<Vault>,
                GroupableResource.DefinitionWithTags<WithCreate>,
                DefinitionStages.WithSku,
                DefinitionStages.WithNetworkRuleSet,
                DefinitionStages.WithConfigurations,
                DefinitionStages.WithAccessPolicy {
        }
    }

    /** Grouping of all the key vault update stages. */
    interface UpdateStages {
        /** A key vault update allowing access policies to be modified, attached, or removed. */
        interface WithAccessPolicy {
            /**
             * Remove an access policy from the access policy list.
             *
             * @param objectId the object ID of the Active Directory identity the access policy is for
             * @return the key vault update stage
             */
            Update withoutAccessPolicy(String objectId);

            /**
             * Attach an existing access policy.
             *
             * @param accessPolicy the existing access policy
             * @return the key vault update stage
             */
            Update withAccessPolicy(AccessPolicy accessPolicy);

            /**
             * Begins the definition of a new access policy to be added to this key vault.
             *
             * @return the first stage of the access policy definition
             */
            AccessPolicy.UpdateDefinitionStages.Blank<Update> defineAccessPolicy();

            /**
             * Begins the update of an existing access policy attached to this key vault.
             *
             * @param objectId the object ID of the Active Directory identity the access policy is for
             * @return the update stage of the access policy definition
             */
            AccessPolicy.Update updateAccessPolicy(String objectId);

            /**
             * Enables role based access control (RBAC) for authorization of data access.
             *
             * It overrides access policies configure.
             *
             * @return the update stage of the access policy definition
             */
            Update withRoleBasedAccessControl();

            /**
             * Disables role based access control (RBAC) for authorization of data access.
             *
             * @return the update stage of the access policy definition
             */
            Update withoutRoleBasedAccessControl();
        }

        /** A key vault update allowing the NetworkRuleSet to be set. */
        interface WithNetworkRuleSet {

            /**
             * Specifies that by default access to key vault should be allowed from all networks.
             *
             * @return the next stage of key vault definition
             */
            Update withAccessFromAllNetworks();

            /**
             * Specifies that by default access to key vault should be denied from all networks. except from those
             * networks specified via withVirtualNetworkRules, withAccessFromIpAddressRange withAccesFromIpAddress
             *
             * @return the update stage of key vault definition
             */
            Update withAccessFromSelectedNetworks();

            /**
             * Specifies that access to the key vault from the specific ip address should be allowed.
             *
             * @param ipAddress the ip address
             * @return the update stage of key vault definition
             */
            Update withAccessFromIpAddress(String ipAddress);

            /**
             * Specifies that access to the key vault from the specific ip range should be allowed.
             *
             * @param ipAddressCidr the idAddress range in Cidr format
             * @return the update stage of key vault definition
             */
            Update withAccessFromIpAddressRange(String ipAddressCidr);

            /**
             * Specifies that access to the key vault should be allowed from applications running on Microsoft azure
             * services.
             *
             * @return the update stage of key vault definition.
             */
            Update withAccessFromAzureServices();

            /**
             * Set the bypass value.
             *
             * @param bypass the bypass value to set
             * @return the update stage of key vault definition.
             */
            Update withBypass(NetworkRuleBypassOptions bypass);

            /**
             * Set the defaultAction value.
             *
             * @param defaultAction the defaultAction value to set
             * @return the update stage of key vault definition.
             */
            Update withDefaultAction(NetworkRuleAction defaultAction);

            /**
             * Get the virtualNetworkRules value.
             *
             * @param virtualNetworkRules virtual network rules
             * @return the update stage of key vault definition.
             */
            Update withVirtualNetworkRules(List<VirtualNetworkRule> virtualNetworkRules);
        }

        /** A key vault update allowing various configurations to be set. */
        interface WithConfigurations {
            /**
             * Enable Azure Virtual Machines to retrieve certificates stored as secrets from the key vault.
             *
             * @return the key vault update stage
             */
            Update withDeploymentEnabled();

            /**
             * Enable Azure Disk Encryption to retrieve secrets from the vault and unwrap keys.
             *
             * @return the key vault update stage
             */
            Update withDiskEncryptionEnabled();

            /**
             * Enable Azure Resource Manager to retrieve secrets from the key vault.
             *
             * @return the key vault update stage
             */
            Update withTemplateDeploymentEnabled();

            /**
             * Enable soft delete for the key vault.
             *
             * @deprecated soft-delete protection is enabled by default.
             * Users will no longer be able to opt out of or turn off soft-delete.
             *
             * @return the next stage of key vault definition
             */
            @Deprecated
            Update withSoftDeleteEnabled();

            /**
             * Enable purge protection for the key vault; valid only if soft delete is also enabled.
             *
             * @return the next stage of key vault definition.
             */
            Update withPurgeProtectionEnabled();

            /**
             * Disable Azure Virtual Machines to retrieve certificates stored as secrets from the key vault.
             *
             * @return the key vault update stage
             */
            Update withDeploymentDisabled();

            /**
             * Disable Azure Disk Encryption to retrieve secrets from the vault and unwrap keys.
             *
             * @return the next stage of key vault definition
             */
            Update withDiskEncryptionDisabled();

            /**
             * Disable Azure Resource Manager to retrieve secrets from the key vault.
             *
             * @return the key vault update stage
             */
            Update withTemplateDeploymentDisabled();
        }
    }

    /** The template for a key vault update operation, containing all the settings that can be modified. */
    interface Update
        extends GroupableResource.UpdateWithTags<Update>,
            Appliable<Vault>,
            UpdateStages.WithAccessPolicy,
            UpdateStages.WithNetworkRuleSet,
            UpdateStages.WithConfigurations {
    }
}


text:
Collaborative Jekyll site based on Minimal Mistakes Skinny Bones Theme. Swarthmore College Library Digital Scholarship.

> I'm currently using a variation of it on my personal website [Made Mistakes](http://mademistakes.com) with some modifications. To learn more about how to use the theme and install it check out the [Skinny Bones demo](http://mmistakes.github.io/skinny-bones-jekyll/) (*work in progress*).

## Notable Features

* Jekyll 3.x and GitHub Pages compatible.
* Stylesheet built using Sass.
* Data files for easier customization of the site navigation/footer and for supporting multiple authors.
* Optional Disqus comments, table of contents, social sharing links, and Google AdSense ads.
* And more.

webhook testing


text:
/*
Project: angular-gantt v1.3.0 - Gantt chart component for AngularJS
Authors: Marco Schweighauser, Rémi Alvergnat
License: MIT
Homepage: https://www.angular-gantt.com
Github: https://github.com/angular-gantt/angular-gantt.git
*/
(function(){
    /* global ResizeSensor: false */
    /* global ElementQueries: false */
    'use strict';
    angular.module('gantt.resizeSensor', ['gantt']).directive('ganttResizeSensor', [function() {
        return {
            restrict: 'E',
            require: '^gantt',
            scope: {
                enabled: '=?'
            },
            link: function(scope, element, attrs, ganttCtrl) {
                var api = ganttCtrl.gantt.api;

                // Load options from global options attribute.
                if (scope.options && typeof(scope.options.progress) === 'object') {
                    for (var option in scope.options.progress) {
                        scope[option] = scope.options[option];
                    }
                }

                if (scope.enabled === undefined) {
                    scope.enabled = true;
                }

                function buildSensor() {
                    var ganttElement = element.parent().parent().parent()[0].querySelectorAll('div.gantt')[0];
                    return new ResizeSensor(ganttElement, function() {
                        // See issue #664
                        if (Math.abs(ganttElement.clientWidth - ganttCtrl.gantt.$scope.ganttElementWidth) > 1) {
                            ganttCtrl.gantt.$scope.ganttElementWidth = ganttElement.clientWidth;
                            ganttCtrl.gantt.$scope.$apply();
                        }
                    });
                }

                var rendered = false;
                var sensor;

                api.core.on.rendered(scope, function() {
                    rendered = true;
                    if (sensor !== undefined) {
                        sensor.detach();
                    }
                    if (scope.enabled) {
                        ElementQueries.update();
                        sensor = buildSensor();
                    }
                });

                scope.$watch('enabled', function(newValue) {
                    if (rendered) {
                        if (newValue && sensor === undefined) {
                            ElementQueries.update();
                            sensor = buildSensor();
                        } else if (!newValue && sensor !== undefined) {
                            sensor.detach();
                            sensor = undefined;
                        }
                    }
                });
            }
        };
    }]);
}());

angular.module('gantt.resizeSensor.templates', []).run(['$templateCache', function($templateCache) {

}]);

//# sourceMappingURL=angular-gantt-resizeSensor-plugin.js.map


text:
package org.kuali.kpme.tklm.leave.accrual;

import org.joda.time.DateTime;
import org.kuali.kpme.core.api.calendar.entry.CalendarEntry;
import org.kuali.kpme.tklm.api.leave.accrual.RateRangeAggregateContract;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class RateRangeAggregate implements RateRangeAggregateContract {
	private List<RateRange> rateRanges = new ArrayList<RateRange>();
	private RateRange currentRate;
	private boolean rateRangeChanged;
	private Map<String, List<CalendarEntry>> calEntryMap;

	public RateRange getRate(DateTime date) {
		rateRangeChanged = false;
		if (currentRate == null) {
			currentRate = rateRanges.get(0);
		}

		if (currentRate.getRange().contains(date)) {
			for (RateRange rateRange : rateRanges) {
				if (rateRange.getRange().contains(date)) {
					rateRangeChanged = rateRange.getAccrualRatePercentageModifier() != currentRate.getAccrualRatePercentageModifier();
					currentRate = rateRange;
					break;
				}
			}
		}
		return currentRate;
	}

	public List<RateRange> getRateRanges() {
		return rateRanges;
	}
	public void setRateRanges(List<RateRange> rateRanges) {
		this.rateRanges = rateRanges;
	}
	public RateRange getCurrentRate() {
		return currentRate;
	}
	public void setCurrentRate(RateRange currentRate) {
		this.currentRate = currentRate;
	}
	public boolean isRateRangeChanged() {
		return rateRangeChanged;
	}
	public void setRateRangeChanged(boolean rateRangeChanged) {
		this.rateRangeChanged = rateRangeChanged;
	}

	// return the rateRange on the given day
	public RateRange getRateOnDate(DateTime date) {
		for (RateRange rateRange : rateRanges) {
			if (rateRange.getRange().contains(date)) {
				return rateRange;
			}
		}
		return null;
	}

	public Map<String, List<CalendarEntry>> getCalEntryMap() {
		return calEntryMap;
	}

	public void setCalEntryMap(Map<String, List<CalendarEntry>> calEntryMap) {
		this.calEntryMap = calEntryMap;
	}

}


text:
var Base = require('./base')

/**
 * Expose `JSON`.
 */

exports = module.exports = JSONReporter

/**
 * Initialize a new `JSON` reporter.
 *
 * @api public
 * @param {Runner} runner
 */
function JSONReporter (runner) {
  Base.call(this, runner)

  var self = this
  var tests = []
  var pending = []
  var failures = []
  var passes = []

  runner.on('test end', function (test) {
    tests.push(test)
  })

  runner.on('pass', function (test) {
    passes.push(test)
  })

  runner.on('fail', function (test) {
    failures.push(test)
  })

  runner.on('pending', function (test) {
    pending.push(test)
  })

  runner.on('end', function () {
    var obj = {
      stats: self.stats,
      tests: tests.map(clean),
      pending: pending.map(clean),
      failures: failures.map(clean),
      passes: passes.map(clean)
    }

    runner.testResults = obj

    process.stdout.write(JSON.stringify(obj, null, 2))
  })
}

/**
 * Return a plain-object representation of `test`
 * free of cyclic properties etc.
 *
 * @api private
 * @param {Object} test
 * @return {Object}
 */
function clean (test) {
  return {
    title: test.title,
    fullTitle: test.fullTitle(),
    duration: test.duration,
    currentRetry: test.currentRetry(),
    err: errorJSON(test.err || {})
  }
}

/**
 * Transform `error` into a JSON object.
 *
 * @api private
 * @param {Error} err
 * @return {Object}
 */
function errorJSON (err) {
  var res = {}
  Object.getOwnPropertyNames(err).forEach(function (key) {
    res[key] = err[key]
  }, err)
  return res
}


text:
/**
 * Created by phucpnt on 5/19/16.
 */
import moment from 'moment';
import toMarkdown from 'to-markdown';
import { mapToContact } from '../contact';

function getFieldValue(poField) {
  let val = null;
  switch (poField.type) { //
    case 'date':
      val = moment.utc(poField.values[0].start_utc).toDate();
      break;
    case 'text':
      val = toMarkdown(poField.values[0].value);
      break;
    case 'duration':
      val = poField.values[0].value / (60 * 60);
      break;
    case 'contact':
      val = poField.values.map(podioContact => mapToContact({ profile: podioContact.value }));
      break;
    case 'calculation':
      switch (poField.config.settings.return_type) {
        case 'date':
          val = moment.utc(poField.values[0].start_utc).toDate();
          break;
        default:
          val = poField.values[0].value;
      }
      break;
    default:
      val = poField.values[0].value;
  }
  return val;
}

function extractItemFields(poFields, objFields) {
  return Object.keys(objFields).reduce((accum, key) => {
    const fieldId = objFields[key];
    const foundField = poFields.find(field => field.field_id === fieldId);
    if (foundField) {
      accum[key] = getFieldValue(foundField);
    }
    return accum;
  }, {});

}

export default function formalize(poItem, AppField) {
  const commonFields = {
    app_item_id: 'appItemId',
    title: 'title',
    created_by: 'createdBy',
    file_count: 'fileCount',
    item_id: 'id',
    link: 'link'
  };

  let finalObj = Object.keys(commonFields).reduce((accum, key) => {
    if (typeof poItem[key] !== 'undefined') {
      accum[commonFields[key]] = poItem[key];
    }
    return accum;
  }, {});

  return Object.assign({}, finalObj, extractItemFields(poItem.fields, AppField));
}


text:
from flask import Flask, render_template_string, redirect, current_app
from sqlalchemy import create_engine, MetaData
from flask_login import UserMixin, LoginManager, login_user, logout_user, current_user
from flask_blogging import SQLAStorage, BloggingEngine
from flask_principal import identity_changed, Identity, AnonymousIdentity, identity_loaded, \
    UserNeed, RoleNeed

app = Flask(__name__)
app.config["SECRET_KEY"] = "secret"  # for WTF-forms and login
app.config["BLOGGING_URL_PREFIX"] = "/blog"
app.config["BLOGGING_DISQUS_SITENAME"] = "test"
app.config["BLOGGING_SITEURL"] = "http://localhost:8000"
app.config["BLOGGING_SITENAME"] = "My Site"
app.config["BLOGGING_PERMISSIONS"] = True  # Enable blogger permissions

# extensions
engine = create_engine('sqlite:////tmp/blog.db')
meta = MetaData()
sql_storage = SQLAStorage(engine, metadata=meta)
blog_engine = BloggingEngine(app, sql_storage)
login_manager = LoginManager(app)
meta.create_all(bind=engine)

class User(UserMixin):
    def __init__(self, user_id):
        self.id = user_id

    def get_name(self):
        return "Paul Dirac"  # typically the user's name

@identity_loaded.connect_via(app)
def on_identity_loaded(sender, identity):
    identity.user = current_user
    if hasattr(current_user, "id"):
        identity.provides.add(UserNeed(current_user.id))
    #identity.provides.add(RoleNeed("blogger"))

@login_manager.user_loader
@blog_engine.user_loader
def load_user(user_id):
    return User(user_id)

index_template = """
<!DOCTYPE html>

        {% if current_user.is_authenticated %}
             Logout
        {% else %}
             Login
        {% endif %}
        &nbsp&nbsp Blog
        &nbsp&nbspSitemap
        &nbsp&nbspATOM

"""

@app.route("/")
def index():
    return render_template_string(index_template)

@app.route("/login/")
def login():
    user = User("testuser")
    login_user(user)

    # notify the change of role
    identity_changed.send(current_app._get_current_object(),
                          identity=Identity("testuser"))
    return redirect("/blog")

@app.route("/logout/")
def logout():
    logout_user()

    # notify the change of role
    identity_changed.send(current_app._get_current_object(),
                          identity=AnonymousIdentity())
    return redirect("/")

if __name__ == "__main__":
    app.run(debug=True, port=8000, use_reloader=True)


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpModule } from '@angular/http';
import { FormsModule } from '@angular/forms';
import { MdDialogModule, MdIconModule } from '@angular/material';

import { NoteWrapperComponent } from './note-wrapper.component';
import { NotesListComponent } from '../notes-list/notes-list.component';
import { AddNoteButtonComponent } from '../add-note-button/add-note-button.component';
import { NoteComponent } from '../note/note.component';
import { NoteService } from '../notes-service/note.service';

const expect = chai.expect;
const assert = chai.assert;
describe('NoteWrapperComponent', () => {
  let component: NoteWrapperComponent;
  let fixture: ComponentFixture<NoteWrapperComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        NoteWrapperComponent,
        NotesListComponent,
        AddNoteButtonComponent,
        NoteComponent
      ],
      imports: [
        RouterTestingModule,
        HttpModule,
        FormsModule,
        MdIconModule,
        MdDialogModule
      ],
      providers: [NoteService],
    })
      .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(NoteWrapperComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should be defined', () => {
    assert.isDefined(component);
  });

  it('should create', () => {
    expect(component).to.be.an('object');
  });
});


text:
<?php
// DIC configuration

$container = $app->getContainer();

// view renderer
$container['renderer'] = function ($c) {
    $settings = $c->get('settings')['renderer'];
    return new Slim\Views\PhpRenderer($settings['template_path']);
};

// monolog
$container['logger'] = function ($c) {
    $settings = $c->get('settings')['logger'];
    $logger = new Monolog\Logger($settings['name']);
    $logger->pushProcessor(new Monolog\Processor\UidProcessor());
    $logger->pushHandler(new Monolog\Handler\StreamHandler($settings['path'], Monolog\Logger::DEBUG));
    return $logger;
};

//view
$container['view'] = function($container){
	$view = new \Slim\Views\Twig(__DIR__ . '/../../resources/views', [
		'cache' => false,
	]);

	$view-> addExtension(new \Slim\Views\TwigExtension(

		$container->router,
		$container->request->getUri()

		));

	return $view;
};

$container['validator'] = function ($container)
{
	return new Netzwelt\Validation\Validator;
};

$container['flash'] = function () {
    return new \Slim\Flash\Messages();
};

$container['LoginController'] = function($container){
	return new src\Controllers\LoginController($container->view);
};

$container['HomeController'] = function($container){
	return new \src\Controllers\HomeController($container->view);
};

$container['PersonController'] = function($container){
	return new \src\Controllers\PersonController($container->view);
};

$container['ProjectController'] = function($container){
	return new \src\Controllers\ProjectController($container->view);
};

#$container['USER'] = function($container){
#    return new \src\Controllers\UserController($container->view);
#};