text:
package gpdb

//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.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// ParametersItem is a nested struct in gpdb response
type ParametersItem struct {
	IsChangeableConfig   string `json:"IsChangeableConfig" xml:"IsChangeableConfig"`
	ForceRestartInstance string `json:"ForceRestartInstance" xml:"ForceRestartInstance"`
	OptionalRange        string `json:"OptionalRange" xml:"OptionalRange"`
	ParameterName        string `json:"ParameterName" xml:"ParameterName"`
	ParameterValue       string `json:"ParameterValue" xml:"ParameterValue"`
	ParameterDescription string `json:"ParameterDescription" xml:"ParameterDescription"`
	CurrentValue         string `json:"CurrentValue" xml:"CurrentValue"`
}


text:
package com.dtflys.forest.exceptions;

public class ForestNoFileNameException extends ForestRuntimeException {

    public ForestNoFileNameException(Class type) {
        super("[Forest] \"" + type.getName() + "\" parameters width @DataFile annotation must define a fileName");
    }
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';

/**
 * @description strips data from caspio reports by iterating each row and constructing
 *              an object with columns as keys and values being the table's row content
 *
 * @param {HTML - div element} div
 * @returns {array} aggregated
 */
function stripCaspioReport(div){
  var table_id = div.querySelector('[id^="cbTable_"]').id;
  var table = document.getElementById(table_id);
  var numRows = table.rows.length;
  var numCols = table.rows[0].cells.length;

  var colNames = [];
  for(var i=0; i<numCols; i+=1)
    colNames.push(table.rows[0].cells[i].innerText.toLowerCase());

  var aggregated = []
  for(var r=1; r<numRows; r+=1){
    var obj = {};
    for(var c=0; c<numCols; c+=1){
      obj[colNames[c]] = table.rows[r].cells[c].innerHTML;
    }
    aggregated.push(obj);
  }

  return aggregated;
}

$(function () {
  $('a[href="#search"]').on('click', function(event) {
      event.preventDefault();
      $('#search').addClass('open');
      $('#search > form > input[type="search"]').focus();
  });

  $('#search, #search button.close').on('click keyup', function(event) {
      if (event.target == this || event.target.className == 'close' || event.keyCode == 27) {
          $(this).removeClass('open');
          document.getElementById('rankingTable_search').innerHTML = "";
      }
  });

  $('#searchBtn').click(function(){
      $('#search').removeClass('open');
  });
});


text:
Color swatch preview

      CIELCh (HCL)

Lightness: <input type="number" data-space="CIELCh" data-channel="Lightness" value="70" />

Chroma: <input type="number" data-space="CIELCh" data-channel="Chroma" value="45" />

hue: <input type="number" data-space="CIELCh" data-channel="hue" value="270" />

      CIELAB

Lightness: <input type="number" data-space="CIELAB" data-channel="Lightness" value="70" />

a*: <input type="number" data-space="CIELAB" data-channel="a" value="0" />

b*: <input type="number" data-space="CIELAB" data-channel="b" value="-45" />

      RGB

R: <input type="number" data-space="RGB" data-channel="Red" value="104" />

G: <input type="number" data-space="RGB" data-channel="Green" value="175" />

B: <input type="number" data-space="RGB" data-channel="Blue" value="252" />

Hex: <input type="text" data-space="RGB_hex" data-channel="RGB_hex" value="#68affc"/>


text:
title: "Добро пожаловать на курс!"
date: 2018-01-13
tags:
 - announcement
category:
 - pyneng-4
---

Вводная информация о курсе:

* [Презентация](https://gitpitch.com/natenka/pyneng-slides/py3_course_intro)

Полезные ссылки:

* [Сайт курса](https://pyneng.github.io/)
* [Книга "Python для сетевых инженеров"](https://www.gitbook.com/book/natenka/pyneng/details)
* [Виртуалки](https://pyneng.github.io/docs/course-vm/)

Советы и ссылки о подготовке, обучению и о том как учиться:

* [https://pyneng.github.io/docs/learning/](https://pyneng.github.io/docs/learning/)

Следующая встреча состоится 20 января в 7:00 UTC.


text:
package com.kotcrab.vis.editor.module.scene.system;

import com.artemis.*;
import com.artemis.EntitySubscription.SubscriptionListener;
import com.artemis.utils.Bag;
import com.artemis.utils.IntBag;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.kotcrab.vis.editor.Log;
import com.kotcrab.vis.editor.entity.EntityScheme;
import com.kotcrab.vis.editor.module.project.ProjectExtensionStorageModule;
import com.kotcrab.vis.editor.plugin.api.EditorEntitySupport;
import com.kotcrab.vis.editor.proxy.*;
import com.kotcrab.vis.runtime.component.*;

public class EntityProxyCache extends Manager {
	private static final String TAG = "EntityProxyCache";

	private ProjectExtensionStorageModule projectExtensionStorage;

	private AspectSubscriptionManager subscriptionManager;

	private Array<EntityProxyCacheListener> listeners = new Array<>();
	private ObjectMap<Entity, EntityProxy> cache = new ObjectMap<>();
	private float pixelsPerUnit;

	public EntityProxyCache (float pixelsPerUnit) {
		this.pixelsPerUnit = pixelsPerUnit;
	}

	@Override
	protected void initialize () {
		EntitySubscription subscription = subscriptionManager.get(Aspect.all(Layer.class, Renderable.class));

		subscription.addSubscriptionListener(new SubscriptionListener() {
			@Override
			public void inserted (IntBag entities) {
				ObjectMap<Entity, EntityProxy> tmpCache = new ObjectMap<>();

				int[] data = entities.getData();
				for (int i = 0; i < entities.size(); i++) {
					int entityId = data[i];
					Entity entity = world.getEntity(entityId);
					tmpCache.put(entity, getProxy(entity));
				}

				cache.putAll(tmpCache);
				listeners.forEach(EntityProxyCacheListener::cacheChanged);
			}

			@Override
			public void removed (IntBag entities) {
				int[] data = entities.getData();
				for (int i = 0; i < entities.size(); i++) {
					cache.remove(world.getEntity(data[i]));
				}
				listeners.forEach(EntityProxyCacheListener::cacheChanged);
			}
		});
	}

	private EntityProxy getProxy (Entity entity) {
		EntityProxy proxy = getInternalProxyFor(entity);

		if (proxy == null) {
			for (EditorEntitySupport support : projectExtensionStorage.getEntitySupports()) {
				proxy = support.resolveProxy(entity);
				if (proxy != null)
					return proxy;
			}
		}

		if (proxy == null) {
			proxy = new MissingProxy(entity);
			Log.error(TAG, String.format("Missing proxy for: %s. Entity structure:", entity));
			Log.error(TAG, String.format("=-%s", entity));

			Bag<Component> components = entity.getComponents(new Bag<>());
			for (int i = 0; i < components.size(); i++) {
				String formatString;
				if (i == components.size() - 1)
					formatString = " \\-- %s";
				else
					formatString = " |-- %s";

				Log.error(TAG, String.format(formatString, components.get(i)));
			}
		}

		return proxy;
	}

	private EntityProxy getInternalProxyFor (Entity entity) {
		if (entity.getComponent(VisParticle.class) != null) return new ParticleProxy(entity, pixelsPerUnit);
		if (entity.getComponent(VisSound.class) != null) return new AudioProxy(entity, false, pixelsPerUnit);
		if (entity.getComponent(VisMusic.class) != null) return new AudioProxy(entity, true, pixelsPerUnit);
		if (entity.getComponent(VisText.class) != null) return new TextProxy(entity);
		if (entity.getComponent(Point.class) != null) return new PointProxy(entity, pixelsPerUnit);
		if (entity.getComponent(VisSprite.class) != null) return new SpriteProxy(entity);

		return null;
	}

	public EntityProxy get (int entityId) {
		return get(world.getEntity(entityId));
	}

	public EntityProxy get (Entity entity) {
		EntityProxy proxy = cache.get(entity);

		if (proxy == null) {
			proxy = getProxy(entity);
			cache.put(entity, proxy);
		}

		return proxy;
	}

	public Array<EntityScheme> getEntitySchemes () {
		Array<EntityScheme> schemes = new Array<>(cache.size);
		cache.values().forEach(proxy -> schemes.add(proxy.getScheme()));
		return schemes;
	}

	public ObjectMap<Entity, EntityProxy> getCache () {
		return cache;
	}

	public void addListener (EntityProxyCacheListener listener) {
		listeners.add(listener);
	}

	public boolean removeListener (EntityProxyCacheListener listener) {
		return listeners.removeValue(listener, true);
	}

	public interface EntityProxyCacheListener {
		void cacheChanged ();
	}
}


text:
All notable changes to this add-on will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

## [11] - 2021-07-29
### Changed
- Update minimum ZAP version to 2.10.0.
- Maintenance changes.

### Added
- API endpoints "applyAll", "applyContext", and "applyGlobal" to apply enabled Alert Filters to existing alerts (Issue 5966).
- API endpoints "testAll", "testContext", and "testGlobal" to test enabled Alert Filters against existing alerts.

## [10] - 2020-01-17
### Added
- Add info and repo URLs.

## [9] - 2019-09-30

- Added support for parameter regex, attack and evidence strings and regexes (Issue 5574)
- Added support for global alert filters (Issue 5575)
- Added option to create alert filters from alert
- Added options to test which alerts will apply to and to actually apply them
- Removed the "Context" from the add-on name
- Promote Alert Filters addon to release status

## [8] - 2019-06-07

- Correct required state of an API parameter.
- Add description to API endpoints.

## 7 - 2018-02-15

- Fix an exception when running ZAP in daemon mode (Issue 4405).

## 6 - 2017-11-27

- Updated for 2.7.0.

## 5 - 2017-11-24

- Dynamically unload the add-on.
- Clear filters on session changes (Issue 3683).

## 4 - 2017-04-03

- Minor functional improvement.

## 3 - 2016-06-02

- Various minor UI improvements

## 2 - 2016-03-22

- Updated to use alertIds from 2.4.3+
- Misc minor bug fixes
- HTML report reports the filtered false positives as true results (Issue 2311)
- Promoted to beta and added icon
- Various minor UI improvements

## 1 - 2015-09-07

- First version

[11]: https://github.com/zaproxy/zap-extensions/releases/alertFilters-v11
[10]: https://github.com/zaproxy/zap-extensions/releases/alertFilters-v10
[9]: https://github.com/zaproxy/zap-extensions/releases/alertFilters-v9
[8]: https://github.com/zaproxy/zap-extensions/releases/alertFilters-v8


text:
/**
 *
 */
package com.chahyadis.jwt.interfaces;

/**
 * IssuerKey

 * nama aplikasi.
 *
 * @author Surya Chahyadi
 * @since March 26th, 2015
 * @version 1.0
 */
public abstract interface IssuerKey {
	/**
	 * appName

	 * Berupa identitas project yang akan divalidasi oleh server.
	 *
	 * @return {@link String}
	 */
	abstract String appName();
}


text:
package org.olat.system.commons.resource;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;
import org.olat.lms.course.CourseModule;
import org.olat.lms.course.ICourse;
import org.olat.system.exception.AssertException;

/**
 * TODO: Class Description for OresHelperTest
 *
 *

 * Initial Date: 07.06.2011

 *
 * @author lavinia
 */
public class OresHelperTest {

    private final Class classInstance = CourseModule.class;
    private final String CLASS_NAME_NO_PACKAGE = "CourseModule";
    private final Long DEFAULT_KEY = new Long(0);
    private final String SUBTYPE = "xyz";
    private final String CLASS_NAME_NO_PACKAGE_WITH_SUBTYPE = CLASS_NAME_NO_PACKAGE + ":" + SUBTYPE;
    private final String RESOURCEABLE_STRING_REPRESENTATION = CLASS_NAME_NO_PACKAGE + "::" + DEFAULT_KEY;

    private OLATResourceable oLATResourceable;

    /**
     * @throws java.lang.Exception
     */
    @Before
    public void setUp() throws Exception {

        oLATResourceable = new OLATResourceable() {
            @Override
            public String getResourceableTypeName() {
                return CLASS_NAME_NO_PACKAGE;
            }

            @Override
            public Long getResourceableId() {
                return DEFAULT_KEY;
            }
        };
    }

    @Test
    public void calculateTypeName_WithClassArg() {
        String typeName = OresHelper.calculateTypeName(classInstance);
        assertEquals(typeName, CLASS_NAME_NO_PACKAGE);
    }

    @Test
    public void calculateTypeName_WithClassAndSubtypeArgs() {
        String typeName = OresHelper.calculateTypeName(classInstance, SUBTYPE);
        // System.out.println(typeName);
        assertEquals(typeName, CLASS_NAME_NO_PACKAGE_WITH_SUBTYPE);
    }

    @Test(expected = AssertException.class)
    public void calculateTypeName_WithTypeAndSubtypeArgs_wrongType() {
        OresHelper.calculateTypeName(CLASS_NAME_NO_PACKAGE, SUBTYPE);
    }

    @Test
    public void calculateTypeName_WithTypeAndSubtypeArgs() {
        String typeName = OresHelper.calculateTypeName(classInstance.getName(), SUBTYPE);
        // System.out.println(typeName);
        assertEquals(typeName, CLASS_NAME_NO_PACKAGE_WITH_SUBTYPE);
    }

    @Test
    public void lookupType() {
        OLATResourceable resourceable = OresHelper.lookupType(classInstance);
        assertNotNull(resourceable);
        assertNotNull(resourceable.getResourceableTypeName());
        assertEquals(resourceable.getResourceableTypeName(), CLASS_NAME_NO_PACKAGE);
        assertNull(resourceable.getResourceableId());
    }

    @Test
    public void lookupType_WithSubtype() {
        OLATResourceable resourceable = OresHelper.lookupType(classInstance, SUBTYPE);
        assertNotNull(resourceable);
        assertNotNull(resourceable.getResourceableTypeName());
        assertEquals(resourceable.getResourceableTypeName(), CLASS_NAME_NO_PACKAGE_WITH_SUBTYPE);
        assertNull(resourceable.getResourceableId());
    }

    @Test
    public void createOLATResourceableTypeWithoutCheck() {
        OLATResourceable resourceable = OresHelper.createOLATResourceableTypeWithoutCheck(CLASS_NAME_NO_PACKAGE);
        assertNotNull(resourceable);
        assertNotNull(resourceable.getResourceableTypeName());
        assertEquals(resourceable.getResourceableTypeName(), CLASS_NAME_NO_PACKAGE);
        assertNotNull(resourceable.getResourceableId());
        assertEquals(resourceable.getResourceableId(), DEFAULT_KEY);
    }

    @Test
    public void createOLATResourceableType_WithTypeAndSubtypeArg() {
        OLATResourceable resourceable = OresHelper.createOLATResourceableType(CLASS_NAME_NO_PACKAGE, SUBTYPE);
        assertNotNull(resourceable);
        assertNotNull(resourceable.getResourceableTypeName());
        assertEquals(resourceable.getResourceableTypeName(), CLASS_NAME_NO_PACKAGE_WITH_SUBTYPE);
        assertNotNull(resourceable.getResourceableId());
        assertEquals(resourceable.getResourceableId(), DEFAULT_KEY);
    }

    @Test
    public void createOLATResourceableType_WithTypeArg() {
        OLATResourceable resourceable = OresHelper.createOLATResourceableType(CLASS_NAME_NO_PACKAGE);
        assertNotNull(resourceable);
        assertNotNull(resourceable.getResourceableTypeName());
        assertEquals(resourceable.getResourceableTypeName(), CLASS_NAME_NO_PACKAGE);
        assertNotNull(resourceable.getResourceableId());
        assertEquals(resourceable.getResourceableId(), DEFAULT_KEY);
    }

    @Test(expected = AssertException.class)
    public void createOLATResourceableInstance_ForClassAndNullKey() {
        OresHelper.createOLATResourceableInstance(classInstance, null);
    }

    @Test
    public void createOLATResourceableInstance_ForClass() {
        OLATResourceable resourceable = OresHelper.createOLATResourceableInstance(classInstance, DEFAULT_KEY);
        assertNotNull(resourceable);
        assertNotNull(resourceable.getResourceableTypeName());
        assertEquals(resourceable.getResourceableTypeName(), CLASS_NAME_NO_PACKAGE);
        assertNotNull(resourceable.getResourceableId());
        assertEquals(resourceable.getResourceableId(), DEFAULT_KEY);
    }

    @Test(expected = AssertException.class)
    public void createOLATResourceableInstance_ForStringAndNullKey() {
        OresHelper.createOLATResourceableInstance(CLASS_NAME_NO_PACKAGE, null);
    }

    @Test
    public void createOLATResourceableInstance_ForString() {
        OLATResourceable resourceable = OresHelper.createOLATResourceableInstance(CLASS_NAME_NO_PACKAGE, DEFAULT_KEY);
        assertNotNull(resourceable);
        assertNotNull(resourceable.getResourceableTypeName());
        assertEquals(resourceable.getResourceableTypeName(), CLASS_NAME_NO_PACKAGE);
        assertNotNull(resourceable.getResourceableId());
        assertEquals(resourceable.getResourceableId(), DEFAULT_KEY);
    }

    @Test
    public void createStringRepresenting() {
        String oresStringRespresentation = OresHelper.createStringRepresenting(oLATResourceable);
        // System.out.println(oresStringRespresentation);
        assertEquals(RESOURCEABLE_STRING_REPRESENTATION, oresStringRespresentation);
    }

    @Test
    public void isOfType() {
        assertTrue(OresHelper.isOfType(oLATResourceable, classInstance));
        assertFalse(OresHelper.isOfType(oLATResourceable, ICourse.class));
    }

    @Test
    public void isLookupTypeEquivalentWithCreateOLATResourceableType() {
        OLATResourceable oLATResourceable_1 = OresHelper.lookupType(classInstance, SUBTYPE);

        String typeName = OresHelper.calculateTypeName(classInstance, SUBTYPE);
        OLATResourceable oLATResourceable_2 = OresHelper.createOLATResourceableType(typeName);
        assertFalse(OresHelper.equals(oLATResourceable_1, oLATResourceable_2));
        assertTrue(oLATResourceable_1.getResourceableTypeName().equals(oLATResourceable_2.getResourceableTypeName()));
    }
}


text:
using namespace physx;
using namespace SampleRenderer;

RenderMeshActor::RenderMeshActor(	Renderer& renderer,
									const PxVec3* verts, PxU32 numVerts,
									const PxVec3* vertexNormals,
									const PxReal* uvs,
									const PxU16* faces16, const PxU32* faces32, PxU32 numFaces, bool flipWinding
								 )
{
	PxVec3Alloc* normals = NULL;
	if(!vertexNormals)
	{
		normals = SAMPLE_NEW(PxVec3Alloc)[numVerts];
		bool status = PxBuildSmoothNormals(numFaces, numVerts, verts, faces32, faces16, normals, flipWinding);
		vertexNormals = normals;
	}

	RendererShape* rs = new RendererMeshShape(renderer, verts, numVerts, vertexNormals, uvs, faces16, faces32, numFaces, flipWinding);
	setRenderShape(rs);

	DELETEARRAY(normals);
}

RenderMeshActor::RenderMeshActor(const RenderMeshActor& src) : RenderBaseActor(src)
{
}

RenderMeshActor::~RenderMeshActor()
{
}


text:
/*---------------------------------------------------------------------------

    (c) 2004 Scorpio Software
        19 Wittama Drive
        Glenmore Park
        Sydney NSW 2745
        Australia

-----------------------------------------------------------------------------

    $Workfile::                                                           $
    $Revision::                                                           $
        $Date::                                                           $
      $Author::                                                           $

---------------------------------------------------------------------------*/
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <algorithm>
#include "fOptions.h"
#include "fMain.h"
#include "ZXPluginManager.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "KRegistry"
#pragma link "KIconButton"
#pragma link "KSpinEdit"
#pragma link "pngimage"
#pragma resource "*.dfm"
//---------------------------------------------------------------------------
using namespace Scorpio;
using namespace GUI;
//---------------------------------------------------------------------------
// used by std::sort for the comparsion of 2 TZXPlugInfo objects
bool operator<(const TPluginInfo& info1, const TPluginInfo& info2 )
{
    bool bLessThan = false;
    if ( info1.Priority == info2.Priority )
    {
        bLessThan = ( info1.LoadOrder < info2.LoadOrder );
    }
    else
    {
        bLessThan = ( info1.Priority > info2.Priority );
    }
    return bLessThan;
}
//---------------------------------------------------------------------------
const String Priorities[4] =
{
    "None",
    "Low",
    "Normal",
    "High"
};
//---------------------------------------------------------------------------
// Constructor
/**
 * creates the BandManager object
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
__fastcall TfrmOptions::TfrmOptions(TComponent* Owner)
: TForm(Owner)
, m_iTopOfButtons(0)
{
    m_BandManager = new ZXBandManager;
    m_iKeyPanelHeights = panCommonKeys->Height;
}
//---------------------------------------------------------------------------
// Destructor
/**
 * Clears the list of plugins, and destroys the BandManager
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
__fastcall TfrmOptions::~TfrmOptions()
{
    ClearPlugins();
    SAFE_DELETE(m_BandManager);
}
//---------------------------------------------------------------------------
// cmdCloseClick
/**
 * Event handler for the Close button. Closes the dialog box
 * @param           Sender the vcl object that called the event
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::cmdCloseClick(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------
// FormShow
/**
 * OnFormShow event handler
 * @param           Sender the vcl object that called the event
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 * @date            Last Modified 10 March 2003 - Add splash screen registry settings
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::FormShow(TObject *Sender)
{
    String path = getenv("APPDATA");
    path += "\\TommyGun\\";
    lblAppDataFolder->Caption = "%APPDATA% = " + path;
    bool bValue = true;
    int  iValue = 0;
    chkShowSplashScreen->Checked = true;
    if (true == regScorpio->Read("ShowSplashScreen", bValue))
    {
        chkShowSplashScreen->Checked = bValue;
    }
    chkShowPluginIcons->Checked = true;
    if (true == regScorpio->Read("ShowPluginIcons", bValue))
    {
        chkShowPluginIcons->Checked = bValue;
    }
    chkLoggingProduceFiles->Checked = false;
    if (true == regScorpio->Read("States", "UseLogFiles", bValue))
    {
        chkLoggingProduceFiles->Checked = bValue;
    }
    /*chkShowProblemDialog->Checked = true;
    if (true == regScorpio->Read("States", "DoNotShowProblems", bValue))
    {
        chkShowProblemDialog->Checked = !bValue;
    }*/
    String sProjectFolder;
    if (regScorpio->Read("ProjectFolder", sProjectFolder))
    {
        edtProjectFolder->Text = sProjectFolder;
    }
    else
    {
        edtProjectFolder->Text = ExtractFilePath(Application->ExeName) + "Projects\\";
    }
    chkRemoveWhitespaceFromXML->Checked = false;
    if (true == regScorpio->Read("States", "RemoveXmlWhitespace", bValue))
    {
        chkRemoveWhitespaceFromXML->Checked = bValue;
    }

    chkUndoEnableUndo->Checked = true;
    if (true == regScorpio->Read("Undo", "EnableUndo", bValue))
    {
        chkUndoEnableUndo->Checked = bValue;
    }
    chkUndoEnabledRedo->Checked = true;
    if (true == regScorpio->Read("Undo", "EnabledRedo", bValue))
    {
        chkUndoEnabledRedo->Checked = bValue;
    }
    chkUndoMemoryLimit->Checked = true;
    if (true == regScorpio->Read("Undo", "EnableMemoryLimit", bValue))
    {
        chkUndoMemoryLimit->Checked = bValue;
    }
    chkUndoClear->Checked = true;
    if (true == regScorpio->Read("Undo", "ClearAfterSave", bValue))
    {
        chkUndoClear->Checked = bValue;
	}
	edtUndoMemory->Value = 16;
	if (true == regScorpio->Read("Undo", "MemoryLimit", iValue))
	{
		edtUndoMemory->Value = iValue;
	}

    chkBackupEnabled->Checked = true;
    if (true == regScorpio->Read("Backup", "EnableBackup", bValue))
    {
        chkBackupEnabled->Checked = bValue;
    }
    chkLimitBackupUsage->Checked = true;
    if (true == regScorpio->Read("Backup", "EnableFolderLimit", bValue))
    {
        chkLimitBackupUsage->Checked = bValue;
    }
	edtBackupFolders->Value = 32;
	if (true == regScorpio->Read("Backup", "FolderLimit", iValue))
	{
		edtBackupFolders->Value = iValue;
	}
	radBackupOnSave->Checked = true;
    if (true == regScorpio->Read("Backup", "BackOnSave", bValue))
    {
        if (false == bValue)
            radBackupOnClose->Checked = true;
    }

    cmdApply->Enabled = false;
}
//---------------------------------------------------------------------------
//  Execute
/**
 * called by the application to show the dialog
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
bool __fastcall TfrmOptions::Execute(void)
{
    m_bPluginsChanged = false;
    m_bPluginChangesApplied = false;
    FindMachineSpecificFolders();
    ShowModal();
    return m_bPluginChangesApplied;
}
//---------------------------------------------------------------------------
// Changed
/**
 * Options have changed, so enables the apply button
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::Changed(void)
{
    cmdApply->Enabled = true;
}
//---------------------------------------------------------------------------
// ClearPlugins
/**
 * Clears the list of plugins that are displayed
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::ClearPlugins(void)
{
    if (true == SAFE_PTR(m_BandManager))
    {
        m_BandManager->SetArrowImage(imgArrowUpDown);
    }
    // remove all the plugins
    for (unsigned int i = 0; i < m_Plugins.size(); i++)
    {
        // remove the control from the bandmanager
        m_BandManager->UnRegisterControl(m_Plugins[i].Panel);
        // remove the control form the form
        SAFE_DELETE(m_Plugins[i].Label);
        SAFE_DELETE(m_Plugins[i].Icon);
        SAFE_DELETE(m_Plugins[i].Image);
        SAFE_DELETE(m_Plugins[i].CheckBox);
        SAFE_DELETE(m_Plugins[i].Shape);
        m_Plugins[i].Panel->Parent->RemoveControl(m_Plugins[i].Panel);
        SAFE_DELETE(m_Plugins[i].Panel);
    }
    m_Plugins.clear();
    panKeysGeneral->Height = panCommonKeys->Height;
    m_iKeyPanelHeights = panCommonKeys->Height;
    panCommonKeys->Align = alTop;
    scpKeys->VertScrollBar->Position = 0;
    scpKeys->Invalidate();
}
//---------------------------------------------------------------------------
// AddPlugin
/**
 * Converts a ZXPlugin object to a TPluginInfo
 * @param           Plugin the plugin to retrieve information from
 * @author          Tony Thompson
 * @date            Last Modified 22 September 2003
 */
//---------------------------------------------------------------------------
/*void __fastcall TfrmOptions::AddPlugin(ZXPlugin* Plugin)
{
    TPluginInfo PluginInfo;
    PluginInfo.Name             = Plugin->Description;
    PluginInfo.RegName          = Plugin->Filename;
    PluginInfo.Vendor           = Plugin->Vendor;
    PluginInfo.FileVersion      = Plugin->FileVersion;
    PluginInfo.PluginVersion    = Plugin->FileVersion;
    PluginInfo.LoadOrder        = Plugin->LoadOrder;
    PluginInfo.Priority         = Plugin->Flags & FLAG_PluginLoadPriorityMask;
    PluginInfo.IsUnloadable     = (FLAG_IsNotUnloadable != (Plugin->Flags & FLAG_IsNotUnloadable));
    PluginInfo.DoNotLoad        = Plugin->DoNotLoad;
    PluginInfo.DoNotShow        = FLAG_IsNotVisibleInOptionsPage == (Plugin->Flags & FLAG_IsNotVisibleInOptionsPage);
    AddPlugin(PluginInfo);
}*/
//---------------------------------------------------------------------------
// AddPlugin
/**
 * Adds a plugins information to the list of plugins
 * @param           pi the information about the plugin
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::AddPlugin(DWORD Handle, String sName, String sRegName, String sVendor, String sPluginVersion, String sFileVersion, bool bIsUnloadable, bool bDoNotLoad, bool bDoNotShow, DWORD dwPriority, int iLoadOrder, TImage* Icon)
{
    static int nextID = 0;
    TPluginInfo pi;
    pi.Handle           = Handle;
    pi.Name             = sName;
    pi.RegName          = sRegName;
    pi.Vendor           = sVendor;
    pi.PluginVersion    = sPluginVersion;
    pi.FileVersion      = sFileVersion;
    pi.IsUnloadable     = bIsUnloadable;
    pi.DoNotLoad        = bDoNotLoad;
    pi.DoNotShow        = bDoNotShow;
    pi.Priority         = dwPriority;
    pi.LoadOrder        = iLoadOrder;

    panOptionsPluginContainerBody->Top = 0;
    //pi.Panel = new TPanel(panOptionsPluginContainerBody);
    pi.Panel = new TPanel((void*)NULL);
    pi.Panel->Name = "PluginPanel" + IntToStr(nextID);
    panOptionsPluginContainerBody->InsertControl(pi.Panel);
    pi.Panel->Color = clWhite;
    pi.Panel->Align = alTop;
    pi.Panel->Width = panOptionsPluginContainer->Width;
    pi.Panel->Height = panOptionsPluginContainer->Height;
    pi.Panel->BevelOuter = bvNone;
    pi.Panel->ShowHint = true;
    pi.Panel->Hint = "Plugin Vendor: " + pi.Vendor + "\nPlugin Version: " + pi.PluginVersion + "\nPlugin File: " + pi.RegName + "\nFile Version: " + pi.FileVersion;
    pi.Panel->Left = 0;
    pi.Panel->Top = 0;
    pi.Panel->Visible = true;
    pi.Shape = new TShape(pi.Panel);
    pi.Shape->Name = "PluginShape" + IntToStr(nextID);
    pi.Shape->Parent = pi.Panel;
    pi.Shape->Align = alClient;
    pi.Shape->Shape = stRectangle;
    pi.Shape->Pen->Color = clWindowFrame;
    pi.Shape->Visible = true;
    pi.Shape->OnMouseDown = chkOptionsPluginNameMouseDown;
    pi.Shape->OnMouseMove = chkOptionsPluginNameMouseMove;
    pi.Shape->OnMouseUp   = chkOptionsPluginNameMouseUp;
    pi.Shape->Brush->Color = clWhite;

    //pi.Panel->Visible = !pi.DoNotShow;

    DWORD PriorityImageIndex = pi.Priority >> SHIFTS_PluginLoadPriority;

    pi.Image = new TImage(pi.Shape);
    pi.Image->Name = "PluginImage" + IntToStr(nextID);
    pi.Image->Width   = 12;
    pi.Image->Height  = 16;
    pi.Image->Visible = true;
    pi.Image->Left    = imgOptionsPluginsPriority->Left;
    pi.Image->Top     = imgOptionsPluginsPriority->Top;
    pi.Image->Parent  = pi.Panel;
    pi.Image->Hint    = Priorities[PriorityImageIndex];
    pi.Image->Transparent = true;

    imgPriorityIcons->GetBitmap(PriorityImageIndex, pi.Image->Picture->Bitmap);

    pi.CheckBox = new TCheckBox(pi.Panel);
    pi.CheckBox->Name = "PluginCheckBox" + IntToStr(nextID);
    pi.CheckBox->Left = 4;
    pi.CheckBox->Top  = 4;
    pi.CheckBox->Width = chkOptionsPluginName->Width;
    pi.CheckBox->Height = chkOptionsPluginName->Height;
    pi.CheckBox->Caption = "";
    pi.CheckBox->Checked = !pi.DoNotLoad;
    pi.CheckBox->Parent = pi.Panel;
    pi.CheckBox->Color = clWhite;
    pi.CheckBox->Visible = true;

    if (pi.IsUnloadable)
    {
        pi.CheckBox->OnClick = DonotLoadChanged;
    }
    else
    {
        pi.CheckBox->Enabled = false;
        pi.CheckBox->Checked = true;
        pi.CheckBox->Visible = false;
    }

    pi.Icon = new TImage(pi.Shape);
    pi.Icon->Name = "PluginIcon" + IntToStr(nextID);
    pi.Icon->Width   = 16;
    pi.Icon->Height  = 16;
    pi.Icon->Visible = true;
    pi.Icon->Left    = imgPluginIcon->Left;
    pi.Icon->Top     = imgPluginIcon->Top;
    pi.Icon->Parent  = pi.Panel;
    pi.Icon->Transparent = true;
    if (true == SAFE_PTR(Icon))
    {
        pi.Icon->Canvas->Draw(0,0, Icon->Picture->Bitmap);
    }
    else
    {
        pi.Icon->Canvas->Draw(0,0, imgDefaultIcon->Picture->Bitmap);
    }

    pi.Label = new TLabel(pi.Panel);
    pi.Label->Name = "PluginLabel" + IntToStr(nextID);
    pi.Label->Parent = pi.Panel;
    pi.Label->AutoSize = false;
    pi.Label->Left = lblOptionsPluginsName->Left;
    pi.Label->Top  = lblOptionsPluginsName->Top;
    pi.Label->Width = lblOptionsPluginsName->Width;
    pi.Label->Caption = pi.Name;
    pi.Label->Visible = true;
    pi.Label->Color = clWhite;
    pi.Label->Transparent = true;
    pi.Label->ShowHint = true;
    pi.Label->Hint = pi.Panel->Hint;
    pi.Label->OnMouseDown = chkOptionsPluginNameMouseDown;
    pi.Label->OnMouseMove = chkOptionsPluginNameMouseMove;
    pi.Label->OnMouseUp   = chkOptionsPluginNameMouseUp;
    ++nextID;

    m_BandManager->RegisterControl(pi.Panel, Name);
    m_Plugins.push_back(pi);
    panOptionsPluginContainerBody->Height = m_Plugins.size() * panOptionsPluginContainer->Height + 2;
    SortPlugins();

    TPanel* pKeysPanel = NULL;
    if (S_QUERY_YES == g_PluginManager.NotifyPlugin((TZX_HPLUGIN)Handle, TZX_QUERY_KEY_PANEL, (LPDATA)&pKeysPanel, 0, 0) && true == SAFE_PTR(pKeysPanel))
    {
        m_iKeyPanelHeights      += pKeysPanel->Height;
        panKeysGeneral->AutoSize = false;
        panKeysGeneral->Height   = m_iKeyPanelHeights;
        pKeysPanel->Parent       = panKeysGeneral;
        pKeysPanel->Top          = m_iKeyPanelHeights - 10;
        pKeysPanel->Align        = alTop;
        pKeysPanel->Visible      = true;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::RemovePlugin(DWORD Handle)
{
    bool bRemoved = false;
    for (unsigned int i = 0; i < m_Plugins.size() && false == bRemoved; i++)
    {
        if (m_Plugins[i].Handle == Handle)
        {
            // remove the control from the bandmanager
            m_BandManager->UnRegisterControl(m_Plugins[i].Panel);
            // remove the control form the form
            if (true == SAFE_PTR(m_Plugins[i].Panel))
            {
                m_Plugins[i].Panel->Parent->RemoveControl(m_Plugins[i].Panel);
                SAFE_DELETE(m_Plugins[i].Panel);
                m_Plugins.erase(m_Plugins.begin() + i);
                bRemoved = true;
            }
        }
    }
}
//---------------------------------------------------------------------------
// chkOptionsPluginNameMouseDown
/**
 * Mouse down event handler for the checkbox to load/unload a plugin
 * @param           Sender the vcl object that called the event
 * @param           Button the button pressed on the checkbox
 * @param           State the state of the shift keys
 * @param           X the x position of the cursor
 * @param           Y the y position of the cursor
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::chkOptionsPluginNameMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    if (Button == mbLeft)
    {
        m_BandPosition = FindPanel(Sender)->Top;
        m_BandManager->MouseDown(Sender, X, Y);
    }
}
//---------------------------------------------------------------------------
// chkOptionsPluginNameMouseMove
/**
 * Mouse move event handler for the checkbox
 * @param           Sender the vcl object that called the event
 * @param           Button the button pressed on the checkbox
 * @param           State the state of the shift keys
 * @param           X the x position of the cursor
 * @param           Y the y position of the cursor
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::chkOptionsPluginNameMouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
    if (Shift.Contains(ssLeft))
    {
        m_BandManager->MouseMove(Sender, X, Y);
    }
}
//---------------------------------------------------------------------------
// chkOptionsPluginNameMouseUp
/**
 * Mouse up event handler for the checkbox
 * @param           Sender the vcl object that called the event
 * @return          HRESULT S_OK successful, S_FALSE failed
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::chkOptionsPluginNameMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{
    if (Button == mbLeft)
    {
        m_bPluginsChanged = true;
        m_BandManager->MouseUp(Sender, X, Y);
        cmdApply->Enabled |= (m_BandPosition != FindPanel(Sender)->Top);
        // apply the plugin settings
        for (unsigned int i = 0; i < m_Plugins.size(); i++)
        {
            int Pos = m_Plugins[i].Panel->Top / panOptionsPluginContainer->Height;
            m_Plugins[i].LoadOrder = Pos;
        }
        SortPlugins();
    }
}
//---------------------------------------------------------------------------
// FindPanel
/**
 * Finds a panel based on the VCL sender informatin
 * @param           Sender the vcl object that called the event
 * @return          TPanel* the pointer to the panel
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
TPanel* __fastcall TfrmOptions::FindPanel(TObject *Sender)
{
    for (unsigned int i = 0; i < m_Plugins.size(); i++)
    {
        if (m_Plugins[i].Label == Sender || m_Plugins[i].Shape == Sender)
        {
            return m_Plugins[i].Panel;
        }
    }
    return NULL;
}
//---------------------------------------------------------------------------
// cmdApplyClick
/**
 * Applys the changes to the options dialog
 * @param           Sender the vcl object that called the event
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 * @date            Last Modified 10 March 2003 - Add splash screen registry settings
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::cmdApplyClick(TObject *Sender)
{
    // save the plugin load order
    for (unsigned int i = 0; i < m_Plugins.size(); i++)
    {
        regScorpio->Write("Plugins", m_Plugins[i].RegName, m_Plugins[i].LoadOrder);
        regScorpio->Write("Plugins", "DNL_" + m_Plugins[i].RegName, !m_Plugins[i].CheckBox->Checked);
    }
    // update the registry
    regScorpio->Write("ShowSplashScreen", chkShowSplashScreen->Checked);
    regScorpio->Write("ShowPluginIcons" , chkShowPluginIcons->Checked );
    regScorpio->Write("States", "UseLogFiles", chkLoggingProduceFiles->Checked);
    //regScorpio->Write("States", "DoNotShowProblems", !chkShowProblemDialog->Checked);
    regScorpio->Write("ProjectFolder", edtProjectFolder->Text);
    regScorpio->Write("States", "RemoveXmlWhitespace", chkRemoveWhitespaceFromXML->Checked);
    regScorpio->Write("Undo", "EnableUndo", chkUndoEnableUndo->Checked);
    regScorpio->Write("Undo", "EnabledRedo", chkUndoEnabledRedo->Checked);
    regScorpio->Write("Undo", "EnableMemoryLimit", chkUndoMemoryLimit->Checked);
    regScorpio->Write("Undo", "ClearAfterSave", chkUndoClear->Checked);
    regScorpio->Write("Undo", "MemoryLimit", (int)edtUndoMemory->Value);
    regScorpio->Write("Undo", "GroupByPlugin", radUndoGroupByPlugin->Checked);
    regScorpio->Write("Undo", "AutoSwitchToPlugin", radUndoAutoSwitchTo->Checked);
    regScorpio->Write("Undo", "EnableStackDialog", chkUndoEnableDialog->Checked);
    regScorpio->Write("Backup", "EnableBackup", chkBackupEnabled->Checked);
    regScorpio->Write("Backup", "EnableFolderLimit", chkLimitBackupUsage->Checked);
    regScorpio->Write("Backup", "FolderLimit", (int)edtBackupFolders->Value);
    regScorpio->Write("Backup", "BackOnSave", radBackupOnSave->Checked);
    // call PostNotifyEvent from frmShell to inform the plugins of a property change
    g_PluginManager.Notify(NULL, TZXN_OPTIONS_SAVE, NULL, 0L, 0L);
    m_bPluginChangesApplied = m_bPluginsChanged;
    cmdApply->Enabled = false;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::DonotLoadChanged(TObject *Sender)
{
    m_bPluginsChanged = true;
    chkOptionsPluginNameClick(Sender);
}
//---------------------------------------------------------------------------
// chkOptionsPluginNameClick
/**
 * Click event handler for the checkbox
 * @param           Sender the vcl object that called the event
 * @return          HRESULT S_OK successful, S_FALSE failed
 * @author          Tony Thompson
 * @date            Last Modified 29 November 2001
 */
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::chkOptionsPluginNameClick(TObject *Sender)
{
    cmdApply->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::SortPlugins(void)
{
    // sort the plugin order
    std::sort(m_Plugins.begin(), m_Plugins.end());
    // reorder the list to show the correct order
    for (unsigned int i = 0; i < m_Plugins.size(); i++)
    {
        m_Plugins[i].Panel->Top = i * panOptionsPluginContainer->Height;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::FindMachineSpecificFolders(void)
{
    // read the registry setting and set it to the appropreiate folder
    String sRegFolder;
    regScorpio->Read("Plugins", "MachineFolder", sRegFolder);
    panPluginsMachine->Caption = "  " + sRegFolder;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::cmbOptionsPluginMachineSpecificChange(TObject *Sender)
{
    cmdApply->Enabled = true;
}
//---------------------------------------------------------------------------
String __fastcall TfrmOptions::ReadMachineFolder(void)
{
    String sRegFolder;
    regScorpio->Read("Plugins", "MachineFolder", sRegFolder);
    return sRegFolder;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::WriteMachineFolder(const String& sMachineFolder)
{
    regScorpio->Write("Plugins", "MachineFolder", sMachineFolder);
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::cmdGeneralClick(TObject *Sender)
{
    TComponent* Button = dynamic_cast<TComponent*>(Sender);
    if (true == SAFE_PTR(Button))
    {
        pgcOptions->ActivePageIndex = Button->Tag;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::spdProjectFolderBrowseClick(TObject *Sender)
{
	dlgBrowse->DefaultFolder = edtProjectFolder->Text;
	if (dlgBrowse->Execute())
    {
        edtProjectFolder->Text = dlgBrowse->FileName;
        cmdApply->Enabled = true;
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::edtProjectFolder2Change(TObject *Sender)
{
    cmdApply->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::spdPluginsUpClick(TObject *Sender)
{
    panIconScroller->Top = std::min(0, panIconScroller->Top + 80);
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::spdPluginsDownClick(TObject *Sender)
{
    panIconScroller->Top = std::max(panButtonContainer->Height - panIconScroller->Height, panIconScroller->Top - 80);
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::chkUndoEnableUndoClick(TObject *Sender)
{
    cmdApply->Enabled = true;
    chkUndoMemoryLimit->Enabled = chkUndoEnableUndo->Checked;
	edtUndoMemory->Enabled = chkUndoEnableUndo->Checked;
	lblUndoMB->Enabled = chkUndoEnableUndo->Checked;
	chkUndoEnabledRedo->Enabled = chkUndoEnableUndo->Checked;
	chkUndoClear->Enabled = chkUndoEnableUndo->Checked;
    chkUndoEnableDialog->Enabled = chkUndoEnableUndo->Checked;
    radUndoAutoSwitchTo->Enabled = chkUndoEnableUndo->Checked;
    radUndoGroupByPlugin->Enabled = chkUndoEnableUndo->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta, TPoint &MousePos, bool &Handled)
{
    if (false == tmrScrollTimer->Enabled)
    {
        tmrScrollTimer->Enabled = true;

        if (WheelDelta > 0)
        {
            spdPluginsUpClick(NULL);
        }
        else if (WheelDelta < 0)
        {
            spdPluginsDownClick(NULL);
        }
    }
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::tmrScrollTimerTimer(TObject *Sender)
{
    tmrScrollTimer->Enabled = false;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::chkBackupEnabledClick(TObject *Sender)
{
    cmdApply->Enabled = true;
    chkLimitBackupUsage->Enabled = chkBackupEnabled->Checked;
    edtBackupFolders->Enabled = chkBackupEnabled->Checked;
    lblBackupFolders->Enabled = chkBackupEnabled->Checked;
    lblBackupWhen->Enabled = chkBackupEnabled->Checked;
    radBackupOnSave->Enabled = chkBackupEnabled->Checked;
    lblBackupOnSave->Enabled = chkBackupEnabled->Checked;
    radBackupOnClose->Enabled = chkBackupEnabled->Checked;
    lblBackupOnClose->Enabled = chkBackupEnabled->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TfrmOptions::lblAppDataFolderClick(TObject *Sender)
{
    String path = getenv("APPDATA");
    path += "\\TommyGun\\";
    ShellExecute(NULL, "open", path.c_str(), NULL, NULL, SW_SHOWDEFAULT);
}
//---------------------------------------------------------------------------


text:
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start

require "simplecov"
require "webmock/rspec"
require "vcr"

SimpleCov.minimum_coverage 100
SimpleCov.start "rails"

VCR.configure do |c|
  c.cassette_library_dir = "spec/vcr_cassettes"
  c.hook_into :webmock
  c.ignore_localhost = true

  # So code coverage reports can be submitted to codeclimate.com
  c.ignore_hosts "codeclimate.com"

  # To debug when a VCR goes wrong.
  # c.debug_logger = $stdout
end

RSpec.configure do |config|
  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  # Some tests use Timecop, just make sure that everything is as expected
  # after returning from it.
  config.before :each do
    Timecop.return

    # Clear the global config before each test.
    APP_CONFIG.clear
    # this value affects the application controller, we have to make sure
    # it has the default value we expect
    APP_CONFIG["check_ssl_usage"] = { "enabled" => true }

    # Expected to be always available.
    APP_CONFIG["machine_fqdn"] = { "value" => "portus.test.lan" }

    # This value is expected to be always available. The default value will be
    # set
    APP_CONFIG["registry"] = {
      "jwt_expiration_time" => { "value" => 5   },
      "catalog_page"        => { "value" => 100 }
    }

    APP_CONFIG["user_permission"] = {
      # This allows non-admins to change the visibility of their personal namespace
      "change_visibility" => { "enabled" => true },
      # This allows non-admins to modify namespaces
      "manage_namespace"  => { "enabled" => true },
      # This allows non-admins to create namespaces
      "create_namespace"  => { "enabled" => true },
      # This allows non-admins to modify teams
      "manage_team"       => { "enabled" => true },
      # This allows non-admins to create teams
      "create_team"       => { "enabled" => true }
    }

    Rails.cache.write("portus-checks", nil)
  end

  config.order = :random
end


text:
The google-cloud-error_reporting gem provides framework instrumentation features
to make it easy to report exceptions from your application.

## Quick Start

```ruby
require "google/cloud/error_reporting"

# Insert a Rack Middleware to report unhanded exceptions
use Google::Cloud::ErrorReporting::Middleware

# Or explicitly submit exceptions
begin
  fail "Boom!"
rescue => exception
  Google::Cloud::ErrorReporting.report exception
end
```

## Configuration
The default configuration enables Stackdriver instrumentation features to run
on Google Cloud Platform. You can easily configure the instrumentation library
if you want to run on a non Google Cloud environment or you want to customize
the default behavior.

See the
[Configuration Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/stackdriver/guides/instrumentation_configuration)
for full configuration parameters.

## Rack Middleware and Railtie
The google-cloud-error_reporting gem provides a Rack Middleware class that can
easily integrate with Rack based application frameworks, such as Rails and
Sinatra. When enabled, it automatically gathers application exceptions from
requests and submits the information to the Stackdriver Error Reporting service.
On top of that, the google-cloud-error_reporting also implements a Railtie
class that automatically enables the Rack Middleware in Rails applications when
used.

### Rails Integration

To use the Stackdriver Error Reporting Railtie for Ruby on Rails applications,
simply add this line to config/application.rb:

```ruby
require "google/cloud/error_reporting/rails"
```

Alternatively, check out the
[stackdriver](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/stackdriver)
gem, which enables this Railtie by default.

### Rack Integration

Other Rack-based framework can also directly leverage the Middleware directly:

```ruby
require "google/cloud/error_reporting"

use Google::Cloud::ErrorReporting::Middleware
```

## Report Captured Exceptions
Captured Ruby exceptions can be reported directly to Stackdriver Error Reporting
by using `Google::Cloud::ErrorReporting.report`:

```ruby
begin
  fail "Boom!"
rescue => exception
  Google::Cloud::ErrorReporting.report exception
end
```

The reported error event can also be customized:

```ruby
begin
  fail "Boom!"
rescue => exception
  Google::Cloud::ErrorReporting.report exception do |error_event|
    # Directly modify the Google::Cloud::ErrorReporting::ErrorEvent object before submission
    error_event.message     = "Custom error message"
    error_event.user        = "johndoh@example.com"
    error_event.http_status = 502
  end
end
```

See
[Google::Cloud::ErrorReporting::ErrorEvent](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-error_reporting/google/cloud/errorreporting/errorevent)
class for all options.


text:
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    sass: {
      dev: {
        options: {
          style: 'expanded',
          sourcemap: 'none'
        },
        files: {
          "app/assets/stylesheets/<%= pkg.name %>.css" : "app/assets/stylesheets/<%= pkg.name %>/init.scss"
        }
      }
    },
    cssmin: {
      options: {
        mergeIntoShorthands: false,
        roundingPrecision: -1
      },
      target: {
        files: {
          'app/assets/stylesheets/<%= pkg.name %>.min.css': ['app/assets/stylesheets/<%= pkg.name %>.css']
        }
      }
    },
    copy: {
      main: {
        files: [
          { expand: true, src: 'README.md', dest: 'docs/', filter: 'isFile' },
          { expand: true, flatten: true, src: 'app/assets/stylesheets/social_colors_rails.min.css', dest: 'docs/', filter: 'isFile' }
        ]
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-copy');

  // Default task(s).
  grunt.registerTask('default', ['sass', 'cssmin', 'copy']);

};


text:
<?php

namespace Magento\CatalogInventory\Model\Indexer\Stock;

use Magento\Catalog\Model\Category;
use Magento\Catalog\Model\Product;
use Magento\Framework\App\ResourceConnection;

/**
 * Abstract action reindex class
 *
 * @package Magento\CatalogInventory\Model\Indexer\Stock
 */
abstract class AbstractAction
{
    /**
     * Resource instance
     *
     * @var Resource
     */
    protected $_resource;

    /**
     * @var \Magento\CatalogInventory\Model\ResourceModel\Indexer\StockFactory
     */
    protected $_indexerFactory;

    /**
     * @var \Magento\Catalog\Model\Product\Type
     */
    protected $_catalogProductType;

    /**
     * @var \Magento\Framework\DB\Adapter\AdapterInterface
     */
    protected $_connection;

    /**
     * Stock Indexer models per product type
     * Sorted by priority
     *
     * @var array
     */
    protected $_indexers = [];

    /**
     * Flag that defines if need to use "_idx" index table suffix instead of "_tmp"
     *
     * @var bool
     */
    protected $_isNeedUseIdxTable = false;

    /**
     * @var \Magento\Framework\Indexer\CacheContext
     */
    private $cacheContext;

    /**
     * @var \Magento\Framework\Event\ManagerInterface
     */
    private $eventManager;

    /**
     * @param ResourceConnection $resource
     * @param \Magento\CatalogInventory\Model\ResourceModel\Indexer\StockFactory $indexerFactory
     * @param \Magento\Catalog\Model\Product\Type $catalogProductType
     * @param \Magento\Framework\Indexer\CacheContext $cacheContext
     * @param \Magento\Framework\Event\ManagerInterface $eventManager
     */
    public function __construct(
        ResourceConnection $resource,
        \Magento\CatalogInventory\Model\ResourceModel\Indexer\StockFactory $indexerFactory,
        \Magento\Catalog\Model\Product\Type $catalogProductType,
        \Magento\Framework\Indexer\CacheContext $cacheContext,
        \Magento\Framework\Event\ManagerInterface $eventManager
    ) {
        $this->_resource = $resource;
        $this->_indexerFactory = $indexerFactory;
        $this->_catalogProductType = $catalogProductType;
        $this->cacheContext = $cacheContext;
        $this->eventManager = $eventManager;
    }

    /**
     * Execute action for given ids
     *
     * @param array|int $ids
     *
     * @return void
     */
    abstract public function execute($ids);

    /**
     * Retrieve connection instance
     *
     * @return bool|\Magento\Framework\DB\Adapter\AdapterInterface
     */
    protected function _getConnection()
    {
        if (null === $this->_connection) {
            $this->_connection = $this->_resource->getConnection();
        }
        return $this->_connection;
    }

    /**
     * Retrieve Stock Indexer Models per Detail Type
     *
     * @return \Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\StockInterface[]
     */
    protected function _getTypeIndexers()
    {
        if (empty($this->_indexers)) {
            foreach ($this->_catalogProductType->getTypesByPriority() as $typeId => $typeInfo) {
                $indexerClassName = isset($typeInfo['stock_indexer']) ? $typeInfo['stock_indexer'] : '';

                $indexer = $this->_indexerFactory->create($indexerClassName)
                    ->setTypeId($typeId)
                    ->setIsComposite(!empty($typeInfo['composite']));

                $this->_indexers[$typeId] = $indexer;
            }
        }
        return $this->_indexers;
    }

    /**
     * Returns table name for given entity
     *
     * @param string $entityName
     * @return string
     */
    protected function _getTable($entityName)
    {
        return $this->_resource->getTableName($entityName);
    }

    /**
     * Retrieve product relations by children
     *
     * @param int|array $childIds
     * @return array
     */
    public function getRelationsByChild($childIds)
    {
        $connection = $this->_getConnection();
        $select = $connection->select()
            ->from($this->_getTable('catalog_product_relation'), 'parent_id')
            ->where('child_id IN(?)', $childIds);

        return $connection->fetchCol($select);
    }

    /**
     * Reindex all
     *
     * @return void
     */
    public function reindexAll()
    {
        $this->useIdxTable(true);
        $this->clearTemporaryIndexTable();

        foreach ($this->_getTypeIndexers() as $indexer) {
            $indexer->reindexAll();
        }

        $this->_syncData();
    }

    /**
     * Synchronize data between index storage and original storage
     *
     * @return $this
     */
    protected function _syncData()
    {
        $idxTableName = $this->_getIdxTable();
        $tableName = $this->_getTable('cataloginventory_stock_status');

        $this->_deleteOldRelations($tableName);

        $columns = array_keys($this->_connection->describeTable($idxTableName));
        $select = $this->_connection->select()->from($idxTableName, $columns);
        $query = $select->insertFromSelect($tableName, $columns);
        $this->_connection->query($query);
        return $this;
    }

    /**
     * Delete old relations
     *
     * @param string $tableName
     *
     * @return void
     */
    protected function _deleteOldRelations($tableName)
    {
        $select = $this->_connection->select()
            ->from(['s' => $tableName])
            ->joinLeft(
                ['w' => $this->_getTable('catalog_product_website')],
                's.product_id = w.product_id AND s.website_id = w.website_id',
                []
            )
            ->where('w.product_id IS NULL');

        $sql = $select->deleteFromSelect('s');
        $this->_connection->query($sql);
    }

    /**
     * Refresh entities index
     *
     * @param array $productIds
     * @return array Affected ids
     */
    protected function _reindexRows($productIds = [])
    {
        $connection = $this->_getConnection();
        if (!is_array($productIds)) {
            $productIds = [$productIds];
        }
        $parentIds = $this->getRelationsByChild($productIds);
        $processIds = $parentIds ? array_merge($parentIds, $productIds) : $productIds;

        // retrieve product types by processIds
        $select = $connection->select()
            ->from($this->_getTable('catalog_product_entity'), ['entity_id', 'type_id'])
            ->where('entity_id IN(?)', $processIds);
        $pairs = $connection->fetchPairs($select);

        $byType = [];
        foreach ($pairs as $productId => $typeId) {
            $byType[$typeId][$productId] = $productId;
        }

        $indexers = $this->_getTypeIndexers();
        foreach ($indexers as $indexer) {
            if (isset($byType[$indexer->getTypeId()])) {
                $indexer->reindexEntity($byType[$indexer->getTypeId()]);
            }
        }

        $this->cacheContext->registerEntities(Product::CACHE_TAG, $productIds);
        $this->eventManager->dispatch('clean_cache_by_tags', ['object' => $this->cacheContext]);

        return $this;
    }

    /**
     * Set or get what either "_idx" or "_tmp" suffixed temporary index table need to use
     *
     * @param bool|null $value
     * @return bool
     */
    public function useIdxTable($value = null)
    {
        if ($value !== null) {
            $this->_isNeedUseIdxTable = (bool)$value;
        }
        return $this->_isNeedUseIdxTable;
    }

    /**
     * Retrieve temporary index table name
     *
     * @return string
     */
    protected function _getIdxTable()
    {
        if ($this->useIdxTable()) {
            return $this->_getTable('cataloginventory_stock_status_idx');
        }
        return $this->_getTable('cataloginventory_stock_status_tmp');
    }

    /**
     * Clean up temporary index table
     *
     * @return void
     */
    public function clearTemporaryIndexTable()
    {
        $this->_getConnection()->delete($this->_getIdxTable());
    }
}


text:
package com.winterwell.utils.containers;

import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.winterwell.utils.StrUtils;
import com.winterwell.utils.Utils;

/**
 * A map backed by an array. Fast for small collections, lousy for big ones. Has
 * a convenient constructor. Another nice property is that insertion order is
 * preserved (like LinkedHashMap). I.e. keySet() values() and entrySet() all return objects in the
 * order they were added.
 *

 * ArrayMap provides iteration over keys which ALLOWS the map to be edited
 * during the iteration. ie. it saves you writing
 * for(X x : map.keySet().toArray(new X[0])) when editing a map.
 *

 * ArrayMap is NOT thread safe. Multi-threaded writes could lead to data
 * corruption (which will throw a ConcurrentModificationException).
 * If this happens, you best discard the map!
 * However it is safer than HashMap: doing a get in thread 1 + a put in thread 2 is fine.
 *
 * @author Daniel
 * @testedby ArrayMapTest
 * @testedby ArrayMapPerfTest
 * @param <K>
 * @param <V>
 */
public class ArrayMap<K, V> extends AbstractMap<K, V> implements
		Serializable, Iterable<K>, Cloneable {
	private static final long serialVersionUID = 1L;

	@Override
	protected ArrayMap<K, V> clone() throws CloneNotSupportedException {
		// NB: a more clone-based approach doesn't let us set final values
		ArrayMap clone = new ArrayMap();
		clone.putAll(this);
		return clone;
	}

	private final ArrayList<K> keys;
	private final ArrayList<V> values;

	/**
	 * Create a map optimised for small cases.
	 */
	public ArrayMap() {
		this(4);
	}

	/**
	 * Convenient access to the 1st key/value pair.
	 *
	 * @throws IndexOutOfBoundsException
	 *             if the map is empty
	 */
	public Pair2<K, V> first() {
		return new Pair2(keys.get(0), values.get(0));
	}

	/**
	 * Create a map with the given starting capacity.
	 */
	public ArrayMap(int initialSize) {
		keys = new ArrayList<K>(initialSize);
		values = new ArrayList<V>(initialSize);
	}

	/**
	 * Is there any call for this??
	 *
	 * @param pList
	 */
	public ArrayMap(List<Pair2<K, V>> pList) {
		keys = new ArrayList<K>(pList.size());
		values = new ArrayList<V>(pList.size());
		for (Pair2<K, V> kv : pList) {
			keys.add(kv.first);
			values.add(kv.second);
		}
	}

	/**
	 * Copy constructor
	 *
	 * @param copyMe Can be null (produces an empty map)
	 */
	public ArrayMap(Map<? extends K, ? extends V> copyMe) {
		this(copyMe==null? 4 : copyMe.size());
		if (copyMe==null) return;
		for (K k : copyMe.keySet()) {
			put(k, copyMe.get(k));
		}
	}

	/**
	 * Awesomely convenient constructor:
	 * new ArrayMap(key1, value1, key2, value2, ...)
	 *
	 * Warning: Does not check for duplicates!
	 * RM: I removed null filtering here because:
	 * (a) it doesn't match the put() behaviour
	 * (b) it was breaking SQLDB.bidKeys and budgetKeys and by extension bid retrieval and, eventually, VAST serving
	 *
	 * @param keyValuePairs
	 */
	public ArrayMap(Object... keyValuePairs) {
		int n = Math.max(keyValuePairs.length / 2, 1);
		keys = new ArrayList<K>(n);
		values = new ArrayList<V>(n);
		// wrong constructor?
		if (keyValuePairs.length == 1 && keyValuePairs[0] instanceof Map) {
			// should have been a call to the copy constructor! Handle it here anyway
			Map<K,V> copyMe = (Map) keyValuePairs[0];
			for (K k : copyMe.keySet()) {
				put(k, copyMe.get(k));
			}
			return;
		}
		assert keyValuePairs.length % 2 == 0;
		for (int i = 0; i < keyValuePairs.length; i += 2) {
			V v = (V) keyValuePairs[i + 1];
			K k = (K) keyValuePairs[i];
			assert k != null;
			keys.add(k);
			values.add(v);
		}
	}

	@Override
	public boolean containsKey(Object key) {
		return keys.contains(key);
	}

	@Override
	public boolean containsValue(Object value) {
		return values.contains(value);
	}

	@Override
	public Set<java.util.Map.Entry<K, V>> entrySet() {
		return new EntrySet();
	}

	/**
	 * key-value entry set.
	 * NB: we use a named class not an anonymous class for code stability
	 */
	private final class EntrySet extends AbstractSet<Entry<K, V>> {
		public EntrySet() {
		}

		@Override
		public Iterator<java.util.Map.Entry<K, V>> iterator() {
			return new Iterator<Entry<K, V>>() {
				MapEntry<K, V> entry = new MapEntry<K, V>(ArrayMap.this);
				int i = 0;

				@Override
				public boolean hasNext() {
					return i < keys.size();
				}

				@Override
				public java.util.Map.Entry<K, V> next() {
					entry.reset(keys.get(i), values.get(i));
					i++;
					return entry;
				}

				@Override
				public void remove() {
					keys.remove(i - 1);
					values.remove(i - 1);
					i--;
				}

			};
		}

		@Override
		public int size() {
			return keys.size();
		}
	};

	@Override
	public V get(Object key) {
		int i = keys.indexOf(key);
		if (i == -1)
			return null;
		return values.get(i);
	}

	public List<Pair2<K, V>> getPList() {
		List<Pair2<K, V>> pList = new ArrayList<Pair2<K, V>>(size());
		for (int i = 0, n = size(); i < n; i++) {
			pList.add(new Pair2<K, V>(keys.get(i), values.get(i)));
		}
		return pList;
	}

	/**
	 * Iterate over the map keys and ALLOW editing within the iteration. This is
	 * a convenience for copy-keys then return an iterator.
	 */
	@Override
	public Iterator<K> iterator() {
		// copy keys to allow editing
		return new ArrayList(keys).iterator();
	}

	/**
	 * The keys in this map. This is not modifiable!
	 */
	@Override
	public Set<K> keySet() {
		return Collections.unmodifiableSet(Containers.listAsSet(keys));
	}

	@Override
	public V put(K key, V value) {
		assert key != null : value;
		// should we quietly ignore null values? No, let's treat them like any other value
		mod++;
		char m = mod;
		int i = keys.indexOf(key);
		if (i != -1) {
			V old = values.set(i, value);
			// Warning: there's a race condition on the removal of an earlier
			// key/value pair
			if (mod != m) {
				// _some_ thread safety (the data-corruption damage has already
				// been done)
				throw new ConcurrentModificationException(StrUtils.ellipsize(
						key + "=" + value, 100));
			}
			return old;
		}
		keys.add(key);
		values.add(value);
		// Warning: there's a race condition on add or removal
		if (mod != m) {
			// _some_ thread safety (the data-corruption damage has already been
			// done)
			throw new ConcurrentModificationException(StrUtils.ellipsize(key
					+ "=" + value, 100));
		}
		return null;
	}

	/**
	 * Guard against threading issues
	 */
	private transient volatile char mod;

	@Override
	public V remove(Object key) {
		int i = keys.indexOf(key);
		if (i == -1)
			return null;
		mod++;
		char m = mod;
		keys.remove(i);
		V del = values.remove(i);
		// Warning: there's a race condition on the removal of an earlier
		// key/value pair
		if (mod != m) {
			// _some_ thread safety (the data-corruption damage has already been
			// done)
			throw new ConcurrentModificationException(StrUtils.ellipsize(
					String.valueOf(key), 100));
		}
		return del;
	}

	@Override
	public int size() {
		return keys.size();
	}

	/**
	 * The values in this map. This is not modifiable!
	 */
	@Override
	public List<V> values() {
		return Collections.unmodifiableList(values);
	}

	/**
	 * @param length
	 * @return ArrayMap or HashMap -- whichever is likely to be faster for the
	 *         given size.
	 * @see ArrayMapPerfTest
	 */
	public static Map useMe(int length) {
		return length < 5 ? new ArrayMap(length) : new HashMap(length);
	}

	/**
	 * @deprecated May be removed in future
	 *
	 * Re-sort by value. If you want to sort by key, just use TreeMap instead.
	 * @param comparator Can be null, in which case do a default-order value sort
	 */
	public void sort(final Comparator<V> comparator) {
		ArrayList<Pair2<V,K>> vk = new ArrayList();
		for(int i=0; i<keys.size(); i++) {
			vk.add(new Pair2<V,K>(values.get(i), keys.get(i)));
		}
		if (comparator==null) {
			Collections.sort(vk);
		} else {
			Collections.sort(vk, new StdComparator(comparator));
		}
		// copy back
		for(int i=0; i<keys.size(); i++) {
			keys.set(i, vk.get(i).second);
			values.set(i, vk.get(i).first);
		}
	}

}

final class StdComparator<V,K> implements Comparator<Pair2<V,K>> {
	private final Comparator<V> comparator;
	public StdComparator(Comparator<V> comparator) {
		this.comparator = comparator;
	}

	@Override
	public int compare(Pair2<V, K> o1, Pair2<V, K> o2) {
		int c = comparator.compare(o1.first, o2.first);
		if (c!=0) return c;
		return Utils.compare(o1.second, o2.second);
	}
}


text:
A project dedicated to the storage of information onto DNA.

This repository is dedicated to the creation of a new pieces of software regarding the encoding of binary information
to DNA.  The attatched file is the original project that I created.  It uses a simple algorithim to read pairs of
bits and then encodes them to DNA.  I warn you this is very basic.  If you have any questions please email
replicateproject@outlook.com.


text:
extern mod extra;

extern mod ssl = "github.com/sfackler/rust-openssl#openssl:0.0";
pub mod ring;


text:
define(function(require, exports, module) {
"use strict";

var Renderer = require("../virtual_renderer").VirtualRenderer;
var Editor = require("../editor").Editor;
var Range = require("../range").Range;
var event = require("../lib/event");
var lang = require("../lib/lang");
var dom = require("../lib/dom");

var $singleLineEditor = function(el) {
    var renderer = new Renderer(el);

    renderer.$maxLines = 4;

    var editor = new Editor(renderer);

    editor.setHighlightActiveLine(false);
    editor.setShowPrintMargin(false);
    editor.renderer.setShowGutter(false);
    editor.renderer.setHighlightGutterLine(false);

    editor.$mouseHandler.$focusWaitTimout = 0;
    editor.$highlightTagPending = true;

    return editor;
};

var AcePopup = function(parentNode) {
    var el = dom.createElement("div");
    var popup = new $singleLineEditor(el);

    if (parentNode)
        parentNode.appendChild(el);
    el.style.display = "none";
    popup.renderer.content.style.cursor = "default";
    popup.renderer.setStyle("ace_autocomplete");

    popup.setOption("displayIndentGuides", false);
    popup.setOption("dragDelay", 150);

    var noop = function(){};

    popup.focus = noop;
    popup.$isFocused = true;

    popup.renderer.$cursorLayer.restartTimer = noop;
    popup.renderer.$cursorLayer.element.style.opacity = 0;

    popup.renderer.$maxLines = 8;
    popup.renderer.$keepTextAreaAtCursor = false;

    popup.setHighlightActiveLine(false);
    // set default highlight color
    popup.session.highlight("");
    popup.session.$searchHighlight.clazz = "ace_highlight-marker";

    popup.on("mousedown", function(e) {
        var pos = e.getDocumentPosition();
        popup.selection.moveToPosition(pos);
        selectionMarker.start.row = selectionMarker.end.row = pos.row;
        e.stop();
    });

    var lastMouseEvent;
    var hoverMarker = new Range(-1,0,-1,Infinity);
    var selectionMarker = new Range(-1,0,-1,Infinity);
    selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
    popup.setSelectOnHover = function(val) {
        if (!val) {
            hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
        } else if (hoverMarker.id) {
            popup.session.removeMarker(hoverMarker.id);
            hoverMarker.id = null;
        }
    };
    popup.setSelectOnHover(false);
    popup.on("mousemove", function(e) {
        if (!lastMouseEvent) {
            lastMouseEvent = e;
            return;
        }
        if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
            return;
        }
        lastMouseEvent = e;
        lastMouseEvent.scrollTop = popup.renderer.scrollTop;
        var row = lastMouseEvent.getDocumentPosition().row;
        if (hoverMarker.start.row != row) {
            if (!hoverMarker.id)
                popup.setRow(row);
            setHoverMarker(row);
        }
    });
    popup.renderer.on("beforeRender", function() {
        if (lastMouseEvent && hoverMarker.start.row != -1) {
            lastMouseEvent.$pos = null;
            var row = lastMouseEvent.getDocumentPosition().row;
            if (!hoverMarker.id)
                popup.setRow(row);
            setHoverMarker(row, true);
        }
    });
    popup.renderer.on("afterRender", function() {
        var row = popup.getRow();
        var t = popup.renderer.$textLayer;
        var selected = t.element.childNodes[row - t.config.firstRow];
        if (selected == t.selectedNode)
            return;
        if (t.selectedNode)
            dom.removeCssClass(t.selectedNode, "ace_selected");
        t.selectedNode = selected;
        if (selected)
            dom.addCssClass(selected, "ace_selected");
    });
    var hideHoverMarker = function() { setHoverMarker(-1) };
    var setHoverMarker = function(row, suppressRedraw) {
        if (row !== hoverMarker.start.row) {
            hoverMarker.start.row = hoverMarker.end.row = row;
            if (!suppressRedraw)
                popup.session._emit("changeBackMarker");
            popup._emit("changeHoverMarker");
        }
    };
    popup.getHoveredRow = function() {
        return hoverMarker.start.row;
    };

    event.addListener(popup.container, "mouseout", hideHoverMarker);
    popup.on("hide", hideHoverMarker);
    popup.on("changeSelection", hideHoverMarker);

    popup.session.doc.getLength = function() {
        return popup.data.length;
    };
    popup.session.doc.getLine = function(i) {
        var data = popup.data[i];
        if (typeof data == "string")
            return data;
        return (data && data.value) || "";
    };

    var bgTokenizer = popup.session.bgTokenizer;
    bgTokenizer.$tokenizeRow = function(row) {
        var data = popup.data[row];
        var tokens = [];
        if (!data)
            return tokens;
        if (typeof data == "string")
            data = {value: data};
        if (!data.caption)
            data.caption = data.value || data.name;

        var last = -1;
        var flag, c;
        for (var i = 0; i < data.caption.length; i++) {
            c = data.caption[i];
            flag = data.matchMask & (1 << i) ? 1 : 0;
            if (last !== flag) {
                tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c});
                last = flag;
            } else {
                tokens[tokens.length - 1].value += c;
            }
        }

        if (data.meta) {
            var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth;
            var metaData = data.meta;
            if (metaData.length + data.caption.length > maxW - 2) {
                // trim meta to fit this popup and add ellipsis
                metaData = metaData.substr(0, maxW - data.caption.length - 3) + "\u2026"
            }
            tokens.push({type: "rightAlignedText", value: metaData});
        }
        return tokens;
    };
    bgTokenizer.$updateOnChange = noop;
    bgTokenizer.start = noop;

    popup.session.$computeWidth = function() {
        return this.screenWidth = 0;
    };

    popup.$blockScrolling = Infinity;

    // public
    popup.isOpen = false;
    popup.isTopdown = false;

    popup.data = [];
    popup.setData = function(list) {
        popup.data = list || [];
        popup.setValue(lang.stringRepeat("\n", list.length), -1);
        popup.setRow(0);
    };
    popup.getData = function(row) {
        return popup.data[row];
    };

    popup.getRow = function() {
        return selectionMarker.start.row;
    };
    popup.setRow = function(line) {
        line = Math.max(-1, Math.min(this.data.length, line));
        if (selectionMarker.start.row != line) {
            popup.selection.clearSelection();
            selectionMarker.start.row = selectionMarker.end.row = line || 0;
            popup.session._emit("changeBackMarker");
            popup.moveCursorTo(line || 0, 0);
            if (popup.isOpen)
                popup._signal("select");
        }
    };

    popup.on("changeSelection", function() {
        if (popup.isOpen)
            popup.setRow(popup.selection.lead.row);
        popup.renderer.scrollCursorIntoView();
    });

    popup.hide = function() {
        this.container.style.display = "none";
        this._signal("hide");
        popup.isOpen = false;
    };
    popup.show = function(pos, lineHeight, topdownOnly) {
        var el = this.container;
        var screenHeight = window.innerHeight;
        var screenWidth = window.innerWidth;
        var renderer = this.renderer;
        // var maxLines = Math.min(renderer.$maxLines, this.session.getLength());
        var maxH = renderer.$maxLines * lineHeight * 1.4;
        var top = pos.top + this.$borderSize;
        if (top + maxH > screenHeight - lineHeight && !topdownOnly) {
            el.style.top = "";
            el.style.bottom = screenHeight - top + "px";
            popup.isTopdown = false;
        } else {
            top += lineHeight;
            el.style.top = top + "px";
            el.style.bottom = "";
            popup.isTopdown = true;
        }

        el.style.display = "";
        this.renderer.$textLayer.checkForSizeChanges();

        var left = pos.left;
        if (left + el.offsetWidth > screenWidth)
            left = screenWidth - el.offsetWidth;

        el.style.left = left + "px";

        this._signal("show");
        lastMouseEvent = null;
        popup.isOpen = true;
    };

    popup.getTextLeftOffset = function() {
        return this.$borderSize + this.renderer.$padding + this.$imageSize;
    };

    popup.$imageSize = 0;
    popup.$borderSize = 1;

    return popup;
};

dom.importCssString("\
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\
    background-color: #CAD6FA;\
    z-index: 1;\
}\
.ace_editor.ace_autocomplete .ace_line-hover {\
    border: 1px solid #abbffe;\
    margin-top: -1px;\
    background: rgba(233,233,253,0.4);\
}\
.ace_editor.ace_autocomplete .ace_line-hover {\
    position: absolute;\
    z-index: 2;\
}\
.ace_editor.ace_autocomplete .ace_scroller {\
   background: none;\
   border: none;\
   box-shadow: none;\
}\
.ace_rightAlignedText {\
    color: gray;\
    display: inline-block;\
    position: absolute;\
    right: 4px;\
    text-align: right;\
    z-index: -1;\
}\
.ace_editor.ace_autocomplete .ace_completion-highlight{\
    color: #000;\
    text-shadow: 0 0 0.01em;\
}\
.ace_editor.ace_autocomplete {\
    width: 280px;\
    z-index: 200000;\
    background: #fbfbfb;\
    color: #444;\
    border: 1px lightgray solid;\
    position: fixed;\
    box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
    line-height: 1.4;\
}");

exports.AcePopup = AcePopup;

});


text:
namespace blink {

class RemoteFrame;

class RemoteFrameView : public Widget {
public:
    static PassRefPtr<RemoteFrameView> create(RemoteFrame*);

    virtual ~RemoteFrameView();

    virtual bool isRemoteFrameView() const OVERRIDE { return true; }

    RemoteFrame& frame() const { return *m_remoteFrame; }

    // Override to notify remote frame that its viewport size has changed.
    virtual void frameRectsChanged() OVERRIDE;

    virtual void invalidateRect(const IntRect&) OVERRIDE;

    virtual void setFrameRect(const IntRect&) OVERRIDE;

private:
    explicit RemoteFrameView(RemoteFrame*);

    RefPtr<RemoteFrame> m_remoteFrame;
};

DEFINE_TYPE_CASTS(RemoteFrameView, Widget, widget, widget->isRemoteFrameView(), widget.isRemoteFrameView());

} // namespace blink

#endif // RemoteFrameView_h


text:
if (typeof(PhoneNumber) === "undefined") {
    var PhoneNumber = require("../../lib/PhoneNumber.js");
}
if (typeof(ilib) === "undefined") {
    var ilib = require("../../lib/ilib.js");
}

module.exports.phonenum_JP = {
    setUp: function(callback) {
        ilib.clearCache();
        callback();
    },

    testParseJPFull: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("03-5841-2047", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "3",
            subscriberNumber: "58412047"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPLocalNumber: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("345-6789", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "3456789"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPFullLongAreaCode: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("0152-41-0670", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "152",
            subscriberNumber: "410670"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPIgnoreFormatting: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("(075) 1234-5678", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "75",
            subscriberNumber: "12345678"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPIgnoreCrap: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("$075@1234&5678-", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "75",
            subscriberNumber: "12345678"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPNoAreaCode: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("82345678", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "82345678"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPInvalidLocalNumber: function(test) {
        test.expect(2);
        // local number is too long
        var parsed = new PhoneNumber("23456788889123", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "23456788889123",
            invalid: true
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPServiceCode: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("0130-12345678", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            serviceCode: "130",
            subscriberNumber: "12345678"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    /*
    no vsc in Japan? I can't find example of vsc.
    testParseJPWithVSC: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("14102012345678", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            vsc: "141",
            trunkAccess: "0",
            areaCode: "20",
            subscriberNumber: "12345678"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    */

    testParseJPMobileNumber: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("070-53412345", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            mobilePrefix: "70",
            subscriberNumber: "53412345"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPPlusIDDToUS: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("+12028675309", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            iddPrefix: "+",
            countryCode: "1",
            areaCode: "202",
            subscriberNumber: "8675309"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPZerosIDDToUS: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("01012028675309", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            iddPrefix: "10",
            countryCode: "1",
            areaCode: "202",
            subscriberNumber: "8675309"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPLongAreaCodeNoTrunk: function(test) {
        test.expect(2);
        // this number uses an area code to start it, but without the trunk, we should
        // not recognize it as an area code
        var parsed = new PhoneNumber("13712345678", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "13712345678"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPEmergencyNumber: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("110", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            emergency: "110"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPEmergencyNumberPlus: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("171171", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            emergency: "171",
            subscriberNumber: "171"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPPartial1: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("0", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPPartial2: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("04", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "4"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial3: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("047", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "47"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial4: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("0475", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "475"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial5: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("04751", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
                trunkAccess: "0",
                areaCode: "475",
                subscriberNumber: "1"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial6: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("047512", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "475",
            subscriberNumber: "12"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial7: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("0475123", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "475",
            subscriberNumber: "123"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial8: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("04751234", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            trunkAccess: "0",
            areaCode: "475",
            subscriberNumber: "1234"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial9: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("047512345", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
                trunkAccess: "0",
                areaCode: "475",
                subscriberNumber: "12345"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },
    testParseJPPartial10: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("0475123456", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
                trunkAccess: "0",
                areaCode: "475",
                subscriberNumber: "123456"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPPartial11: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("04751234567", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
                trunkAccess: "0",
                areaCode: "475",
                subscriberNumber: "1234567"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPPartial12: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("047512345678", {locale: "ja-JP"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
                trunkAccess: "0",
                areaCode: "475",
                subscriberNumber: "12345678"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPWithUSMCC: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("6153222313", {locale: "ja-JP", mcc: "316"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            areaCode: "615",
            subscriberNumber: "3222313"
        }, {locale: "ja-US"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPWithFRMCC: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("6153222313", {locale: "ja-JP", mcc: "208"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "6153222313"
        }, {locale: "ja-FR"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPWithMXMCC: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("6153222313", {locale: "ja-JP", mcc: "334"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            areaCode: "615",
            subscriberNumber: "3222313"
        }, {locale: "ja-MX"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPWithDEMCC: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("6153222313", {locale: "ja-JP", mcc: "262"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "6153222313"
        }, {locale: "ja-DE"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPWithKRMCC: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("6153222313", {locale: "ja-JP", mcc: "450"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "6153222313",
            invalid: true
        }, {locale: "ja-KR"});

        test.ok(parsed.equals(expected));
        test.done();
    },

    testParseJPWithJPMCC: function(test) {
        test.expect(2);
        var parsed = new PhoneNumber("6153222313", {locale: "ja-JP", mcc: "440"});
        test.ok(typeof(parsed) !== "undefined");

        var expected = new PhoneNumber({
            subscriberNumber: "6153222313"
        }, {locale: "ja-JP"});

        test.ok(parsed.equals(expected));
        test.done();
    }
};


text:
<?php

/**
 * Sanitize hex colors
 */
function kirki_sanitize_hex( $color ) {
	// Remove any spaces and special characters before and after the string
	$color = trim( $color. ' \t\n\r\0\x0B' );

	// Remove any trailing '#' symbols from the color value
	$color = str_replace( '#', '', $color );

	// If there are more than 6 characters, only keep the first 6.
	if ( strlen( $color ) > 6 ) {

		$color = substr( $color, 0, 6 );

	}

	if ( strlen( $color ) == 6 ) {

		$hex = $color; // If string consists of 6 characters, then this is our color

	} else {

		// String is shorter than 6 characters.
		// We will have to do some calculations below to get the actual 6-digit hex value.

		// If the string is longer than 3 characters, only keep the first 3.
		if ( strlen( $color ) > 3 ) {
			$color = substr( $color, 0, 3 );
		}

		// If this is a 3-character string, format it to 6 characters.
		if ( strlen( $color ) == 3 ) {

			$red    = substr( $color, 0, 1 ) . substr( $color, 0, 1 );
			$green  = substr( $color, 1, 1 ) . substr( $color, 1, 1 );
			$blue   = substr( $color, 2, 1 ) . substr( $color, 2, 1 );

			$hex = $red . $green . $blue;

		}

		// If this is shorter than 3 characters, do some voodoo.
		if ( strlen( $color ) == 2 ) {

			$hex = $color . $color . $color;

		} else if ( strlen( $color ) == 1 ) {

			$hex = $color . $color . $color . $color . $color . $color;

		}

	}

	return '#' . $hex;
}

/*
 * Gets the rgb value of the $hex color.
 * Returns an array.
 */
function kirki_get_rgb( $hex, $implode = false ) {
	// Remove any trailing '#' symbols from the color value
	$hex = str_replace( '#', '', kirki_sanitize_hex( $hex ) );

	if ( strlen( $hex ) == 3 ) {
		// If the color is entered using a short, 3-character format,
		// then find the rgb values from them
		$red    = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
		$green  = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
		$blue   = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
	} else {
		// If the color is entered using a 6-character format,
		// then find the rgb values from them
		$red    = hexdec( substr( $hex, 0, 2 ) );
		$green  = hexdec( substr( $hex, 2, 2 ) );
		$blue   = hexdec( substr( $hex, 4, 2 ) );
	}

	// rgb is an array
	$rgb = array( $red, $green, $blue );
	if ( $implode ) {
		return implode( ',', $rgb );
	} else {
		return $rgb;
	}
}

/*
 * Gets the rgba value of a color.
 */
function kirki_get_rgba( $hex = '#fff', $opacity = 100 ) {
	$hex = kirki_sanitize_hex( $hex );
	// Make sure that opacity is properly formatted :
	// Set the opacity to 100 if a larger value has been entered by mistake.
	// If a negative value is used, then set to 0.
	// If an opacity value is entered in a decimal form (for example 0.25), then multiply by 100.
	if ( $opacity >= 100 ) {

		$opacity = 100;

	} elseif ( $opacity < 0 ) {

		$opacity = 0;

	} elseif ( $opacity < 1 && $opacity != 0 ) {

		$opacity = ( $opacity * 100 );

	} else {

		$opacity = $opacity;

	}

	// Divide the opacity by 100 to end-up with a CSS value for the opacity
	$opacity = ( $opacity / 100 );

	$color = 'rgba(' . kirki_get_rgb( $hex, true ) . ', ' . $opacity . ')';

	return $color;

}