text:
<?php
namespace Aws\LicenseManager;

use Aws\AwsClient;

/**
 * This client is used to interact with the **AWS License Manager** service.
 * @method \Aws\Result acceptGrant(array $args = [])
 * @method \GuzzleHttp\Promise\Promise acceptGrantAsync(array $args = [])
 * @method \Aws\Result checkInLicense(array $args = [])
 * @method \GuzzleHttp\Promise\Promise checkInLicenseAsync(array $args = [])
 * @method \Aws\Result checkoutBorrowLicense(array $args = [])
 * @method \GuzzleHttp\Promise\Promise checkoutBorrowLicenseAsync(array $args = [])
 * @method \Aws\Result checkoutLicense(array $args = [])
 * @method \GuzzleHttp\Promise\Promise checkoutLicenseAsync(array $args = [])
 * @method \Aws\Result createGrant(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createGrantAsync(array $args = [])
 * @method \Aws\Result createGrantVersion(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createGrantVersionAsync(array $args = [])
 * @method \Aws\Result createLicense(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createLicenseAsync(array $args = [])
 * @method \Aws\Result createLicenseConfiguration(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createLicenseConfigurationAsync(array $args = [])
 * @method \Aws\Result createLicenseConversionTaskForResource(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createLicenseConversionTaskForResourceAsync(array $args = [])
 * @method \Aws\Result createLicenseManagerReportGenerator(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createLicenseManagerReportGeneratorAsync(array $args = [])
 * @method \Aws\Result createLicenseVersion(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createLicenseVersionAsync(array $args = [])
 * @method \Aws\Result createToken(array $args = [])
 * @method \GuzzleHttp\Promise\Promise createTokenAsync(array $args = [])
 * @method \Aws\Result deleteGrant(array $args = [])
 * @method \GuzzleHttp\Promise\Promise deleteGrantAsync(array $args = [])
 * @method \Aws\Result deleteLicense(array $args = [])
 * @method \GuzzleHttp\Promise\Promise deleteLicenseAsync(array $args = [])
 * @method \Aws\Result deleteLicenseConfiguration(array $args = [])
 * @method \GuzzleHttp\Promise\Promise deleteLicenseConfigurationAsync(array $args = [])
 * @method \Aws\Result deleteLicenseManagerReportGenerator(array $args = [])
 * @method \GuzzleHttp\Promise\Promise deleteLicenseManagerReportGeneratorAsync(array $args = [])
 * @method \Aws\Result deleteToken(array $args = [])
 * @method \GuzzleHttp\Promise\Promise deleteTokenAsync(array $args = [])
 * @method \Aws\Result extendLicenseConsumption(array $args = [])
 * @method \GuzzleHttp\Promise\Promise extendLicenseConsumptionAsync(array $args = [])
 * @method \Aws\Result getAccessToken(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getAccessTokenAsync(array $args = [])
 * @method \Aws\Result getGrant(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getGrantAsync(array $args = [])
 * @method \Aws\Result getLicense(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getLicenseAsync(array $args = [])
 * @method \Aws\Result getLicenseConfiguration(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getLicenseConfigurationAsync(array $args = [])
 * @method \Aws\Result getLicenseConversionTask(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getLicenseConversionTaskAsync(array $args = [])
 * @method \Aws\Result getLicenseManagerReportGenerator(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getLicenseManagerReportGeneratorAsync(array $args = [])
 * @method \Aws\Result getLicenseUsage(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getLicenseUsageAsync(array $args = [])
 * @method \Aws\Result getServiceSettings(array $args = [])
 * @method \GuzzleHttp\Promise\Promise getServiceSettingsAsync(array $args = [])
 * @method \Aws\Result listAssociationsForLicenseConfiguration(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listAssociationsForLicenseConfigurationAsync(array $args = [])
 * @method \Aws\Result listDistributedGrants(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listDistributedGrantsAsync(array $args = [])
 * @method \Aws\Result listFailuresForLicenseConfigurationOperations(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listFailuresForLicenseConfigurationOperationsAsync(array $args = [])
 * @method \Aws\Result listLicenseConfigurations(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listLicenseConfigurationsAsync(array $args = [])
 * @method \Aws\Result listLicenseConversionTasks(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listLicenseConversionTasksAsync(array $args = [])
 * @method \Aws\Result listLicenseManagerReportGenerators(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listLicenseManagerReportGeneratorsAsync(array $args = [])
 * @method \Aws\Result listLicenseSpecificationsForResource(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listLicenseSpecificationsForResourceAsync(array $args = [])
 * @method \Aws\Result listLicenseVersions(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listLicenseVersionsAsync(array $args = [])
 * @method \Aws\Result listLicenses(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listLicensesAsync(array $args = [])
 * @method \Aws\Result listReceivedGrants(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listReceivedGrantsAsync(array $args = [])
 * @method \Aws\Result listReceivedGrantsForOrganization(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listReceivedGrantsForOrganizationAsync(array $args = [])
 * @method \Aws\Result listReceivedLicenses(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listReceivedLicensesAsync(array $args = [])
 * @method \Aws\Result listReceivedLicensesForOrganization(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listReceivedLicensesForOrganizationAsync(array $args = [])
 * @method \Aws\Result listResourceInventory(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listResourceInventoryAsync(array $args = [])
 * @method \Aws\Result listTagsForResource(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listTagsForResourceAsync(array $args = [])
 * @method \Aws\Result listTokens(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listTokensAsync(array $args = [])
 * @method \Aws\Result listUsageForLicenseConfiguration(array $args = [])
 * @method \GuzzleHttp\Promise\Promise listUsageForLicenseConfigurationAsync(array $args = [])
 * @method \Aws\Result rejectGrant(array $args = [])
 * @method \GuzzleHttp\Promise\Promise rejectGrantAsync(array $args = [])
 * @method \Aws\Result tagResource(array $args = [])
 * @method \GuzzleHttp\Promise\Promise tagResourceAsync(array $args = [])
 * @method \Aws\Result untagResource(array $args = [])
 * @method \GuzzleHttp\Promise\Promise untagResourceAsync(array $args = [])
 * @method \Aws\Result updateLicenseConfiguration(array $args = [])
 * @method \GuzzleHttp\Promise\Promise updateLicenseConfigurationAsync(array $args = [])
 * @method \Aws\Result updateLicenseManagerReportGenerator(array $args = [])
 * @method \GuzzleHttp\Promise\Promise updateLicenseManagerReportGeneratorAsync(array $args = [])
 * @method \Aws\Result updateLicenseSpecificationsForResource(array $args = [])
 * @method \GuzzleHttp\Promise\Promise updateLicenseSpecificationsForResourceAsync(array $args = [])
 * @method \Aws\Result updateServiceSettings(array $args = [])
 * @method \GuzzleHttp\Promise\Promise updateServiceSettingsAsync(array $args = [])
 */
class LicenseManagerClient extends AwsClient {}


text:
package com.nd.android.u.square.ui.view.swipemenulistview;

/**
 *
 * @author baoyz
 * @date 2014-8-24
 *
 */
public interface SwipeMenuCreator {

	void create(SwipeMenu menu);
}

redpajama_set_name: RedPajamaGithub


text:
from freenect import sync_get_depth, sync_get_video
import cv
import numpy as np

def doloop():
    global depth, rgb
    while True:
        # Get a fresh frame
        (depth,_), (rgb,_) = sync_get_depth(), sync_get_video()

        # Build a two panel color image
        d3 = np.dstack((depth,depth,depth)).astype(np.uint8)
        da = np.hstack((d3,rgb))

        # Simple Downsample
        cv.ShowImage('both',np.array(da[::2,::2,::-1]))
        cv.WaitKey(5)

doloop()

"""
IPython usage:
 ipython
 [1]: run -i demo_freenect
 #<ctrl -c>  (to interrupt the loop)
 [2]: %timeit -n100 sync_get_depth(), sync_get_rgb() # profile the kinect capture

"""


text:
package au.com.windyroad.hateoas.client;

import java.net.URI;

import org.openqa.selenium.WebElement;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.MediaType;

import au.com.windyroad.hateoas.core.Link;
import cucumber.api.PendingException;

public class WebDriverLink extends Link {

    private WebElement webElement;
    private WebDriverResolver resolver;

    public WebDriverLink(WebElement webElement) {
        this.webElement = webElement;
    }

    public WebDriverLink(WebDriverResolver resolver, WebElement webElement) {
        this.webElement = webElement;
        this.resolver = resolver;
    }

    @Override
    public <T> T resolve(Class<T> type) {
        webElement.click();
        return resolver.createProxy(type);
    }

    @Override
    public <T> T resolve(ParameterizedTypeReference<T> type) {
        // TODO Auto-generated method stub
        throw new PendingException();
    }

    @Override
    public MediaType getRepresentationFormat() {
        throw new PendingException();
    }

    @Override
    public URI getAddress() {
        throw new PendingException();
    }

    public WebElement getWebElement() {
        return this.webElement;
    }

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.cognitiveservices.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The QuotaLimit model. */
@Fluent
public final class QuotaLimit {
    /*
     * The count property.
     */
    @JsonProperty(value = "count")
    private Float count;

    /*
     * The renewalPeriod property.
     */
    @JsonProperty(value = "renewalPeriod")
    private Float renewalPeriod;

    /*
     * The rules property.
     */
    @JsonProperty(value = "rules")
    private List<ThrottlingRule> rules;

    /** Creates an instance of QuotaLimit class. */
    public QuotaLimit() {
    }

    /**
     * Get the count property: The count property.
     *
     * @return the count value.
     */
    public Float count() {
        return this.count;
    }

    /**
     * Set the count property: The count property.
     *
     * @param count the count value to set.
     * @return the QuotaLimit object itself.
     */
    public QuotaLimit withCount(Float count) {
        this.count = count;
        return this;
    }

    /**
     * Get the renewalPeriod property: The renewalPeriod property.
     *
     * @return the renewalPeriod value.
     */
    public Float renewalPeriod() {
        return this.renewalPeriod;
    }

    /**
     * Set the renewalPeriod property: The renewalPeriod property.
     *
     * @param renewalPeriod the renewalPeriod value to set.
     * @return the QuotaLimit object itself.
     */
    public QuotaLimit withRenewalPeriod(Float renewalPeriod) {
        this.renewalPeriod = renewalPeriod;
        return this;
    }

    /**
     * Get the rules property: The rules property.
     *
     * @return the rules value.
     */
    public List<ThrottlingRule> rules() {
        return this.rules;
    }

    /**
     * Set the rules property: The rules property.
     *
     * @param rules the rules value to set.
     * @return the QuotaLimit object itself.
     */
    public QuotaLimit withRules(List<ThrottlingRule> rules) {
        this.rules = rules;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (rules() != null) {
            rules().forEach(e -> e.validate());
        }
    }
}


text:
The Notification command can be used to send a push Notification to a client. If the client does not have Push Notifications enabled then they'll see it as a badge on the web client.

We advise you only to use Push Notifications for important messages as to not be annoying.
```
/openaudio notification <selector> <message>
```

example,
```
/openaudio notification @a Welcome to the server!
```


text:
XIO_HANDLE getWebSocketsIOTransport(const char* fqdn, int port)
{
	WSIO_CONFIG ws_io_config;
	ws_io_config.host = fqdn;
	ws_io_config.port = port;
	ws_io_config.protocol_name = DEFAULT_WS_PROTOCOL_NAME;
	ws_io_config.relative_path = DEFAULT_WS_RELATIVE_PATH;
	ws_io_config.use_ssl = true;
	ws_io_config.trusted_ca = NULL;

	return xio_create(wsio_get_interface_description(), &ws_io_config);
}
static TRANSPORT_LL_HANDLE IoTHubTransportAMQP_Create_WebSocketsOverTls(const IOTHUBTRANSPORT_CONFIG* config)
{
	AMQP_TRANSPORT_INSTANCE* transport_state = (AMQP_TRANSPORT_INSTANCE*)IoTHubTransportAMQP_Create(config);

	if (transport_state != NULL)
	{
		transport_state->tls_io_transport_provider = getWebSocketsIOTransport;
		transport_state->iotHubPort = DEFAULT_WS_PORT;
	}

	return transport_state;
}

static TRANSPORT_PROVIDER thisTransportProvider_WebSocketsOverTls = {
	IoTHubTransportAMQP_GetHostname,
	IoTHubTransportAMQP_SetOption,
	IoTHubTransportAMQP_Create_WebSocketsOverTls,
	IoTHubTransportAMQP_Destroy,
	IoTHubTransportAMQP_Register,
	IoTHubTransportAMQP_Unregister,
	IoTHubTransportAMQP_Subscribe,
	IoTHubTransportAMQP_Unsubscribe,
	IoTHubTransportAMQP_DoWork,
	IoTHubTransportAMQP_GetSendStatus
};

extern const TRANSPORT_PROVIDER* AMQP_Protocol_over_WebSocketsTls(void)
{
	return &thisTransportProvider_WebSocketsOverTls;
}


text:
package hudson.plugins.warnings;

import static org.junit.Assert.*;
import hudson.plugins.warnings.GroovyParser.DescriptorImpl;
import hudson.util.FormValidation;
import hudson.util.FormValidation.Kind;

import java.io.IOException;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;

/**
 * Tests the class {@link GroovyParser}.
 *
 * @author Ulli Hafner
 */
public class GroovyParserTest {
    // CHECKSTYLE:OFF
    private static final String SINGLE_LINE_EXAMPLE = "file/name/relative/unix:42:evil: this is a warning message";
    private static final String MULTI_LINE_EXAMPLE = "    [javac] 1. WARNING in C:\\Desenvolvimento\\Java\\jfg\\src\\jfg\\AttributeException.java (at line 3)\n"
                    + "    [javac]     public class AttributeException extends RuntimeException\n"
                    + "    [javac]                  ^^^^^^^^^^^^^^^^^^\n"
                    + "    [javac] The serializable class AttributeException does not declare a static final serialVersionUID field of type long\n"
                    + "    [javac] ----------\n";
    private static final String MULTILINE_SCRIPT = "import hudson.plugins.warnings.parser.Warning\n" +
                    "import hudson.plugins.analysis.util.model.Priority\n" +
                    "\n" +
                    "String type = matcher.group(1)\n" +
                    "Priority priority;\n" +
                    "if (\"warning\".equalsIgnoreCase(type)) {\n" +
                    "    priority = Priority.NORMAL;\n" +
                    "}\n" +
                    "else {\n" +
                    "    priority = Priority.HIGH;\n" +
                    "}\n" +
                    "\n" +
                    "String fileName = matcher.group(2)\n" +
                    "String lineNumber = matcher.group(3)\n" +
                    "String message = matcher.group(4)\n" +
                    "\n" +
                    "return new Warning(fileName, Integer.parseInt(lineNumber), \"Generic Parser\", \"\", message);\n";
    @SuppressWarnings("javadoc")
    public static final String MULTI_LINE_REGEXP = "(WARNING|ERROR)\\s*in\\s*(.*)\\(at line\\s*(\\d+)\\).*(?:\\r?\\n[^\\^]*)+(?:\\r?\\n.*[\\^]+.*)\\r?\\n(?:\\s*\\[.*\\]\\s*)?(.*)";
    @SuppressWarnings("javadoc")
    public static final String SINGLE_LINE_REGEXP = "^\\s*(.*):(\\d+):(.*):\\s*(.*)$";
    // CHECKSTYLE:ON

    /**
     * Verifies that multi line expressions are correctly detected.
     */
    @Test
    public void testMultiLine() {
        GroovyParser parser = new GroovyParser("name", MULTI_LINE_REGEXP, "empty");

        assertTrue("Wrong multi line support guess", parser.hasMultiLineSupport());
    }

    /**
     * Verifies that single line expressions are correctly detected.
     */
    @Test
    public void testSingleLine() {
        GroovyParser parser = new GroovyParser("name", SINGLE_LINE_REGEXP, "empty");

        assertFalse("Wrong single line support guess", parser.hasMultiLineSupport());
    }

    /**
     * Test the validation of the name parameter.
     */
    @Test
    public void testNameValidation() {
        DescriptorImpl descriptor = createDescriptor();

        assertError(descriptor.doCheckName(null));
        assertError(descriptor.doCheckName(StringUtils.EMPTY));
        assertOk(descriptor.doCheckName("Java Parser 2"));
    }

    /**
     * Test the validation of the regexp parameter.
     */
    @Test
    public void testRegexpValidation() {
        DescriptorImpl descriptor = createDescriptor();

        assertError(descriptor.doCheckRegexp(null));
        assertError(descriptor.doCheckRegexp(StringUtils.EMPTY));
        assertError(descriptor.doCheckRegexp("one brace ("));
        assertError(descriptor.doCheckRegexp("backslash \\"));

        assertOk(descriptor.doCheckRegexp("^.*[a-z]"));
    }

    /**
     * Test the validation of the script parameter.
     *
     * @throws IOException
     *             if the example file could not be read
     */
    @Test
    public void testScriptValidationWithoutExample() throws IOException {
        DescriptorImpl descriptor = createDescriptor();

        assertError(descriptor.doCheckScript(null));
        assertError(descriptor.doCheckScript(StringUtils.EMPTY));
        assertError(descriptor.doCheckScript("Hello World"));

        assertOk(descriptor.doCheckScript(readScript()));
    }

    private String readScript() throws IOException {
        return IOUtils.toString(GroovyParserTest.class.getResourceAsStream("groovy.snippet"));
    }

    /**
     * Test the validation of the script parameter with a given regular
     * expression and example. Expected result: the expected result is a
     * warning.
     *
     * @throws IOException
     *             if the example file could not be read
     */
    @Test
    public void testScriptValidationOneWarning() throws IOException {
        DescriptorImpl descriptor = createDescriptor();

        assertOk(descriptor.doCheckExample(SINGLE_LINE_EXAMPLE, SINGLE_LINE_REGEXP, readScript()));
    }

    /**
     * Test the validation of the script parameter with a given regular
     * expression and example. Expected result: the regular expression will not
     * match.
     *
     * @throws IOException
     *             if the example file could not be read
     */
    @Test
    public void testScriptValidationNoMatchesFound() throws IOException {
        DescriptorImpl descriptor = createDescriptor();

        assertError(descriptor.doCheckExample("this is a warning message", SINGLE_LINE_REGEXP, readScript()));
    }

    /**
     * Test the validation of the script parameter with a given regular
     * expression and example. Expected result: the regular expression will not
     * match.
     *
     * @throws IOException
     *             if the example file could not be read
     */
    @Test
    public void testScriptValidationIllegalMatchAccess() throws IOException {
        DescriptorImpl descriptor = createDescriptor();

        assertError(descriptor.doCheckExample(SINGLE_LINE_EXAMPLE, "^\\s*(.*):(\\d+):(.*)$", readScript()));
    }

    /**
     * Test the validation of the script parameter with a given regular
     * expression and a multi-line example. Expected result: the regular
     * expression will match.
     *
     * @throws IOException
     *             if the example file could not be read
     */
    @Test
    public void testMultiLineExpressionWillMatch() throws IOException {
        DescriptorImpl descriptor = createDescriptor();

        assertOk(descriptor.doCheckExample(MULTI_LINE_EXAMPLE, MULTI_LINE_REGEXP, MULTILINE_SCRIPT));
    }

    private DescriptorImpl createDescriptor() {
        return new DescriptorImpl();
    }

    private void assertOk(final FormValidation actualResult) {
        verify(actualResult, FormValidation.Kind.OK);
    }

    private void assertError(final FormValidation actualResult) {
        verify(actualResult, FormValidation.Kind.ERROR);
    }

    private void verify(final FormValidation actualResult, final Kind expectedResult) {
        assertEquals("Wrong validation result", expectedResult, actualResult.kind);
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Archipel Character Generator</title>
        <meta name="description" content="A simple character generator app for the Archipel RPG">
        <meta name="viewport" content="width=device-width">

        <link rel="shortcut icon" href="favicon.ico">
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144x144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="apple-touch-icon-57x57-precomposed.png">

        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">

        <link rel="stylesheet/less" type="text/css" href="styles.less">

        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/bootstrap-responsive.css" rel="stylesheet">

              Archipel

About

                    Characters

Create new

Saved Characters

{{char.name}}

© Alpha team 2012


text:
const AbilityChoiceSelection = require('./AbilityChoiceSelection');
const ChoosePlayerPrompt = require('./gamesteps/ChoosePlayerPrompt');

class AbilityChoosePlayerDefinition {
    static create(properties) {
        if(properties.chooseOpponent) {
            let opponentCondition = AbilityChoosePlayerDefinition.createConditionFunction(properties.chooseOpponent);
            return new AbilityChoosePlayerDefinition({
                name: 'opponent',
                condition: (player, context) => player !== context.choosingPlayer && opponentCondition(player, context),
                activePromptTitle: 'Select an opponent',
                waitingPromptTitle: 'Waiting for player to select an opponent'
            });
        }

        if(properties.choosePlayer) {
            return new AbilityChoosePlayerDefinition({
                name: 'chosenPlayer',
                condition: properties.choosePlayer,
                activePromptTitle: 'Select a player',
                waitingPromptTitle: 'Waiting for player to select a player'
            });
        }

        return null;
    }

    static createConditionFunction(conditionProperty) {
        if(typeof(conditionProperty) === 'function') {
            return conditionProperty;
        }

        return () => true;
    }

    constructor({ name, condition, activePromptTitle, waitingPromptTitle }) {
        this.name = name;
        this.condition = AbilityChoosePlayerDefinition.createConditionFunction(condition);
        this.activePromptTitle = activePromptTitle;
        this.waitingPromptTitle = waitingPromptTitle;
    }

    eligibleChoices(context) {
        context.choosingPlayer = context.player;
        return context.game.getPlayers().filter(player => this.isEligible(player, context));
    }

    isEligible(player, context) {
        return this.condition(player, context);
    }

    canResolve(context) {
        return this.eligibleChoices(context).length > 0;
    }

    resolve(context) {
        let choices = this.eligibleChoices(context);
        let result = new AbilityChoiceSelection({
            name: this.name,
            choosingPlayer: context.player,
            eligibleChoices: choices
        });

        let prompt = new ChoosePlayerPrompt(context.game, context.player, {
            condition: player => choices.includes(player),
            activePromptTitle: this.activePromptTitle,
            waitingPromptTitle: this.waitingPromptTitle,
            source: context.source,
            onSelect: chosenPlayer => {
                if(this.name === 'opponent') {
                    context.opponent = chosenPlayer;
                } else {
                    context.chosenPlayer = chosenPlayer;
                }
                result.resolve(chosenPlayer);
            },
            onCancel: () => {
                result.cancel();
            }
        });

        context.game.queueStep(prompt);

        return result;
    }
}

module.exports = AbilityChoosePlayerDefinition;


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EAAddinFramework.Utilities
{
    public partial class AddinSettingsForm : Form
    {
        private AddinSettings settings { get => this.settingsForm.settings; }
        private AddinSettingsFormBase settingsForm { get; set; }
        public AddinSettingsForm( AddinSettingsFormBase settingsForm)
        {
            InitializeComponent();
            this.settingsForm = settingsForm;
            this.settingsForm.FormClosing += new FormClosingEventHandler(this.settingFormClosing);
            this.configListView.Objects = this.settings.getAllConfigs();
            //show prototype as test
            this.Text = this.settingsForm.Text;
            this.settingsForm.TopLevel = false;

            this.settingsForm.FormBorderStyle = FormBorderStyle.None;
            this.splitContainer.Panel2.Controls.Add(this.settingsForm);

            //resize if needed
            if (this.settingsForm.Height > this.splitContainer.Panel2.Height)
            {
                //get the difference
                var difference = this.settingsForm.Height - this.splitContainer.Panel2.Height;
                //add to height of form
                var splitterdistance = this.splitContainer.SplitterDistance;
                this.Height += difference;
                //set the splitter back
                this.splitContainer.SplitterDistance = splitterdistance;
            }
            //resize if needed
            if (this.settingsForm.Width > this.splitContainer.Panel2.Width)
            {
                //get the difference
                var difference = this.settingsForm.Width - this.splitContainer.Panel2.Width;
                //add to width of form
                this.Width += difference;
            }
            this.settingsForm.Dock = DockStyle.Top;
            //make sure the window is not larger than the screen it it displaying on
            var screen = Screen.FromControl(this);
            if (this.Height > screen.WorkingArea.Height)
            {
                this.Height = screen.WorkingArea.Height;
            }
            //show screen
            this.settingsForm.Show();
            //select first row
            this.configListView.SelectedIndex = 0;
        }
        private void enableDisable()
        {
            this.deleteButton.Enabled = this.selectedConfig?.type == AddinConfigType.Package;
        }

        private void settingFormClosing(object sender, EventArgs e)
        {
            //reset current config to default user config
            this.settings.currentConfig = null;
            this.Close();
        }

        private AddinConfig selectedConfig { get => this.configListView.SelectedObject as AddinConfig; }

        private void configListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.settings.currentConfig = this.selectedConfig;
            this.settingsForm.refreshContents();
            enableDisable();
        }

        private void addConfigButton_Click(object sender, EventArgs e)
        {
            var newConfig = this.settings.addConfig();
            this.configListView.AddObject(newConfig);
            this.configListView.SelectedObject = newConfig;
        }

        private void deleteButton_Click(object sender, EventArgs e)
        {
            this.settings.deleteCurrentConfig();
            this.configListView.RemoveObject(this.configListView.SelectedObject);
            this.enableDisable();
        }

        private void configListView_DoubleClick(object sender, EventArgs e)
        {
            this.selectedConfig.openContext();
        }
    }
}


text:
package money

import (
	"database/sql"
	"database/sql/driver"
)

var _ sql.Scanner = (*NullMoney)(nil)
var _ driver.Value = NullMoney{}

// NullMoney represents an Money that may be null.
// NullMoney implements the Scanner interface so
// it can be used as a scan destination, similar to NullString.
type NullMoney struct {
	Money Money
	Valid bool
}

// Scan implements the sql.Scanner interface.
func (m *NullMoney) Scan(value interface{}) error {
	var n sql.NullInt64
	err := n.Scan(value)
	m.Money = Money(n.Int64)
	m.Valid = n.Valid
	return err
}

// Value implements the driver.Valuer interface.
func (m NullMoney) Value() (driver.Value, error) {
	if !m.Valid {
		return nil, nil
	}
	return int64(m.Money), nil
}


text:
<link href="../polymer/polymer.html" rel="import">
<link href="../core-style/core-style.html" rel="import">

<core-style id="polyAnimateCssBase">

.animated {
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

.animated.infinite {
  -webkit-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
}

.animated.hinge {
  -webkit-animation-duration: 2s;
  animation-duration: 2s;
}

.animated.bounceIn,
.animated.bounceOut {
  -webkit-animation-duration: .75s;
  animation-duration: .75s;
}

.animated.flipOutX,
.animated.flipOutY {
  -webkit-animation-duration: .75s;
  animation-duration: .75s;
}
</core-style>


text:
namespace ExampleApp
{
	namespace InitialExperience
	{
		namespace View
		{
			class InitialExperienceIntroViewModule
			{
			public:
				InitialExperienceIntroViewModule(AndroidNativeState& nativeState,
                                                 ExampleAppMessaging::TMessageBus& messageBus,
												 NavRouting::View::INavWidgetViewModel& navWidgetViewModel,
                                                 CameraTransitions::SdkModel::ICameraTransitionController& cameraTransitionController);
				~InitialExperienceIntroViewModule();

				InitialExperienceIntroController& GetController() { return *m_pController; }

			private:

				InitialExperienceIntroController* m_pController;
				InitialExperienceIntroView* m_pView;
			};
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:state_enabled="false">
        <shape >
            <solid android:color="#b5b5b5"/>
            <corners
                android:bottomRightRadius="5dp"/>
        </shape>
    </item>
    <item
        android:state_pressed="true">
        <shape >
            <solid android:color="@color/window_bg"/>
            <corners
                android:bottomRightRadius="5dp"/>
        </shape>
    </item>
    <item
        android:state_focused="true">
        <shape >
            <solid android:color="@color/theme_rose"/>
            <corners android:bottomRightRadius="5dp"/>
        </shape>
    </item>
	<item>
        <shape >
            <solid android:color="@color/white"/>
            <corners android:bottomRightRadius="5dp"/>
        </shape>
    </item>
</selector>


text:
.ui.borderless.inverted.menu {
  background-color: #024E30;
}

.landing-section-1{
  padding: 10px 10px 30px 10px;
  background-color: #024E30;
  color: honeydew;
}

.landing-section-2{
  padding: 10px 10px 30px 10px;
  background-color: honeydew;
  color: forestgreen;
}

.landing-section-3{
  padding: 10px 10px 30px 10px;
  background-color: #024E30;
  color: honeydew;
}

.landing-section-4{
  padding: 10px 10px 30px 10px;
  background-color: honeydew;
  color: forestgreen;
}

#login-buttons a, .accounts-dialog a {
  color: white;
;
}

.whole-background{
  background-color: honeydew;
}


text:
shared_examples_for "Net::HTTP" do
  describe "when making real requests", net_connect: true do
    let(:port){ WebMockServer.instance.port }

    before(:each) do
      @http = Net::HTTP.new("localhost", port)
    end

    it "should return a Net::ReadAdapter from response.body when a real request is made with a block and #read_body", net_connect: true do
      response = Net::HTTP.new("localhost", port).request_get('/') { |r| r.read_body { } }
      expect(response.body).to be_a(Net::ReadAdapter)
    end

    it "should handle requests with block passed to read_body", net_connect: true do
      body = ""
      req = Net::HTTP::Get.new("/")
      Net::HTTP.start("localhost", port) do |http|
        http.request(req) do |res|
          res.read_body do |str|
            body << str
          end
        end
      end
      expect(body).to match(/hello world/)
    end

    it "should connect only once when connected on start", net_connect: true do
      @http = Net::HTTP.new('localhost', port)
      socket_id_before_request = socket_id_after_request = nil
      @http.start {|conn|
        socket_id_before_request = conn.instance_variable_get(:@socket).object_id
        conn.request(Net::HTTP::Get.new("/"))
        socket_id_after_request = conn.instance_variable_get(:@socket).object_id
      }

      if !defined?(WebMock::Config) || WebMock::Config.instance.net_http_connect_on_start
        expect(socket_id_before_request).not_to eq(nil.object_id)
        expect(socket_id_after_request).not_to eq(nil.object_id)
        expect(socket_id_after_request).to eq(socket_id_before_request)
      else
        expect(socket_id_before_request).to eq(nil.object_id)
        expect(socket_id_after_request).not_to eq(nil.object_id)
      end
    end

    describe "without start" do
      it "should close connection after a real request" do
        @http.get('/') { }
        expect(@http).not_to be_started
      end

      it "should execute block exactly once" do
        times = 0
        @http.get('/') { times += 1 }
        expect(times).to eq(1)
      end

      it "should have socket open during a real request" do
        socket_id = nil
        @http.get('/') {
          socket_id = @http.instance_variable_get(:@socket).object_id
        }
        expect(socket_id).not_to be_nil
      end

      it "should be started during a real request" do
        started = nil
        @http.get('/') {
          started = @http.started?
        }
        expect(started).to eq(true)
        expect(@http.started?).to eq(false)
      end
    end

    describe "with start" do
      it "should close connection after a real request" do
        @http.start {|conn| conn.get('/') { } }
        expect(@http).not_to be_started
      end

      it "should execute block exactly once" do
        times = 0
        @http.start {|conn| conn.get('/') { times += 1 }}
        expect(times).to eq(1)
      end

      it "should have socket open during a real request" do
        socket_id = nil
        @http.start {|conn| conn.get('/') {
            socket_id = conn.instance_variable_get(:@socket).object_id
          }
        }
        expect(socket_id).not_to be_nil
      end

      it "should be started during a real request" do
        started = nil
        @http.start {|conn| conn.get('/') {
            started = conn.started?
          }
        }
        expect(started).to eq(true)
        expect(@http.started?).to eq(false)
      end
    end

    describe "with start without request block" do
      it "should close connection after a real request" do
        @http.start {|conn| conn.get('/') }
        expect(@http).not_to be_started
      end

      it "should have socket open during a real request" do
        socket_id = nil
        @http.start {|conn|
          socket_id = conn.instance_variable_get(:@socket).object_id
        }
        expect(socket_id).not_to be_nil
      end

      it "should be started during a real request" do
        started = nil
        @http.start {|conn|
          started = conn.started?
        }
        expect(started).to eq(true)
        expect(@http.started?).to eq(false)
      end
    end

    describe "with start without a block and finish" do
      it "should gracefully start and close connection" do
        @http.start
        @http.get("/")
        expect(@http).to be_started
        @http.finish
        expect(@http).not_to be_started
      end
    end
  end
end


text:
Viral landing page that powered beeketing.com launch
====================================================

## Install Instruction

1. Intall LAMP stack on your system, make sure you can run php command from cli
2. Install/Download compower.phar to project root
3. Run command `php composer.phar install`
4. Enter params like database info etc... you can skip email config, customer io, segment io settings if  you don't use them
5. Update schema `php app/console doctrine:schema:update --force`
6. Build assets `php app/console assets:install --symlink`
7. Now your project is ready to run, you can use this link for example `http://localhost/viral-landing/web/app_dev.php`
8. If you are building for `prod` env please run this command as well `php app/console assetic:dump -e prod`


text:
package fridge.windows;

import java.io.File;
import java.io.IOException;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.nio.file.DirectoryIteratorException;
import java.nio.file.StandardOpenOption;
import java.nio.file.DirectoryStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.NoSuchFileException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.AtomicMoveNotSupportedException;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JList;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.event.DocumentListener;
import javax.swing.event.DocumentEvent;
import javax.swing.DefaultListModel;

import javax.swing.ActionMap;
import javax.swing.InputMap;

import fridge.data.FolderCollectionItem;

public class MainWindow1 extends fridge.windows.FileWindow{
  private Path currFolder;
  private Path prevFolder;
  private JTextField folderNameField;
  private JList<String> view0;
  private JList<String> view1;
  private int[] selectedFolders;
  private int[] selectedQuickAccess;

  private String currentPath;
  private String[] fullFileNames; //need this?
  private String[] quickAccessFolders;
  private String loadedQuickAccessCollection;

  public MainWindow1(fridge.window_content.WindowCollection winColl,
                     fridge.window_content.WindowMaker winMaker,
                     fridge.action_handling.ClassListSelectionListener[] CLSL_ptrs,
                     fridge.action_handling.ClassActionListener[] CAL_ptrs,
                     JTextField fn_par,
                     JList view0_par,
                     JList view1_par,
                     fridge.window_content.Menu menu,
                     int par_myWindowIndex){

    super(winMaker.newMainWin1(winColl, CLSL_ptrs, CAL_ptrs, fn_par, view0_par, view1_par, menu),
        CLSL_ptrs, CAL_ptrs, par_myWindowIndex, menu, winColl);

    winCollection = winColl;
    selectedFolders = null;
    quickAccessFolders = null;
    selectedQuickAccess = null;
    loadedQuickAccessCollection = null;

    folderNameField = fn_par;
    view0 = view0_par;
    view1 = view1_par;
    currFolder = Paths.get(folderNameField.getText());
    prevFolder = Paths.get("/");

    frame.pack();
  }

  public String[] getQAFolders(){
    return quickAccessFolders;
  }

  private void setQuickAccessFolders(String[] newFolders){
    quickAccessFolders = newFolders;
  }

  private void setQuickAccessAliases(String[] newAliases){
    if (null == newAliases){
      clearQuickAccessAliases();
    }
    else{
      view1.setListData(newAliases);
    }
  }

  private void clearQuickAccessAliases(){
    String[] empty = new String[1];
    empty[0] = "";
    view1.clearSelection();
    view1.setListData(empty);
  }

  private void setLoadedQuickAccessCollection(String collectionName){
    loadedQuickAccessCollection = collectionName;
  }

  private void addFolder(){
    /*
     * Noticee!
     * all folder variables could be moved to WindowCollection. the group stuff is
     * already there. this would make it easier to access folder data from other locations
     * than MainWin1. Maybe even create a class for the folders and make WindowCollection
     * have an object made from this class. And of course make methods to WindowCollection
     * which access data from this object
     */
  }

  protected void moveItemsToGroup(String groupName){
    Path[] itemsToPass;
    Path[] pathsToPass;

    itemsToPass = getSelectedFolderNames();
    pathsToPass = getSelectedFullPaths();

    winCollection.setGroupItems(groupName, itemsToPass, pathsToPass);
  }

  protected void addItemsToGroup(String groupName){
    Path[] itemsToPass;
    Path[] pathsToPass;

    itemsToPass = getSelectedFolderNames();
    pathsToPass = getSelectedFullPaths();

    winCollection.addGroupItems(groupName, itemsToPass, pathsToPass);
  }

  private Path[] getSelectedFullPaths(){
    Path[] selectedPaths;

    selectedPaths = new Path[selectedFolders.length];

    for (int i = 0; i < selectedFolders.length; i++){
      selectedPaths[i] = Paths.get(fullFileNames[selectedFolders[i]]);
    }

    return selectedPaths;
  }

  private Path[] getSelectedFolderNames(){
    Path[] tempPaths;
    Path[] selectedNames;

    tempPaths = getPathsOfCurrentFolder();
    selectedNames = new Path[selectedFolders.length];

    for (int i = 0; i < selectedFolders.length; i++){
      selectedNames[i] = tempPaths[selectedFolders[i] - 1];
    }

    return selectedNames;
  }

  public void updateViews(){
  }

  public void updateContent(){
    updateFolderContent();
    updateQuickAccess();
    updateMenu();
  }

  public void newFolder(){
    winCollection.addNew("newFolderWin");
  }

  public void createFile(String fileName, String fileType){
    System.err.println("MainWin1 create file " + fileName + " type (" + fileType + ")");
    Charset charset = Charset.forName("UTF-8");
    Path newFilePath = null;

    if ("/" == currFolder.toString()){
      newFilePath = Paths.get(currFolder.toString() + fileName);
    }
    else{
      newFilePath = Paths.get(currFolder.toString() + "/" + fileName);
    }

    try (BufferedWriter writer = Files.newBufferedWriter(newFilePath, charset,
                                                         StandardOpenOption.CREATE)) {
      updateContent();
    } catch (IOException ioe) {
        errorWindow("Could not create file " + newFilePath.toString());
        System.err.println("IOException: " + ioe.getMessage());
    }
  }

  public void exclude(){
    int i = 0;
    int tempIndex = 0;
    int QAF_index = -1;
    String[] tempFolders = null;
    String[] newAliases = null;
    Path tempPath = null;

    if (null != selectedQuickAccess && 1 == selectedQuickAccess.length){
      tempFolders = new String[quickAccessFolders.length - 1];
      QAF_index = view1.getMinSelectionIndex();
      for (i = 0; i < quickAccessFolders.length; i++){
        if (i != QAF_index){
          tempFolders[tempIndex] = quickAccessFolders[i];
          tempIndex++;
        }
      }
      quickAccessFolders = tempFolders;
      if (null != quickAccessFolders){
        newAliases = new String[quickAccessFolders.length];

        for (i = 0; i < quickAccessFolders.length; i++){
          tempPath = Paths.get(quickAccessFolders[i]);
          newAliases[i] = tempPath.getFileName().toString();
        }

        setQuickAccessAliases(newAliases);
        updateContent();
      }
    }
  }

  public void delete(){
    int answer = -1;
    boolean noo = false;

    if (null != selectedFolders){
      answer = yesNoWindow("Are you sure you want to delete " + selectedFolders.length +" selected file(s)");

      if (0 == answer){
        for (int i = 0; i < selectedFolders.length; i++){
          deleteFile(Paths.get(fullFileNames[selectedFolders[i]]));
        }
        updateContent();
      }
      else{
        updateContent();
        selectedFolders = null;
      }
    }
  }

  private void deleteFile(Path deleteFile){
    try{
      Files.delete(deleteFile);
    } catch (NoSuchFileException x) {
        errorWindow(deleteFile.toString() + ": no such" + " file or directory");
    } catch (DirectoryNotEmptyException x) {
        errorWindow(deleteFile.toString() + " is not empty");
    } catch (IOException ioe) {
        // File permission problems are caught here.
        System.err.println(ioe);
    }
  }

  public void copy(){
    moveSetup("copy");
    winCollection.setMovePerformers(null);
  }

  public void cut(){
    moveSetup("cut");
  }

  private void moveSetup(String moveType){
    String[] groupsToUpdate;
    Path[] moveFiles;
    int i;

    if (null != selectedFolders){
      moveFiles = new Path[selectedFolders.length];

      for (i = 0; i < moveFiles.length; i++){
        moveFiles[i] = Paths.get(fullFileNames[selectedFolders[i]]);
      }

      winCollection.setMoveSources(moveFiles);
      winCollection.setMoveType(moveType);

      if ("cut" == moveType){
        groupsToUpdate = winCollection.groupsContainPath(moveFiles);

        for (i = 0; i < groupsToUpdate.length; i++){
          winCollection.setMoveUpdateIndexes(groupsToUpdate[i], moveFiles);
        }

        winCollection.setMovePerformers(groupsToUpdate);
      }
    }
  }

  public void paste(){
    Path[] sourceFiles = winCollection.getMoveSources();
    String moveType = winCollection.getMoveType();
    String[] movePerformers;
    boolean copyOK = true;
    int i;

    if (null != sourceFiles && null != moveType){
      if ("cut" == moveType){
        for (i = 0; i < sourceFiles.length; i++){
          copyOK = handleMove(sourceFiles[i]);
        }
      }
      else if ("copy" == moveType){
        for (i = 0; i < sourceFiles.length; i++){
          copyOK = handleCopy(sourceFiles[i]);
        }
      }

      if (true == copyOK){
        winCollection.setMoveSources(null);
        if (null != winCollection.getMovePerformers()){
          sourceFiles = getNewLocations(sourceFiles);

          movePerformers = winCollection.getMovePerformers();
          for (i = 0; i < movePerformers.length; i++){
            winCollection.updateItemPaths(movePerformers[i], sourceFiles);
          }
        }else{
          sourceFiles = getNewLocations(sourceFiles);
          winCollection.updateItemPaths(winCollection.getMovePerformer(), sourceFiles);
        }
        winCollection.setMovePerformers(null);
        winCollection.setMovePerformer(null);
        updateContent();
      }
      else {
        errorWindow("Error while pasting");
      }
    }
  }

  private Path[] getNewLocations(Path[] oldLocations){
    Path[] newLocations = new Path[oldLocations.length];

    for (int i = 0; i < newLocations.length; i++){
      newLocations[i] = currFolder.resolve(oldLocations[i].getFileName());
    }
    return newLocations;
  }

  private boolean handleMove(Path sourceFile){
    try{
      Files.move(sourceFile, currFolder.resolve(sourceFile.getFileName()), StandardCopyOption.ATOMIC_MOVE);
    } catch(AtomicMoveNotSupportedException anse){
        System.err.println("atomic move not supported");
        try{
          Files.move(sourceFile, currFolder.resolve(sourceFile.getFileName()));
        } catch(IOException ioe){
          System.err.println("could not move file. " + ioe.getMessage());
          return false;
        }
    } catch(IOException ioe){
        System.err.println("could not move file. " + ioe.getMessage());
        return false;
    }
    return true;
  }

  private boolean handleCopy(Path sourceFile){
    try{
      Files.copy(sourceFile, currFolder.resolve(sourceFile.getFileName()));
    } catch(IOException ioe){
      System.err.println("could not copy file. " + ioe.getMessage());
      errorWindow("Could not move file " + sourceFile.toString());
      return false;
    }
    return true;
  }

  public void openFile(){
    Path tempPath = null;
    String tempFileName = null;
    String tempWholePath = null;

    if (null == selectedFolders){
      System.err.println("[ERROR] got null to selectedFolders at some point]");
      //handle error by not opening
    }
    else if (selectedFolders.length > 1){
      errorWindow("Only on file can be opened at a time");
    }
    else if (selectedFolders.length < 1){
      System.err.println("Trying to open file when none selected");
    }
    else{
      if (null != fullFileNames){
        tempPath = Paths.get(fullFileNames[selectedFolders[0]]);
      }

      /* open previous folder */
      if (0 == selectedFolders[0]){
        currFolder = prevFolder;
        if (!(currFolder.toString().equals("/"))){
          tempFileName = currFolder.getFileName().toString();
          tempWholePath = currFolder.toString();

          /* assign folder under current folder to prevFolder */
          prevFolder = Paths.get(currFolder.toString().substring(0, tempWholePath.length() - tempFileName.length()));
          System.err.println("prev folder set to: " + prevFolder);
        }
        folderNameField.setText(currFolder.toString());
        updateFolderContent();
      }
      //open the folder
      else if (Files.isDirectory(tempPath)){
        if (null != tempPath){
          prevFolder = currFolder;
          currFolder = tempPath;
          folderNameField.setText(currFolder.toString());
          updateFolderContent();
        }
      }
      //open the file
      else{
        try{
          java.awt.Desktop.getDesktop().open(new File(tempPath.toString()));
        }
        catch (IOException ex){
          System.out.println("IOException: " + ex.getMessage());
        }
      }
    }
  }

  protected void handleEvent(fridge.action_handling.MyListener ML_ptr){
    String tempStore = null;
    int i;

    //make it impossible to select the first row of folders of groups
    if ("ClassListSelectionListener" == ML_ptr.getType()){
      if ("folder" == ML_ptr.getName()){
        selectedFolders = new int[((fridge.action_handling.ClassListSelectionListener)ML_ptr).getSelectedIndexesLen()];
        selectedFolders = ((fridge.action_handling.ClassListSelectionListener)ML_ptr).getSelectedIndexes();
      }
      else if ("quickAccess" == ML_ptr.getName()){
        selectedQuickAccess = new int[((fridge.action_handling.ClassListSelectionListener)ML_ptr).getSelectedIndexesLen()];
        selectedQuickAccess = ((fridge.action_handling.ClassListSelectionListener)ML_ptr).getSelectedIndexes();
      }
    }
    else if ("ClassActionListener" == ML_ptr.getType()){
      if ("folderShowGroup" == ML_ptr.getName()){
        showGroupWin();
      }
      else if ("quickSave" == ML_ptr.getName()){
        //ask for alias. it could be passed to addToQuickAccess method as a parameter.
        addToQuickAccess();
      }
      else if ("quickLoad" == ML_ptr.getName()){
        loadSelectedQuickAccessFolder();
      }
      else if ("qa_showGroup" == ML_ptr.getName()){
        showGroupWin();
      }
      else if ("qa_operations" == ML_ptr.getName()){
        winCollection.addNew("operationsWin", myWindowIndex);
      }
      else if ("folderNameField" == ML_ptr.getName()){
        tempStore = currFolder.toString();
        currFolder = Paths.get(((fridge.action_handling.ClassActionListener)ML_ptr).getActionCommand());
        if (Files.isDirectory(currFolder)){
          updateFolderContent();
          winCollection.setCurrFolder(currFolder);
        }
        else{
          currFolder = Paths.get(tempStore);
        }
      }
    }
  }

  private void showGroupWin(){
    if (true == hideSuccessful()){
      if (false == winCollection.namedWindowExists("MainWin2")){
        System.out.println("[DEBUG] creating MainWin2");
        winCollection.addNew("MainWin2");
      }
      else if (true == winCollection.namedWindowIsHidden("MainWin2")){
        System.out.println("[DEBUG] showing window: MainWin2");
        winCollection.showWindow("MainWin2");
      }
    }
    //if MainWin2 does not exist create it. if it is hidden show it
  }

  private void updateFolderContent(){
    String[] newContent = null;
    String[] temp = null;
    String currFileName = null;
    String nextRowString = null;
    int folderFileCount = 0;
    int testFileCount = 0;
    int i;

    if (Files.isDirectory(currFolder)){
      try (DirectoryStream<Path> stream = Files.newDirectoryStream(currFolder)){
        fullFileNames = null; //reset earlier file names

        for (Path file: stream){
          currFileName = file.getFileName().toString();

          if (null == fullFileNames){
            fullFileNames = new String[1];
            fullFileNames[0] = file.toString();
          }
          if (null != fullFileNames){
            temp = fullFileNames;
            fullFileNames = new String[fullFileNames.length + 1];
            for (i = 0; i < fullFileNames.length - 1; i++){
              fullFileNames[i] = temp[i];
            }
            fullFileNames[i] = file.toString();
          }

          if ('.' != currFileName.charAt(0) ||
              '.' == currFileName.charAt(1) || true){
            if (null == newContent){
              if (true == Files.isDirectory(file)){
                nextRowString = "<dir> ";
              }
              else{
                nextRowString = "           ";
              }
              newContent = new String[folderFileCount + 2];
              newContent[folderFileCount] = "..";
              folderFileCount++;
              newContent[folderFileCount] = nextRowString + currFileName;;
              folderFileCount++;
            }
            else{
              temp = newContent;
              newContent = new String[folderFileCount + 1];
              for (i = 0; i < folderFileCount; i++){
                newContent[i] = temp[i];
              }
              if (true == Files.isDirectory(file)){
                nextRowString = "<dir> ";
              }
              else{
                nextRowString = "           ";
              }
              newContent[folderFileCount] = nextRowString + currFileName;
              folderFileCount++;
            }
          }
        }
      }
      catch (IOException | DirectoryIteratorException x){
        System.err.println(x);
      }
    }

    if (null == newContent){
      String[] prev = new String[1];
      prev[0] = "..";
      view0.setListData(prev);
    }
    else{
      view0.setListData(newContent);
    }
  }

  private void clearView(JList view){
    DefaultListModel viewListModel = (DefaultListModel) view.getModel();
    viewListModel.removeAllElements();
  }

  private void updateQuickAccess(){}

  private void addToQuickAccess(){
    String[] storeArray = null;
    int i = 0;
    int maxIndex = -1;
    int[] allIndices = null;

    maxIndex = view1.getLastVisibleIndex();
    if (maxIndex > -1){
      storeArray = new String[maxIndex + 2];
      allIndices = new int[maxIndex + 1];

      //copy earlier quick access content to storeArray
      for (i = 0; i <= maxIndex; i++){
        view1.setSelectedIndex(i);
        storeArray[i] = view1.getSelectedValue();
      }

      addQuickAccessFolder(currFolder.toString());
      storeArray[i] = getAlias();
      winCollection.setQA_folderAliases(storeArray);
      view1.setListData(storeArray);
    }
    else{
      storeArray = new String[1];
      addQuickAccessFolder(currFolder.toString());
      storeArray[0] = getAlias();
      winCollection.setQA_folderAliases(storeArray);
      view1.setListData(storeArray);
    }
  }

  private String getAlias(){
    return defaultAlias();
  }

  private String defaultAlias(){
    Path alias = null;

    alias = currFolder.getFileName();

    /* fixes problem with root ("/") folder */
    if (null == alias){
      return currFolder.toString();
    }

    return alias.toString();
  }

  private void addQuickAccessFolder(String newFolder){
    int i;
    String[] temp = quickAccessFolders;

    if (null == quickAccessFolders){
      quickAccessFolders = new String[1];
      quickAccessFolders[0] = newFolder;
    }
    else{
      quickAccessFolders = new String[temp.length + 1];
      for (i = 0; i < temp.length; i++){
        quickAccessFolders[i] = temp[i];
      }
      quickAccessFolders[i] = newFolder;
    }
    winCollection.setQuickAccessFolders(quickAccessFolders);
  }

  private void loadSelectedQuickAccessFolder(){
    int QAF_index;
    if (null != selectedQuickAccess && 1 == selectedQuickAccess.length){
      QAF_index = view1.getMinSelectionIndex();
      currFolder = Paths.get(quickAccessFolders[QAF_index]);
      folderNameField.setText(quickAccessFolders[QAF_index]);
      updateFolderContent();
    }
    else{
      errorWindow("Cannot load multiple Quick Access Folders");
    }
  }

  public void loadQuickAccessCollection(FolderCollectionItem collectionItem){
    int i;
    String[] aliases = collectionItem.getAliases();
    String[] paths = collectionItem.getPaths();

    setQuickAccessFolders(collectionItem.getPaths());
    setQuickAccessAliases(collectionItem.getAliases());
    setLoadedQuickAccessCollection(collectionItem.getName());
    winCollection.setLoadedFolderCollection(collectionItem.getName());
  }

  private void printSelectedFiles(){
    int i;

    if (null != selectedFolders){
      System.err.print("Selected files:\n\t");
      for (i = 0; i < selectedFolders.length; i++){
        System.err.print(selectedFolders[i] + ", ");
      }
    }
  }

  public boolean hideSuccessful(){
    if (true == winCollection.hideNotificationOk("MainWin1", myWindowIndex)){
      frame.setVisible(false);
      winCollection.printHiddenWindows();
      return true;
    }
    return false;
  }

  private Path[] getPathsOfCurrentFolder(){
    int i;
    int pathCount = 0;
    Path[] temp = null;
    Path[] paths = null;
    Path processedPath = null;
    //edit this to make sense

    try (DirectoryStream<Path> stream = Files.newDirectoryStream(currFolder)){
      for (Path file: stream){
        processedPath = file.getFileName();

        if ('.' != processedPath.getFileName().toString().charAt(0) ||
            '.' == processedPath.getFileName().toString().charAt(1)){
          if (null == paths){
            paths = new Path[1];
            paths[pathCount] = processedPath;
            pathCount++;
          }
          else{
            temp = paths;
            paths = new Path[pathCount + 1];
            for (i = 0; i < pathCount; i++){
              paths[i] = temp[i];
            }
            paths[pathCount] = processedPath;
            pathCount++;
          }
        }
      }
    }
    catch (IOException | DirectoryIteratorException x){
      System.err.println(x.getMessage());
    }

    return paths;
  }
}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "status".
 *
 * @property integer $id
 * @property string $message
 * @property integer $permissions
 * @property integer $created_at
 * @property integer $updated_at
 */
class Status extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'status';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['permissions', 'created_at', 'updated_at'], 'integer'],
            [['created_at', 'updated_at'], 'required'],
            [['message'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'message' => Yii::t('app', 'Message'),
            'permissions' => Yii::t('app', 'Permissions'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
        ];
    }
}


text:
import { TestBed } from '@angular/core/testing';

import { MarkerService } from './marker.service';

describe('MarkerService', () => {
  let service: MarkerService;

  beforeEach(() => {
    TestBed.configureTestingModule({});
    service = TestBed.inject(MarkerService);
  });

  it('should be created', () => {
    expect(service).toBeTruthy();
  });
});


text:
get '/' do
  redirect '/posts'
end


text:
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                Toggle navigation

            </button>
            Try

            <form class="navbar-form navbar-left" ng-submit="searchItem()">

                    <input type="text" class="form-control"
                           placeholder="Search"
                           ng-model="searchQuery"
                           uib-typeahead="post.title for post in items | filter:$viewValue | limitTo:8"
                           typeahead-on-select="selectItem($item, $model, $label)"
                    />

                <button type="submit" class="btn btn-default">Submit</button>
            </form>

Blog


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>fr.univnantes.vroom</groupId>
  <artifactId>v-room</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>${project.artifactId}</name>
  <description>A software for managing room reservations</description>
  <inceptionYear>2015</inceptionYear>
  <licenses>
    <license>
      <name>MIT</name>
      <url>https://opensource.org/licenses/MIT</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
    <encoding>UTF-8</encoding>
    <scala.version>2.11.5</scala.version>
    <scala.compat.version>2.11</scala.compat.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>${scala.version}</version>
    </dependency>

    <!-- Test -->
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_${scala.compat.version}</artifactId>
      <version>2.2.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalamock</groupId>
      <artifactId>scalamock-scalatest-support_2.11</artifactId>
      <version>3.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src/main/scala</sourceDirectory>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
      <plugin>
        <!-- see http://davidb.github.com/scala-maven-plugin -->
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <args>
                <arg>-dependencyfile</arg>
                <arg>${project.build.directory}/.scala_dependencies</arg>
              </args>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- disable surefire -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.7</version>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
      </plugin>
      <!-- enable scalatest -->
      <plugin>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest-maven-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
          <junitxml>.</junitxml>
          <filereports>WDF_TestSuite.txt</filereports>
        </configuration>
        <executions>
          <execution>
            <id>test</id>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>


text:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/content/slicedemo"/>
    <filter root="/content/dam/slicedemo"/>
</workspaceFilter>


text:
<resources>
    <string name="app_name">Benchmark</string>
</resources>


text:
package com.thoughtworks.go.server.util;

import org.h2.api.DatabaseEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.SQLException;

public class H2EventListener implements DatabaseEventListener {
    private static final Logger LOGGER = LoggerFactory.getLogger(H2EventListener.class);
    private int listenerLastState;
    private long startTime;

    public void init(String url) {
        LOGGER.info("Initializing database: {}", url);
    }

    public void opened() {
        LOGGER.info("Database is opened");
    }

    public void exceptionThrown(SQLException e, String sql) {
        LOGGER.error("Exception thrown from database on sql statement: {}", sql, e);
    }

    public void setProgress(int state, String name, int progress, int max) {
        if (state == listenerLastState) {
            if (System.currentTimeMillis() - startTime > 10000) {
                logState(state, name, progress, max);
                startTime = System.currentTimeMillis();
            }
        } else {
            listenerLastState = state;
            logState(state, name, progress, max);
        }
    }

    void logState(int state, String name, int progress, int max) {
        switch (state) {
            case DatabaseEventListener.STATE_BACKUP_FILE:
                log("Backing up " + name + " " + (100L * progress / max) + "%");
                break;
            case DatabaseEventListener.STATE_CREATE_INDEX:
                log("Creating index " + name + " " + (100L * progress / max) + "%");
                break;
            case DatabaseEventListener.STATE_RECOVER:
                log("Recovering " + name + " " + (100L * progress / max) + "%");
                break;
            case DatabaseEventListener.STATE_SCAN_FILE:
                log("Scanning file " + name + " " + (100L * progress / max) + "%");
                break;
            case DatabaseEventListener.STATE_STATEMENT_START:
            case DatabaseEventListener.STATE_STATEMENT_END:
            case DatabaseEventListener.STATE_STATEMENT_PROGRESS:
                break;
            default:
                log("Unknown state: " + state);
        }
    }

    public void closingDatabase() {
        LOGGER.info("Closing database");
    }

    void log(String message) {
        System.out.println(message);
        LOGGER.info(message);
    }
}


text:
from __future__ import unicode_literals

from django.db import models, migrations
import datetime

class Migration(migrations.Migration):

    dependencies = [
        ('intern', '0003_auto_20150910_1753'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='date',
            options={'verbose_name_plural': 'Termine', 'verbose_name': 'Termin'},
        ),
        migrations.RemoveField(
            model_name='date',
            name='date',
        ),
        migrations.AddField(
            model_name='date',
            name='end',
            field=models.DateTimeField(verbose_name='Ende', default=datetime.datetime.now, blank=True),
        ),
        migrations.AddField(
            model_name='date',
            name='start',
            field=models.DateTimeField(verbose_name='Beginn', default=datetime.datetime.now, blank=True),
        ),
    ]


text:
<!doctype html>

		<meta charset="utf-8">
		<title>Interactive journalism</title>
		<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
		<meta name="author" content="Hakim El Hattab">
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
		<link rel="stylesheet" href="css/reveal.min.css">
		<link rel="stylesheet" href="../css/styles.css">
		<link rel="stylesheet" href="../css/bootstrap.css">
		<link rel="stylesheet" href="css/theme/default.css" id="theme">
		<link rel="stylesheet" href="css/style.css">

		<link rel="stylesheet" href="lib/css/zenburn.css">

Interactive Journalism

Wilhelm Eklund

SRC

Developer @ Aftonbladet

Filip Holmberg

A

Developer @ Aftonbladet

Visualize election results

Parse data

Present to users

Scaling the application

Thank you!