text:
package com.AssassinAndroid.AsyncTasks;

import android.content.Context;
import android.location.Location;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import com.AssassinAndroid.Activities.TargetActivity;
import com.AssassinAndroid.Tools.Utilities;
import com.google.android.gms.maps.model.LatLng;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

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

/**
 * User: AnubhawArya
 * Date: 2/9/14
 * Time: 10:41 AM
 */
public class TargetLocationAsyncTask extends AsyncTask<String, Integer, JSONObject> {

    Context context;

    public TargetLocationAsyncTask(Context context) {
        this.context = context;
    }

    protected void onPreExecute() {
        if (!Utilities.isNetworkAvailable(context))
            cancel(true);
    }

    protected JSONObject doInBackground(String... params) {
        if (isCancelled())
            return null;
        List<NameValuePair> loginParams = new ArrayList<NameValuePair>();
        loginParams.add(new BasicNameValuePair("userid", Utilities.userId));
        try {
            return Utilities.getResponse(Utilities.API_URL + "location.php", loginParams);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    protected void onPostExecute(JSONObject o) {
        if (o == null) {
            Toast.makeText(context, "Problem logging in!", Toast.LENGTH_SHORT).show();
            return;
        }
        try {
            TargetActivity.mLatLng=new LatLng(o.getDouble("latitude"),o.getDouble("longitude"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        Log.d(Utilities.TAG, o.toString());
    }
}


text:
<?php
namespace App\Twig;

use App\Entity\Template;
use Doctrine\ORM\EntityManagerInterface;
use Twig\Error\LoaderError;
use Twig\Loader\LoaderInterface;
use Twig\Source;

class DatabaseLoader implements LoaderInterface
{
    protected $repo;

    /** @var bool */
    protected $enabled;

    public function __construct(bool $enabled, EntityManagerInterface $em)
    {
        $this->enabled = $enabled;
        if (!$enabled) {
            return;
        }

        $this->repo = $em->getRepository(Template::class);
    }

    public function getSourceContext($name)
    {
        if (false === $template = $this->getTemplate($name)) {
            throw new LoaderError(sprintf('Template "%s" does not exist.', $name));
        }

        return new Source($template->getSource(), $name);
    }

    public function exists($name)
    {
        return (bool)$this->getTemplate($name);
    }

    public function getCacheKey($name)
    {
        return $name;
    }

    public function isFresh($name, $time)
    {
        if (false === $template = $this->getTemplate($name)) {
            return false;
        }

        return $template->getLastUpdated()->getTimestamp() <= $time;
    }

    /**
     * @param $name
     * @return Template|null
     */
    protected function getTemplate($name)
    {
        if (!$this->enabled || substr($name, 0, 8) !== 'dynamic/') {
            return null;
        }

        $template = $this->repo->findOneBy(['filename' => str_replace('dynamic/', '', $name)]);

        // Return null if the template is blank in the database: this will cause it to fall back to the filesystem
        // loader.
        if ($template && $template->getSource() === '') {
            return null;
        }

        return $template;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Google\Cloud\Tests\Vision;

use Google\Cloud\Storage\StorageClient;
use Google\Cloud\Vision\Image;

/**
 * @group vision
 */
class ImageTest extends \PHPUnit_Framework_TestCase
{
    public function testWithBytes()
    {
        $bytes = file_get_contents(__DIR__ .'/../fixtures/vision/eiffel-tower.jpg');
        $image = new Image($bytes, ['landmarks']);

        $res = $image->requestObject();

        $this->assertEquals($res['image']['content'], base64_encode($bytes));
        $this->assertEquals($res['features'], [ ['type' => 'LANDMARK_DETECTION'] ]);
    }

    public function testWithStorage()
    {
        $storage = new StorageClient;
        $bucket = $storage->bucket('test-bucket');
        $object = $bucket->object('test-object.jpg');

        $gcsUri = 'gs://test-bucket/test-object.jpg';

        $image = new Image($object, [ 'landmarks' ]);
        $res = $image->requestObject();

        $this->assertEquals($res['image']['source']['gcsImageUri'], $gcsUri);
        $this->assertEquals($res['features'], [ ['type' => 'LANDMARK_DETECTION'] ]);
    }

    public function testWithResource()
    {
        $resource = fopen(__DIR__ .'/../fixtures/vision/eiffel-tower.jpg', 'r');
        $bytes = file_get_contents(__DIR__ .'/../fixtures/vision/eiffel-tower.jpg');

        $image = new Image($resource, ['landmarks']);
        $res = $image->requestObject();

        $this->assertEquals($res['image']['content'], base64_encode($bytes));
        $this->assertEquals($res['features'], [ ['type' => 'LANDMARK_DETECTION'] ]);
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testWithInvalidType()
    {
        new Image([], ['landmarks']);
    }

    public function testMaxResults()
    {
        $bytes = 'foo';
        $image = new Image($bytes, ['landmarks'], [
            'maxResults' => [
                'landmarks' => 100
            ]
        ]);

        $res = $image->requestObject();
        $this->assertEquals($res['features'][0]['maxResults'], 100);
    }

    public function testShortNamesMapping()
    {
        $names = [
            'faces'      => 'FACE_DETECTION',
            'landmarks'  => 'LANDMARK_DETECTION',
            'logos'      => 'LOGO_DETECTION',
            'labels'     => 'LABEL_DETECTION',
            'text'       => 'TEXT_DETECTION',
            'safeSearch' => 'SAFE_SEARCH_DETECTION',
            'imageProperties' => 'IMAGE_PROPERTIES'
        ];

        $bytes = 'foo';

        $image = new Image($bytes, array_keys($names));

        $res = $image->requestObject();

        $features = [];
        foreach ($res['features'] as $feature) {
            $features[] = $feature['type'];
        }

        $this->assertEquals(array_values($names), $features);
    }

    public function testBytesWithoutEncoding()
    {
        $bytes = 'foo';

        $image = new Image($bytes, ['landmarks']);

        $res = $image->requestObject(false);
        $this->assertEquals($res['image']['content'], $bytes);

        $encodedRes = $image->requestObject();
        $this->assertEquals($encodedRes['image']['content'], base64_encode($bytes));
    }
}


text:
package com.smartdevicelink.test.rpc.datatypes;

import com.smartdevicelink.proxy.rpc.PhoneCapability;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.TestValues;

import junit.framework.TestCase;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Iterator;

/**
 * This is a unit test class for the SmartDeviceLink library project class :
 * {@link com.smartdevicelink.proxy.rpc.PhoneCapability}
 */
public class PhoneCapabilityTests extends TestCase {

    private PhoneCapability msg;

    @Override
    public void setUp() {
        msg = new PhoneCapability();

        msg.setDialNumberEnabled(TestValues.GENERAL_BOOLEAN);
    }

    /**
     * Tests the expected values of the RPC message.
     */
    public void testRpcValues() {
        // Test Values
        boolean dialNumberEnabled = msg.getDialNumberEnabled();

        // Valid Tests
        assertEquals(TestValues.MATCH, TestValues.GENERAL_BOOLEAN, dialNumberEnabled);

        // Invalid/Null Tests
        PhoneCapability msg = new PhoneCapability();
        assertNotNull(TestValues.NOT_NULL, msg);

        assertNull(TestValues.NULL, msg.getDialNumberEnabled());
    }

    public void testJson() {
        JSONObject reference = new JSONObject();

        try {
            reference.put(PhoneCapability.KEY_DIALNUMBER_ENABLED, TestValues.GENERAL_BOOLEAN);

            JSONObject underTest = msg.serializeJSON();
            assertEquals(TestValues.MATCH, reference.length(), underTest.length());

            Iterator<?> iterator = reference.keys();
            while (iterator.hasNext()) {
                String key = (String) iterator.next();
                assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
            }
        } catch (JSONException e) {
            fail(TestValues.JSON_FAIL);
        }
    }
}


text:
#pragma once
#include <aws/securityhub/SecurityHub_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/securityhub/model/IntegrationType.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace SecurityHub
{
namespace Model
{

  /**
   *
Contains details about a product.

See Also:
   AWS
   * API Reference

   */
  class AWS_SECURITYHUB_API Product
  {
  public:
    Product();
    Product(Aws::Utils::Json::JsonView jsonValue);
    Product& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The ARN assigned to the product.

     */
    inline const Aws::String& GetProductArn() const{ return m_productArn; }

    /**
     *
The ARN assigned to the product.

     */
    inline bool ProductArnHasBeenSet() const { return m_productArnHasBeenSet; }

    /**
     *
The ARN assigned to the product.

     */
    inline void SetProductArn(const Aws::String& value) { m_productArnHasBeenSet = true; m_productArn = value; }

    /**
     *
The ARN assigned to the product.

     */
    inline void SetProductArn(Aws::String&& value) { m_productArnHasBeenSet = true; m_productArn = std::move(value); }

    /**
     *
The ARN assigned to the product.

     */
    inline void SetProductArn(const char* value) { m_productArnHasBeenSet = true; m_productArn.assign(value); }

    /**
     *
The ARN assigned to the product.

     */
    inline Product& WithProductArn(const Aws::String& value) { SetProductArn(value); return *this;}

    /**
     *
The ARN assigned to the product.

     */
    inline Product& WithProductArn(Aws::String&& value) { SetProductArn(std::move(value)); return *this;}

    /**
     *
The ARN assigned to the product.

     */
    inline Product& WithProductArn(const char* value) { SetProductArn(value); return *this;}

    /**
     *
The name of the product.

     */
    inline const Aws::String& GetProductName() const{ return m_productName; }

    /**
     *
The name of the product.

     */
    inline bool ProductNameHasBeenSet() const { return m_productNameHasBeenSet; }

    /**
     *
The name of the product.

     */
    inline void SetProductName(const Aws::String& value) { m_productNameHasBeenSet = true; m_productName = value; }

    /**
     *
The name of the product.

     */
    inline void SetProductName(Aws::String&& value) { m_productNameHasBeenSet = true; m_productName = std::move(value); }

    /**
     *
The name of the product.

     */
    inline void SetProductName(const char* value) { m_productNameHasBeenSet = true; m_productName.assign(value); }

    /**
     *
The name of the product.

     */
    inline Product& WithProductName(const Aws::String& value) { SetProductName(value); return *this;}

    /**
     *
The name of the product.

     */
    inline Product& WithProductName(Aws::String&& value) { SetProductName(std::move(value)); return *this;}

    /**
     *
The name of the product.

     */
    inline Product& WithProductName(const char* value) { SetProductName(value); return *this;}

    /**
     *
The name of the company that provides the product.

     */
    inline const Aws::String& GetCompanyName() const{ return m_companyName; }

    /**
     *
The name of the company that provides the product.

     */
    inline bool CompanyNameHasBeenSet() const { return m_companyNameHasBeenSet; }

    /**
     *
The name of the company that provides the product.

     */
    inline void SetCompanyName(const Aws::String& value) { m_companyNameHasBeenSet = true; m_companyName = value; }

    /**
     *
The name of the company that provides the product.

     */
    inline void SetCompanyName(Aws::String&& value) { m_companyNameHasBeenSet = true; m_companyName = std::move(value); }

    /**
     *
The name of the company that provides the product.

     */
    inline void SetCompanyName(const char* value) { m_companyNameHasBeenSet = true; m_companyName.assign(value); }

    /**
     *
The name of the company that provides the product.

     */
    inline Product& WithCompanyName(const Aws::String& value) { SetCompanyName(value); return *this;}

    /**
     *
The name of the company that provides the product.

     */
    inline Product& WithCompanyName(Aws::String&& value) { SetCompanyName(std::move(value)); return *this;}

    /**
     *
The name of the company that provides the product.

     */
    inline Product& WithCompanyName(const char* value) { SetCompanyName(value); return *this;}

    /**
     *
A description of the product.

     */
    inline const Aws::String& GetDescription() const{ return m_description; }

    /**
     *
A description of the product.

     */
    inline bool DescriptionHasBeenSet() const { return m_descriptionHasBeenSet; }

    /**
     *
A description of the product.

     */
    inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; }

    /**
     *
A description of the product.

     */
    inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); }

    /**
     *
A description of the product.

     */
    inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); }

    /**
     *
A description of the product.

     */
    inline Product& WithDescription(const Aws::String& value) { SetDescription(value); return *this;}

    /**
     *
A description of the product.

     */
    inline Product& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;}

    /**
     *
A description of the product.

     */
    inline Product& WithDescription(const char* value) { SetDescription(value); return *this;}

    /**
     *
The categories assigned to the product.

     */
    inline const Aws::Vector<Aws::String>& GetCategories() const{ return m_categories; }

    /**
     *
The categories assigned to the product.

     */
    inline bool CategoriesHasBeenSet() const { return m_categoriesHasBeenSet; }

    /**
     *
The categories assigned to the product.

     */
    inline void SetCategories(const Aws::Vector<Aws::String>& value) { m_categoriesHasBeenSet = true; m_categories = value; }

    /**
     *
The categories assigned to the product.

     */
    inline void SetCategories(Aws::Vector<Aws::String>&& value) { m_categoriesHasBeenSet = true; m_categories = std::move(value); }

    /**
     *
The categories assigned to the product.

     */
    inline Product& WithCategories(const Aws::Vector<Aws::String>& value) { SetCategories(value); return *this;}

    /**
     *
The categories assigned to the product.

     */
    inline Product& WithCategories(Aws::Vector<Aws::String>&& value) { SetCategories(std::move(value)); return *this;}

    /**
     *
The categories assigned to the product.

     */
    inline Product& AddCategories(const Aws::String& value) { m_categoriesHasBeenSet = true; m_categories.push_back(value); return *this; }

    /**
     *
The categories assigned to the product.

     */
    inline Product& AddCategories(Aws::String&& value) { m_categoriesHasBeenSet = true; m_categories.push_back(std::move(value)); return *this; }

    /**
     *
The categories assigned to the product.

     */
    inline Product& AddCategories(const char* value) { m_categoriesHasBeenSet = true; m_categories.push_back(value); return *this; }

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline const Aws::Vector<IntegrationType>& GetIntegrationTypes() const{ return m_integrationTypes; }

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline bool IntegrationTypesHasBeenSet() const { return m_integrationTypesHasBeenSet; }

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline void SetIntegrationTypes(const Aws::Vector<IntegrationType>& value) { m_integrationTypesHasBeenSet = true; m_integrationTypes = value; }

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline void SetIntegrationTypes(Aws::Vector<IntegrationType>&& value) { m_integrationTypesHasBeenSet = true; m_integrationTypes = std::move(value); }

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline Product& WithIntegrationTypes(const Aws::Vector<IntegrationType>& value) { SetIntegrationTypes(value); return *this;}

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline Product& WithIntegrationTypes(Aws::Vector<IntegrationType>&& value) { SetIntegrationTypes(std::move(value)); return *this;}

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline Product& AddIntegrationTypes(const IntegrationType& value) { m_integrationTypesHasBeenSet = true; m_integrationTypes.push_back(value); return *this; }

    /**
     *
The types of integration that the product supports. Available values are the
     * following.

 SEND_FINDINGS_TO_SECURITY_HUB -
     * Indicates that the integration sends findings to Security Hub.

     *
 RECEIVE_FINDINGS_FROM_SECURITY_HUB - Indicates that the
     * integration receives findings from Security Hub.

     */
    inline Product& AddIntegrationTypes(IntegrationType&& value) { m_integrationTypesHasBeenSet = true; m_integrationTypes.push_back(std::move(value)); return *this; }

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline const Aws::String& GetMarketplaceUrl() const{ return m_marketplaceUrl; }

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline bool MarketplaceUrlHasBeenSet() const { return m_marketplaceUrlHasBeenSet; }

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline void SetMarketplaceUrl(const Aws::String& value) { m_marketplaceUrlHasBeenSet = true; m_marketplaceUrl = value; }

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline void SetMarketplaceUrl(Aws::String&& value) { m_marketplaceUrlHasBeenSet = true; m_marketplaceUrl = std::move(value); }

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline void SetMarketplaceUrl(const char* value) { m_marketplaceUrlHasBeenSet = true; m_marketplaceUrl.assign(value); }

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline Product& WithMarketplaceUrl(const Aws::String& value) { SetMarketplaceUrl(value); return *this;}

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline Product& WithMarketplaceUrl(Aws::String&& value) { SetMarketplaceUrl(std::move(value)); return *this;}

    /**
     *
The URL for the page that contains more information about the product.

     */
    inline Product& WithMarketplaceUrl(const char* value) { SetMarketplaceUrl(value); return *this;}

    /**
     *
The URL used to activate the product.

     */
    inline const Aws::String& GetActivationUrl() const{ return m_activationUrl; }

    /**
     *
The URL used to activate the product.

     */
    inline bool ActivationUrlHasBeenSet() const { return m_activationUrlHasBeenSet; }

    /**
     *
The URL used to activate the product.

     */
    inline void SetActivationUrl(const Aws::String& value) { m_activationUrlHasBeenSet = true; m_activationUrl = value; }

    /**
     *
The URL used to activate the product.

     */
    inline void SetActivationUrl(Aws::String&& value) { m_activationUrlHasBeenSet = true; m_activationUrl = std::move(value); }

    /**
     *
The URL used to activate the product.

     */
    inline void SetActivationUrl(const char* value) { m_activationUrlHasBeenSet = true; m_activationUrl.assign(value); }

    /**
     *
The URL used to activate the product.

     */
    inline Product& WithActivationUrl(const Aws::String& value) { SetActivationUrl(value); return *this;}

    /**
     *
The URL used to activate the product.

     */
    inline Product& WithActivationUrl(Aws::String&& value) { SetActivationUrl(std::move(value)); return *this;}

    /**
     *
The URL used to activate the product.

     */
    inline Product& WithActivationUrl(const char* value) { SetActivationUrl(value); return *this;}

    /**
     *
The resource policy associated with the product.

     */
    inline const Aws::String& GetProductSubscriptionResourcePolicy() const{ return m_productSubscriptionResourcePolicy; }

    /**
     *
The resource policy associated with the product.

     */
    inline bool ProductSubscriptionResourcePolicyHasBeenSet() const { return m_productSubscriptionResourcePolicyHasBeenSet; }

    /**
     *
The resource policy associated with the product.

     */
    inline void SetProductSubscriptionResourcePolicy(const Aws::String& value) { m_productSubscriptionResourcePolicyHasBeenSet = true; m_productSubscriptionResourcePolicy = value; }

    /**
     *
The resource policy associated with the product.

     */
    inline void SetProductSubscriptionResourcePolicy(Aws::String&& value) { m_productSubscriptionResourcePolicyHasBeenSet = true; m_productSubscriptionResourcePolicy = std::move(value); }

    /**
     *
The resource policy associated with the product.

     */
    inline void SetProductSubscriptionResourcePolicy(const char* value) { m_productSubscriptionResourcePolicyHasBeenSet = true; m_productSubscriptionResourcePolicy.assign(value); }

    /**
     *
The resource policy associated with the product.

     */
    inline Product& WithProductSubscriptionResourcePolicy(const Aws::String& value) { SetProductSubscriptionResourcePolicy(value); return *this;}

    /**
     *
The resource policy associated with the product.

     */
    inline Product& WithProductSubscriptionResourcePolicy(Aws::String&& value) { SetProductSubscriptionResourcePolicy(std::move(value)); return *this;}

    /**
     *
The resource policy associated with the product.

     */
    inline Product& WithProductSubscriptionResourcePolicy(const char* value) { SetProductSubscriptionResourcePolicy(value); return *this;}

  private:

    Aws::String m_productArn;
    bool m_productArnHasBeenSet;

    Aws::String m_productName;
    bool m_productNameHasBeenSet;

    Aws::String m_companyName;
    bool m_companyNameHasBeenSet;

    Aws::String m_description;
    bool m_descriptionHasBeenSet;

    Aws::Vector<Aws::String> m_categories;
    bool m_categoriesHasBeenSet;

    Aws::Vector<IntegrationType> m_integrationTypes;
    bool m_integrationTypesHasBeenSet;

    Aws::String m_marketplaceUrl;
    bool m_marketplaceUrlHasBeenSet;

    Aws::String m_activationUrl;
    bool m_activationUrlHasBeenSet;

    Aws::String m_productSubscriptionResourcePolicy;
    bool m_productSubscriptionResourcePolicyHasBeenSet;
  };

} // namespace Model
} // namespace SecurityHub
} // namespace Aws


text:
.heading-font {
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
  font-weight: 200;
  letter-spacing: 1px;
}
.body-font {
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
}
.alt-font {
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
  text-transform: uppercase;
  letter-spacing: 2px;
}

.dropdown-menu {
  min-width: 100%;
  overflow: scroll;
}

.thumbnail {
  padding:0;
}

.fill {
  min-height: 100%;
  height: 100%;
}

.example-html img {
  max-width: 100%;
}

.example-html h1 {
  font-size: 36px;
}

.example-html h2 {
  font-size: 28px;
}

.example-html h3 {
  font-size: 22px;
}

.example-html p {
  font-size: 16px;
}

.example-html ul li {
  font-size: 16px;
}

.packageList p {
  font-size: 16px;
}

@media (min-width: 768px) {
  .packageList .thumbnail {
    min-height: 250px;
  }
}

.packageList img {
  margin-top: 10px;
  margin-bottom: 10px;
  max-width: 96px;
  max-height: 96px;
  min-width: 96px;
  height: 100%;
}

.row .spacer {
  margin-bottom: 7px;
}

.package-property {
  text-align: left;
}

@media (min-width: 768px) {
  .package-property {
    text-align: right;
  }
}

/* Set search input style */
input.transparent-input {
  background-color: rgba(0,0,0,0) !important;
  border-width: 1px !important;
  border-color: #ffffff;
  border-style: solid;
  border-radius: 20px;
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
  color: #ffffff;
  outline: transparent;
}

/* Overwrite search focus border color*/
input.transparent-input:focus {
  border-color: #ffffff;
}

/* Overwrite search placeholder color*/
.form-control::-webkit-input-placeholder { color: white; }
.form-control:-moz-placeholder { color: white; }
.form-control::-moz-placeholder { color: white; }
.form-control:-ms-input-placeholder { color: white; }

.scroll-debug {
  position: fixed;
  bottom: 10px;
  right: 10px;
}

html,
body {
  height: 100%;
  width: 100%;
}
body {
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
}
a {
  -webkit-transition: all 0.35s;
  -moz-transition: all 0.35s;
  transition: all 0.35s;
  color: rgba(33,44,55,0.8);
}
a:hover,
a:focus {
  color: rgba(33,44,55,0.8);
}
hr {
  max-width: 100px;
  margin: 25px auto 0;
  border-width: 1px;
  border-color: rgba(34, 34, 34, 0.1);
}
hr.light {
  border-color: white;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
  font-weight: 200;
  letter-spacing: 1px;
}
p {
  font-size: 18px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.navbar-default {
  background-color: white;
  border-color: rgba(34, 34, 34, 0.05);
  -webkit-transition: all 0.35s;
  -moz-transition: all 0.35s;
  transition: all 0.35s;
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
  font-weight: 200;
  letter-spacing: 1px;
}

.navbar-default .navbar-header .navbar-brand {
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
  font-weight: 400;
  font-size: 28px;
  letter-spacing: 1px;
  color: #222222;
}

@media (min-width: 768px) {
  .navbar-default .navbar-header .navbar-brand {
    font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
    font-weight: 400;
    font-size: 28px;
    letter-spacing: 1px;
    color: #ffffff;
  }
}
.navbar-default .navbar-header .navbar-brand:hover,
.navbar-default .navbar-header .navbar-brand:focus {
  color: rgba(33,44,55,1);
}
.navbar-default .navbar-header .navbar-toggle {
  font-size: 12px;
  color: #222222;
  padding: 8px 10px;
}
.navbar-default .nav > li > a {
  font-family: 'Lato', 'Helvetica', 'Arial', 'sans-serif';
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
}
.navbar-default .nav > li > a,
.navbar-default .nav > li > a:focus {
  color: #222222;
}
.navbar-default .nav > li > a:hover,
.navbar-default .nav > li > a:focus:hover {
  color: #7b4397;
}
.navbar-default .nav > li.active > a,
.navbar-default .nav > li.active > a:focus {
  color: #fdcc52 !important;
  background-color: transparent;
}
.navbar-default .nav > li.active > a:hover,
.navbar-default .nav > li.active > a:focus:hover {
  background-color: transparent;
}
@media (min-width: 768px) {
  .navbar-default {
    background-color: transparent;
    border-color: transparent;
  }
  .navbar-default .navbar-header .navbar-brand {
    color: rgba(255, 255, 255, 0.9);
  }
  .transparentnavigation {
    background-color: rgba(0,0,0,0);
  }

  .purplenavigation {
    background-color: rgba(33,44,55,0.8);
  }
  .navbar-default .navbar-header .navbar-brand:hover,
  .navbar-default .navbar-header .navbar-brand:focus {
    color: white;
  }
  .navbar-default .nav > li > a,
  .navbar-default .nav > li > a:focus {
    color: rgba(255, 255, 255, 0.9);
  }
  .navbar-default .nav > li > a:hover,
  .navbar-default .nav > li > a:focus:hover {
    color: white;
  }
  .navbar-default.affix {
    background-color: white;
    border-color: rgba(34, 34, 34, 0.1);
  }
  .navbar-default.affix .navbar-header .navbar-brand {
    color: #222222;
  }
  .navbar-default.affix .navbar-header .navbar-brand:hover,
  .navbar-default.affix .navbar-header .navbar-brand:focus {
    color: #fdcc52;
  }
  .navbar-default.affix .nav > li > a,
  .navbar-default.affix .nav > li > a:focus {
    color: #222222;
  }
  .navbar-default.affix .nav > li > a:hover,
  .navbar-default.affix .nav > li > a:focus:hover {
    color: #fdcc52;
  }
}

header {
  position: relative;
  width: 100%;
  min-height: auto;
  background-repeat: repeat-y;
  background: url("../images/bg-pattern.png"), #7b4397;
  /* fallback for old browsers */
  background: url("../images/bg-pattern.png"), -webkit-linear-gradient(to left, #7b4397, #000000);
  /* Chrome 10-25, Safari 5.1-6 */
  background: url("../images/bg-pattern.png"), linear-gradient(to left, #7b4397, #000000);
  /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
  color: white;
}

header .header-content {
  text-align: center;
  padding: 150px 0 50px;
  position: relative;
}
header .header-content .header-content-inner {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}
header .header-content .header-content-inner h1 {
  margin-top: 0;
  margin-bottom: 30px;
  font-size: 30px;
}
header .header-content .header-content-inner .list-badges {
  margin-bottom: 25px;
}
header .header-content .header-content-inner .list-badges img {
  height: 50px;
  margin-bottom: 25px;
}
@media (min-width: 768px) {
  header {
    min-height: 100%;
  }
  header .header-content {
    text-align: center;
    padding: 0;
    height: 100vh;
  }
  header .header-content .header-content-inner {
    max-width: none;
    margin: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
  header .header-content .header-content-inner h1 {
    font-size: 35px;
  }
  header .device-container {
    max-width: none;
    max-height: calc(0vh);
    margin: 100px auto 0;
  }
}
@media (min-width: 992px) {
  header .header-content .header-content-inner h1 {
    font-size: 50px;
  }
}
section {
  padding: 100px 0;
}
section h2 {
  font-size: 50px;
}

footer {
  background-color: rgba(33,44,55,0.8);
  padding: 25px 0;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
}
footer p {
  font-size: 16px;
  margin: 0;
}

.no-gutter > [class*='col-'] {
  padding-right: 0;
  padding-left: 0;
}
.btn-outline {
  color: white;
  border-color: white;
  border: 1px solid;
}
::-moz-selection {
  color: white;
  text-shadow: none;
  background: #222222;
}
::selection {
  color: white;
  text-shadow: none;
  background: #222222;
}
img::selection {
  color: white;
  background: transparent;
}
img::-moz-selection {
  color: white;
  background: transparent;
}
body {
  webkit-tap-highlight-color: #222222;
}

.list-middle {
  margin-top: 0px;
  text-align: center;
  vertical-align: top;
}

.list-header {
  font-size: 20px;
  margin-top: 0px;
  text-align: center;
  height: 65px;
  vertical-align: top;
}

.caption a {
  text-decoration: none;
}


text:
<?php

namespace Magento\Sales\Block\Adminhtml\Order\View;

/**
 * Order history block
 *
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class History extends \Magento\Backend\Block\Template
{
    /**
     * Core registry
     *
     * @var \Magento\Framework\Registry
     */
    protected $_coreRegistry = null;

    /**
     * Sales data
     *
     * @var \Magento\Sales\Helper\Data
     */
    protected $_salesData = null;

    /**
     * @var \Magento\Sales\Helper\Admin
     */
    private $adminHelper;

    /**
     * @param \Magento\Backend\Block\Template\Context $context
     * @param \Magento\Sales\Helper\Data $salesData
     * @param \Magento\Framework\Registry $registry
     * @param \Magento\Sales\Helper\Admin $adminHelper
     * @param array $data
     */
    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Sales\Helper\Data $salesData,
        \Magento\Framework\Registry $registry,
        \Magento\Sales\Helper\Admin $adminHelper,
        array $data = []
    ) {
        $this->_coreRegistry = $registry;
        $this->_salesData = $salesData;
        parent::__construct($context, $data);
        $this->adminHelper = $adminHelper;
    }

    /**
     * Preparing global layout
     *
     * @return $this
     */
    protected function _prepareLayout()
    {
        $onclick = "submitAndReloadArea($('order_history_block').parentNode, '" . $this->getSubmitUrl() . "')";
        $button = $this->getLayout()->createBlock(
            'Magento\Backend\Block\Widget\Button'
        )->setData(
            ['label' => __('Submit Comment'), 'class' => 'action-save action-secondary', 'onclick' => $onclick]
        );
        $this->setChild('submit_button', $button);
        return parent::_prepareLayout();
    }

    /**
     * Get stat uses
     *
     * @return array
     */
    public function getStatuses()
    {
        $state = $this->getOrder()->getState();
        $statuses = $this->getOrder()->getConfig()->getStateStatuses($state);
        return $statuses;
    }

    /**
     * Check allow to send order comment email
     *
     * @return bool
     */
    public function canSendCommentEmail()
    {
        return $this->_salesData->canSendOrderCommentEmail($this->getOrder()->getStore()->getId());
    }

    /**
     * Retrieve order model
     *
     * @return \Magento\Sales\Model\Order
     */
    public function getOrder()
    {
        return $this->_coreRegistry->registry('sales_order');
    }

    /**
     * Check allow to add comment
     *
     * @return bool
     */
    public function canAddComment()
    {
        return $this->_authorization->isAllowed('Magento_Sales::comment') && $this->getOrder()->canComment();
    }

    /**
     * Submit URL getter
     *
     * @return string
     */
    public function getSubmitUrl()
    {
        return $this->getUrl('sales/*/addComment', ['order_id' => $this->getOrder()->getId()]);
    }

    /**
     * Customer Notification Applicable check method
     *
     * @param  \Magento\Sales\Model\Order\Status\History $history
     * @return bool
     */
    public function isCustomerNotificationNotApplicable(\Magento\Sales\Model\Order\Status\History $history)
    {
        return $history->isCustomerNotificationNotApplicable();
    }

    /**
     * Replace links in string
     *
     * @param array|string $data
     * @param null|array $allowedTags
     * @return string
     */
    public function escapeHtml($data, $allowedTags = null)
    {
        return $this->adminHelper->escapeHtmlWithLinks($data, $allowedTags);
    }
}


text:
name: Command Line Interface
route: /cli
---

# RJS Command Line Interface

ReworkJS comes bundled with a command line interface which handles tasks such as
launching, building or testing your app.

It only comes installed locally by default. But you can install [@reworkjs/cli](https://github.com/reworkjs/cli)
to gain access to it from anywhere.

## List of available commands

General options:
- `--env <NODE_ENV>`: Sets the NODE_ENV environment variable for the lifetime of the process.
- `--verbose <verbosity>`: Sets the verbosity of the output. Defaults to `info`.

### `rjs init`

Installs and initializes the reworkjs framework.
You can launch it again as many times as you wish to configure new elements that might have
been added after your initial installation.

### `rjs start`

Builds and launches the application.

The compiler will launch in watch mode if the `NODE_ENV` variable is set to `development`

Options:
- `--port`: The port on which the static and pre-rendering server will respond to HTTP requests.
- `--ssr`: By default, `rjs start` will launch without Server-Side Rendering to reduce compilation time. Use `--ssr` to enable Server Side Rendering.
- `--no-split`: By default, starting the app with pre-rendering will create a split view in the terminal with the output of
  the pre-rendering server builder, the client bundle builder, and the pre-rendering server itself. You can revert back
  to a regular CLI display using this option.

### `rjs build`

Builds the application.

Usage: `rjs build <...parts> [options]`

Options:
- `parts`: Which parts of the application to build. Either "server" for the pre-rendering server, "client" for the browser bundle, or both separated by a space.

### `rjs print-config`

Dumps the computed framework configuration. For debug purposes.


text:
from oslo_config import cfg
from oslo_db import options

from glance.common import exception
import glance.db.sqlalchemy.api
from glance.db.sqlalchemy import models as db_models
from glance.db.sqlalchemy import models_glare as artifact_models
from glance.db.sqlalchemy import models_metadef as metadef_models
import glance.tests.functional.db as db_tests
from glance.tests.functional.db import base
from glance.tests.functional.db import base_glare
from glance.tests.functional.db import base_metadef

CONF = cfg.CONF

def get_db(config):
    options.set_defaults(CONF, connection='sqlite://')
    config(debug=False)
    db_api = glance.db.sqlalchemy.api
    return db_api

def reset_db(db_api):
    db_models.unregister_models(db_api.get_engine())
    db_models.register_models(db_api.get_engine())

def reset_db_metadef(db_api):
    metadef_models.unregister_models(db_api.get_engine())
    metadef_models.register_models(db_api.get_engine())

def reset_db_artifacts(db_api):
    artifact_models.unregister_models(db_api.get_engine())
    artifact_models.register_models(db_api.get_engine())

class TestSqlAlchemyDriver(base.TestDriver,
                           base.DriverTests,
                           base.FunctionalInitWrapper):

    def setUp(self):
        db_tests.load(get_db, reset_db)
        super(TestSqlAlchemyDriver, self).setUp()
        self.addCleanup(db_tests.reset)

    def test_get_image_with_invalid_long_image_id(self):
        image_id = '343f9ba5-0197-41be-9543-16bbb32e12aa-xxxxxx'
        self.assertRaises(exception.NotFound, self.db_api._image_get,
                          self.context, image_id)

    def test_image_tag_delete_with_invalid_long_image_id(self):
        image_id = '343f9ba5-0197-41be-9543-16bbb32e12aa-xxxxxx'
        self.assertRaises(exception.NotFound, self.db_api.image_tag_delete,
                          self.context, image_id, 'fake')

    def test_image_tag_get_all_with_invalid_long_image_id(self):
        image_id = '343f9ba5-0197-41be-9543-16bbb32e12aa-xxxxxx'
        self.assertRaises(exception.NotFound, self.db_api.image_tag_get_all,
                          self.context, image_id)

    def test_user_get_storage_usage_with_invalid_long_image_id(self):
        image_id = '343f9ba5-0197-41be-9543-16bbb32e12aa-xxxxxx'
        self.assertRaises(exception.NotFound,
                          self.db_api.user_get_storage_usage,
                          self.context, 'fake_owner_id', image_id)

class TestSqlAlchemyVisibility(base.TestVisibility,
                               base.VisibilityTests,
                               base.FunctionalInitWrapper):

    def setUp(self):
        db_tests.load(get_db, reset_db)
        super(TestSqlAlchemyVisibility, self).setUp()
        self.addCleanup(db_tests.reset)

class TestSqlAlchemyMembershipVisibility(base.TestMembershipVisibility,
                                         base.MembershipVisibilityTests,
                                         base.FunctionalInitWrapper):

    def setUp(self):
        db_tests.load(get_db, reset_db)
        super(TestSqlAlchemyMembershipVisibility, self).setUp()
        self.addCleanup(db_tests.reset)

class TestSqlAlchemyDBDataIntegrity(base.TestDriver,
                                    base.FunctionalInitWrapper):
    """Test class for checking the data integrity in the database.

    Helpful in testing scenarios specific to the sqlalchemy api.
    """

    def setUp(self):
        db_tests.load(get_db, reset_db)
        super(TestSqlAlchemyDBDataIntegrity, self).setUp()
        self.addCleanup(db_tests.reset)

    def test_paginate_redundant_sort_keys(self):
        original_method = self.db_api._paginate_query

        def fake_paginate_query(query, model, limit,
                                sort_keys, marker, sort_dir, sort_dirs):
            self.assertEqual(['created_at', 'id'], sort_keys)
            return original_method(query, model, limit,
                                   sort_keys, marker, sort_dir, sort_dirs)

        self.stubs.Set(self.db_api, '_paginate_query',
                       fake_paginate_query)
        self.db_api.image_get_all(self.context, sort_key=['created_at'])

    def test_paginate_non_redundant_sort_keys(self):
        original_method = self.db_api._paginate_query

        def fake_paginate_query(query, model, limit,
                                sort_keys, marker, sort_dir, sort_dirs):
            self.assertEqual(['name', 'created_at', 'id'], sort_keys)
            return original_method(query, model, limit,
                                   sort_keys, marker, sort_dir, sort_dirs)

        self.stubs.Set(self.db_api, '_paginate_query',
                       fake_paginate_query)
        self.db_api.image_get_all(self.context, sort_key=['name'])

class TestSqlAlchemyTask(base.TaskTests,
                         base.FunctionalInitWrapper):

    def setUp(self):
        db_tests.load(get_db, reset_db)
        super(TestSqlAlchemyTask, self).setUp()
        self.addCleanup(db_tests.reset)

class TestSqlAlchemyQuota(base.DriverQuotaTests,
                          base.FunctionalInitWrapper):

    def setUp(self):
        db_tests.load(get_db, reset_db)
        super(TestSqlAlchemyQuota, self).setUp()
        self.addCleanup(db_tests.reset)

class TestDBPurge(base.DBPurgeTests,
                  base.FunctionalInitWrapper):

    def setUp(self):
        db_tests.load(get_db, reset_db)
        super(TestDBPurge, self).setUp()
        self.addCleanup(db_tests.reset)

class TestArtifacts(base_glare.ArtifactsTestDriver,
                    base_glare.ArtifactTests):
    def setUp(self):
        db_tests.load(get_db, reset_db_artifacts)
        super(TestArtifacts, self).setUp()
        self.addCleanup(db_tests.reset)

class TestMetadefSqlAlchemyDriver(base_metadef.TestMetadefDriver,
                                  base_metadef.MetadefDriverTests,
                                  base.FunctionalInitWrapper):

    def setUp(self):
        db_tests.load(get_db, reset_db_metadef)
        super(TestMetadefSqlAlchemyDriver, self).setUp()
        self.addCleanup(db_tests.reset)


text:
/*
 * $Id: WindowsMutexMgr.cpp 471747 2006-11-06 14:31:56Z amassari $
 */

#include <windows.h>

#include <xercesc/util/MutexManagers/WindowsMutexMgr.hpp>
#include <xercesc/framework/MemoryManager.hpp>

XERCES_CPP_NAMESPACE_BEGIN

WindowsMutexMgr::WindowsMutexMgr()
{
}

WindowsMutexMgr::~WindowsMutexMgr()
{
}

XMLMutexHandle
WindowsMutexMgr::create(MemoryManager* const manager)
{
    CRITICAL_SECTION* newCS=(CRITICAL_SECTION*)manager->allocate(sizeof(CRITICAL_SECTION));
    InitializeCriticalSection(newCS);
    return newCS;
}

void
WindowsMutexMgr::destroy(XMLMutexHandle mtx, MemoryManager* const manager)
{
    ::DeleteCriticalSection((LPCRITICAL_SECTION)mtx);
    manager->deallocate(mtx);
}

void
WindowsMutexMgr::lock(XMLMutexHandle mtx)
{
    ::EnterCriticalSection((LPCRITICAL_SECTION)mtx);
}

void
WindowsMutexMgr::unlock(XMLMutexHandle mtx)
{
    ::LeaveCriticalSection((LPCRITICAL_SECTION)mtx);
}

XERCES_CPP_NAMESPACE_END


text:
<title>Dynamically registering methods - Using the GNU Compiler Collection (GCC)</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Messaging-with-the-GNU-Objective_002dC-runtime.html#Messaging-with-the-GNU-Objective_002dC-runtime" title="Messaging with the GNU Objective-C runtime">
<link rel="next" href="Forwarding-hook.html#Forwarding-hook" title="Forwarding hook">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Forwarding hook,
Up: Messaging with the GNU Objective-C runtime

8.10.1 Dynamically registering methods

If objc_msg_lookup() does not find a suitable method
implementation, because the receiver does not implement the required
method, it tries to see if the class can dynamically register the
method.

To do so, the runtime checks if the class of the receiver implements
the method

     + (BOOL) resolveInstanceMethod: (SEL)selector;

in the case of an instance method, or

     + (BOOL) resolveClassMethod: (SEL)selector;

in the case of a class method.  If the class implements it, the
runtime invokes it, passing as argument the selector of the original
method, and if it returns YES, the runtime tries the lookup
again, which could now succeed if a matching method was added
dynamically by +resolveInstanceMethod: or
+resolveClassMethod:.

This allows classes to dynamically register methods (by adding them to
the class using class_addMethod) when they are first called.
To do so, a class should implement +resolveInstanceMethod: (or,
depending on the case, +resolveClassMethod:) and have it
recognize the selectors of methods that can be registered dynamically
at runtime, register them, and return YES.  It should return
NO for methods that it does not dynamically registered at
runtime.

If +resolveInstanceMethod: (or +resolveClassMethod:) is
not implemented or returns NO, the runtime then tries the
forwarding hook.

Support for +resolveInstanceMethod: and
resolveClassMethod: was added to the GNU Objective-C runtime in
GCC version 4.6.


text:
<!DOCTYPE html>

      <meta charset="UTF-8">
      <meta name="description" content="owl carousel gallery">
      <meta name="keywords" content="owl carousel, JQuery, html theme">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="author" content="Mansur Iscel">
      <title>
         Portable Owl Carousel Image Gallery
      </title>

      <link rel="stylesheet" href="./public/owl-carousel/assets/css/docs.theme.min.css">
      <link rel="stylesheet" href="./public/css/style.css">

      <link rel="stylesheet" href="./public/owl-carousel/assets/owlcarousel/assets/owl.carousel.min.css">
      <link rel="stylesheet" href="./public/owl-carousel/assets/owlcarousel/assets/owl.theme.default.min.css">

1

2

3

4

5

6

7

8

9

10

11

12


text:
package com.migibert.kheo.exception.mapping;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import com.migibert.kheo.exception.ServerNotFoundException;

@Provider
public class ServerNotFoundExceptionMapper implements ExceptionMapper<ServerNotFoundException> {

    @Override
    public Response toResponse(ServerNotFoundException arg0) {
        return Response.status(Status.NOT_FOUND).build();
    }

}


text:
import { Component, OnInit, OnDestroy } from '@angular/core';

@Component({
  selector: 'homepage-header',
  templateUrl: './header.html',
  styleUrls: [ './header.scss' ]
})

export class HomepageHeader implements OnInit, OnDestroy {
  isCollapsed = true;

  constructor() {}

  ngOnInit() {

  }

  ngOnDestroy() {

  }

  runCollapsed(_$event) {
    this.isCollapsed = !this.isCollapsed
  }
}


text:
<?php

/**
 * Google Font Loading
 *
 * Returns an array of saved Google Fonts.
 * Updates Google Font database in interval given
 *
 *	@param  	string 	$key 		Google Font API key
 *	@param  	int		$key 		Google Font cache refresh interval in ms
 *
 * @return	array
 *
 */

if( !function_exists( 'ot_get_google_font' ) ) :

	function ot_get_google_font($key = false, $interval = 604800 ){

		// get the themes name
		$_theme = wp_get_theme();
		$_theme_name = strtolower(str_replace(' ', '_', $_theme->name));

		// get cached fields
		$db_cache_field               = 'googlefont-cache-'.$_theme_name;
		$db_cache_field_last_updated  = 'googlefont-cache-last-'.$_theme_name;
		$db_cache_field_themename     = 'googlefont-'.$_theme_name;

		$current_fonts = get_option( $db_cache_field ); // get current fonts
		$last 			   = get_option( $db_cache_field_last_updated ); // get the date for last update
		$theme 			   = get_option ( $db_cache_field_themename ); // get the theme name
		$now 			     = time(); // get current timestamp
		$api_key		   = $key ? $key : false;

		if( ! empty($api_key) ){ // check if the api key is set

			if ( !$last || ( ($now - $last ) > $interval ) || !$theme || $current_fonts == "" || !$current_fonts ) {

				$fontsSeraliazed = 'https://www.googleapis.com/webfonts/v1/webfonts?key='.$api_key;

				// get the Google Fonts from remote URL
				$google_response = wp_remote_get ( $fontsSeraliazed, array ( 'sslverify' => false ) );

				// we have no errors, proceed
				if ( 200 == wp_remote_retrieve_response_code( $google_response ) ) {

					// parse the result from Google Font API
					$fontArray = json_decode($google_response['body'], true);

					$googleFontArray = array();

					// generate the array to store the fonts
					foreach($fontArray['items'] as $index => $value){
						$_family                               = strtolower( str_replace(' ','_',$value['family']) );
						$googleFontArray[$_family]['family']   = $value['family'];
						$googleFontArray[$_family]['variants'] = $value['variants'];
						$googleFontArray[$_family]['subsets']  = $value['subsets'];
					}

					if ( is_array($googleFontArray) ) {

						// we got good results, so update the existing fields
						update_option( $db_cache_field, $googleFontArray );
						update_option( $db_cache_field_last_updated, time() );
						update_option( $db_cache_field_themename, $_theme_name );

					} else {

						// there are no fields, so add them to the database
						add_option( $db_cache_field, $googleFontArray,'', 'no' );
						add_option( $db_cache_field_last_updated, time(),'', 'no' );
						add_option( $db_cache_field_themename, $_theme_name,'', 'no' );

					}

					// get the google font array from options DB
					$db_font_array = get_option( $db_cache_field );

					function notice_new_fonts_added() {

						// Display message
						$html =  '

';
						$html .= "Connection to Google Font API successfull. You can now use the fonts within the theme options panel.";
						$html .= '

';

						echo $html;

					}

					add_action( 'admin_notices', 'notice_new_fonts_added', 99);

				} else if (403 == wp_remote_retrieve_response_code( $google_response )) {

					function notice_api_limit_exceeded() {

						// Display message
						$html =  '

';
						$html .= "Daily limit for unauthenticated use of Google Fonts API exceeded. Please try it again later.";
						$html .= '

';

						echo $html;

					}

					add_action( 'admin_notices', 'notice_api_limit_exceeded', 99);

					// we are using the already stored fonts
					if( is_array($current_fonts) && count($current_fonts) ) {
						$db_font_array = $current_fonts;
					}

				} else {

					function notice_no_connection_possible() {

						// Display message
						$html =  '

';
						$html .= "Connection to Google Fonts API failed. Please try it again later.";
						$html .= '

';

						echo $html;

					}

					add_action( 'admin_notices', 'msg_no_connection_possible', 99);

					// we are using the already stored fonts
					if( is_array($current_fonts) && count($current_fonts) ) {
						$db_font_array = $current_fonts;
					}

				}

			} else {

				// get the google font array from options DB
				if( is_array($current_fonts) && count($current_fonts) ) {
					$db_font_array = $current_fonts;
				}

			}

			return $db_font_array;

		} else {

			if ( ! function_exists('notice_no_api_key') ) {
				function notice_no_api_key() {
					// Display message
					$html =  '

';
					$html .= "You need to set the Google Fonts API Key in order to use the Custom fonts features.";
					$html .= '

';

					echo $html;
				}
			}

			add_action( 'admin_notices', 'notice_no_api_key', 99);
		}

		// no api key -> return false
		return false;

	}

	add_action( 'wp_enqueue_scripts', 'ot_get_google_font', 999 );

endif;

/**
 * Google Fonts Ajax Callback
 *
 * Returns a json string with all Google Fonts from DB
 *
 * @return string
 *
 */
function ot_ajax_get_google_font(){

		// get the current themes name
		$_theme = wp_get_theme();
		$_theme_name = strtolower(str_replace(' ', '_', $_theme->name));

		$fonts = get_option('googlefont-cache-'.$_theme_name);

		die(json_encode($fonts));

}
// creating Ajax call for WordPress
add_action( 'wp_ajax_nopriv_ot_ajax_get_google_font', 'ot_ajax_get_google_font' );
add_action( 'wp_ajax_ot_ajax_get_google_font', 'ot_ajax_get_google_font' );

/**
 * Enqueue Styles and Scripts
 *
 * Enqueues scripts for the Google Font preview box.
 *
 * @param	string	$hook of the current themes page
 *
 * @uses		wp_enqueue_style(), wp_enqueue_script()
 *
 */
function ot_action_enqueue_scripts($hook){

	if (!defined('__DIR__')) {
		define('__DIR__', dirname(__FILE__));
	}

	if($hook == 'appearance_page_ot-theme-options'):

		// get plugin folder
		$path = '/'.basename( __DIR__);

		// enqueue the css file
		wp_enqueue_style( 'ot-google-font-css', get_template_directory_uri().$path.'/css/style.css', array(), '', 'all');

		// enqueue the js file
		wp_enqueue_script( 'ot-google-font-js', get_template_directory_uri().$path.'/js/scripts.js', array(), '', 'all');

	endif;

}

/* add scripts for metaboxes to post-new.php & post.php */
if(is_admin()){
		add_action( 'admin_enqueue_scripts', 'ot_action_enqueue_scripts', 11 );
}

/**
 * Get Google Font stylesheets
 *
 * Includes the Google Font stylesheets into the head section of the current page
 *
 * @param	array		$default_theme_fonts the default theme fonts set before
 *
 * @uses		wp_enqueue_style(), wp_enqueue_script()
 *
 */
function ot_action_get_google_font_link(){

	if (!is_admin()) {

		// get the themes name
		$_theme = wp_get_theme();
		$_theme_name = strtolower(str_replace(' ', '_', $_theme->name));

		$_def_fonts = unserialize(OT_FONT_DEFAULTS);

		// lets get all the font options from the option tree settings
		$ot_settings_id = ot_settings_id();
		$_ot_options = get_option( $ot_settings_id );

		$_font_array = array();
		foreach($_ot_options['settings'] as $index => $_setting){
			if($_setting['type'] == 'typography'){
				$_font_array[] = ot_get_option($_setting['id']);
			}
		}

		// array to store already used font-families and not load them double
		$_font_array_backup = array();

		// loop through fonts
		foreach( $_font_array as $index => $font ){

			$_output = "";

			if( !empty($font) && is_array($font) ) :

				// get the google font array from db cache
				$_db_font_cache = get_option( 'googlefont-cache-'.$_theme_name );

				if($_def_fonts):

					if( isset($_db_font_cache[$font['font-family']]['family']) ) {

						if( !array_key_exists($font['font-family'], $_def_fonts) ) {
							$_output = $_db_font_cache[$font['font-family']]['family'];
						}

					}

				endif;

				// check if the font family allready exists
				if (isset($_db_font_cache) && is_array($_db_font_cache)) {
					if ( array_key_exists($font['font-family'], $_db_font_cache) ) {
						$_font_array_backup[$font['font-family']] = $_db_font_cache[$font['font-family']];
					}
				}

			endif;
		}

		// loop through the font array and enqueue the google font stylesheet if needed
		if( is_array($_font_array_backup) && !empty($_font_array_backup) ){

			foreach($_font_array_backup as $index => $_g_font_family){

				if (!empty($_g_font_family)) {

					// build the font weight string
					$_font_weight_array = array();
					foreach($_font_array as $font => $value) {

						// check if font-weight exists for this font-family
						if(!empty($value['font-weight']) && $value['font-family'] == $index ) :

							// check if font-weight already exists, if not, add it to the array
							if(!in_array($value['font-weight'], $_font_weight_array)):

								// replace font-weight keywords
								if($value['font-weight'] == 'normal') $value['font-weight'] = 400;
								if($value['font-weight'] == 'bold') $value['font-weight'] = 500;

								$_font_weight_array[] = $value['font-weight'];

							endif;

						endif;

					}

					$_font_add_string = "";
					if (count($_g_font_family['variants'])) $_font_add_string .= ":". implode(',', $_g_font_family['variants']);

					// build the font style string
					$_font_style_array = array();
					foreach ($_font_array as $font => $value) {

						// check if font-style exists for this font-family
						if (!empty($value['font-style']) && $value['font-family'] == $index ) :

							// check if font-style already exists, if not, add it to the array
							if (!in_array($value['font-style'], $_font_style_array)) :
								$_font_style_array[] = $value['font-style'];
							endif;

						endif;

					}

					// check, if we already have some font-weights
					if (count($_font_style_array)) {
						if (empty($_font_add_string)) {
							$_font_add_string .= ":". implode(',', $_font_style_array);
						} else {
							$_font_add_string .= ",". implode(',', $_font_style_array);
						}
					}

					wp_register_style( 'ot-google-font-' . $index, 'http://fonts.googleapis.com/css?family=' . $_g_font_family['family'] . $_font_add_string, array(), '', 'all');
					wp_enqueue_style( 'ot-google-font-' . $index );

				}
			}
		}
	}
}

// Action to call the google font include on frontpage
add_action('wp_enqueue_scripts', 'ot_action_get_google_font_link', 15);

?>


text:
class ContentElementTemplate < Template
  validates_presence_of :content_element_type

  named_scope :grid_data, :select => 'id,title,code,content_element_type'
  named_scope :of_type, lambda { |*args| { :conditions => ["content_element_type = ?", (args.first)] } }

end


text:
/**
 * Сдвиг секции влево.
 *
 * @author dew1983@mail.ru <Suvorov Andrey M.>
 */

Ext.define(
	'FBEditor.view.panel.treenavigation.body.contextmenu.section.left.Left',
	{
		extend: 'FBEditor.view.panel.treenavigation.body.contextmenu.section.Item',
		requires: [
			'FBEditor.view.panel.treenavigation.body.contextmenu.section.left.LeftController',
			'FBEditor.editor.command.section.LeftCommand'
		],

		xtype: 'contextmenu-treenavigation-body-section-left',
		controller: 'contextmenu.treenavigation.body.section.left',

		text: 'Сдвинуть влево (убрать вложенность)',

		isActive: function ()
		{
			var me = this,
				parent,
				el,
				active;

			active = me.callParent(arguments);

			if (active)
			{
				el = me.getElement();

				// родительская секция
				parent = el.getParent();

				active = parent && parent.isSection;
			}

			return active;
		}
	}
);


text:
import angular from 'angular';
import Navbar from './navbar/navbar';
import Footerbar from './footerbar/footerbar';
import User from './user/user';

let commonModule = angular.module('app.common', [
  Navbar,
  Footerbar,
  User
])

.name;

export default commonModule;


text:
package org.talend.dataprep.api;

import java.util.concurrent.TimeUnit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Profile;
import org.talend.dataprep.configuration.DataPrepComponentScanConfiguration;

import com.netflix.hystrix.Hystrix;

@SpringBootApplication
@Configuration("org.talend.dataprep.api.Application")
@Profile("standalone")
@Import(DataPrepComponentScanConfiguration.class)
public class Application implements DisposableBean {

    private static final Logger LOG = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void destroy() throws Exception {
        LOG.info("Shutting down Hystrix...");
        // shutdown all thread pools; waiting a little time for shutdown
        Hystrix.reset(1, TimeUnit.SECONDS);
        LOG.info("Shut down Hystrix done.");
    }
}


text:
import { expect, sinon } from './test_dependencies';
import ImagePusher from '../dist/image-pusher';
import Log from '../dist/log';

describe('ImagePusher', () => {

  beforeEach(() => {
    if (Log._log.restore) {
      Log._log.restore();
    }
    sinon.stub(Log, '_log');
  });

  it('should succeed as a promise', () => {
    // given:
    let response = {
      pipe: sinon.spy(),
      on: sinon.stub().withArgs('end').callsArg(1)
    };

    let image = {
      push: sinon.stub().callsArgWith(1, undefined, response)
    };

    let docker = {
      getImage: sinon.stub().withArgs('gurl').returns(image)
    };

    // when:
    let pusher = new ImagePusher(docker, 'gurl');

    // then:
    return pusher.should.eventually.be.fulfilled
      .then(() => {
        return response.on.should.have.been.called;
      });
  });

  it('should fail as a promise', () => {
    // given:
    let image = {
      push: sinon.stub().callsArgWith(1, new Error('darn'))
    };

    let docker = {
      getImage: sinon.stub().withArgs('gurl').returns(image)
    };

    // when:
    let pusher = new ImagePusher(docker, 'gurl');

    // then:
    return pusher.should.eventually.be.rejectedWith(Error, 'darn');
  });

});


text:
title: 'Omskjær hjertet'
date: 24/10/2021
---

5 Mos 10 fortsetter kapittel 9 og er i grunnen Guds bekreftelse av den pakten han hadde inngått med Israel. Ja, mye av denne boken er en slags fornyelse av pakten: Selv etter den forferdelige synden ved Horeb, da de henfalt til avguderi straks Moses forlot dem en liten stund, ga ikke Gud opp.

`Les 5 Mos 10,1–11. Hva skjer her som gjør at vi skjønner at Gud tilgav folket dets synd og stadfestet paktsløftet gitt til dem og deres fedre?`

Moses knuste steintavlene med de ti bud (5 Mos 9,17) – et tegn på at pakten var brutt (5 Mos 32,19). «For å vise sin avsky for deres forbrytelse, kastet han steintavlene fra seg, og de gikk i stykker like for øynene på folket. Med dette gav han til kjenne at slik de hadde brutt pakten med Gud, hadde han brutt pakten med dem.» – _Alfa og Omega_, bind 1, side 304–306 [PP 320].

Når Gud ba Moses om å hugge nye tavler «lik de første» og at han ville skrive ordene som var på de første, viser det at Gud hadde tilgitt folket og ikke hadde oppgitt dem.

`Les 5 Mos 10,14–16. Hva sier Gud til dem? Hva er meningen med de bildene han brukte her?`

Vi har en blanding av bilder her: forhuden, hjertet og nakken. Men poenget er klart. Omskjæring var et tegn på pakten, men det er bare et ytre tegn. Gud ønsket hjertet, altså deres sinn, følelser og kjærlighet. Bildet av de stivnakkede pekte ganske enkelt på hvor sta de var i sin motvilje mot å adlyde Herren. Og Gud ba dem egentlig om å slutte med vinglingen og tjene ham av hele sitt hjerte.

`Tenk på alle gangene Herren har tilgitt dine synder. Hva burde det si deg om hans nåde?`


text:
namespace plusfish {

MatcherFactory::MatcherFactory() {}

MatcherInterface* MatcherFactory::GetMatcher(
    const MatchRule_Match& match) const {
  switch (match.method()) {
    case MatchRule_Method_CONTAINS:
      return new ContainsMatcher(match);
    case MatchRule_Method_REGEX:
      return new RegexMatcher(match);
    case MatchRule_Method_PREFIX:
      return new PrefixMatcher(match);
    case MatchRule_Method_EQUALS:
      return new EqualsMatcher(match);
    case MatchRule_Method_TIMING:
      return new TimingMatcher(match, get_req_meta_cb_);
    case MatchRule_Method_NONE:
      break;
  }
  return nullptr;
}

}  // namespace plusfish


text:
/*
 * =====================================================================================
 *
 *       Filename:  linkData.h
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  02/14/2011 02:35:25 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Mitchelle Rasquinha
 *        Company:  Georgia Institute of Technology
 *
 * =====================================================================================
 */

#ifndef  MANIFOLD_IRIS_LINKDATA_H
#define  MANIFOLD_IRIS_LINKDATA_H

#include	"../interfaces/genericHeader.h"
#include	"flit.h"
#include	<cstring>
#include "kernel/serialize.h"

namespace manifold {
namespace iris {

enum link_arrival_data_type { FLIT, CREDIT };

class LinkData
{
    public:
        ~LinkData();

        link_arrival_data_type type;
        uint vc;
        Flit *f; //Note LinkData doesn't own the flit, so the flit is deleted separately.
        uint src;

        std::string toString(void) const;

};

} // namespace iris
} // namespace manifold

namespace manifold
{
    namespace kernel
    {
        template<>
            size_t
            Get_serialize_size<manifold::iris::LinkData>(const manifold::iris::LinkData* ld);

        template<>
            size_t
            Serialize<manifold::iris::LinkData>(manifold::iris::LinkData* p,unsigned char* buf );

            template<>
            manifold::iris::LinkData*
            Deserialize<manifold::iris::LinkData>(unsigned char* data );
    }
}

#endif // MANIFOLD_IRIS_LINKDATA_H


text:
using System.Net.WebSockets;
using System;
using System.Linq;
using System.Net;
using SlackAPI.WebSocketMessages;

namespace SlackAPI
{
    public class SlackSocketClient : SlackClient
    {
        readonly bool maintainPresenceChanges;
        SlackSocket underlyingSocket;

        public event Action<NewMessage> OnMessageReceived;
        public event Action<ReactionAdded> OnReactionAdded;
        public event Action<Pong> OnPongReceived;
        public event Action<PresenceChange> OnPresenceChanged;
        public event Action OnConnectionLost;

        bool HelloReceived;
        public const int PingInterval = 3000;

        public long PingRoundTripMilliseconds { get; private set; }
        public bool IsReady { get { return HelloReceived; } }
        public bool IsConnected { get { return underlyingSocket != null && underlyingSocket.Connected; } }

        public event Action OnHello;
        private LoginResponse loginDetails;

        public SlackSocketClient(string token, IWebProxy proxySettings = null, bool maintainPresenceChanges = false)
            : base(token, proxySettings)
        {
            this.maintainPresenceChanges = maintainPresenceChanges;
        }

        public override void Connect(Action<LoginResponse> onConnected, Action onSocketConnected = null)
        {
            base.Connect((s) => {
                if (s.ok)
                    ConnectSocket(onSocketConnected);

                onConnected(s);
            });
        }

        protected override void Connected(LoginResponse loginDetails)
        {
            this.loginDetails = loginDetails;
            base.Connected(loginDetails);
        }

        public void ConnectSocket(Action onSocketConnected){
            underlyingSocket = new SlackSocket(loginDetails, this, onSocketConnected, this.proxySettings);
            underlyingSocket.ConnectionClosed += UnderlyingSocket_ConnectionClosed;
        }

        private void UnderlyingSocket_ConnectionClosed()
        {
            OnConnectionLost?.Invoke();
        }

        public void ErrorReceiving(Action<WebSocketException> callback)
        {
            if (callback != null) underlyingSocket.ErrorReceiving += callback;
        }

        public void ErrorReceivingDesiralization(Action<Exception> callback)
        {
            if (callback != null) underlyingSocket.ErrorReceivingDesiralization += callback;
        }

        public void ErrorHandlingMessage(Action<Exception> callback)
        {
            if (callback != null) underlyingSocket.ErrorHandlingMessage += callback;
        }

        public void BindCallback<K>(Action<K> callback)
        {
            underlyingSocket.BindCallback(callback);
        }

        public void UnbindCallback<K>(Action<K> callback)
        {
            underlyingSocket.UnbindCallback(callback);
        }

        public void SendPresence(Presence status)
        {
            underlyingSocket.Send(new PresenceChange() { presence = status, user = base.MySelf.id });
        }

        public void SendTyping(string channelId)
        {
            underlyingSocket.Send(new Typing() { channel = channelId });
        }

        public void SendMessage(Action<MessageReceived> onSent, string channelId, string textData, string userName = null)
        {
            if (userName == null)
            {
                userName = MySelf.id;
            }

            if (onSent != null) {
                underlyingSocket.Send( new Message() {channel = channelId, text = textData, user = userName, type = "message"}, onSent);
            } else {
                underlyingSocket.Send(new Message() { channel = channelId, text = textData, user = userName, type = "message" });
            }
        }

        public void SendPing()
        {
            underlyingSocket.Send(new Ping());
        }

        public void SubscribePresenceChange(params string[] usersIds)
        {
            underlyingSocket.Send(new PresenceChangeSubscription(usersIds));
        }

        public void HandlePongReceived(Pong pong)
        {
            if (OnPongReceived != null)
                OnPongReceived(pong);
        }

        public void HandleReactionAdded(ReactionAdded reactionAdded)
        {
            if (OnReactionAdded != null)
                OnReactionAdded(reactionAdded);
        }

        public void HandleHello(Hello hello)
        {
            if (maintainPresenceChanges)
            {
                // Subscribe presence change event for all the users on startup to maintain status in the the lookup table
                SubscribePresenceChange(UserLookup.Keys.ToArray());
            }

            HelloReceived = true;

            if (OnHello != null)
                OnHello();
        }

        public void HandlePresence(PresenceChange change)
        {
            UserLookup[change.user].presence = change.presence.ToString().ToLower();
        }

        public void HandleManualPresence(ManualPresenceChange change)
        {
            change.user = MySelf.id;
            HandlePresence(change);
        }

        public void HandleUserChange(UserChange change)
        {
            UserLookup[change.user.id] = change.user;
        }

        public void HandleTeamJoin(TeamJoin newuser)
        {
            UserLookup.Add(newuser.user.id, newuser.user);
        }

        public void HandleChannelCreated(ChannelCreated created)
        {
            ChannelLookup.Add(created.channel.id, created.channel);
        }

        public void HandleChannelRename(ChannelRename rename)
        {
            ChannelLookup[rename.channel.id].name = rename.channel.name;
        }

        public void HandleChannelDeleted(ChannelDeleted deleted)
        {
            ChannelLookup.Remove(deleted.channel);
        }

        public void HandleChannelArchive(ChannelArchive archive)
        {
            ChannelLookup[archive.channel].is_archived = true;
        }

        public void HandleChannelUnarchive(ChannelUnarchive unarchive)
        {
            ChannelLookup[unarchive.channel].is_archived = false;
        }

        public void HandleGroupJoined(GroupJoined joined)
        {
            GroupLookup.Add(joined.channel.id, joined.channel);
        }

        public void HandleGroupLeft(GroupLeft left)
        {
            GroupLookup.Remove(left.channel);
        }

        public void HandleGroupOpen(GroupOpen open)
        {
            GroupLookup[open.channel].is_open = true;
        }

        public void HandleGroupClose(GroupClose close)
        {
            GroupLookup[close.channel].is_open = false;
        }

        public void HandleGroupArchive(GroupArchive archive)
        {
            GroupLookup[archive.channel].is_archived = true;
        }

        public void HandleGroupUnarchive(GroupUnarchive unarchive)
        {
            GroupLookup[unarchive.channel].is_archived = false;
        }

        public void HandleGroupRename(GroupRename rename)
        {
            GroupLookup[rename.channel.id].name = rename.channel.name;
            GroupLookup[rename.channel.id].created = rename.channel.created;
        }

        public void UserTyping(Typing t)
        {

        }

        public void Message(NewMessage m)
        {
            if (OnMessageReceived != null)
                OnMessageReceived(m);
        }

        public void FileShareMessage(FileShareMessage m)
        {
            Message(m);
        }

        public void PresenceChange(PresenceChange p)
        {
            OnPresenceChanged?.Invoke(p);
        }

        public void ManualPresenceChange(ManualPresenceChange p)
        {
            p.user = MySelf.id;
            PresenceChange(p);
        }

        public void ChannelMarked(ChannelMarked m)
        {

        }

		public void CloseSocket()
		{
			underlyingSocket.Close();
		}
    }
}


text:
using content::NavigationController;
using content::NavigationEntry;
using content::SSLStatus;
using content::WebContents;

ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate)
    : delegate_(delegate),
      input_in_progress_(false) {
}

ToolbarModelImpl::~ToolbarModelImpl() {
}

// ToolbarModelImpl Implementation.
string16 ToolbarModelImpl::GetText(
    bool display_search_urls_as_search_terms) const {
  if (display_search_urls_as_search_terms) {
    string16 search_terms = GetSearchTerms();
    if (!search_terms.empty())
      return search_terms;
  }
  std::string languages;  // Empty if we don't have a |navigation_controller|.
  Profile* profile = GetProfile();
  if (profile)
    languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages);

  GURL url(GetURL());
  if (url.spec().length() > content::kMaxURLDisplayChars)
    url = url.IsStandard() ? url.GetOrigin() : GURL(url.scheme() + ":");
  // Note that we can't unescape spaces here, because if the user copies this
  // and pastes it into another program, that program may think the URL ends at
  // the space.
  return AutocompleteInput::FormattedStringWithEquivalentMeaning(
      url, net::FormatUrl(url, languages, net::kFormatUrlOmitAll,
                          net::UnescapeRule::NORMAL, NULL, NULL, NULL));
}

GURL ToolbarModelImpl::GetURL() const {
  const NavigationController* navigation_controller = GetNavigationController();
  if (navigation_controller) {
    const NavigationEntry* entry = navigation_controller->GetVisibleEntry();
    if (entry)
      return ShouldDisplayURL() ? entry->GetVirtualURL() : GURL();
  }

  return GURL(chrome::kAboutBlankURL);
}

bool ToolbarModelImpl::WouldReplaceSearchURLWithSearchTerms() const {
  return !GetSearchTerms().empty();
}

bool ToolbarModelImpl::ShouldDisplayURL() const {
  // Note: The order here is important.
  // - The WebUI test must come before the extension scheme test because there
  //   can be WebUIs that have extension schemes (e.g. the bookmark manager). In
  //   that case, we should prefer what the WebUI instance says.
  // - The view-source test must come before the WebUI test because of the case
  //   of view-source:chrome://newtab, which should display its URL despite what
  //   chrome://newtab's WebUI says.
  NavigationController* controller = GetNavigationController();
  NavigationEntry* entry = controller ? controller->GetVisibleEntry() : NULL;
  if (entry) {
    if (entry->IsViewSourceMode() ||
        entry->GetPageType() == content::PAGE_TYPE_INTERSTITIAL) {
      return true;
    }
  }

  WebContents* web_contents = delegate_->GetActiveWebContents();
  if (web_contents && web_contents->GetWebUIForCurrentState())
    return !web_contents->GetWebUIForCurrentState()->ShouldHideURL();

  if (entry && entry->GetURL().SchemeIs(extensions::kExtensionScheme))
    return false;

#if defined(OS_CHROMEOS)
  if (entry && entry->GetURL().SchemeIs(chrome::kDriveScheme))
    return false;
#endif

  if (entry && entry->GetVirtualURL() == GURL(chrome::kChromeUINewTabURL))
    return false;

  return true;
}

ToolbarModelImpl::SecurityLevel ToolbarModelImpl::GetSecurityLevel() const {
  if (input_in_progress_)  // When editing, assume no security style.
    return NONE;

  NavigationController* navigation_controller = GetNavigationController();
  if (!navigation_controller)  // We might not have a controller on init.
    return NONE;

  NavigationEntry* entry = navigation_controller->GetVisibleEntry();
  if (!entry)
    return NONE;

  const SSLStatus& ssl = entry->GetSSL();
  switch (ssl.security_style) {
    case content::SECURITY_STYLE_UNKNOWN:
    case content::SECURITY_STYLE_UNAUTHENTICATED:
      return NONE;

    case content::SECURITY_STYLE_AUTHENTICATION_BROKEN:
      return SECURITY_ERROR;

    case content::SECURITY_STYLE_AUTHENTICATED:
      if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT))
        return SECURITY_WARNING;
      if (net::IsCertStatusError(ssl.cert_status)) {
        DCHECK(net::IsCertStatusMinorError(ssl.cert_status));
        return SECURITY_WARNING;
      }
      if ((ssl.cert_status & net::CERT_STATUS_IS_EV) &&
          content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, NULL))
        return EV_SECURE;
      return SECURE;

    default:
      NOTREACHED();
      return NONE;
  }
}

int ToolbarModelImpl::GetIcon() const {
  if (WouldReplaceSearchURLWithSearchTerms())
    return IDR_OMNIBOX_SEARCH;
  static int icon_ids[NUM_SECURITY_LEVELS] = {
    IDR_LOCATION_BAR_HTTP,
    IDR_OMNIBOX_HTTPS_VALID,
    IDR_OMNIBOX_HTTPS_VALID,
    IDR_OMNIBOX_HTTPS_WARNING,
    IDR_OMNIBOX_HTTPS_INVALID,
  };
  DCHECK(arraysize(icon_ids) == NUM_SECURITY_LEVELS);
  return icon_ids[GetSecurityLevel()];
}

string16 ToolbarModelImpl::GetEVCertName() const {
  DCHECK_EQ(GetSecurityLevel(), EV_SECURE);
  scoped_refptr<net::X509Certificate> cert;
  // Note: Navigation controller and active entry are guaranteed non-NULL or
  // the security level would be NONE.
  content::CertStore::GetInstance()->RetrieveCert(
      GetNavigationController()->GetVisibleEntry()->GetSSL().cert_id, &cert);
  return GetEVCertName(*cert);
}

// static
string16 ToolbarModelImpl::GetEVCertName(const net::X509Certificate& cert) {
  // EV are required to have an organization name and country.
  if (cert.subject().organization_names.empty() ||
      cert.subject().country_name.empty()) {
    NOTREACHED();
    return string16();
  }

  return l10n_util::GetStringFUTF16(
      IDS_SECURE_CONNECTION_EV,
      UTF8ToUTF16(cert.subject().organization_names[0]),
      UTF8ToUTF16(cert.subject().country_name));
}

void ToolbarModelImpl::SetInputInProgress(bool value) {
  input_in_progress_ = value;
}

bool ToolbarModelImpl::GetInputInProgress() const {
  return input_in_progress_;
}

NavigationController* ToolbarModelImpl::GetNavigationController() const {
  // This |current_tab| can be NULL during the initialization of the
  // toolbar during window creation (i.e. before any tabs have been added
  // to the window).
  WebContents* current_tab = delegate_->GetActiveWebContents();
  return current_tab ? &current_tab->GetController() : NULL;
}

Profile* ToolbarModelImpl::GetProfile() const {
  NavigationController* navigation_controller = GetNavigationController();
  return navigation_controller ?
      Profile::FromBrowserContext(navigation_controller->GetBrowserContext()) :
      NULL;
}

string16 ToolbarModelImpl::GetSearchTerms() const {
  const WebContents* contents = delegate_->GetActiveWebContents();
  string16 search_terms = chrome::search::GetSearchTerms(contents);

  // Don't extract search terms that the omnibox would treat as a navigation.
  // This might confuse users into believing that the search terms were the
  // URL of the current page, and could cause problems if users hit enter in
  // the omnibox expecting to reload the page.
  if (!search_terms.empty()) {
    AutocompleteMatch match;
    Profile* profile =
        Profile::FromBrowserContext(contents->GetBrowserContext());
    AutocompleteClassifierFactory::GetForProfile(profile)->Classify(
        search_terms, string16(), false, false, &match, NULL);
    if (!AutocompleteMatch::IsSearchType(match.type))
      search_terms.clear();
  }

  return search_terms;
}