text:
package com.microsoft.azure.management.compute;

import com.microsoft.azure.management.resources.fluentcore.utils.ResourceNamer;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;

public class VirtualMachineExtensionOperationsTests extends ComputeManagementTestBase {
    @BeforeClass
    public static void setup() throws Exception {
        createClients();
    }

    @AfterClass
    public static void cleanup() throws Exception {
    }

    @Test
    public void canResetPasswordUsingVMAccessExtension() throws Exception {
        final String RG_NAME = ResourceNamer.randomResourceName("vmexttest", 15);
        final String LOCATION = "eastus";
        final String VMNAME = "javavm";

        // Create a Linux VM
        //
        VirtualMachine vm = computeManager.virtualMachines()
                .define(VMNAME)
                .withRegion(LOCATION)
                .withNewResourceGroup(RG_NAME)
                .withNewPrimaryNetwork("10.0.0.0/28")
                .withPrimaryPrivateIpAddressDynamic()
                .withoutPrimaryPublicIpAddress()
                .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
                .withRootUserName("Foo12")
                .withPassword("BaR@12abc!")
                .withSize(VirtualMachineSizeTypes.STANDARD_D3)
                .create();

        // Using VMAccess Linux extension to reset the password for the existing user 'Foo12'
        // https://github.com/Azure/azure-linux-extensions/blob/master/VMAccess/README.md
        //
        vm.update()
                .defineNewExtension("VMAccessForLinux")
                    .withPublisher("Microsoft.OSTCExtensions")
                    .withType("VMAccessForLinux")
                    .withVersion("1.4")
                    .withProtectedSetting("username", "Foo12")
                    .withProtectedSetting("password", "B12a6@12xyz!")
                    .withProtectedSetting("reset_ssh", "true")
                .attach()
                .apply();

        Assert.assertTrue(vm.extensions().size() > 0);
        Assert.assertTrue(vm.extensions().containsKey("VMAccessForLinux"));

        // Update the VMAccess Linux extension to reset password again for the user 'Foo12'
        //
        vm.update()
                .updateExtension("VMAccessForLinux")
                    .withProtectedSetting("username", "Foo12")
                    .withProtectedSetting("password", "muy!234OR")
                    .withProtectedSetting("reset_ssh", "true")
                .parent()
                .apply();
    }

    @Test
    public void canInstallUninstallCustomExtension() throws Exception {
        final String RG_NAME = ResourceNamer.randomResourceName("vmexttest", 15);
        final String LOCATION = "eastus";
        final String VMNAME = "javavm";

        final String mySqlInstallScript = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/4397e808d07df60ff3cdfd1ae40999f0130eb1b3/mysql-standalone-server-ubuntu/scripts/install_mysql_server_5.6.sh";
        final String installCommand = "bash install_mysql_server_5.6.sh Abc.123x(";
        List<String> fileUris = new ArrayList<>();
        fileUris.add(mySqlInstallScript);

        // Create Linux VM with a custom extension to install MySQL
        //
        VirtualMachine vm = computeManager.virtualMachines()
                .define(VMNAME)
                .withRegion(LOCATION)
                .withNewResourceGroup(RG_NAME)
                .withNewPrimaryNetwork("10.0.0.0/28")
                .withPrimaryPrivateIpAddressDynamic()
                .withoutPrimaryPublicIpAddress()
                .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
                .withRootUserName("Foo12")
                .withPassword("BaR@12abc!")
                .withSize(VirtualMachineSizeTypes.STANDARD_D3)
                .defineNewExtension("CustomScriptForLinux")
                    .withPublisher("Microsoft.OSTCExtensions")
                    .withType("CustomScriptForLinux")
                    .withVersion("1.4")
                    .withAutoUpgradeMinorVersionEnabled()
                    .withPublicSetting("fileUris",fileUris)
                    .withPublicSetting("commandToExecute", installCommand)
                .attach()
                .create();

        Assert.assertTrue(vm.extensions().size() > 0);
        Assert.assertTrue(vm.extensions().containsKey("CustomScriptForLinux"));
        VirtualMachineExtension customScriptExtension = vm.extensions().get("CustomScriptForLinux");
        Assert.assertEquals(customScriptExtension.publisherName(), "Microsoft.OSTCExtensions");
        Assert.assertEquals(customScriptExtension.typeName(), "CustomScriptForLinux");
        Assert.assertEquals(customScriptExtension.autoUpgradeMinorVersionEnabled(), true);

        // Remove the custom extension
        //
        vm.update()
                .withoutExtension("CustomScriptForLinux")
                .apply();

        Assert.assertTrue(vm.extensions().size() == 0);
    }

    @Test
    public void canHandleExtensionReference() throws Exception {
        final String RG_NAME = ResourceNamer.randomResourceName("vmexttest", 15);
        final String LOCATION = "eastus";
        final String VMNAME = "javavm";

        // Create a Linux VM
        //
        VirtualMachine vm = computeManager.virtualMachines()
                .define(VMNAME)
                .withRegion(LOCATION)
                .withNewResourceGroup(RG_NAME)
                .withNewPrimaryNetwork("10.0.0.0/28")
                .withPrimaryPrivateIpAddressDynamic()
                .withoutPrimaryPublicIpAddress()
                .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_14_04_LTS)
                .withRootUserName("Foo12")
                .withPassword("BaR@12abc!")
                .withSize(VirtualMachineSizeTypes.STANDARD_D3)
                .defineNewExtension("VMAccessForLinux")
                    .withPublisher("Microsoft.OSTCExtensions")
                    .withType("VMAccessForLinux")
                    .withVersion("1.4")
                    .withProtectedSetting("username", "Foo12")
                    .withProtectedSetting("password", "B12a6@12xyz!")
                    .withProtectedSetting("reset_ssh", "true")
                .attach()
                .create();

        Assert.assertTrue(vm.extensions().size() > 0);

        // Get the created virtual machine via VM List not by VM GET
        List<VirtualMachine> virtualMachines = computeManager.virtualMachines()
                .listByGroup(RG_NAME);
        VirtualMachine vmWithExtensionReference = null;
        for (VirtualMachine virtualMachine : virtualMachines) {
            if (virtualMachine.name().equalsIgnoreCase(VMNAME)) {
                vmWithExtensionReference = virtualMachine;
                break;
            }
        }
        // The VM retrieved from the list will contain extensions as reference (i.e. with only id)
        Assert.assertNotNull(vmWithExtensionReference);

        // Update the extension
        VirtualMachine vmWithExtensionUpdated = vmWithExtensionReference.update()
                .updateExtension("VMAccessForLinux")
                .withProtectedSetting("username", "Foo12")
                .withProtectedSetting("password", "muy!234OR")
                .withProtectedSetting("reset_ssh", "true")
                .parent()
                .apply();

        // Again getting VM with extension reference
        virtualMachines = computeManager.virtualMachines()
                .listByGroup(RG_NAME);
        vmWithExtensionReference = null;
        for (VirtualMachine virtualMachine : virtualMachines) {
            vmWithExtensionReference = virtualMachine;
        }
        Assert.assertNotNull(vmWithExtensionReference);

        VirtualMachineExtension accessExtension = null;
        for (VirtualMachineExtension extension : vmWithExtensionReference.extensions().values()) {
            if (extension.name().equalsIgnoreCase("VMAccessForLinux")) {
                accessExtension = extension;
                break;
            }
        }
        // Even though VM's inner contain just extension reference VirtualMachine::extensions()
        // should resolve the reference and get full extension.
        Assert.assertNotNull(accessExtension);
        Assert.assertNull(accessExtension.publisherName());
        Assert.assertNull(accessExtension.typeName());
        Assert.assertNull(accessExtension.versionName());
    }
}


text: Cordova Plugin Payment Gateway Integration for CCAvenue

redpajama_set_name: RedPajamaGithub


text:
package org.wso2.carbon.databridge.agent.conf;

import org.wso2.carbon.config.annotation.Configuration;
import org.wso2.carbon.config.annotation.Element;

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

/**
 * Configuration class for data-bridge-config.yaml file.
 */
@Configuration(namespace = "data.agent.config", description = "Configuration of the Data Agents - to " +
        "publish events through databridge")
public class DataAgentsConfiguration {

    @Element(description = "Data agent configurations", required = true)
    public List<Agent> agents = new ArrayList<>();

    public DataAgentsConfiguration() {
        agents.add(new Agent("Thrift",
                "org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftDataEndpoint"));
        agents.add(new Agent("Binary",
                "org.wso2.carbon.databridge.agent.endpoint.binary.BinaryDataEndpoint"));
    }

    @Override
    public String toString() {
        return "Data Agents - " + agents.toString();
    }

    public List<Agent> getAgents() {
        return agents;
    }

    public void setAgents(List<Agent> agents) {
        this.agents = agents;
    }

}


text:
import {
  moduleForModel,
  test
} from 'ember-qunit';
import Ember from 'ember';
import { stubRequest } from 'ember-cli-fake-server';
import modelDeps from '../../support/common-model-dependencies';

moduleForModel('log-drain', 'model:log-drain', {
  // Specify the other units that are required for this test.
  needs: modelDeps.concat([
    'adapter:log-drain'
  ])
});

test('posts to /accounts/:stack_id/log_drains', function(assert){
  let done = assert.async();
  assert.expect(1);
  let stack, drain;
  let store = this.store();
  Ember.run(() => {
    stack = store.push('stack',{id:'s1'});
  });

  stubRequest('post', '/accounts/s1/log_drains', function(){
    assert.ok(true, 'posts to correct url');
    return this.success({id:'ld1'});
  });

  Ember.run(() => {
    drain = store.createRecord('log-drain', {stack});
    drain.save().finally(done);
  });
});


text:
var environment = process.env.NODE_ENV || 'development';
module.exports = config = require('./app/' + environment);

config.env  = environment;
config.gulp = require('./build/gulp');

// temporary solution for api keys
config.api = {
  marvel: require('./api/marvel')
};


text:
import React from 'react'
import { Routes, Route, Link } from '@onemarket/appson'

import Home from './modules/Home'
import NoMatch from './modules/NoMatch'

const Typescript = () => (

Typescript

        <Link to="/">Home</Link>

    <Routes>
      <Route exact path="/" component={Home} />
      <Route component={NoMatch} />
    </Routes>

)

export default Typescript


text:
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>Protocols</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css"
title="Style">

                Sections:
                Index
                 Introduction
                More Info.
                Visual Index
                Class
                by Class
                Links

Protocols

The following examples show how to use
the support provided JADE to implement interaction protocols.

FIPARequestInitiatorAgent

        Author: Giovanni Caire (TILab
        S.p.a)

        Date: 26/11/2003

FIPARequestResponderAgent

        Author: Giovanni Caire (TILab
        S.p.a)

        Date: 26/11/2003

ContractNetInitiatorAgent

        Author: Giovanni Caire (TILab
        S.p.a)

        Date: 26/11/2003

ContractNetResponderAgent

        Author: Giovanni Caire (TILab
        S.p.a)

        Date: 26/11/2003

BrokerAgent

        Author: Giovanni Caire (TILab
        S.p.a)

        Date: 26/11/2003

        FIPARequestInitiatorAgent

        Description:

        This example shows how to implement the initiator role in
        a FIPA-request interaction protocol. In this case in particular
        we use an AchieveREInitiator ("Achieve Rational effect")
        to request a dummy action to a number of agents (whose local
        names must be specified as arguments).

        This example should be used together with the FIPARequestResponderAgent
        as described below.

        Start the JADE runtime (with the management GUI) and launch some
        FIPARequestResponderAgent on it.

        java jade.Boot -gui r1:examples.protocols.FIPARequestResponderAgent r2:examples.protocols.FIPARequestResponderAgent

        Then, from another window (or from the management GUI), launch an
        FIPARequestInitiatorAgent specifying the local names of the responder as arguments.

      java jade.Boot -container i:examples.protocols.FIPARequestInitiatorAgent(r1
      r2)

        Jade classes used:

        Agent, ACLMessage, AchieveREInitiator

        Source

        \src\examples\protocols\FIPARequestInitiatorAgent.java

        FIPARequestResponderAgent

        Description:

        This example shows how to implement the responder role in
        a FIPA-request interaction protocol. In this case in particular
        we use an AchieveREResponder ("Achieve Rational effect")
        to serve requests to perform actions from other agents. We use a
        random generator to simulate request refusals and action execution
        failures.

        This example should be used together with the FIPARequestInitiatorAgent
        as described here.

        Jade classes used:

        Agent, ACLMessage, MessageTemplate, AchieveREResponder

        Source

        \src\examples\protocols\FIPARequestResponderAgent.java

        ContractNetInitiatorAgent

        Description:

        This example shows how to implement the initiator role in
        a FIPA-contract-net interaction protocol. In this case in particular
        we use a ContractNetInitiator
        to assign a dummy task to the agent that provides the best offer
        among a set of agents (whose local
        names must be specified as arguments).

        This example should be used together with the ContractNetResponderAgent
        as described below.

        Start the JADE runtime (with the management GUI) and launch some
        ContractNetResponderAgent on it.

        java jade.Boot -gui r1:examples.protocols.ContractNetResponderAgent r2:examples.protocols.ContractNetResponderAgent

        Then, from another window (or from the management GUI), launch an
        ContractNetInitiatorAgent specifying the local names of the responder as arguments.

      java jade.Boot -container i:examples.protocols.ContractNetInitiatorAgent(r1
      r2)

        Jade classes used:

        Agent, ACLMessage, ContractNetInitiator

        Source

        \src\examples\protocols\ContractNetInitiatorAgent.java

        ContractNetResponderAgent

        Description:

        This example shows how to implement the responder role in
        a FIPA-contract-net interaction protocol. In this case in particular
        we use a ContractNetResponder
        to participate into a negotiation where an initiator needs to assign
        a task to an agent among a set of candidates.

        This example should be used together with the ContractNetInitiatorAgent
        as described here.

        Jade classes used:

        Agent, ACLMessage, MessageTemplate, ContractNetResponder

        Source

        \src\examples\protocols\ContractNetResponderAgent.java

        BrokerAgent

        Description:

        This example shows how to implement nested protocols.
        In this case in particular we want to implement a broker agent
        that forwards incoming requests to perform actions to another
        agent. To implement that we use an AchieveREResponder ("Achieve Rational effect")
        and we register an AchieveREInitiator in the state where the
        requested action has to be performed.

        This example should be used together with the FIPARequestInitiatorAgent
        and the FIPARequestResponderAgent
        as described below.

        Start the JADE runtime (with the management GUI) and launch one
        FIPARequestResponderAgent and one BrokerAgent on it. Specify the name
        of the responder as an argument to the broker.

        java jade.Boot -gui r:examples.protocols.FIPARequestResponderAgent b:examples.protocols.BrokerAgent(r)

        Then, from another window (or from the management GUI), launch a
        FIPARequestInitiatorAgent specifying the local name of the broker as argument.

        java jade.Boot -container i:examples.protocols.FIPARequestInitiatorAgent(b)

        Jade classes used:

        Agent, ACLMessage, MessageTemplate, AchieveREResponder, AchieveContractNetInitiator

        Source

        \src\examples\protocols\BrokerAgent.java

JADE
is a trademark of TILAB (formerly CSELT).

JADE has been developed jointly by TILAB
(formerly CSELT)
and the Computer
Engineering Group of the University
of Parma


text:
var httpProxy = require('express-http-proxy');
var serveIndex = require('serve-index');
var express = require('express');
var _       = require('underscore');
var app = express();
var net = require('net');
var fs  = require('fs');
var logger = require('./lib/logger');

var defaultConfig = {
    hostname : '0.0.0.0',
    port: '3000',
    webPath:  process.cwd(),
    mockPath: process.cwd(),
    logLevel: 'info',
    proxies: {
        /*
        '/api': {
            host: '127.0.0.1:6000',
        },
        '/userapi': {
            host: '127.0.0.1:7000',
            headers: {
                host: 'api.examples.com'
            }
        }*/
    },
    mocks: {
        /*
        '/api/item/list': 'testdata/test.json',
        '/api/item/1': function(req, res) {
            res.json({ code: 0, data: { id: 1, name: 'javascript in action' } });
        },
        '/api/cart': {
            'get': 'testdata/test.json',
            'post': function(req, res) {
                res.send('add cart successful');
            }
        }*/
    }
}

module.exports =  function(config){
    if(!_.isObject(config)){
        logger.error('config is invalid, please check your config.');
        return;
    }

    config = _.defaults(config, defaultConfig);
    //set logger level
    logger.logLevel = config.logLevel || 'info';

    //mocks
    _.each(config.mocks, function (mockConfig, key) {
        if (_.isString(mockConfig)) {
            logger.info("[GET] %s -> %s", key, mockConfig);

            app.get(key, function (req, res) {
                logger.debug("[GET] %s -> %s", key, mockConfig);
                res.sendFile(mockConfig, getSendFileOptions(config.mockPath));
            });
        } else if (_.isFunction(mockConfig)) {
            logger.info("[GET] %s -> [function]", key);
            app.get(key, mockConfig);
        } else if (_.isObject(mockConfig)) {
            var route = app.route(key);
            _.each(mockConfig, function (methodConfig, method) {
                if (_.isString(methodConfig)) {
                    logger.info("[%s] %s -> %s", method.toUpperCase(), key, methodConfig);
                    route[method](function (req, res) {
                        logger.debug("[%s] %s -> %s", method.toUpperCase(), key, methodConfig);
                        res.sendFile(methodConfig, getSendFileOptions(config.mockPath));
                    })
                } else if (_.isFunction(methodConfig)) {
                    logger.info("[%s] %s -> [function]", method.toUpperCase(), key);
                    route[method](methodConfig);
                }
            });
        }
    });

    //proxies
    _.each(config.proxies, function(proxyConfig, key){
        var router = express.Router();
        var host = proxyConfig.host;

        if(host.indexOf('http://') != 0 && host.indexOf('https://') != 0){
            host = 'http://' + proxyConfig.host;
        }

        logger.info("[proxy] %s - > %s", key, host);

        router.all('*', httpProxy(host, {
            reqBodyEncoding: null,
            decorateRequest: function(req) {
                var path = req.path;

                if (proxyConfig.prefixPath) {
                    req.path = proxyConfig.prefixPath + path;
                }

                logger.debug("[proxy] %s -> %s", key + path, host + req.path);

                if(!_.isEmpty(proxyConfig.headers)){
                    _.each(proxyConfig.headers, function(header, key){
                        req.headers[key] = header;
                    });
                }

                return req;
            }
        }))

        app.use(key ,router);
    });

    //static resources
    if (config.webPath) {
        app.use(express.static(config.webPath));
        app.use(serveIndex(config.webPath, {icons: true}));
    }

    app.listen(config.port, config.hostname, function(){
        logger.info('Starting http dev server: http://' + config.hostname +':' + config.port);
    });

    return app;
}

function getSendFileOptions(mockPath) {
    return {
        root: mockPath,
        headers: {
            'x-timestamp': Date.now(),
            'x-sent': true
        }
      };
}


text:
/* $Id$  */

package org.apache.lenya.cms.cocoon.acting;

import java.util.Collections;
import java.util.Map;

import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.acting.ServiceableAction;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.Repository;
import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.cms.workflow.WorkflowUtil;
import org.apache.lenya.util.ServletHelper;

/**
 * Action to invoke a workflow transition independently from the request document URL. Parameters:
 *

 *
area:  The area.

 *
document-uuid:  The document uuid.

 *
language:  The language.

 *
event:  The event to invoke.

 *

 */
public class WorkflowInvokerAction extends ServiceableAction {

    /**
     * AREA The area
     */
    public static final String AREA = "area";
    /**
     * DOCUMENT_UUID The document id
     */
    public static final String DOCUMENT_UUID = "document-uuid";
    /**
     * LANGUAGE The language
     */
    public static final String LANGUAGE = "language";
    /**
     * EVENT The event
     */
    public static final String EVENT = "event";

    private Repository repository;

    /**
     * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector,
     *      org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String,
     *      org.apache.avalon.framework.parameters.Parameters)
     */
    public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source,
            Parameters parameters) throws Exception {

        String area = parameters.getParameter(AREA);
        String documentId = parameters.getParameter(DOCUMENT_UUID);
        String language = parameters.getParameter(LANGUAGE);
        String eventName = parameters.getParameter(EVENT);

        if (getLogger().isDebugEnabled()) {
            getLogger().debug(getClass().getName() + " invoked.");
            getLogger().debug("    Area:        [" + area + "]");
            getLogger().debug("    Document ID: [" + documentId + "]");
            getLogger().debug("    Language:    [" + language + "]");
            getLogger().debug("    Event:       [" + eventName + "]");
        }

        Request request = ObjectModelHelper.getRequest(objectModel);
        Session session = this.repository.getSession(request);
        Publication pub = session.getUriHandler().getPublication(
                ServletHelper.getWebappURI(request));
        Document document = pub.getArea(area).getDocument(documentId, language);

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("    Invoking workflow event");
        }
        WorkflowUtil.invoke(document, eventName);

        return Collections.EMPTY_MAP;
    }

    public void setRepository(Repository repository) {
        this.repository = repository;
    }

}


text:
layout: splash
permalink: /
header:
  overlay_color: "#5e616c"
  overlay_image: locker_dark.jpg
  cta_label: "<i class='fa fa-download'></i> Get OpenPGP Software"
  cta_url: "/software/"
  caption:
excerpt: 'Email encryption. For all operating systems. Standing the test of time.'
feature_row:
  - image_path: home_mailbox_bw.jpg
    alt: "Email encryption"
    title: "Email encryption"
    excerpt: "Although OpenPGP's main purpose is end-to-end encrypted email communication, it is also utilized for encrypted messaging and other use cases such as password managers."
    url: "/software/"
    btn_label: "Learn More"
  - image_path: home_computer_bw.jpg
    alt: "For all operating systems"
    title: "For all operating systems"
    excerpt: "OpenPGP is available for all major platforms, such as Windows, Mac OS, GNU/Linux, Android, and iOS."
    url: "/software/"
    btn_label: "Learn More"
  - image_path: home_stamp_bw.jpg
    alt: "Standing the test of time"
    title: "Standing the test of time"
    excerpt: "OpenPGP was standardized in 1997 and since then continuously improved. As far as we know, intelligence organizations aren't able to break it."
    url: "/about/"
    btn_label: "Learn More"
intro:
  - excerpt: 'OpenPGP is the most widely used email encryption standard. It is defined by the OpenPGP Working Group of the Internet Engineering Task Force (IETF) as a Proposed Standard in [RFC 4880](https://tools.ietf.org/html/rfc4880). OpenPGP was originally derived from the PGP software, created by [Phil Zimmermann](https://philzimmermann.com).'
---

{% include feature_row id="intro" type="center" %}

{% include feature_row %}


text:
package net.i2p.router.transport.crypto;

/*
 * free (adj.): unencumbered; not under the control of others
 * Written by jrandom in 2003 and released into the public domain
 * with no warranty of any kind, either expressed or implied.
 * It probably won't  make your computer catch on fire, or eat
 * your children, but it might.  Use at your own risk.
 *
 */

import java.math.BigInteger;

import junit.framework.TestCase;
import net.i2p.I2PAppContext;
import net.i2p.data.SessionKey;
import net.i2p.util.RandomSource;

public class DHSessionKeyBuilderTest extends TestCase {
    public void testDHSessionKeyBuilder(){
        I2PAppContext ctx = new I2PAppContext();
        for (int i = 0; i < 5; i++) {
            DHSessionKeyBuilder builder1 = new DHSessionKeyBuilder();
            DHSessionKeyBuilder builder2 = new DHSessionKeyBuilder();
            BigInteger pub1 = builder1.getMyPublicValue();
            BigInteger pub2 = builder2.getMyPublicValue();
            try {
                builder2.setPeerPublicValue(pub1);
                builder1.setPeerPublicValue(pub2);
            } catch (DHSessionKeyBuilder.InvalidPublicParameterException ippe) {
                assertTrue(ippe.getMessage(), true);
            }
            SessionKey key1 = builder1.getSessionKey();
            SessionKey key2 = builder2.getSessionKey();

            assertEquals(key1, key2);

            byte iv[] = new byte[16];
            RandomSource.getInstance().nextBytes(iv);
            String origVal = "1234567890123456"; // 16 bytes max using AESEngine
            byte enc[] = new byte[16];
            byte dec[] = new byte[16];
            ctx.aes().encrypt(origVal.getBytes(), 0, enc, 0, key1, iv, 16);
            ctx.aes().decrypt(enc, 0, dec, 0, key2, iv, 16);
            String tranVal = new String(dec);
            assertEquals(origVal, tranVal);
        }
    }
}


text:
package com.intellij.util.containers;

import com.intellij.openapi.util.Condition;
import com.intellij.util.Function;
import com.intellij.util.Functions;
import com.intellij.util.PairFunction;
import junit.framework.TestCase;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
import java.util.Collection;
import java.util.Map;

/**
 * @author gregsh
 */
public class TreeTraverserTest extends TestCase {

  private static Map<Integer, Collection<Integer>> numbers() {
    return ContainerUtil.<Integer, Collection<Integer>>immutableMapBuilder().
      put(1, Arrays.asList(2, 3, 4)).
      put(2, Arrays.asList(5, 6, 7)).
      put(3, Arrays.asList(8, 9, 10)).
      put(4, Arrays.asList(11, 12, 13)).
      build();
  }

  private static final Condition<Integer> IS_ODD = new Condition<Integer>() {
    @Override
    public boolean value(Integer integer) {
      return integer.intValue() % 2 == 1;
    }
  };

  private static final Function<Integer, Integer> INCREMENT = new Function<Integer, Integer>() {
    @Override
    public Integer fun(Integer k) {
      return k + 1;
    }
  };

  private static final Function<Integer, Integer> SQUARE = new Function<Integer, Integer>() {
    @Override
    public Integer fun(Integer k) {
      return k * k;
    }
  };

  private static final PairFunction<Integer, Integer, Integer> FIBONACCI = new PairFunction<Integer, Integer, Integer>() {
    @Override
    public Integer fun(Integer k1, Integer k2) {
      return k2 + k1;
    }
  };

  @NotNull
  private static Condition<Integer> LESS_THAN(final int max) {
    return new Condition<Integer>() {
      @Override
      public boolean value(Integer integer) {
        return integer < max;
      }
    };
  }

  @NotNull
  private static Condition<Integer> LESS_THAN_MOD(final int max) {
    return new Condition<Integer>() {
      @Override
      public boolean value(Integer integer) {
        return integer % max < max / 2;
      }
    };
  }

  // JBIterable ----------------------------------------------

  public void testSkipTakeSize() {
    JBIterable<Integer> it = JBIterable.generate(1, INCREMENT).skip(10).take(10);
    assertEquals(10, it.size());
    assertEquals(new Integer(11), it.first());
  }

  public void testSkipWhile() {
    JBIterable<Integer> it = JBIterable.generate(1, INCREMENT).skipWhile(LESS_THAN_MOD(10)).take(10);
    assertEquals(Arrays.asList(5, 6, 7, 8, 9, 10, 11, 12, 13, 14), it.toList());
  }

  public void testTakeWhile() {
    JBIterable<Integer> it = JBIterable.generate(1, INCREMENT).takeWhile(LESS_THAN_MOD(10)).take(10);
    assertEquals(Arrays.asList(1, 2, 3, 4), it.toList());
  }

  public void testFilterTransformTakeWhile() {
    JBIterable<Integer> it = JBIterable.generate(1, INCREMENT).filter(IS_ODD).transform(SQUARE).takeWhile(LESS_THAN(100));
    assertEquals(Arrays.asList(1, 9, 25, 49, 81), it.toList());
    assertEquals(new Integer(1), it.first());
    assertEquals(new Integer(81), it.last());
  }

  public void testFilterTransformSkipWhile() {
    JBIterable<Integer> it = JBIterable.generate(1, INCREMENT).filter(IS_ODD).transform(SQUARE).skipWhile(LESS_THAN(100)).take(3);
    assertEquals(Arrays.asList(121, 169, 225), it.toList());
    assertEquals(new Integer(121), it.first());
    assertEquals(new Integer(225), it.last());
  }

  // TreeTraverser ----------------------------------------------

  @NotNull
  private static TreeTraverser<Integer> traverser() {
    return new TreeTraverser<Integer>(Functions.fromMap(numbers()));
  }

  public void testSimplePreOrderDfs() {
    TreeTraverser<Integer> t = traverser();
    assertEquals(Arrays.asList(1, 2, 5, 6, 7, 3, 8, 9, 10, 4, 11, 12, 13), t.preOrderTraversal(1).toList());
  }

  public void testSimplePostOrderDfs() {
    TreeTraverser<Integer> t = traverser();
    assertEquals(Arrays.asList(5, 6, 7, 2, 8, 9, 10, 3, 11, 12, 13, 4, 1), t.postOrderTraversal(1).toList());
  }

  public void testSimpleBfs() {
    TreeTraverser<Integer> t = traverser();
    assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), t.breadthFirstTraversal(1).toList());
  }

  // FilteredTraverser ----------------------------------------------

  @NotNull
  private static FilteredTraverser<Integer> filteredTraverser() {
    return new FilteredTraverser<Integer>(Functions.fromMap(numbers()));
  }

  public void testSimpleFilter() {
    FilteredTraverser<Integer> t = filteredTraverser();
    assertEquals(Arrays.asList(1, 5, 7, 3, 9, 11, 13), t.withRoot(1).filter(IS_ODD).toList());
  }

  public void testSimpleExpand() {
    FilteredTraverser<Integer> t = filteredTraverser();
    assertEquals(Arrays.asList(1, 2, 3, 8, 9, 10, 4), t.withRoot(1).expand(IS_ODD).toList());
  }

  public void testExpandFilter() {
    FilteredTraverser<Integer> t = filteredTraverser();
    assertEquals(Arrays.asList(1, 3, 9), t.withRoot(1).expand(IS_ODD).filter(IS_ODD).toList());
  }

  public void testSkipExpandedDfs() {
    FilteredTraverser<Integer> t = filteredTraverser();
    assertEquals(Arrays.asList(2, 8, 9, 10, 4), t.withRoot(1).expand(IS_ODD).leavesOnly(true).leavesTraversal().toList());
  }

  public void testSkipExpandedBfs() {
    FilteredTraverser<Integer> t = filteredTraverser();
    assertEquals(Arrays.asList(2, 4, 8, 9, 10), t.withRoot(1).expand(IS_ODD).leavesOnly(true).leavesBreadthFirstTraversal().toList());
  }

  public void testExpandSkipFilterReset() {
    FilteredTraverser<Integer> t = filteredTraverser();
    assertEquals(Arrays.asList(1, 5, 7, 3, 9, 11, 13), t.withRoot(1).expand(IS_ODD).
      leavesOnly(true).reset().filter(IS_ODD).toList());
  }

  public void testFilterChildren() {
    FilteredTraverser<Integer> t = filteredTraverser();
    assertEquals(Arrays.asList(1, 5, 7, 3, 9, 11, 13), t.withRoot(1).children(IS_ODD).toList());
  }

  public void testEndlessGraph() {
    FilteredTraverser<Integer> t = new FilteredTraverser<Integer>(new Function<Integer, Iterable<Integer>>() {
      @Override
      public Iterable<Integer> fun(Integer k) {
        return JBIterable.generate(k, INCREMENT).transform(SQUARE).take(3);
      }
    });
    assertEquals(Arrays.asList(1, 1, 4, 9, 1, 4, 9, 16, 25, 36, 81), t.withRoot(1).breadthFirstTraversal().take(11).toList());
  }

  public void testEndlessGraphParents() {
    FilteredTraverser<Integer> t = new FilteredTraverser<Integer>(new Function<Integer, Iterable<Integer>>() {
      @Override
      public Iterable<Integer> fun(Integer k) {
        return JBIterable.generate(1, k, FIBONACCI).skip(2).take(3);
      }
    });
    TreeTraverser.TracingIt<Integer> it = t.withRoot(1).preOrderTraversal().skip(20).typedIterator();
    TreeTraverser.TracingIt<Integer> cursor = JBIterator.cursor(it).first();
    assertNotNull(cursor);
    assertSame(cursor, it);
    assertEquals(Arrays.asList(20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), cursor.backtrace().toList());
  }

}


text:
this is a test repository!
的设备vsdnfndsndks


text:
from .catalog import Catalog
from .imagepicker import ImagePicker


text:
\hypertarget{quest_8h}{\section{quest.\-h File Reference}
\label{quest_8h}\index{quest.\-h@{quest.\-h}}
}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item
const char $\ast$ \hyperlink{quest_8h_a33504d3cfa7980c5646061494f95132b}{viewrules} ()
\end{DoxyCompactItemize}

\subsection{Function Documentation}
\hypertarget{quest_8h_a33504d3cfa7980c5646061494f95132b}{\index{quest.\-h@{quest.\-h}!viewrules@{viewrules}}
\index{viewrules@{viewrules}!quest.h@{quest.\-h}}
\subsubsection[{viewrules}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ viewrules (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{quest_8h_a33504d3cfa7980c5646061494f95132b}


text:
namespace Google.Cloud.Dialogflow.V2.Snippets
{
    // [START dialogflow_v2_generated_Contexts_DeleteContext_async]
    using Google.Cloud.Dialogflow.V2;
    using System.Threading.Tasks;

    public sealed partial class GeneratedContextsClientSnippets
    {
        /// <summary>Snippet for DeleteContextAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteContextRequestObjectAsync()
        {
            // Create client
            ContextsClient contextsClient = await ContextsClient.CreateAsync();
            // Initialize request argument(s)
            DeleteContextRequest request = new DeleteContextRequest
            {
                ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
            };
            // Make the request
            await contextsClient.DeleteContextAsync(request);
        }
    }
    // [END dialogflow_v2_generated_Contexts_DeleteContext_async]
}


text:
{% extends "layout.html"  %}
{% block body %}

Now viewing all meals [View random meal]

{% for meal in meals %}

{{ meal }}

{% endfor %}

{% endblock %}


text:
layout: blog_by_author
author_name: Pratap J Rao
title: Pratap J Rao
subtitle: Pratap J Rao
permalink: authors/PratapJRao/
web: http://pixelshooter.net
email: pratap@pixelshooter.net
bio: "Over the years, I have made my interest in photography as wholesome as possible. I have been sharing photos on this website since its inception in 2006.  I have also made it a point to travel the length and breadth of India. In the process I have fallen in love with Himalayas, discovered a deep love for Landscape Photography, kept alive my interest for nature, and also professionally covered weddings and other events. My knowledge of photography is from this rich hands-on experience.

I am also a print maker, having started archival printing in Bangalore at a time when not many photogs were even aware of the term. Completely self-taught, I print with a Canon Pixma Pro9500, and I'll be glad to show you my portfolio in prints. I also conduct photography workshops and tours. Keep visiting this site to see announcements about my future workshops.
"
avatar: pratapjrao.jpg
twitter: pixelshooter
googleplus:
linkedin:
instagram:
tumblr:
github:
stackoverflow:
lastfm:
dribbble:
pinterest:
foursquare:
steam:
youtube:
soundcloud:
weibo:
flickr:
---


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('logos', '0002_useroptions'),
    ]

    operations = [
        migrations.RenameField(
            model_name='useroptions',
            old_name='username',
            new_name='user',
        ),
    ]


text:
package org.jboss.weld.tests.unit.hierarchy.discovery.event;

public interface Interface3<I3> {

}


text:
<?php

namespace Matthias\SymfonyDependencyInjectionTest\Tests\Fixtures;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;

class NonDependablePrependableExtension implements ExtensionInterface, PrependExtensionInterface
{
    public function load(array $config, ContainerBuilder $container): void
    {
    }

    public function getAlias()
    {
        return 'non_dependable';
    }

    public function getNamespace(): void
    {
    }

    public function getXsdValidationBasePath(): void
    {
    }

    public function prepend(ContainerBuilder $container)
    {
        $container->setParameter('parameter_from_non_dependable', 'non-dependable value');
    }
}


text:
"""URL routes for API resources."""

from __future__ import unicode_literals

from .resources.aggregation import AggregationGroupResource
from .resources.aggregation import AggregationGroupListResource
from .resources.aggregation import AggregationListResource
from .resources.aggregation import AggregationExploreResource
from .resources.aggregation import AggregationInfoResource
from .resources.aggregation import AggregationResource
from .resources.analysis import AnalysisResource
from .resources.analysis import AnalyzerRunResource
from .resources.analysis import AnalyzerSessionActiveListResource
from .resources.analysis import AnalyzerSessionResource
from .resources.attribute import AttributeResource
from .resources.explore import ExploreResource
from .resources.explore import SearchHistoryResource
from .resources.explore import SearchHistoryTreeResource
from .resources.datafinder import DataFinderResource
from .resources.datasource import DataSourceResource
from .resources.datasource import DataSourceListResource
from .resources.event import EventResource
from .resources.event import EventAnnotationResource
from .resources.event import EventCreateResource
from .resources.event import EventTaggingResource
from .resources.event import EventAddAttributeResource
from .resources.event import CountEventsResource
from .resources.event import MarkEventsWithTimelineIdentifier
from .resources.sketch import SketchResource
from .resources.sketch import SketchListResource
from .resources.archive import SketchArchiveResource
from .resources.information import VersionResource
from .resources.view import ViewResource
from .resources.view import ViewListResource
from .resources.searchtemplate import SearchTemplateResource
from .resources.searchtemplate import SearchTemplateParseResource
from .resources.searchtemplate import SearchTemplateListResource
from .resources.upload import UploadFileResource
from .resources.task import TaskResource
from .resources.story import StoryListResource
from .resources.story import StoryResource
from .resources.explore import QueryResource
from .resources.timeline import TimelineResource
from .resources.timeline import TimelineListResource
from .resources.searchindex import SearchIndexListResource
from .resources.searchindex import SearchIndexResource
from .resources.session import SessionResource
from .resources.user import UserListResource
from .resources.user import GroupListResource
from .resources.user import CollaboratorResource
from .resources.user import LoggedInUserResource
from .resources.sigma import SigmaResource
from .resources.sigma import SigmaListResource
from .resources.sigma import SigmaByTextResource
from .resources.sigma import SigmaRuleResource
from .resources.sigma import SigmaRuleListResource
from .resources.sigma import SigmaRuleByTextResource
from .resources.graph import GraphListResource
from .resources.graph import GraphResource
from .resources.graph import GraphPluginListResource
from .resources.graph import GraphCacheResource
from .resources.intelligence import TagMetadataResource

from .resources.scenarios import ScenarioTemplateListResource
from .resources.scenarios import ScenarioListResource

# Disable error for long line. Readability is more important than line
# length in this case.
# pylint: disable=line-too-long
API_ROUTES = [
    (SketchListResource, "/sketches/"),
    (SketchResource, "/sketches/<int:sketch_id>/"),
    (SketchArchiveResource, "/sketches/<int:sketch_id>/archive/"),
    (
        AnalysisResource,
        "/sketches/<int:sketch_id>/timelines/<int:timeline_id>/analysis/",
    ),
    (AnalyzerRunResource, "/sketches/<int:sketch_id>/analyzer/"),
    (
        AnalyzerSessionActiveListResource,
        "/sketches/<int:sketch_id>/analyzer/sessions/active/",
    ),
    (
        AnalyzerSessionResource,
        "/sketches/<int:sketch_id>/analyzer/sessions/<int:session_id>/",
    ),
    (AggregationListResource, "/sketches/<int:sketch_id>/aggregation/"),
    (
        AggregationGroupResource,
        "/sketches/<int:sketch_id>/aggregation/group/<int:group_id>/",
    ),
    (AggregationGroupListResource, "/sketches/<int:sketch_id>/aggregation/group/"),
    (AggregationExploreResource, "/sketches/<int:sketch_id>/aggregation/explore/"),
    (AggregationInfoResource, "/aggregation/info/"),
    (
        AggregationResource,
        "/sketches/<int:sketch_id>/aggregation/<int:aggregation_id>/",
    ),
    (ExploreResource, "/sketches/<int:sketch_id>/explore/"),
    (SearchHistoryResource, "/sketches/<int:sketch_id>/searchhistory/"),
    (SearchHistoryTreeResource, "/sketches/<int:sketch_id>/searchhistorytree/"),
    (EventResource, "/sketches/<int:sketch_id>/event/"),
    (EventAddAttributeResource, "/sketches/<int:sketch_id>/event/attributes/"),
    (EventTaggingResource, "/sketches/<int:sketch_id>/event/tagging/"),
    (EventAnnotationResource, "/sketches/<int:sketch_id>/event/annotate/"),
    (EventCreateResource, "/sketches/<int:sketch_id>/event/create/"),
    (
        MarkEventsWithTimelineIdentifier,
        "/sketches/<int:sketch_id>/event/add_timeline_id/",
    ),
    (ViewListResource, "/sketches/<int:sketch_id>/views/"),
    (AttributeResource, "/sketches/<int:sketch_id>/attribute/"),
    (ViewResource, "/sketches/<int:sketch_id>/views/<int:view_id>/"),
    (SearchTemplateListResource, "/searchtemplate/"),
    (SearchTemplateResource, "/searchtemplate/<int:searchtemplate_id>/"),
    (SearchTemplateParseResource, "/searchtemplate/<int:searchtemplate_id>/parse/"),
    (UploadFileResource, "/upload/"),
    (TaskResource, "/tasks/"),
    (StoryListResource, "/sketches/<int:sketch_id>/stories/"),
    (StoryResource, "/sketches/<int:sketch_id>/stories/<int:story_id>/"),
    (QueryResource, "/sketches/<int:sketch_id>/explore/query/"),
    (CountEventsResource, "/sketches/<int:sketch_id>/count/"),
    (TimelineListResource, "/sketches/<int:sketch_id>/timelines/"),
    (TimelineResource, "/sketches/<int:sketch_id>/timelines/<int:timeline_id>/"),
    (SearchIndexListResource, "/searchindices/"),
    (SearchIndexResource, "/searchindices/<int:searchindex_id>/"),
    (
        SessionResource,
        "/sketches/<int:sketch_id>/explore/sessions/<string:timeline_index>",
    ),
    (UserListResource, "/users/"),
    (GroupListResource, "/groups/"),
    (CollaboratorResource, "/sketches/<int:sketch_id>/collaborators/"),
    (VersionResource, "/version/"),
    (SigmaListResource, "/sigma/"),  # TODO(jaegeral): deprecate this
    (SigmaResource, "/sigma/rule/<string:rule_uuid>/"),  # TODO: deprecate
    (SigmaByTextResource, "/sigma/text/"),  # TODO(jaegeral): deprecate this
    (SigmaRuleListResource, "/sigmarule/"),
    (SigmaRuleResource, "/sigmarule/<string:rule_uuid>/"),
    (SigmaRuleByTextResource, "/sigmarule/text/"),
    (LoggedInUserResource, "/users/me/"),
    (GraphListResource, "/sketches/<int:sketch_id>/graphs/"),
    (GraphResource, "/sketches/<int:sketch_id>/graphs/<int:graph_id>/"),
    (GraphPluginListResource, "/graphs/"),
    (GraphCacheResource, "/sketches/<int:sketch_id>/graph/"),
    (DataSourceListResource, "/sketches/<int:sketch_id>/datasource/"),
    (DataSourceResource, "/sketches/<int:sketch_id>/datasource/<int:datasource_id>/"),
    (DataFinderResource, "/sketches/<int:sketch_id>/data/find/"),
    (ScenarioTemplateListResource, "/scenarios/"),
    (ScenarioListResource, "/sketches/<int:sketch_id>/scenarios/"),
    (TagMetadataResource, "/intelligence/tagmetadata/"),
]


text:
package jwtc.android.chess.pubnub;

import android.app.ListActivity;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;

import jwtc.android.chess.R;

public class PubnubUserListActivity extends ListActivity {
    private static final String LOG_TAG = "PUBNUB";

    public static final String HERE_NOW_PINTENT = "userListHereNowIntent";
    public static final String PRESENCE_PINTENT = "presenceIntent";
    public static final String SUBSCRIBE_PINTENT = "subscribeIntent";

    public static final int HERE_NOW_CODE = 101;
    public static final int PRESENCE_JOIN_CODE = 102;
    public static final int PRESENCE_STATE_CODE = 103;
    public static final int PRESENCE_LEAVE_CODE = 104;
    public static final int SUBSCRIBE_STATISTICS_CODE = 105;

    public final static String HERE_NOW_RESULT = "userListHereNowResult";
    public final static String PRESENCE_JOIN_RESULT = "presenceJoinResult";
    public final static String PRESENCE_STATE_RESULT = "presenceStateResult";
    public final static String PRESENCE_LEAVE_RESULT = "presenceLeaveResult";
    public final static String SUBSCRIBE_STATISTICS_RESULT = "subscribeStatisticsResult";

    public static final int HERE_NOW_TASK = 2;
    public static final int PRESENCE_TASK = 3;
    public static final int SUBSCRIBE_STATISTICS_TASK = 4;

    static boolean isActive = false; // used in PubnubService to understand is PubnubUserListActivity active now or not
    static boolean isPresenceCalled = false;
    private String myName;
    private PubnubService pubnubService;

    private TextView tvStatistics;
    private ArrayList<PubnubUser> users;
    private PubnubArrayAdapter adapter;

    private boolean bound = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(LOG_TAG, "UserListActivity.onCreate()");
        setContentView(R.layout.pubnub_list_view);
        myName = getIntent().getStringExtra("myName");
        tvStatistics = (TextView) findViewById(R.id.tvStatistics);
        users = new ArrayList<PubnubUser>();
        adapter = new PubnubArrayAdapter(PubnubUserListActivity.this, users);
        adapter.setMyName(myName);
        setListAdapter(adapter);
        Toast.makeText(PubnubUserListActivity.this, "Download user list", Toast.LENGTH_SHORT).show();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Log.d(LOG_TAG, "requestCode = " + requestCode + ", resultCode = " + resultCode);
        switch (requestCode) {
            case HERE_NOW_TASK:
                if (resultCode == HERE_NOW_CODE) {
                    ArrayList<PubnubUser> hereNowUsers = data.getExtras().getParcelableArrayList(HERE_NOW_RESULT);
                    if (hereNowUsers == null || users == null) return;
                    users.removeAll(hereNowUsers);
                    users.addAll(hereNowUsers);
                    adapter.notifyDataSetChanged();
                }
                break;
            case PRESENCE_TASK:
                switch (resultCode) {
                    case PRESENCE_JOIN_CODE:
                        PubnubUser joinedUser = data.getParcelableExtra(PRESENCE_JOIN_RESULT);
                        if (null == joinedUser) break;
                        if (joinedUser.getName().equalsIgnoreCase(myName)) break;
                        for (PubnubUser user : users) {
                            if (user.getName().equalsIgnoreCase(joinedUser.getName())) {
                                return;
                            }
                        }
                        users.add(joinedUser);
                        adapter.notifyDataSetChanged();
                        break;
                    case PRESENCE_STATE_CODE:
                        PubnubUser stateChangedUser = data.getParcelableExtra(PRESENCE_STATE_RESULT);
                        for (PubnubUser user : users) {
                            if (user.getName().equalsIgnoreCase(stateChangedUser.getName())) {
                                user.setStatus(stateChangedUser.getStatus());
                                adapter.notifyDataSetChanged();
                                break;
                            }
                        }
                        break;
                    case PRESENCE_LEAVE_CODE:
                        String name = data.getStringExtra(PRESENCE_LEAVE_RESULT);
                        for (PubnubUser user : users) {
                            if (user.getName().equalsIgnoreCase(name)) {
                                users.remove(user);
                                adapter.notifyDataSetChanged();
                                break;
                            }
                        }
                        break;
                    default:
                        break;
                }
                break;
            case SUBSCRIBE_STATISTICS_TASK:
                if (resultCode == SUBSCRIBE_STATISTICS_CODE) {
                    String statistics = data.getStringExtra(SUBSCRIBE_STATISTICS_RESULT);
                    tvStatistics.setText(statistics);
                }
                break;
            default:
                break;
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d(LOG_TAG, "PubnubUserListActivity.onStart()");
        PendingIntent pendingIntent;
        Intent intent;
        pendingIntent = createPendingResult(PRESENCE_TASK, new Intent(), 0);
        intent = new Intent(PubnubUserListActivity.this, PubnubService.class).putExtra(PRESENCE_PINTENT, pendingIntent);
        startService(intent);
        pendingIntent = createPendingResult(HERE_NOW_TASK, new Intent(), 0);
        intent = new Intent(PubnubUserListActivity.this, PubnubService.class).putExtra(HERE_NOW_PINTENT, pendingIntent);
        startService(intent);
        pendingIntent = createPendingResult(SUBSCRIBE_STATISTICS_TASK, new Intent(), 0);
        intent = new Intent(PubnubUserListActivity.this, PubnubService.class).putExtra(SUBSCRIBE_PINTENT, pendingIntent);
        startService(intent);
        myName = getIntent().getStringExtra("myName");
        isActive = true;
        if (bound) return;
        Intent bindIntent = new Intent(PubnubUserListActivity.this, PubnubService.class);
        bindService(bindIntent, serviceConnection, Context.BIND_AUTO_CREATE);
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d(LOG_TAG, "PubnubUserListActivity.onStop()");
        //pubnubService.unsubscribePresencePubnub();
        isActive = false;
        /*if (!bound) return;
        unbindService(serviceConnection);
        bound = false;*/
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        Log.d(LOG_TAG, "PubnubUserListActivity.onBackButtonPressed()");
        pubnubService.unsubscribeFromPubnubChannel();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d(LOG_TAG, "PubnubUserListActivity.onDestroy()");
        if (!bound) return;
        unbindService(serviceConnection);
        bound = false;
    }

    public void onUserItemPlayBtnClick(View v) {
        pubnubService.unsubscribeFromPubnubChannel();
        isActive = false;
        RelativeLayout vwParentRow = (RelativeLayout) v.getParent();
        TextView child = (TextView) vwParentRow.getChildAt(0);
        String acceptor = child.getText().toString();
        String gameId = UUID.randomUUID().toString();
        String gameCreate = "{ game : 'create',  initiator : '" + myName + "', acceptor: '" + acceptor + "', gameId: '" + gameId + "' }";
        Intent i = new Intent();
        i.putExtra("gameCreate", gameCreate);
        i.setClass(PubnubUserListActivity.this, PubnubChessActivity.class);
        startActivity(i);
    }

    private ServiceConnection serviceConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            Log.d(LOG_TAG, "PubnubUserListActivity connected to Service.");
            pubnubService = ((PubnubService.LocalBinder) iBinder).getService();
            bound = true;
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            Log.d(LOG_TAG, "PubnubUserListActivity disconnected from Service.");
            bound = false;
        }
    };
}


text:
// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef TXHISTORYDIALOG_H
#define TXHISTORYDIALOG_H

#include "guiutil.h"
#include "uint256.h"

#include <map>

#include <QDialog>

class ClientModel;
class WalletModel;

QT_BEGIN_NAMESPACE
class QMenu;
class QModelIndex;
class QPoint;
class QResizeEvent;
class QString;
class QWidget;
QT_END_NAMESPACE

namespace Ui {
    class txHistoryDialog;
}

class HistoryTXObject
{
public:
    HistoryTXObject()
      : blockHeight(-1), blockByteOffset(0), valid(false), fundsMoved(true) {};
    int blockHeight; // block transaction was mined in
    int blockByteOffset; // byte offset the tx is stored in the block (used for ordering multiple txs same block)
    bool valid; // whether the transaction is valid from an Omni perspective
    bool fundsMoved; // whether tokens actually moved in this transaction
    std::string txType; // human readable string containing type
    std::string address; // the address to be displayed (usually sender or recipient)
    std::string amount; // string containing formatted amount
};

typedef std::map<uint256, HistoryTXObject> HistoryMap;

/** Dialog for looking up Master Protocol tokens */
class TXHistoryDialog : public QDialog
{
    Q_OBJECT

public:
    explicit TXHistoryDialog(QWidget *parent = 0);
    ~TXHistoryDialog();

    void setClientModel(ClientModel *model);
    void setWalletModel(WalletModel *model);

    virtual void resizeEvent(QResizeEvent* event);
    std::string shrinkTxType(int txType, bool *fundsMoved);

private:
    Ui::txHistoryDialog *ui;
    ClientModel *clientModel;
    WalletModel *walletModel;
    GUIUtil::TableViewLastColumnResizingFixer *borrowedColumnResizingFixer;
    QMenu *contextMenu;
    HistoryMap txHistoryMap;

private Q_SLOTS:
    void contextualMenu(const QPoint &point);
    void showDetails();
    void copyAddress();
    void copyAmount();
    void copyTxID();
    void UpdateHistory();
    int PopulateHistoryMap();
    void UpdateConfirmations();
    void checkSort(int column);

public Q_SLOTS:
    void focusTransaction(const uint256& txid);
    void ReinitTXHistoryTable();

Q_SIGNALS:
    void doubleClicked(const QModelIndex& idx);
    // Fired when a message should be reported to the user
    void message(const QString &title, const QString &message, unsigned int style);
};

#endif // TXHISTORYDIALOG_H


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using UnityEngine;

namespace BuildingThemes
{
    public class Configuration
    {
        public int version = 0;

        public bool UnlockPolicyPanel = true;

        public bool CreateBuildingDuplicates = false;

        [DefaultValue(true)]
        public bool ThemeValidityWarning = true;

        [XmlArray(ElementName = "Themes")]
        [XmlArrayItem(ElementName = "Theme")]
        public List<Theme> themes = new List<Theme>();

        public Theme getTheme(string name)
        {
            foreach (Theme theme in themes)
            {
                if (theme.name == name) return theme;
            }
            return null;
        }

        public class Theme
        {
            [XmlAttribute("name")]
            public string name;

            [XmlIgnoreAttribute]
            public bool isBuiltIn = false;

            [XmlAttribute("style-package"), DefaultValue(null)]
            public string stylePackage = null;

            [XmlArray(ElementName = "Buildings")]
            [XmlArrayItem(ElementName = "Building")]
            public List<Building> buildings = new List<Building>();

            public bool containsBuilding(string name)
            {
                foreach (Building building in buildings)
                {
                    if (building.name == name) return true;
                }
                return false;
            }

            public IEnumerable<Building> getVariations(string baseName)
            {
                return from building in buildings where building.baseName == baseName select building;
            }

            public Building getBuilding(string name)
            {
                foreach (Building building in buildings)
                {
                    if (building.name == name) return building;
                }
                return null;
            }
        }

        public class Building
        {
            [XmlAttribute("name")]
            public string name;

            [XmlIgnoreAttribute]
            public Building builtInBuilding = null;

            [XmlIgnoreAttribute()]
            public bool fromStyle = false;

            [XmlAttribute("level"), DefaultValue(-1)]
            public int level = -1;

            [XmlAttribute("upgrade-name"), DefaultValue(null)]
            public string upgradeName = null;

            [XmlAttribute("base-name"), DefaultValue(null)]
            public string baseName = null;

            [XmlAttribute("spawn-rate"), DefaultValue(10)]
            public int spawnRate = 10;

            [XmlAttribute("include"), DefaultValue(true)]
            public bool include = true;

            [XmlAttribute("dlc"), DefaultValue(null)]
            public string dlc = null;

            [XmlAttribute("environments"), DefaultValue(null)]
            public string environments = null;

            public bool Equals(Building other)
            {
                if (other == null) { return false; }
                if (object.ReferenceEquals(this, other)) { return true; }
                return this.name == other.name
                    && this.level == other.level
                    && this.upgradeName == other.upgradeName
                    && this.baseName == other.baseName
                    && this.spawnRate == other.spawnRate
                    && this.include == other.include;
            }

            public Building(string name)
            {
                this.name = name;
            }

            public Building(Building builtInBuilding)
            {
                this.builtInBuilding = builtInBuilding;

                this.name = builtInBuilding.name;
                this.level = builtInBuilding.level;
                this.upgradeName = builtInBuilding.upgradeName;
                this.baseName = builtInBuilding.baseName;
                this.spawnRate = builtInBuilding.spawnRate;
                this.include = builtInBuilding.include;
                this.dlc = builtInBuilding.dlc;
                this.environments = builtInBuilding.environments;
            }

            public Building()
            {
            }
        }

        public static Configuration Deserialize(string filename)
        {
            if (!File.Exists(filename)) return null;

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration));
            try
            {
                using (System.IO.StreamReader streamReader = new System.IO.StreamReader(filename))
                {
                    return (Configuration)xmlSerializer.Deserialize(streamReader);
                }
            }
            catch (Exception e)
            {
                Debugger.Log("Couldn't load configuration (XML malformed?)");
                throw e;
            }
        }

        public static void Serialize(string filename, Configuration config)
        {
            var xmlSerializer = new XmlSerializer(typeof(Configuration));
            try
            {
                using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(filename))
                {
                    var configCopy = new Configuration();

                    configCopy.version = config.version;
                    configCopy.UnlockPolicyPanel = config.UnlockPolicyPanel;
                    configCopy.CreateBuildingDuplicates = config.CreateBuildingDuplicates;
                    configCopy.ThemeValidityWarning = config.ThemeValidityWarning;

                    foreach (var theme in config.themes)
                    {
                        var newTheme = new Theme
                        {
                            name = theme.name,
                            stylePackage = theme.stylePackage
                        };
                        foreach (var building in theme.buildings.Where(building =>
                            // a user-added building has to be included, or we don't need it in the config
                            (building.builtInBuilding == null && building.include)

                                // a built-in building that was modified by the user: Only add it to the config if the modification differs
                            || (building.builtInBuilding != null && !building.Equals(building.builtInBuilding))))
                        {
                            newTheme.buildings.Add(building);
                        }
                        if (!theme.isBuiltIn || newTheme.buildings.Count > 0)
                        {
                            configCopy.themes.Add(newTheme);
                        }
                    }

                    xmlSerializer.Serialize(streamWriter, configCopy);
                }
            }
            catch (Exception e)
            {
                Debugger.Log("Couldn't create configuration file at \"" + Directory.GetCurrentDirectory() + "\"");
                throw e;
            }
        }
    }
}


text:
<?php

namespace Respect\Validation\Rules;

use PHPUnit_Framework_TestCase;
use SplFileInfo;

/**
 * @author Henrique Moody <henriquemoody@gmail.com>
 * @group  rule
 * @covers Respect\Validation\Rules\Extension
 * @covers Respect\Validation\Exceptions\ExtensionException
 */
class ExtensionTest extends PHPUnit_Framework_TestCase
{
    public function providerValidExtension()
    {
        return array(
            array('filename.txt', 'txt'),
            array('filename.jpg', 'jpg'),
            array('filename.inc.php', 'php'),
            array('filename.foo.bar.bz2', 'bz2'),
        );
    }

    /**
     * @dataProvider providerValidExtension
     */
    public function testShouldValidateExtension($filename, $extension)
    {
        $rule = new Extension($extension);

        $this->assertTrue($rule->validate($filename));
    }

    public function testShouldAcceptSplFileInfo()
    {
        $fileInfo = new SplFileInfo(__FILE__);

        $rule = new Extension('php');

        $this->assertTrue($rule->validate($fileInfo));
    }

    public function testShouldInvalidWhenNotStringNorSplFileInfo()
    {
        $nonFile = array(__FILE__);

        $rule = new Extension('php');

        $this->assertFalse($rule->validate($nonFile));
    }

    /**
     * @expectedException Respect\Validation\Exceptions\ExtensionException
     * @expectedExceptionMessage "filename.jpg" must have "png" extension
     */
    public function testShouldThrowExtensionExceptionWhenCheckingValue()
    {
        $rule = new Extension('png');
        $rule->check('filename.jpg');
    }
}


text:
moduloDirectivas.component('manytomany', {
    templateUrl: "js/system/components/manytomany/manytomany.html",
    controllerAs: 'mtm',
    controller: manyToMany,
    bindings: {
        iconbootstrap: '@',
        id: '<',
        referencetable: '<',
        table: '<'
    }

});

function manyToMany(serverService, $uibModal) {
    var self = this;

    self.open = function (id) {
        var modalInstance = $uibModal.open({
            templateUrl: 'js/system/components/manytomany/modal.html',
            controller: 'mtmModal',
            windowClass: 'mtmModal1',
            resolve: {
                id: function () {
                    return id;
                },
                reference: function () {
                    return self.referencetable;
                },
                currentTable: function () {
                    return self.table;
                }
            }
        });

    };

//    function getData(id) {
//        var filter = '&filter=and,id_' + self.table + ',equa,' + id;
//        serverService.promise_getAll(self.referencetable.name,filter).then(function (data) {
//            var vars = self.referencetable.vars;
//            var mdata = data.data.message;
//            var result = [];
//
//            for (var d in mdata) {
//                var res = [];
//                for (var v in vars) {
//                    if (typeof vars[v] === 'object') {
//                        var n = Object.keys(vars[v]);
//                        res.push(mdata[d][n[0]][vars[v][n[0]]]);
//                    } else {
//                        res.push(mdata[d][vars[v]]);
//                    }
//                }
//                result.push(res);
//            }
//
//            self.data = result;
//        }).catch(function (err) {
//            console.log('error', err);
//        });
//    }
}


text:
<?php

class Doctrine_Template_Listener_DmCommentable extends Doctrine_Record_Listener
{

  public function __construct($options = array())
  {
    $this->_options = $options;
  }

  public function postDelete(Doctrine_Event $event)
  {
    $event->getInvoker()->getComments()->delete();
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
        name="Alfresco Share JAR Archetype."
        xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <requiredProperties>
        <requiredProperty key="version">
            <defaultValue>1.0-SNAPSHOT</defaultValue>
        </requiredProperty>
    </requiredProperties>

    <fileSets>
        <fileSet filtered="false" packaged="false" encoding="UTF-8">
            <directory>src/main/assembly</directory>
            <includes>
                <include>**</include>
            </includes>
        </fileSet>
        <fileSet filtered="true" packaged="true" encoding="UTF-8">
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.java</include>
            </includes>
        </fileSet>
        <fileSet filtered="true" packaged="true" encoding="UTF-8">
            <directory>src/test/java</directory>
            <includes>
                <include>**/*.java</include>
            </includes>
        </fileSet>
        <fileSet filtered="true" packaged="false" encoding="UTF-8">
            <directory>src/main/resources/alfresco/web-extension</directory>
            <includes>
                <include>__artifactId__-slingshot-application-context.xml</include>
            </includes>
        </fileSet>
        <fileSet filtered="true" packaged="false" encoding="UTF-8">
            <directory>src/main/resources/alfresco/web-extension/site-data/extensions</directory>
            <includes>
                <include>__artifactId__-example-widgets.xml</include>
            </includes>
        </fileSet>
        <fileSet encoding="UTF-8" filtered="false">
            <directory>src/main/resources</directory>
            <includes>
                <include>**</include>
            </includes>
            <excludes>
                <exclude>**/__artifactId__-slingshot-application-context.xml</exclude>
                <exclude>**/__artifactId__-example-widgets.xml</exclude>
            </excludes>
        </fileSet>
        <fileSet filtered="true" packaged="false" encoding="UTF-8">
            <directory>src/test/resources</directory>
            <includes>
                <include>**</include>
            </includes>
        </fileSet>

        <fileSet encoding="UTF-8">
            <directory></directory>
            <includes>
                <include>debug.sh</include>
                <include>debug.bat</include>
                <include>run.sh</include>
                <include>run.bat</include>
                <include>README.md</include>
            </includes>
        </fileSet>
    </fileSets>
</archetype-descriptor>


text:
![Typewriter.js](https://raw.githubusercontent.com/mwrouse/typewriter.js/master/images/typewriterjs.gif)
<hr/>
A *pure JavaScript* library that allows for easy, and customizable typewriter effects.

Coming in at under 6KB, this library is lightweight, and extremely simple!

No bullshit features or functions, just straight to the point!

[See an example](https://github.com/mwrouse/typewriter.js#example)

## Usage
Typewriter.js is a simple library, works on zero customization, but is also very customizable.

To begin, a basic scenario:
```html
<div id="typewriter"></div>
```
This is the element that we want our typewriter effect to happen in.

You need to pair this with the following JavaScript:
```javascript
var elem = document.getElementById('typewriter');
elem.typewriter('Hello, World!').start();
```
This is the most basic case for Typewriter.js, the ```.start()``` **is** required.

This would type out ```Hello, World!``` inside the ```#typewriter``` DOM Element.

### Options
To customize the script, you need to pass it options:
```javascript
var options = {
    start_delay: 3 // Delay in seconds before it starts typing
};
elem.typewriter('Hello, World!', options).start();
```
Above is an example of simple options, this script will wait three seconds, and then type ```Hello, World!```

Options is the second, and last, parameter of ```typewriter```.

Here is the full list of available options:
```
                 mode: Mode to execute the script in (Default: 1/TYPEWRITER_MODE_DEFAULT)

          start_delay: Delay (in seconds) before the script starts typing (Default: 2)
       callback_delay: Delay (in seconds) before a callback function executes (Default: 1)

          letters.tag: HTML Tag to use for letters (Default: 'span')
        letters.class: Class to use on letters (animation) (Default: 'typewriter-letter')
 letters.remove_class: Class to use for removing letters (animation) (Default: typewriter-letter-remove')

           cursor.tag: HTML tag for the cursor (Default: 'span')
         cursor.class: Class to use on the cursor (animation) (Default: 'typewriter-cursor')
cursor.no_blink_class: Class that does not blink the cursor (Default: 'typewriter-cursor-noblink')
```
Note: letters and cursor are other objects

And, here is an example of options utilizing all of these:
```javascript
var options = {
                mode: TYPEWRITER_MODE_DEFAULT,

                start_delay: 3,
                callback_delay: 1.5,

                letters: {
                          tag: 'span',
                        class: 'letter',
                  remove_class: 'letter-remove'
                },

                 cursor: {
                           tag: 'span',
                         class: 'cursor',
                  no_blink_class: 'cursor-no-blink'
                 },
        };
```

#### setOptions method
If you prefer to not pass options as a parameter of ```typewriter```, then the ```setOptions``` method exists to set options:
```javascript
elem.typewriter('Hello, World!').setOptions(options).start();
```

#### setContent method
Similarly, the ```setContent``` method allows you to set the text to type:
```javascript
elem.typewriter().setContent('Hello, World!').start();
```
The ```setContent``` method is *extremely* useful when typing more stuff in callback functions.

Currently, ```setContent``` does not work when wanting to use modes ```TYPEWRITER_MODE_ARRAY``` and ```TYPEWRITER_MODE_CORRECTION```.

### Script Modes
Typewriter.js has three modes that you can use, ```DEFAULT```, ```CORRECTION```, and ```ARRAY```.

Each one allows for bigger and better typewriting effects, and requires that you format the first parameter of ```typewriter``` differently.

Here are some helper constants for you to remember the modes, and their integer values:
```
TYPEWRITER_MODE_DEFAULT => 0
TYPEWRITER_MODE_CORRECTION => 1
TYPEWRITER_MODE_ARRAY => 2
```

#### Default Mode (0)
The default mode, as its name implies, is the default/automatic mode that Typewriter.js will run under.

This mode requires that a ```string``` be the first parameter of ```typewriter```, here is a script that runs in ```DEFAULT MODE```:

```javascript
elem.typewriter('This is mode 0, or the default mode').start();
```
Which produces the following:

![Typewriter.js Default example](https://raw.githubusercontent.com/mwrouse/typewriter.js/master/images/default.gif)

#### Correction Mode (1)
Correction mode, as its name also implies, allows you to generate a spelling correction.

The first parameter now needs to be an ```array of strings```, with the first element being the incorrect version, and the second element being the corrected version. You will need to specify the mode in the options.

```javascript
elem.typewriter(['This was typedasdf in mode 1.', 'This was typed in mode 1.'],
  { mode: TYPEWRITER_MODE_CORRECTION }).start();
```
Which produces the following:

![Typewriter.js Correction example](https://raw.githubusercontent.com/mwrouse/typewriter.js/master/images/correction.gif)

Only the first two elements will be used, if you have more than two elements, they will not be used, see the ```TYPEWRITER_MODE_ARRAY``` mode.

#### Array Mode (2)
Array allows you to display multiple messages, one after another, as well as making corrections!

The first parameter must be an ```array```, which can have ```array``` or ```string``` elements.

```javascript
elem.typewriter(['This is the first sentence.', ['This is the secnd sentence', 'This is the second sentence']],
  { mode: TYPEWRITER_MODE_ARRAY }).start();
```
Which produces the following:

![Typewriter.js Array example](https://raw.githubusercontent.com/mwrouse/typewriter.js/master/images/array.gif)

### Callback Function
There are two ways to execute callback functions:

Using the ```setCallback``` method:
```javascript
elem.typewriter('Hello, World!', options).setCallback(function(me){
  console.log('callback function');
}).start();
```

**OR**, adding the function as a parameter to the ```start``` method:
```javascript
elem.typewriter('Hello, World!', options).start(function(me){
  console.log('callback function');
});
```
If you put both of these, the callback function that is a parameter to the ```start``` method is the one that will be executed.

The callback function will **only be called once**.

#### Callback Parameters
The first parameter of the callback function is a reference to ```typewriter```, you can use this to chain together typewriter functions, like so:
```javascript
elem.typewriter('Hello, World', options).start(function(me){
  me.erase(); // This will erase what was just typed
});
```

The Second parameter, optional, is a reference to the DOM Element that the typewriter is applied to, you can use this to make changes to the element in the callback function:
```javascript
element.typewriter('Hello, World', options).start(function(me, elem){
  elem.classList.add('finished'); // Will add the finished class to the element
});
```

### Backspacing
While it is recommended that you use the ```TYPEWRITER_MODE_CORRECTION``` mode to produce a correction effect, you may like to do things the old fashioned way, or the hard way. You do you.

For you people, the ```backspace``` method exists, call it from a callback function, using the syntax:
```javascript
me.backspace(callback_function);
```
Where ```me``` is a reference to ```typewriter```, the parameter we suggested you have in the callback function.
The ```backspace``` method accepts one parameter, which is a callback function, use this to daisy chain callbacks :)

Example:
```javascript
elem.typewriter('typewriter.py').start(function(me){
  // First backspace
  me.backspace(function(me){
    // Second backspace
    me.backspace(function(me){
      me.setContent('js').startNoDelay(); // Make correction, changes to typewriter.js
    });
  });
});
```
This will produce the following:

![Typewriter.js Backspace example](https://raw.githubusercontent.com/mwrouse/typewriter.js/master/images/backspace.gif)

This is the same as writing:
```javascript
elem.typewriter(['typewriter.py', 'typewriter.js'], { mode: TYPEWRITER_MODE_CORRECTION }).start();
```
And is the suggested way to make corrections.

### Erasing
Using the ```erase``` method, in a callback function, is a way to erase the entire sentence that has just been typed.

```javascript
elem.typewriter('This will all be erased').start(function(me){
  me.erase();
});
```
Which will result in the following:

![Typewriter.js erase example](https://raw.githubusercontent.com/mwrouse/typewriter.js/master/images/erase.gif)

The ```erase``` method also accepts a callback function like the ```backspace``` method.

You can use the ```TYPEWRITER_MODE_CORRECTION``` mode to simular this as well:
```javascript
elem.typewriter(['This will all be erased', ''], { mode: TYPEWRITER_MODE_CORRECTION }).start();
```

#### startNoDelay Method
In the above example there is the ```startNoDelay``` method, this does the exact same thing as the ```start``` method, except there is no delay before typing.

The ```startNoDelay``` method accepts a callback function as a parameter, just like the ```start``` method does.

## CSS Animations
This script utilizes the ```animationend``` event listener to trigger typing the next letter(s), removing letters, as well as callback functions on the last letters.

Therefore, if you want to speed up the typing or backspacing, simply increase the animation duration on your CSS classes for the ```letters.remove_class``` and ```letters.class``` CSS classes.

Likewise, to speedup these actions, slow down the animation durations.

## Example
View an example on [CodePen](http://codepen.io/mwrouse/full/PNpmbd)

The text will turn green when each callback function is executed, be sure to pay attention to that.

## License
Distributed under the [MIT License](https://raw.githubusercontent.com/mwrouse/typewriter.js/master/LICENSE).


text:
<?php

namespace spec\Gesdinet\JWTRefreshTokenBundle\DependencyInjection;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;

class GesdinetJWTRefreshTokenExtensionSpec extends ObjectBehavior
{
    public function it_is_initializable()
    {
        $this->shouldHaveType('Gesdinet\JWTRefreshTokenBundle\DependencyInjection\GesdinetJWTRefreshTokenExtension');
    }

    public function it_should_set_parameters_correctly(ContainerBuilder $container, ParameterBag $parameterBag)
    {
        $parameterBag->resolveValue(Argument::any())->will(function ($args) {
            return $args[0];
        });
        $parameterBag->unescapeValue(Argument::any())->will(function ($args) {
            return $args[0];
        });

        $container->getParameterBag()->willReturn($parameterBag);
        $container->fileExists(Argument::any())->willReturn(true);
        $container->setParameter(Argument::any(), Argument::any())->will(function () {
        });
        $container->setDefinition(Argument::any(), Argument::any())->will(function () {
        });
        $container->setAlias(Argument::any(), Argument::any())->will(function () {
        });
        $container->getReflectionClass(Argument::type('string'))->will(function ($args) {
            return new \ReflectionClass($args[0]);
        });
        $container->addResource(Argument::any())->willReturn(null);
        $container->removeBindings(Argument::any())->willReturn(null);

        $container->removeBindings(Argument::any())->will(function () {
        });

        $configs = [];
        $this->load($configs, $container);
    }
}


text: module TraversableInstances where


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Subarticle</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="Leonard Schütz">
    <meta name="description" content="Template subarticle">
    <meta name="keywords" content="leonard schütz, programming, compilers, ">
    <meta name="language" content="English">
    <meta name="contact" content="leni.schuetz@me.com">
    <meta name="date" content="Mon, 01 Jan 1990 00:00:00 +0100">

    <meta property="og:url" content="https://leonardschuetz.ch/">
    <meta property="og:title" content="Subarticle">
    <meta property="og:description" content="Template subarticle">
    <meta property="og:site_name" content="Leonard Schütz">
    <meta property="og:type" content="website">
    <meta property="og:locale" content="en_US">

    <meta name="twitter:card" content="summary">
    <meta name="twitter:site" content="@leni4838">
    <meta name="twitter:title" content="Subarticle">
    <meta name="twitter:description" content="Template subarticle">

    <link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/>
    <link rel="stylesheet" type="text/css" href="/resources/css/style.css"/>
    <link rel="alternate" type="application/rss+xml" title="Blog" href="/feed.xml" />
    <link href="https://fonts.googleapis.com/css?family=Noto+Sans" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">

          leonard schütz

          about
          blog

Subarticle Template

1. January 1990

This is a template for a sub article. Foo Bar Baz!!!

Link to parent article

          this blog is open-source

      Copyright © 2020 Leonard Schütz | Attributions


text:
module QueryReport
  module ColumnModule
    class Column
      include ActionView::Helpers::SanitizeHelper

      attr_reader :report, :name, :options, :type, :data

      def initialize(report, column_name, options={}, block = nil)
        @report, @name, @options = report, column_name, options
        if @report.model_class
          @type = @report.model_class.columns_hash[column_name.to_s].try(:type) || options[:type] || :string rescue :string
        else
          @type = :string
        end
        @data = block || column_name.to_sym
      end

      def only_on_web?
        @options[:only_on_web] == true
      end

      def sortable?
        @options[:sortable].present? && @options[:sortable] != false
      end

      def sort_link_attribute
        @options[:sortable] == true ? name : @options[:sortable]
      end

      def rowspan?
        @options[:rowspan] == true || @options[:rowspan].kind_of?(Symbol)
      end

      def pdf_options
        @options[:pdf] || {}
      end

      def rowspan_column_humanized
        return @rowspan_column_humanized if @rowspan_column_humanized
        rowspan_column_name = @options[:rowspan].kind_of?(Symbol) ? @options[:rowspan] : self.name

        report.columns.each do |column|
          if column.name == rowspan_column_name
            @rowspan_column_humanized = column.humanize
            return @rowspan_column_humanized
          end
        end
        @rowspan_column_humanized = self.humanize
      end

      def humanize
        @humanize ||= options[:as] || begin
          @report.model_class.human_attribute_name(name) if @report.model_class && !@report.array_record?
        end
      end

      def value(record)
        self.data.kind_of?(Symbol) ? (record.respond_to?(self.name) ? record.send(self.name) : record[self.name]) : self.data.call(record)
      end

      def has_total?
        @options[:show_total] == true
      end

      def align
        @options[:align] || (has_total? ? :right : :left)
      end

      def total
        @total ||= begin
          if has_total?
            sum = 0
            report.records_to_render.each do |r|
              r = report.content_from_element(r[humanize])
              r = strip_tags(r) if r.kind_of? String
              sum = sum + r.to_f
            end
            sum.kind_of?(Float) ? sum.round(2) : sum
          else
            nil
          end
        end
      end
    end
  end
end


text:
#ifndef LWIP_HDR_APPS_SNTP_H
#define LWIP_HDR_APPS_SNTP_H

#include "apps/sntp/sntp_opts.h"
#include "lwip/ip_addr.h"

#ifdef __cplusplus
extern "C" {
#endif

/* SNTP operating modes: default is to poll using unicast.
   The mode has to be set before calling sntp_init(). */
#define SNTP_OPMODE_POLL            0
#define SNTP_OPMODE_LISTENONLY      1
void sntp_setoperatingmode(u8_t operating_mode);
u8_t sntp_getoperatingmode(void);

void sntp_init(void);
void sntp_stop(void);
u8_t sntp_enabled(void);

void sntp_setserver(u8_t idx, const ip_addr_t *addr);
ip_addr_t sntp_getserver(u8_t idx);

#if SNTP_SERVER_DNS
void sntp_setservername(u8_t idx, char *server);
char *sntp_getservername(u8_t idx);
#endif /* SNTP_SERVER_DNS */

#if SNTP_GET_SERVERS_FROM_DHCP
void sntp_servermode_dhcp(int set_servers_from_dhcp);
#else /* SNTP_GET_SERVERS_FROM_DHCP */
#define sntp_servermode_dhcp(x)
#endif /* SNTP_GET_SERVERS_FROM_DHCP */

#ifdef __cplusplus
}
#endif

#endif /* LWIP_HDR_APPS_SNTP_H */


text:
package com.navercorp.pinpoint.collector.manage;

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

/**
 * @Author Taejin Koo
 */
public interface ClusterManagerMBean {

    boolean isEnable();

    List<String> getConnectedAgentList();

}


text:
class ActiveRecordModelInspector < ModelInspector
  def db
    "postgres" # technically we should detect postgres vs mysql
  end

  def table
    model.table_name
  end

  def fields
    @fields ||= model.attribute_names
  end

  def relations
    active_record_relations + active_mongoid_relations
  end

  def active_record_relations
    model.reflections.map do |key, desc|
      {
        type: "active_record",
        relationshipType: desc.macro.to_s,
        class: desc.class_name,
        accessor: key
      }
    end
  end
end


text: const facebookAppId = '{app-id}';


text:
#import "CPTDefinitions.h"
#import "CPTResponder.h"

@class CPTLayer;
@class CPTPlotRange;
@class CPTGraph;
@class CPTPlotSpace;

/// @name Plot Space
/// @{

/**	@brief Plot space coordinate change notification.
 *
 *	This notification is posted to the default notification center whenever the mapping between
 *	the plot space coordinate system and drawing coordinates changes.
 *	@ingroup notification
 **/
extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification;

/// @}

/**
 *	@brief Plot space delegate.
 **/
@protocol CPTPlotSpaceDelegate<NSObject>

@optional

/// @name Scaling
/// @{

/** @brief (Optional) Informs the receiver that it should uniformly scale (e.g., in response to a pinch on iOS).
 *  @param space The plot space.
 *  @param interactionScale The scaling factor.
 *  @param interactionPoint The coordinates of the scaling centroid.
 *  @return YES should be returned if the gesture should be handled by the plot space, and NO to prevent handling.
 *  In either case, the delegate may choose to take extra actions, or handle the scaling itself.
 **/
-(BOOL)plotSpace:(CPTPlotSpace *)space shouldScaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint;

/// @}

/// @name Scrolling
/// @{

/**	@brief (Optional) Notifies that plot space is going to scroll.
 *	@param space The plot space.
 *  @param proposedDisplacementVector The proposed amount by which the plot space will shift.
 *	@return The displacement actually applied.
 **/
-(CGPoint)plotSpace:(CPTPlotSpace *)space willDisplaceBy:(CGPoint)proposedDisplacementVector;

/// @}

/// @name Plot Range Changes
/// @{

/**	@brief (Optional) Notifies that plot space is going to change a plot range.
 *	@param space The plot space.
 *  @param newRange The proposed new plot range.
 *  @param coordinate The coordinate of the range.
 *	@return The new plot range to be used.
 **/
-(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate;

/**	@brief (Optional) Notifies that plot space has changed a plot range.
 *	@param space The plot space.
 *  @param coordinate The coordinate of the range.
 **/
-(void)plotSpace:(CPTPlotSpace *)space didChangePlotRangeForCoordinate:(CPTCoordinate)coordinate;

/// @}

/// @name User Interaction
/// @{

/**	@brief (Optional) Notifies that plot space intercepted a device down event.
 *	@param space The plot space.
 *  @param event The native event (e.g., UIEvent on iPhone)
 *  @param point The point in the host view.
 *	@return Whether the plot space should handle the event or not.
 *  In either case, the delegate may choose to take extra actions, or handle the scaling itself.
 **/
-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point;

/**	@brief (Optional) Notifies that plot space intercepted a device dragged event.
 *	@param space The plot space.
 *  @param event The native event (e.g., UIEvent on iPhone)
 *  @param point The point in the host view.
 *	@return Whether the plot space should handle the event or not.
 *  In either case, the delegate may choose to take extra actions, or handle the scaling itself.
 **/
-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point;

/**	@brief (Optional) Notifies that plot space intercepted a device cancelled event.
 *	@param space The plot space.
 *  @param event The native event (e.g., UIEvent on iPhone)
 *	@return Whether the plot space should handle the event or not.
 *  In either case, the delegate may choose to take extra actions, or handle the scaling itself.
 **/
-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceCancelledEvent:(CPTNativeEvent *)event;

/**	@brief (Optional) Notifies that plot space intercepted a device up event.
 *	@param space The plot space.
 *  @param event The native event (e.g., UIEvent on iPhone)
 *  @param point The point in the host view.
 *	@return Whether the plot space should handle the event or not.
 *  In either case, the delegate may choose to take extra actions, or handle the scaling itself.
 **/
-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point;

/// @}

@end

#pragma mark -

@interface CPTPlotSpace : NSObject<CPTResponder, NSCoding> {
    @private
    __cpt_weak CPTGraph *graph;
    id<NSCopying, NSCoding, NSObject> identifier;
    __cpt_weak id<CPTPlotSpaceDelegate> delegate;
    BOOL allowsUserInteraction;
}

@property (nonatomic, readwrite, copy) id<NSCopying, NSCoding, NSObject> identifier;
@property (nonatomic, readwrite, assign) BOOL allowsUserInteraction;
@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTGraph *graph;
@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak id<CPTPlotSpaceDelegate> delegate;

@end

#pragma mark -

/**	@category CPTPlotSpace(AbstractMethods)
 *	@brief CPTPlotSpace abstract methods—must be overridden by subclasses
 **/
@interface CPTPlotSpace(AbstractMethods)

/// @name Coordinate Space Conversions
/// @{
-(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint;
-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint;
-(void)plotPoint:(NSDecimal *)plotPoint forPlotAreaViewPoint:(CGPoint)point;
-(void)doublePrecisionPlotPoint:(double *)plotPoint forPlotAreaViewPoint:(CGPoint)point;

-(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event;
-(void)plotPoint:(NSDecimal *)plotPoint forEvent:(CPTNativeEvent *)event;
-(void)doublePrecisionPlotPoint:(double *)plotPoint forEvent:(CPTNativeEvent *)event;
///	@}

/// @name Coordinate Range
/// @{
-(void)setPlotRange:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate;
-(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate;
///	@}

/// @name Scale Types
/// @{
-(void)setScaleType:(CPTScaleType)newType forCoordinate:(CPTCoordinate)coordinate;
-(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate;
///	@}

/// @name Adjusting Ranges
/// @{
-(void)scaleToFitPlots:(NSArray *)plots;
-(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint;
///	@}

@end