text:
package uk.ac.ebi.atlas.search.diffanalytics;

import org.hamcrest.MatcherAssert;
import org.hamcrest.core.Is;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import uk.ac.ebi.atlas.model.experiment.differential.Contrast;
import uk.ac.ebi.atlas.model.experiment.differential.DifferentialExpression;
import uk.ac.ebi.atlas.model.experiment.differential.microarray.MicroarrayExpression;
import uk.ac.ebi.atlas.trader.ContrastTrader;

import java.sql.ResultSet;

@RunWith(MockitoJUnitRunner.class)
public class DiffAnalyticsRowMapperTest {

    private DiffAnalyticsRowMapper subject;

    @Mock
    private ContrastTrader contrastTraderMock;

    @Mock
    private ResultSet resultSetMock;

    private Contrast contrast = new Contrast("c1", "ad", null, null, "name");

    @Before
    public void setUp() throws Exception {
        Mockito.when(contrastTraderMock.getContrast("e1", "c1")).thenReturn(contrast);

        Mockito.when(resultSetMock.getString(DiffAnalyticsQueryBuilder.EXPERIMENT)).thenReturn("e1");
        Mockito.when(resultSetMock.getString(DiffAnalyticsQueryBuilder.CONTRASTID)).thenReturn("c1");
        Mockito.when(resultSetMock.getString(DiffAnalyticsQueryBuilder.IDENTIFIER)).thenReturn("id1");
        Mockito.when(resultSetMock.getString(DiffAnalyticsQueryBuilder.ORGANISM)).thenReturn("org1");
        Mockito.when(resultSetMock.getDouble(DiffAnalyticsQueryBuilder.PVALUE)).thenReturn(0.0001);
        Mockito.when(resultSetMock.getDouble(DiffAnalyticsQueryBuilder.LOG_2_FOLD)).thenReturn(-1.1);
        Mockito.when(resultSetMock.getString(DiffAnalyticsQueryBuilder.TSTAT)).thenReturn("1.1");

        subject = new DiffAnalyticsRowMapper(contrastTraderMock);
    }

    @Test
    public void testMapRow() throws Exception {
        DiffAnalytics expression = subject.mapRow(resultSetMock, 1);

        MatcherAssert.assertThat(expression.getBioentityId(), Is.is("id1"));
        MatcherAssert.assertThat(expression.getExperimentAccession(), Is.is("e1"));
        MatcherAssert.assertThat(expression.getSpecies(), Is.is("org1"));

        DifferentialExpression value = new MicroarrayExpression(0.0001, -1.1, 1.1);
        MatcherAssert.assertThat(expression.getExpression(), Is.is(value));
    }

    @Test
    public void testBuildDifferentialExpression() {
        DifferentialExpression expression = subject.buildDifferentialExpression(0.001, 1, null);
        MatcherAssert.assertThat(expression.getClass().getName(), Is.is(DifferentialExpression.class.getName()));
    }

    @Test
    public void testBuildMicroarrayExpression() {
        DifferentialExpression expression = subject.buildDifferentialExpression(0.001, 1, "1.1");
        MatcherAssert.assertThat(expression.getClass().getName(), Is.is(MicroarrayExpression.class.getName()));
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Primary_Contact__c</fullName>
    <deleteConstraint>SetNull</deleteConstraint>
    <description>The main Contact for a Household or Administrative Account.</description>
    <externalId>false</externalId>
    <inlineHelpText>The main Contact for a Household or Administrative Account.</inlineHelpText>
    <label>Primary Contact</label>
    <referenceTo>Contact</referenceTo>
    <relationshipLabel>Account</relationshipLabel>
    <relationshipName>Organizations</relationshipName>
    <required>false</required>
    <trackFeedHistory>false</trackFeedHistory>
    <type>Lookup</type>
</CustomField>

redpajama_set_name: RedPajamaGithub


text:
import os
from setuptools import setup, find_packages
import basitapi

def read(fname):
    try:
        return open(os.path.join(os.path.dirname(__file__), fname)).read()
    except IOError:
        return ''

setup(
    name='basitapi',
    version=basitapi.__version__,
    description=read('DESCRIPTION'),
    long_description=read('README.md'),
    license='The MIT LICENCE',
    platforms=['OS Independent'],
    keywords='rest, api, django',
    author='Ömer ÜCEL',
    author_email='omerucel@gmail.com',
    url='https://github.com/omerucel/basitapi',
    packages=find_packages(exclude=['tests', 'cover']),
    include_package_data=True,
    install_requires=[
        'Django',
    ]
)


text:
// This file was automatically generated by lister-gen

package v1

import (
	"k8s.io/apimachinery/pkg/api/errors"
	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/labels"
	api "k8s.io/client-go/pkg/api"
	v1 "k8s.io/client-go/pkg/api/v1"
	"k8s.io/client-go/tools/cache"
)

// NamespaceLister helps list Namespaces.
type NamespaceLister interface {
	// List lists all Namespaces in the indexer.
	List(selector labels.Selector) (ret []*v1.Namespace, err error)
	// Get retrieves the Namespace from the index for a given name.
	Get(name string) (*v1.Namespace, error)
	NamespaceListerExpansion
}

// namespaceLister implements the NamespaceLister interface.
type namespaceLister struct {
	indexer cache.Indexer
}

// NewNamespaceLister returns a new NamespaceLister.
func NewNamespaceLister(indexer cache.Indexer) NamespaceLister {
	return &namespaceLister{indexer: indexer}
}

// List lists all Namespaces in the indexer.
func (s *namespaceLister) List(selector labels.Selector) (ret []*v1.Namespace, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1.Namespace))
	})
	return ret, err
}

// Get retrieves the Namespace from the index for a given name.
func (s *namespaceLister) Get(name string) (*v1.Namespace, error) {
	key := &v1.Namespace{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
	obj, exists, err := s.indexer.Get(key)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(api.Resource("namespace"), name)
	}
	return obj.(*v1.Namespace), nil
}


text:
/* vim: set et ts=4 sts=4 sw=4 tw=72 : */
/* See the LICENSE file for the license of the project */
package uk.ac.cam.cl.git;

import java.io.IOException;
import java.io.File;
import java.io.FileReader;
import java.io.BufferedReader;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.LinkedList;
import java.util.Collections;
import java.util.Set;
import java.util.HashSet;

import uk.ac.cam.cl.git.api.RepoUserRequestBean;
import uk.ac.cam.cl.git.api.DuplicateRepoNameException;
import uk.ac.cam.cl.git.api.ForkRequestBean;
import uk.ac.cam.cl.git.api.HereIsYourException;
import uk.ac.cam.cl.git.api.RepositoryNotFoundException;
import uk.ac.cam.cl.git.api.IllegalCharacterException;
import uk.ac.cam.cl.git.api.KeyException;
import uk.ac.cam.cl.git.api.Commit;
import uk.ac.cam.cl.git.api.FileBean;
import uk.ac.cam.cl.git.configuration.ConfigurationLoader;
import uk.ac.cam.cl.git.interfaces.*;

import com.jcraft.jsch.*;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This is the concrete implementation of WebInterface, used on the
 * server to serve repos, files, add SSH keys, etc.
 *
 * @author Kovacsics Robert <rmk35@cam.ac.uk>
 * @author Isaac Dunn <ird28@cam.ac.uk>
 */

public class GitService implements WebInterface {
    /* For logging */
    private static final Logger log = LoggerFactory.getLogger(GitService.class);

    private static Set<String> sshKeyGeneration =
        Collections.synchronizedSet(new HashSet<String>());

    @Override
    public List<String> listRepositories(String securityToken)
    {
        checkSecurityToken(securityToken);
        List<Repository> repos = ConfigDatabase.instance().getRepos();
        List<String> toReturn = new LinkedList<String>();
        for (Repository repo : repos) {
            toReturn.add(repo.getName());
        }
        return toReturn;
    }

    @Override
    public List<Commit> listCommits
           (String securityToken
          , String repoName)
            throws IOException, RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        if (repoName == null)
            throw new RepositoryNotFoundException("No repository given.");

        Repository repo = ConfigDatabase.instance().getRepoByName(repoName);
        if (repo == null)
            throw new RepositoryNotFoundException("Repository not found in database! "
                        + "It may exist on disk though.");

        try
        {
            repo.openLocal(repoName); /* throws IOException */
        }
        catch (org.eclipse.jgit.errors.RepositoryNotFoundException e)
        {
            /* Dangling repository entry, remove from database */
            ConfigDatabase.instance().delRepoByName(repoName);
            throw new RepositoryNotFoundException("Repository not found on disk! "
                        + "Removed from database.");
        }

        return repo.listCommits();
    }

    @Override
    public String resolveCommit
           (String securityToken
          , String repoName
          , String commitName)
            throws IOException, RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        if (repoName == null)
            throw new RepositoryNotFoundException("No repository given.");

        Repository repo = ConfigDatabase.instance().getRepoByName(repoName);
        if (repo == null)
            throw new RepositoryNotFoundException("Repository not found in database! "
                        + "It may exist on disk though.");

        try
        {
            repo.openLocal(repoName); /* throws IOException */
        }
        catch (org.eclipse.jgit.errors.RepositoryNotFoundException e)
        {
            /* Dangling repository entry, remove from database */
            ConfigDatabase.instance().delRepoByName(repoName);
            throw new RepositoryNotFoundException("Repository not found on disk! "
                        + "Removed from database.");
        }

        return repo.resolveCommit(commitName);
    }

    @Override
    public List<String> listFiles
    (String securityToken
          , String repoName
          , String commitID)
            throws IOException, RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        if (repoName == null)
            throw new RepositoryNotFoundException("No repository given.");

        Repository repo = ConfigDatabase.instance().getRepoByName(repoName);
        if (repo == null)
            throw new RepositoryNotFoundException("Repository not found in database! "
                        + "It may exist on disk though.");

        try
        {
            repo.openLocal(repoName, commitID); /* throws IOException */
        }
        catch (org.eclipse.jgit.errors.RepositoryNotFoundException e)
        {
            /* Dangling repository entry, remove from database */
            ConfigDatabase.instance().delRepoByName(repoName);
            throw new RepositoryNotFoundException("Repository not found on disk! "
                        + "Removed from database.");
        }

        Collection<String> files = repo.getSources();
        List<String> rtn = new LinkedList<String>();
        if (files != null)
            for (String file : files)
                rtn.add(file);

        return rtn;
    }

    @Override
    public String getFile
           (String securityToken
          , String fileName
          , String commitID
          , String repoName)
            throws IOException, RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        if (repoName == null)
            throw new RepositoryNotFoundException("No repository given.");

        Repository repo = ConfigDatabase.instance().getRepoByName(repoName);
        if (repo == null)
            throw new RepositoryNotFoundException("Repository not found in database! "
                    + "It may exist on disk though.");

        try
        {
            repo.openLocal(repoName, commitID);
        }
        catch (org.eclipse.jgit.errors.RepositoryNotFoundException e)
        {
            /* Dangling repository entry, remove from database */
            ConfigDatabase.instance().delRepoByName(repoName);
            throw new RepositoryNotFoundException("Repository not found on disk! "
                    + "Removed from database.");
        }

        return repo.getFile(fileName);
    }

    @Override
    public List<FileBean> getAllFiles
           (String securityToken
          , String repoName
          , String commitID)
            throws IOException, RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        List<FileBean> rtn = new LinkedList<FileBean>();
        for (String file : listFiles(securityToken, repoName, commitID))
        {
            rtn.add(new FileBean(file, getFile(securityToken,
                                        file, commitID, repoName)));
        }

        return rtn;
    }

    @Override
    public String forkRepository
           (String securityToken
          , ForkRequestBean details)
            throws IOException, DuplicateRepoNameException,
                              IllegalCharacterException
    {
        checkSecurityToken(securityToken);
        log.debug("Forking repository \"" + details.getRepoName() + ".git\""
                + " to \"" + details.getNewRepoName() + ".git\""
                + " for user \"" + details.getUserName() + "\"");
        Repository rtn = new Repository(details.getNewRepoName()
                                      , details.getUserName()
                                      , null /* RW */
                                      , null /* RO */
                                      , details.getRepoName());
        ConfigDatabase.instance().addRepo(rtn);
        while (!rtn.repoExists())
        {
            try
            {
                Thread.sleep(100);
            }
            catch (InterruptedException e)
            {
                /* If we woke up earlier from sleep than expected,
                 * continue to check for repo existence.
                 */
            }
        }
        rtn.cloneParent();
        /* No need to return only repo-name, as we either had it given
         * to us, or we created it in a known manner.
         */
        log.debug("Forked repository \"" + details.getRepoName() + ".git\""
                + " to \"" + details.getNewRepoName() + ".git\""
                + " for user \"" + details.getUserName() + "\"");
        return rtn.getRepoPath();
    }

    @Override
    public String addRepository
           (String securityToken
          , RepoUserRequestBean details)
            throws IOException, DuplicateRepoNameException,
                              IllegalCharacterException
    {
        checkSecurityToken(securityToken);
        log.debug("Creating new repository \"" + details.getRepoName()
                + ".git\"" + " for user \"" + details.getUserName()
                + "\"");
        Repository rtn = new Repository(details.getRepoName()
                                      , details.getUserName()
                                      , null
                                      , null);
        ConfigDatabase.instance().addRepo(rtn);
        /* No need to return repo-name as we had it given to us.
         */
        log.debug("Created new repository \"" + details.getRepoName()
                + ".git\"" + " for user \"" + details.getUserName()
                + "\"");
        return rtn.getRepoPath();
    }

    @Override
    public void deleteRepository
           (String securityToken
          , String repoName)
            throws IOException, RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        ConfigDatabase.instance().delRepoByName(repoName);

        /* Delete the repository on disk */
        recursiveDelete(new File(
            ConfigurationLoader.getConfig()
                .getGitoliteHome() + "/repositories/"
                    + repoName + ".git"));
    }

    @Override
    public void getMeAnException
           (String securityToken)
            throws HereIsYourException
    {
        checkSecurityToken(securityToken);
        boolean TRUE = true;
        if (TRUE)
            throw new HereIsYourException();
    }

    @Override
    public void addSSHKey
           (String securityToken
          , String key
          , String userName)
            throws IOException, KeyException
    {
        checkSecurityToken(securityToken);
        ConfigDatabase.instance().addSSHKey(key, userName);
    }

    @Override
    public String getRepoURI
           (String securityToken
          , String repoName)
            throws RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        return ConfigDatabase.instance()
                .getRepoByName(repoName)
                .getRepoPath();
    }

    @Override
    public void addReadOnlyUser
           (String securityToken
          , RepoUserRequestBean details)
            throws IOException, RepositoryNotFoundException
    {
        checkSecurityToken(securityToken);
        Repository repo = ConfigDatabase.instance()
                .getRepoByName(details.getRepoName());
        repo.addReadOnlyUser(details.getUserName());
        ConfigDatabase.instance().updateRepo(repo);
    }

    @Override
    public List<String> getDanglingRepos
           (String securityToken)
            throws IOException
    {
        checkSecurityToken(securityToken);
        /* Just to be sure! */
        ConfigDatabase.instance().generateConfigFile();

        return Arrays.asList(ConfigDatabase.instance().listDanglingRepositories());
    }

    @Override
    public void removeDanglingRepos
           (String securityToken)
            throws IOException
    {
        checkSecurityToken(securityToken);
        /* Just to be sure! */
        ConfigDatabase.instance().generateConfigFile();

        for (String repo : ConfigDatabase.instance()
                            .listDanglingRepositories())
        {
            log.info("Removing (dangling) repository \"" + repo + "\"!");
            recursiveDelete(new File(
                        ConfigurationLoader.getConfig()
                            .getGitoliteHome() + "/repositories/"
                                + repo + ".git"));

            log.info("Removed (dangling) repository \"" + repo + "\"!");
        }
    }

    /*
     * Helper function to remove directories recursively
     */
    private static void recursiveDelete(File f)
    {
        if (f.isDirectory())
        {
            if (f.list().length == 0)
                f.delete();
            else
            {
                for (String child : f.list())
                    recursiveDelete(new File(f, child));
                f.delete();
            }

        }
        else
        {
            f.delete();
        }
    }

    /**
     * Rebuilds database from gitolite configuration file, in case the
     * two become out of sync.
     */
    @Override
    public void rebuildDatabase
           (String securityToken)
            throws IOException, DuplicateRepoNameException
    {
        checkSecurityToken(securityToken);
        ConfigDatabase.instance().rebuildDatabaseFromGitolite();
    }

    /**
     * Checks the security token in the configuration file against the
     * argument.
     *
     * @throws SecurityException When the token does not match or can
     * not be verified. This is a runtime exception as we can not
     * recover from this.
     */
    private void checkSecurityToken(String securityToken)
    {
        if (securityToken == null)
        {
            log.error("No securityToken query parameter given!");
            throw new SecurityException("No securityToken query parameter given!");
        }
        else if (ConfigurationLoader.getConfig()
                    .getSecurityToken() == null)
        {
            log.error("No securityToken configuration option set!");
            throw new SecurityException("No securityToken configuration option set!");
        }
        else if (!ConfigurationLoader.getConfig()
                    .getSecurityToken().equals(securityToken))
        {
            log.error("The given securityToken is invalid!\n"
                    + "Got      \"" + securityToken + "\"\n"
                    + "expected \""
                    + ConfigurationLoader.getConfig()
                        .getSecurityToken() + "\"");
            throw new SecurityException("The given securityToken is invalid!");
        }
    }

    public String getPrivateKey
           (String securityToken
          , String userName)
            throws IOException, JSchException
    {
        File privKey = new File(ConfigurationLoader.getConfig()
                .getGitoliteSSHKeyLocation() + "/" + "local/ro-" +
                userName);
        File pubKey  = new File(ConfigurationLoader.getConfig()
                .getGitoliteSSHKeyLocation() + "/" + "local/ro-" +
                userName + ".pub");
        JSch jsch = new JSch();

        /* Make sure for one user, only one key is being generated,
         * otherwise we will have two keys being passed back, the first
         * one being wrong.
         */
        synchronized (sshKeyGeneration)
        {
            while (sshKeyGeneration.contains(userName)
                 ||sshKeyGeneration.size() > ConfigurationLoader
                             .getConfig().getGitDefaultMaxPerRoute())
            {
                log.info("Waiting for another thread to finish with " +
                        userName);
                try
                {
                    sshKeyGeneration.wait();
                }
                catch (InterruptedException e)
                {
                    /* We will check again, by looping. */
                }
            }
            sshKeyGeneration.add(userName);
        }

        if (!privKey.exists() || !pubKey.exists())
        { /* Generate key pair */
            log.info("Generating keys for " + userName +
                    " for this machine");

            if (!pubKey.getParentFile().exists())
            {
                pubKey.getParentFile().mkdirs();
            }

            try
            {
                KeyPair keyPair = KeyPair.genKeyPair(jsch, KeyPair.RSA, 2048);
                keyPair.writePrivateKey(privKey.getAbsolutePath());
                keyPair.writePublicKey(pubKey.getAbsolutePath(),
                        "Local key for " + userName);
                keyPair.dispose();
            }
            catch (JSchException e)
            {
                privKey.delete();
                pubKey.delete();
                throw e;
            }

            try
            {
                ConfigDatabase.instance().rescanSSHKeys();
            }
            catch (KeyException e)
            {
                log.warn("The following keys have been removed: " +
                        e.getMessage());
            }

            log.info("Generated keys for " + userName +
                    " for this machine");
        }

        FileReader fileReader = new FileReader(privKey);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        StringBuilder rtn = new StringBuilder();
        String line = null;
        String lineSeparator = System.getProperty("line.separator");

        while ((line = bufferedReader.readLine()) != null)
        {
            rtn.append(line);
            rtn.append(lineSeparator);
        }

        /* Remove last line separator */
        rtn.deleteCharAt(rtn.length()-1);

        /* Tell other threads we have finished with this key */
        synchronized (sshKeyGeneration)
        {
            sshKeyGeneration.remove(userName);
            sshKeyGeneration.notify();
        }

        return rtn.toString();
    }
}


text:
package iso20022

// Identifies the different types of freight charges associated with goods.
type Charge13 struct {

	// Identifies whether the freight charges associated with the goods are "prepaid" or "collect".
	Type *FreightCharges1Code `xml:"Tp"`

	// Amount of money associated with a service.
	Charges []*ChargesDetails2 `xml:"Chrgs,omitempty"`
}

func (c *Charge13) SetType(value string) {
	c.Type = (*FreightCharges1Code)(&value)
}

func (c *Charge13) AddCharges() *ChargesDetails2 {
	newValue := new(ChargesDetails2)
	c.Charges = append(c.Charges, newValue)
	return newValue
}


text:
<!DOCTYPE html>

    <title>{% block title %}{{ SITENAME }}{% endblock %}</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    {% if THEMECOLOR %}
    <meta name="theme-color" content="{{ THEMECOLOR }}">
    {% endif %}
    {% if 'liquid_tags.notebook' in PLUGINS %}
        {% include 'includes/liquid_tags_nb_header.html' %}
    {% endif %}

    {# Favicons are a touchy subject. For reasoning for the following code, see: http://stackoverflow.com/a/23851464/872397 #}
    {% if FAVICON %}
    <link href="{{ SITEURL }}/{{ FAVICON }}" rel="icon">
    {% endif %}
    {% if FAVICON_IE %}

    {% endif %}
    {% if TOUCHICON %}
    <link rel="apple-touch-icon" href="{{ SITEURL }}/{{ TOUCHICON }}">
    {% endif %}

    {% block canonical_rel %}{% endblock %}

    {% block meta %}
        <meta name="author" content="{{ AUTHOR }}" />
    {% endblock %}

    {# Open Graph tags #}
    {% if USE_OPEN_GRAPH is not defined %}
        {% set USE_OPEN_GRAPH = True %}
    {% endif %}
    {% if USE_OPEN_GRAPH %}
    {% block opengraph %}

        {% if OPEN_GRAPH_FB_APP_ID %}
            <meta property="fb:app_id" content="{{ OPEN_GRAPH_FB_APP_ID }}"/>
        {% endif %}
        <meta property="og:site_name" content="{{ SITENAME }}" />
        <meta property="og:type" content="website"/>
        <meta property="og:title" content="{{ SITENAME }}"/>
        <meta property="og:url" content="{{ SITEURL }}"/>
        <meta property="og:description" content="{{ SITENAME }}"/>
        {% if OPEN_GRAPH_IMAGE %}
            <meta property="og:image"
                  content="{{ SITEURL }}/{{ OPEN_GRAPH_IMAGE }}"/>
        {% endif %}
    {% endblock %}
    {% endif %}

    {# Twitter Cards tags #}
    {% include 'includes/twitter_cards.html' %}

    {% if MANIFEST %}
    <link rel="manifest" href="{{ SITEURL }}/{{ MANIFEST }}">
    {% endif %}

    {% if BOOTSTRAP_THEME %}
        <link rel="stylesheet" href="{{ SITEURL }}/theme/css/bootstrap.{{ BOOTSTRAP_THEME }}.min.css" type="text/css"/>
    {% else %}
        <link rel="stylesheet" href="{{ SITEURL }}/theme/css/bootstrap.min.css" type="text/css"/>
    {% endif %}
    <link href="{{ SITEURL }}/theme/css/font-awesome.min.css" rel="stylesheet">

    <link href="{{ SITEURL }}/theme/css/pygments/{{ PYGMENTS_STYLE|default('native') }}.css" rel="stylesheet">
    {% if 'tipue_search' in PLUGINS %}
    <link href="{{ SITEURL}}/theme/tipuesearch/tipuesearch.css" rel="stylesheet">
    {% endif %}
    {% if DOCUTIL_CSS %}
        <link href="{{ SITEURL }}/theme/css/html4css1.css" rel="stylesheet">
    {% endif %}
    {% if TYPOGRIFY %}
        <link href="{{ SITEURL }}/theme/css/typogrify.css" rel="stylesheet">
    {% endif %}
    <link rel="stylesheet" href="{{ SITEURL }}/theme/css/style.css" type="text/css"/>
    {% if CUSTOM_CSS %}
        <link href="{{ SITEURL }}/{{ CUSTOM_CSS }}" rel="stylesheet">
    {% endif %}
    {% if SHARIFF %}
        <link href="{{ SITEURL }}/theme/css/shariff/shariff.min.css" rel="stylesheet">
    {% endif %}

    {% if FEED_ALL_ATOM %}
        <link href="{{ SITEURL }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate"
              title="{{ SITENAME }} ATOM Feed"/>
    {% endif %}
    {% if FEED_ALL_RSS %}
        <link href="{{ SITEURL }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate"
              title="{{ SITENAME }} RSS Feed"/>
    {% endif %}

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                Toggle navigation

            </button>

                {% if SITELOGO %} {% endif %}
                {% if not HIDE_SITENAME %}{{ SITENAME }}{% endif %}

                {% for title, link in MENUITEMS %}

{{ title }}

                {% endfor %}
                {% if DISPLAY_PAGES_ON_MENU %}
                    {% for p in PAGES %}

                             {{ p.menulabel|default(p.title) }}

                      {% endfor %}
                {% endif %}
                {% if DISPLAY_CATEGORIES_ON_MENU %}
                    {% for cat, null in categories %}

                            {{ cat | capitalize }}

                    {% endfor %}
                {% endif %}

            {% if 'tipue_search' in PLUGINS %}

                <form class="navbar-search" action="/search">
                  <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input" required>
                </form>

            {% endif %}

Archives

{% if BANNER and BANNER_ALL_PAGES %}
    {% include 'includes/banner.html' %}
{% elif BANNER and not BANNER_ALL_PAGES %}
    {% block banner %}{% endblock %}
{% endif %}

        {% if not HIDE_SIDEBAR or ABOUT_ME %}

        {% else %}

        {% endif %}
        {% block breadcrumbs %}
        {% endblock %}

        {% block content %}
        {% endblock %}

        {% if not HIDE_SIDEBAR or ABOUT_ME %}

            {% if ABOUT_ME %}
                {% include 'includes/aboutme.html' %}
            {% endif %}
            {% if not HIDE_SIDEBAR %}
                {% include 'includes/sidebar.html' %}
            {% endif %}

        {% endif %}

{% include 'includes/footer.html' %}

{% if BANNER %}

{% endif %}
{% include 'includes/github-js.html' %}
{% include 'includes/disqus_script.html' %}
{% include 'includes/ga.html' %}
{% include 'includes/piwik.html' %}

{% block scripts %}{% endblock %}


text:
import re
match = re.search(r'..g', 'piiig')
print 'fount', match.group(), match.groups()

match = re.search(r'<.*?>', '<b>foo<b>')
print match.group()


text:
CREATE TABLE [ServerEye].[dm_os_memory_pools](
	[UTCCaptureTime] [datetime] NOT NULL,
	[LocalCaptureTime] [datetime] NOT NULL,
	[DimMemoryTrackerID] [smallint] NOT NULL,
	[memory_node_id] [smallint] NOT NULL,
	[NumUniqueRows] [int] NOT NULL,
	[sum_max_free_entries_count] [bigint] NULL,
	[sum_free_entries_count] [bigint] NULL,
	[sum_removed_in_all_rounds_count] [bigint] NULL,
 CONSTRAINT [PKdm_os_memory_pools] PRIMARY KEY CLUSTERED
(
	[UTCCaptureTime] ASC,
	[DimMemoryTrackerID] ASC,
	[memory_node_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


text:
package org.apache.metamodel.query;

import junit.framework.TestCase;

public class FunctionTypeTest extends TestCase {

	public void testEvaluateNumbers() throws Exception {
		assertEquals(2.5, FunctionType.AVG.evaluate(1.5, 2, null, 3, 3.5));
		assertEquals(10.0, FunctionType.SUM.evaluate(1.5, 2, null, 3, 3.5));
		assertEquals(4l, FunctionType.COUNT.evaluate(1.5, 2, null, 3, 3.5));
		assertEquals(1.5, FunctionType.MIN.evaluate(1.5, 2, null, 3, 3.5));
		assertEquals(3.5, FunctionType.MAX.evaluate(1.5, 2, null, 3, 3.5));
	}

	public void testEvaluateStrings() throws Exception {
		assertEquals(2.5, FunctionType.AVG.evaluate("1.5", "2", null, "3",
				"3.5"));
		assertEquals(10.0, FunctionType.SUM.evaluate("1.5", "2", null, "3",
				"3.5"));
		assertEquals(2l, FunctionType.COUNT.evaluate("foo", "BAR", null));
		assertEquals("a", FunctionType.MIN.evaluate("abc", "a", null, "bcd"));
		assertEquals("bcd", FunctionType.MAX.evaluate("abc", "a", null, "bcd"));
	}
}


text:
<?php
error_reporting(1);
define('DBDEBUG',1);
ini_set('xdebug.var_display_max_depth', -1);
ini_set('xdebug.var_display_max_children', -1);
ini_set('xdebug.var_display_max_data', -1);

define('ROOT', realpath(dirname(__FILE__)));

function Loader($class,$ext=".php"){
    $filename = strtolower(str_replace('\\', DIRECTORY_SEPARATOR, ROOT.DIRECTORY_SEPARATOR.$class) . $ext);
	if(file_exists($filename) && is_file($filename)){
    	require_once($filename);
	}
}

function Inc($class,$ext=".php"){
    $filename = strtolower(str_replace(array('\\','/'), DIRECTORY_SEPARATOR, ROOT.DIRECTORY_SEPARATOR.$class) . $ext);
    if(file_exists($filename) && is_file($filename)){
        require_once($filename);
        return TRUE;
    }
    return FALSE;
}

    function View($view, $ext = ".php")
    {
        try {
            ob_start();
            $filename = strtolower(str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, ROOT . DIRECTORY_SEPARATOR . $view) . $ext);
            if (file_exists($filename) && is_file($filename)) {
                require ($filename);
            }
            return ob_get_clean();
        } catch(\Exception $e) {
            return $e->getCode();
        }
    }

//spl_autoload_register('Loader');

?>
<?php
/*
use \Theme\Controllers\Theme as theme;
use \Test\Controllers as app;
use \test\controllers\test as test;

$data = new \Library\Core\Data();
*/
$theme = "";

//$header = new theme\Header($theme);
Inc('/Library/v52/Core/Render');
Inc('/Library/v52/Core/Data');

//$render = new \Library\Core\Render();
$render = new Render();
echo $render->View('test/views/core/one','.html');

//$footer = new theme\Footer($theme);

//var_dump($test);
?>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. Torrey bot. Club 26: 70 (1899)

#### Original name
Fistulina firma Peck

### Remarks
null


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Examples for Physics/Mechanics — SymPy 1.0.1.dev documentation</title>

    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="http://96.sympy-live-tests.appspot.com/static/live-core.css" type="text/css" />
    <link rel="stylesheet" href="http://96.sympy-live-tests.appspot.com/static/live-autocomplete.css" type="text/css" />
    <link rel="stylesheet" href="http://96.sympy-live-tests.appspot.com/static/live-sphinx.css" type="text/css" />

    <link rel="shortcut icon" href="../../../_static/sympy-notailtext-favicon.ico"/>
    <link rel="top" title="SymPy 1.0.1.dev documentation" href="../../../index.html" />
    <link rel="up" title="Classical Mechanics" href="index.html" />
    <link rel="next" title="A rolling disc" href="examples/rollingdisc_example.html" />
    <link rel="prev" title="Nonminimal Coordinates Pendulum" href="examples/lin_pend_nonmin_example.html" />

  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

Examples for Physics/Mechanics¶

Here are some examples that illustrate how one typically uses this module. We
have ordered the examples roughly according to increasing difficulty. If you
have used this module to do something others might find useful or interesting,
consider adding it here!

A rolling disc

A bicycle

Nonminimal Coordinates Pendulum

Related Topics

Documentation overview

SymPy Modules Reference

Physics Module

Classical Mechanics

Previous: Nonminimal Coordinates Pendulum

Next: A rolling disc

This Page

Show Source

Quick search

    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

      ©2015 SymPy Development Team.

      |
      Powered by Sphinx 1.4.1
      & Alabaster 0.7.7

      |
      Page source


text:
import { equals } from 'ramda';
import { Context, DependencyList, useContext, useEffect, useState } from 'react';
import { BehaviorSubject } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';

export const createUseContext = <State>(context: Context<BehaviorSubject<State>>) => <
  Params extends any[],
  T
>(
  mapper: (state: State, ...args: Params) => T,
) => (...args: Params) => {
  const state$ = useContext(context);
  return useObservableState(state$, (s) => mapper(s, ...args), args);
};

export const useObservableState = <State, T>(
  state$: BehaviorSubject<State>,
  mapper: (state: State) => T,
  deps: DependencyList,
) => {
  const [state, setState] = useState(mapper(state$.value));

  useEffect(() => {
    const subscription = state$
      .pipe(
        map((s) => mapper(s)),
        distinctUntilChanged<T>(equals),
      )
      .subscribe(setState);

    return () => subscription.unsubscribe();
  }, [state$, ...deps]); //eslint-disable-line react-hooks/exhaustive-deps

  return state;
};


text:
package com.applivery.applvsdklib.tools.androidimplementations;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import com.applivery.applvsdklib.AppliverySdk;
import com.applivery.applvsdklib.tools.androidimplementations.sensors.SensorEventsController;
import com.applivery.applvsdklib.tools.permissions.ContextProvider;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.Stack;

/**
 * Created by Sergio Martinez Rodriguez
 * Date 4/1/16.
 */
public class AppliveryActivityLifecycleCallbacks
    implements Application.ActivityLifecycleCallbacks, ContextProvider {

  private Stack<ActivityLifecyleWrapper> activityStack = new Stack<>();
  private final Context applicationContext;
  private final SensorEventsController sensorEventsController;
  private final ScreenshotObserver screenshotObserver;
  private final Set<String> activitiesOnRotation = new HashSet<>();

  public AppliveryActivityLifecycleCallbacks(Context applicationContext) {
    this.applicationContext = applicationContext;
    this.sensorEventsController = SensorEventsController.getInstance(applicationContext);
    this.screenshotObserver = ScreenshotObserver.getInstance(applicationContext);
  }

  public Activity getCurrentActivity() {

    for (ActivityLifecyleWrapper activityLifecyleWrapper : activityStack) {
      if (!activityLifecyleWrapper.isPaused()) {
        return activityLifecyleWrapper.getActivity();
      }
    }

    for (ActivityLifecyleWrapper activityLifecyleWrapper : activityStack) {
      if (!activityLifecyleWrapper.isStopped()) {
        return activityLifecyleWrapper.getActivity();
      }
    }
    return null;
  }

  public boolean isActivityContextAvailable() {
    return (getCurrentActivity() != null);
  }

  @Override public Context getApplicationContext() {
    return applicationContext;
  }

  @Override public boolean isApplicationContextAvailable() {
    return applicationContext != null;
  }

  //region Activity lifecycle Management
  @Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
  }

  @Override public void onActivityStarted(Activity activity) {

    if (activitiesOnRotation.contains(activity.getPackageName() + activity.getLocalClassName())) {
      activitiesOnRotation.remove(activity.getPackageName() + activity.getLocalClassName());
    } else {
      if (activityStack.empty() && !activity.isChangingConfigurations()) {
        appWillReturnfromBackground();
      }
    }

    this.activityStack.push(new ActivityLifecyleWrapper(activity, true, false));
  }

  private void appWillReturnfromBackground() {
    checkForUpdates();
    sensorEventsController.registerAllSensorsForApplication();
    screenshotObserver.startObserving();
  }

  private void checkForUpdates() {
    if (AppliverySdk.getCheckForUpdatesBackground()) {
      AppliverySdk.obtainAppConfigForCheckUpdates();
      AppliverySdk.continuePendingPermissionsRequestsIfPossible();
    }
  }

  @Override public void onActivityResumed(Activity activity) {
    try {
      activity.getChangingConfigurations();
      activityStack.peek().setIsPaused(false);
    } catch (Exception e) {
      AppliverySdk.Logger.log(e.getMessage());
    }
  }

  @Override public void onActivityPaused(Activity activity) {
    try {
      activityStack.peek().setIsPaused(true);
    } catch (Exception e) {
      AppliverySdk.Logger.log(e.getMessage());
    }
  }

  @Override public void onActivityStopped(Activity activity) {
    try {
      if (activity.isChangingConfigurations()) {
        activitiesOnRotation.add(activity.getPackageName() + activity.getLocalClassName());
      } else if (activityStack.size() <= 1) {
        appWillEnterBackground();
      }
      removeActivityFromStack(activity);
    } catch (Exception e) {
      AppliverySdk.Logger.log(e.getMessage());
    }
  }

  private void appWillEnterBackground() {
    sensorEventsController.unRegisterAllSensorsForApplication();
    screenshotObserver.stopObserving();
  }

  @Override public void onActivityDestroyed(Activity activity) {
  }

  @Override public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
  }

  //endregion

  //region StackUtils

  private void removeActivityFromStack(Activity activity) {
    Iterator<ActivityLifecyleWrapper> iter = activityStack.iterator();
    while (iter.hasNext()) {
      ActivityLifecyleWrapper activityLifecyleWrapper = iter.next();
      if (activityLifecyleWrapper.getActivity().equals(activity)) {
        activityStack.remove(activityLifecyleWrapper);
      }
    }
  }

  //endregion
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>YUI 3.x: CSS Grids Fixed Example</title>
    <link rel="stylesheet" href="../../build/cssreset/cssreset.css" type="text/css">
    <link rel="stylesheet" href="../../build/cssfonts/cssfonts.css" type="text/css">
    <link rel="stylesheet" href="../../build/cssgrids/cssgrids.css" type="text/css">

Fixed Layout Template


text:
# Downloads the Visual Studio Online Build Agent and installs on the new machine
# and registers with the Visual Studio Online account and build agent pool

# Enable -Verbose option
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]$VSOAccount,
[Parameter(Mandatory=$true)]$VSOUser,
[Parameter(Mandatory=$true)]$VSOPass,
[Parameter(Mandatory=$true)]$AgentName,
[Parameter(Mandatory=$true)]$PoolName
)

Write-Verbose "Entering InstallVSOAgent.ps1" -verbose

$currentLocation = Split-Path -parent $MyInvocation.MyCommand.Definition
Write-Verbose "Current folder: $currentLocation" -verbose

#Create a temporary directory where to download from VSTS the agent package (agent.zip) and then launch the configuration.
$agentTempFolderName = Join-Path $env:temp ([System.IO.Path]::GetRandomFileName())
New-Item -ItemType Directory -Force -Path $agentTempFolderName
Write-Verbose "Temporary Agent download folder: $agentTempFolderName" -verbose

$serverUrl = "https://$VSOAccount.visualstudio.com"
Write-Verbose "Server URL: $serverUrl" -verbose

$VSOAgentURL = "$serverUrl/_apis/distributedtask/packages/agent"
Write-Verbose "VSO Agent URL: $VSOAgentURL" -verbose

$retryCount = 3
$retries = 1
Write-Verbose "Downloading Agent install files" -verbose
do
{
  try
  {
    $basicAuth = ("{0}:{1}" -f $VSOUser,$VSOPass)
    $basicAuth = [System.Text.Encoding]::UTF8.GetBytes($basicAuth)
    $basicAuth = [System.Convert]::ToBase64String($basicAuth)
    $headers = @{Authorization=("Basic {0}" -f $basicAuth)}

    Invoke-WebRequest -Uri $VSOAgentURL -headers $headers -Method Get -OutFile "$agentTempFolderName\agent.zip"
    Write-Verbose "Downloaded agent successfully on attempt $retries" -verbose
    break
  }
  catch
  {
    $exceptionText = ($_ | Out-String).Trim()
    Write-Verbose "Exception occured downloading agent: $exceptionText in try number $retries" -verbose
    $retries++
    Start-Sleep -Seconds 30
  }
}
while ($retries -le $retryCount)

# Construct the agent folder under the main (hardcoded) C: drive.
$agentInstallationPath = Join-Path "C:" $AgentName
# Create the directory for this agent.
New-Item -ItemType Directory -Force -Path $agentInstallationPath

# Create a folder for the build work
New-Item -ItemType Directory -Force -Path (Join-Path $agentInstallationPath $WorkFolder)

Write-Verbose "Extracting the zip file for the agent" -verbose
$destShellFolder = (new-object -com shell.application).namespace("$agentInstallationPath")
$destShellFolder.CopyHere((new-object -com shell.application).namespace("$agentTempFolderName\agent.zip").Items(),16)

# Removing the ZoneIdentifier from files downloaded from the internet so the plugins can be loaded
# Don't recurse down _work or _diag, those files are not blocked and cause the process to take much longer
Write-Verbose "Unblocking files" -verbose
Get-ChildItem -Path $agentInstallationPath | Unblock-File | out-null
Get-ChildItem -Recurse -Path $agentInstallationPath\Agent | Unblock-File | out-null

# Retrieve the path to the vsoAgent.exe file.
$agentExePath = [System.IO.Path]::Combine($agentInstallationPath, 'Agent', 'vsoAgent.exe')
Write-Verbose "Agent Location = $agentExePath" -Verbose
if (![System.IO.File]::Exists($agentExePath))
{
    Write-Error "File not found: $agentExePath" -Verbose
    return
}

# Call the agent with the configure command and all the options (this creates the settings file) without prompting
# the user or blocking the cmd execution

Write-Verbose "Configuring agent" -Verbose

# Set the current directory to the agent dedicated one previously created.
Push-Location -Path $agentInstallationPath
# The actual install of the agent. Using NetworkService as default service logon account, and some other values that could be turned into paramenters if needed
&start cmd.exe "/k $agentExePath /configure /RunningAsService /login:$VSOUser,$VSOPass /serverUrl:$serverUrl ""/WindowsServiceLogonAccount:NT AUTHORITY\NetworkService"" /WindowsServiceLogonPassword /WindowsServiceDisplayName:VsoBuildAgent /name:$AgentName /PoolName:$PoolName /WorkFolder:$WorkFolder /StartMode:Automatic /force /NoPrompt &exit"
# Restore original current directory.
Pop-Location

Write-Verbose "Agent install output: $LASTEXITCODE" -Verbose

Write-Verbose "Exiting InstallVSOAgent.ps1" -Verbose


text:
package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"
	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

func main() {
	ctx := context.Background()
	c, err := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.SearchProjectsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#SearchProjectsRequest.
	}
	it := c.SearchProjects(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

// [END cloudresourcemanager_v3_generated_Projects_SearchProjects_sync]


text:
export const ORGANIZATION_ADDED = 'ORGANIZATION_ADDED';
export const ORGANIZATIONS_LOADED = 'ORGANIZATIONS_LOADED';
export const ORGANIZATION_SELECTED = 'ORGANIZATION_SELECTED';
export const ORGANIZATION_TAB_SELECTED = 'ORGANIZATION_TAB_SELECTED';
export const SINGER_ADDED = 'SINGER_ADDED';
export const SINGERS_LOADED = 'SINGERS_LOADED';
export const SINGER_DELETED_FROM_ORGANIZATION = 'SINGER_DELETED_FROM_ORGANIZATION';
export const DELETE_SINGER_FROM_ORGANIZATION_FAILED = 'DELETE_SINGER_FROM_ORGANIZATION_FAILED';
export const CHOIR_SELECTED = 'CHOIR_SELECTED';
export const CHOIR_ADDED = 'CHOIR_ADDED';
export const CHOIRS_LOADED = 'CHOIRS_LOADED';
export const CHOIR_DELETED = 'CHOIR_DELETED';
export const CHOIR_EDITED = 'CHOIR_EDITED';
export const VENUE_SELECTED = 'VENUE_SELECTED';
export const VENUE_ADDED = 'VENUE_ADDED';
export const VENUES_LOADED = 'VENUES_LOADED';
export const PERFORMANCE_ADDED = 'PERFORMANCE_ADDED';

export const ORGANIZATIONS_REQUESTED = 'ORGANIZATIONS_REQUESTED';
export const ORGANIZATIONS_RECEIVED = 'ORGANIZATIONS_RECEIVED';

// singers
export const SINGERS_REQUESTED = 'SINGERS_REQUESTED';
export const SINGERS_RECEIVED = 'SINGERS_RECEIVED';

// modal
export const SHOW_MODAL = 'SHOW_MODAL';
export const HIDE_MODAL = 'HIDE_MODAL';

// user
export const LOGIN_REQUESTED = 'LOGIN_REQUESTED';
export const LOGOUT_REQUESTED = 'LOGOUT_REQUESTED';
export const AUTHENTICATION_FAILED = 'AUTHENTICATION_FAILED';
export const PASSWORD_CHANGED = 'PASSWORD_CHANGED';

// failed requests
export const ADD_SINGER_FAILED = 'ADD_SINGER_FAILED';
export const ADD_SINGER_FAILED_CLEARED = 'ADD_SINGER_FAILED_CLEARED';
export const ADD_ORGANIZATION_FAILED = 'ADD_ORGANIZATION_FAILED';
export const ADD_ORGANIZATION_FAILED_CLEARED = 'ADD_ORGANIZATION_FAILED_CLEARED';
export const ADD_CHOIR_FAILED = 'ADD_CHOIR_FAILED';
export const ADD_CHOIR_FAILED_CLEARED = 'ADD_CHOIR_FAILED_CLEARED';
export const ADD_PERFORMANCE_FAILED = 'ADD_PERFORMANCE_FAILED';
export const EDIT_CHOIR_FAILED = 'EDIT_CHOIR_FAILED';
export const EDIT_CHOIR_FAILED_CLEARED = 'EDIT_CHOIR_FAILED_CLEARED';
export const CHANGE_PASSWORD_FAILED = 'CHANGE_PASSWORD_FAILED';
export const CHANGE_PASSWORD_FAILED_CLEARED = 'CHANGE_PASSWORD_FAILED_CLEARED';
export const FAILED_REQUESTS_CLEARED = 'FAILED_REQUESTS_CLEARED';

// grid
export const GRID_LOADED = 'GRID_LOADED';
export const GRID_UPDATED = 'GRID_UPDATED';
export const GRID_REQUESTED = 'GRID_REQUESTED';
export const GRID_RECEIVED = 'GRID_RECEIVED';
export const SINGER_MOVED = 'SINGER_MOVED';
export const SINGER_LIST_UPDATED = 'SINGER_LIST_UPDATED';
export const GRID_SIZE_RECEIVED = 'GRID_SIZE_RECEIVED';
export const GRID_SIZE_UPDATED = 'GRID_SIZE_UPDATED';

// performances
export const PERFORMANCE_GRID_SIZE_UPDATED = 'PERFORMANCE_GRID_SIZE_UPDATED';


text:
package com.julun.widgets.filterbar;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;

import java.lang.ref.WeakReference;

/**
 * 搜索查询的过滤栏.
 */
public class SearchFilterBar extends LinearLayout {
    private WeakReference<Context> cxt;

    public SearchFilterBar(Context context, AttributeSet attrs) {
        super(context, attrs);
        initThis(context,attrs);
    }

    private void initThis(Context context, AttributeSet attrs) {
        cxt = new WeakReference<Context>(context);
        this.setOrientation(HORIZONTAL);
        if(null != attrs){
            initAttrs(attrs);
        }
    }

    private void initAttrs(AttributeSet attrs) {

    }

    public SearchFilterBar(Context context) {
        super(context);
        initThis(context,null);
    }
}


text:
import sbt.Keys._
import sbt._
import sbtrelease.ReleasePlugin.autoImport._
import ReleaseTransformations._

object ReleaseProcess {

    val settings = Seq(
        releaseIgnoreUntrackedFiles := true,
        releaseTagComment := s"Release ${(version in ThisBuild).value}",
        releaseCommitMessage := s"Set version to ${(version in ThisBuild).value}",
        releaseCrossBuild := false
    )

    val runPublishSigned = ReleaseStep(action = Command.process("publishSigned", _))

    val process =  Seq[ReleaseStep](
        checkSnapshotDependencies,
        inquireVersions,
        //runTest,
        setReleaseVersion,
        commitReleaseVersion,
        tagRelease,
        runPublishSigned,
        setNextVersion,
        commitNextVersion,
        pushChanges
    )

}


text:
package com.toscaruntime.deployment;

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

/**
 * This defines common contract to persist deployment to data source, all method is synchronous call to datasource
 *
 * @author Minh Khang VU
 */
public interface DeploymentPersister {

    void syncInsertNodeIfNotExist(String id, int instancesCount);

    void syncSaveNodeInstancesCount(String nodeId, int newInstancesCount);

    int syncGetNodeInstancesCount(String id);

    void syncInsertInstanceIfNotExist(String id, String nodeId, String state);

    void syncDeleteInstance(String id);

    void syncSaveInstanceState(String id, String newState);

    String syncGetInstanceState(String id);

    void syncSaveInstanceAttribute(String instanceId, String key, String value);

    void syncDeleteInstanceAttribute(String instanceId, String key);

    void syncInsertRelationshipIfNotExist(String sourceId, String targetId, String relationshipType);

    void syncInsertRelationshipInstanceIfNotExist(String sourceInstanceId, String targetInstanceId, String sourceNodeId, String targetNodeId, String relationshipType, String state);

    void syncDeleteRelationshipInstance(String sourceInstanceId, String targetInstanceId, String relationshipType);

    void syncSaveRelationshipAttribute(String sourceInstanceId, String targetInstanceId, String relationshipType, String key, String value);

    void syncDeleteRelationshipAttribute(String sourceInstanceId, String targetInstanceId, String relationshipType, String key);

    void syncSaveRelationshipState(String sourceInstanceId, String targetInstanceId, String relationshipType, String newState);

    void syncSaveInstanceOutputs(String instanceId, String interfaceName, String operationName, Map<String, String> outputs);

    void syncSaveRelationshipOutputs(String sourceInstanceId, String targetInstanceId, String relationshipType, String interfaceName, String operationName, Map<String, String> outputs);

    Map<String, String> syncGetOutputs(String instanceId, String interfaceName, String operationName);

    Map<String, String> syncGetAttributes(String instanceId);

    Map<String, String> syncGetRelationshipAttributes(String sourceInstanceId, String targetInstanceId, String relationshipType);

    List<String> syncGetOutputInterfaces(String instanceId);

    List<String> syncGetOutputOperations(String instanceId, String interfaceName);

    List<String> syncGetRelationshipOutputInterfaces(String sourceInstanceId, String targetInstanceId, String relationshipType);

    List<String> syncGetRelationshipOutputOperations(String sourceInstanceId, String targetInstanceId, String relationshipType, String interfaceName);

    Map<String, String> syncGetRelationshipOutputs(String sourceInstanceId, String targetInstanceId, String relationshipType, String interfaceName, String operationName);

    String syncGetRelationshipInstanceState(String sourceInstanceId, String targetInstanceId, String relationshipType);

    boolean hasExistingData();

    void syncInsertNewNodeTask(String instanceId, String interfaceName, String operationName);

    void syncStartNodeTask(String instanceId, String interfaceName, String operationName);

    void syncFinishNodeTask(String instanceId, String interfaceName, String operationName);

    void syncStopNodeTask(String instanceId, String interfaceName, String operationName, String error);

    void syncInsertNewTask(String taskId);

    void syncStartTask(String taskId);

    void syncFinishTask(String taskId);

    void syncStopTask(String taskId, String error);

    void syncInsertNewRelationshipTask(String sourceInstanceId, String targetInstanceId, String relationshipType, String interfaceName, String operationName);

    void syncStartRelationshipTask(String sourceInstanceId, String targetInstanceId, String relationshipType, String interfaceName, String operationName);

    void syncFinishRelationshipTask(String sourceInstanceId, String targetInstanceId, String relationshipType, String interfaceName, String operationName);

    void syncStopRelationshipTask(String sourceInstanceId, String targetInstanceId, String relationshipType, String interfaceName, String operationName, String error);

    RunningExecutionDTO syncGetRunningExecution();

    Map<NodeTaskDTO, String> syncGetRunningExecutionNodeTasks();

    Map<RelationshipTaskDTO, String> syncGetRunningExecutionRelationshipTasks();

    Map<TaskDTO, String> syncGetRunningExecutionTasks();

    void syncInsertExecutionInputs(Map<String, Object> inputs);

    void syncFinishRunningExecution();

    void syncStopRunningExecution(String error);

    void syncStopRunningExecution();

    void syncCancelRunningExecution();
}


text:
#include "hb.hh"

#ifndef HB_NO_OT_SHAPE

#include "hb-ot-shaper-myanmar-machine.hh"
#include "hb-ot-shaper-indic.hh"
#include "hb-ot-layout.hh"

/*
 * Myanmar shaper.
 */

static const hb_tag_t
myanmar_basic_features[] =
{
  /*
   * Basic features.
   * These features are applied in order, one at a time, after reordering,
   * constrained to the syllable.
   */
  HB_TAG('r','p','h','f'),
  HB_TAG('p','r','e','f'),
  HB_TAG('b','l','w','f'),
  HB_TAG('p','s','t','f'),
};
static const hb_tag_t
myanmar_other_features[] =
{
  /*
   * Other features.
   * These features are applied all at once, after clearing syllables.
   */
  HB_TAG('p','r','e','s'),
  HB_TAG('a','b','v','s'),
  HB_TAG('b','l','w','s'),
  HB_TAG('p','s','t','s'),
};

static inline void
set_myanmar_properties (hb_glyph_info_t &info)
{
  hb_codepoint_t u = info.codepoint;
  unsigned int type = hb_indic_get_categories (u);

  info.myanmar_category() = (myanmar_category_t) (type & 0xFFu);
}

static inline bool
is_one_of_myanmar (const hb_glyph_info_t &info, unsigned int flags)
{
  /* If it ligated, all bets are off. */
  if (_hb_glyph_info_ligated (&info)) return false;
  return !!(FLAG_UNSAFE (info.myanmar_category()) & flags);
}

/* Note:
 *
 * We treat Vowels and placeholders as if they were consonants.  This is safe because Vowels
 * cannot happen in a consonant syllable.  The plus side however is, we can call the
 * consonant syllable logic from the vowel syllable function and get it all right!
 *
 * Keep in sync with consonant_categories in the generator. */
#define CONSONANT_FLAGS_MYANMAR (FLAG (M_Cat(C)) | FLAG (M_Cat(CS)) | FLAG (M_Cat(Ra)) | /* FLAG (M_Cat(CM)) | */ FLAG (M_Cat(IV)) | FLAG (M_Cat(GB)) | FLAG (M_Cat(DOTTEDCIRCLE)))

static inline bool
is_consonant_myanmar (const hb_glyph_info_t &info)
{
  return is_one_of_myanmar (info, CONSONANT_FLAGS_MYANMAR);
}

static void
setup_syllables_myanmar (const hb_ot_shape_plan_t *plan,
			 hb_font_t *font,
			 hb_buffer_t *buffer);
static void
reorder_myanmar (const hb_ot_shape_plan_t *plan,
		 hb_font_t *font,
		 hb_buffer_t *buffer);

static void
collect_features_myanmar (hb_ot_shape_planner_t *plan)
{
  hb_ot_map_builder_t *map = &plan->map;

  /* Do this before any lookups have been applied. */
  map->add_gsub_pause (setup_syllables_myanmar);

  map->enable_feature (HB_TAG('l','o','c','l'), F_PER_SYLLABLE);
  /* The Indic specs do not require ccmp, but we apply it here since if
   * there is a use of it, it's typically at the beginning. */
  map->enable_feature (HB_TAG('c','c','m','p'), F_PER_SYLLABLE);

  map->add_gsub_pause (reorder_myanmar);

  for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_basic_features); i++)
  {
    map->enable_feature (myanmar_basic_features[i], F_MANUAL_ZWJ | F_PER_SYLLABLE);
    map->add_gsub_pause (nullptr);
  }
  map->add_gsub_pause (hb_syllabic_clear_var); // Don't need syllables anymore, use stop to free buffer var

  for (unsigned int i = 0; i < ARRAY_LENGTH (myanmar_other_features); i++)
    map->enable_feature (myanmar_other_features[i], F_MANUAL_ZWJ);
}

static void
setup_masks_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
		     hb_buffer_t              *buffer,
		     hb_font_t                *font HB_UNUSED)
{
  HB_BUFFER_ALLOCATE_VAR (buffer, myanmar_category);
  HB_BUFFER_ALLOCATE_VAR (buffer, myanmar_position);

  /* No masks, we just save information about characters. */

  unsigned int count = buffer->len;
  hb_glyph_info_t *info = buffer->info;
  for (unsigned int i = 0; i < count; i++)
    set_myanmar_properties (info[i]);
}

static void
setup_syllables_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
			 hb_font_t *font HB_UNUSED,
			 hb_buffer_t *buffer)
{
  HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
  find_syllables_myanmar (buffer);
  foreach_syllable (buffer, start, end)
    buffer->unsafe_to_break (start, end);
}

static int
compare_myanmar_order (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
{
  int a = pa->myanmar_position();
  int b = pb->myanmar_position();

  return (int) a - (int) b;
}

/* Rules from:
 * https://docs.microsoft.com/en-us/typography/script-development/myanmar */

static void
initial_reordering_consonant_syllable (hb_buffer_t *buffer,
				       unsigned int start, unsigned int end)
{
  hb_glyph_info_t *info = buffer->info;

  unsigned int base = end;
  bool has_reph = false;

  {
    unsigned int limit = start;
    if (start + 3 <= end &&
	info[start  ].myanmar_category() == M_Cat(Ra) &&
	info[start+1].myanmar_category() == M_Cat(As) &&
	info[start+2].myanmar_category() == M_Cat(H))
    {
      limit += 3;
      base = start;
      has_reph = true;
    }

    {
      if (!has_reph)
	base = limit;

      for (unsigned int i = limit; i < end; i++)
	if (is_consonant_myanmar (info[i]))
	{
	  base = i;
	  break;
	}
    }
  }

  /* Reorder! */
  {
    unsigned int i = start;
    for (; i < start + (has_reph ? 3 : 0); i++)
      info[i].myanmar_position() = POS_AFTER_MAIN;
    for (; i < base; i++)
      info[i].myanmar_position() = POS_PRE_C;
    if (i < end)
    {
      info[i].myanmar_position() = POS_BASE_C;
      i++;
    }
    myanmar_position_t pos = POS_AFTER_MAIN;
    /* The following loop may be ugly, but it implements all of
     * Myanmar reordering! */
    for (; i < end; i++)
    {
      if (info[i].myanmar_category() == M_Cat(MR)) /* Pre-base reordering */
      {
	info[i].myanmar_position() = POS_PRE_C;
	continue;
      }
      if (info[i].myanmar_category() == M_Cat(VPre)) /* Left matra */
      {
	info[i].myanmar_position() = POS_PRE_M;
	continue;
      }
      if (info[i].myanmar_category() == M_Cat(VS))
      {
	info[i].myanmar_position() = info[i - 1].myanmar_position();
	continue;
      }

      if (pos == POS_AFTER_MAIN && info[i].myanmar_category() == M_Cat(VBlw))
      {
	pos = POS_BELOW_C;
	info[i].myanmar_position() = pos;
	continue;
      }

      if (pos == POS_BELOW_C && info[i].myanmar_category() == M_Cat(A))
      {
	info[i].myanmar_position() = POS_BEFORE_SUB;
	continue;
      }
      if (pos == POS_BELOW_C && info[i].myanmar_category() == M_Cat(VBlw))
      {
	info[i].myanmar_position() = pos;
	continue;
      }
      if (pos == POS_BELOW_C && info[i].myanmar_category() != M_Cat(A))
      {
	pos = POS_AFTER_SUB;
	info[i].myanmar_position() = pos;
	continue;
      }
      info[i].myanmar_position() = pos;
    }
  }

  /* Sit tight, rock 'n roll! */
  buffer->sort (start, end, compare_myanmar_order);
}

static void
reorder_syllable_myanmar (const hb_ot_shape_plan_t *plan HB_UNUSED,
			  hb_face_t *face HB_UNUSED,
			  hb_buffer_t *buffer,
			  unsigned int start, unsigned int end)
{
  myanmar_syllable_type_t syllable_type = (myanmar_syllable_type_t) (buffer->info[start].syllable() & 0x0F);
  switch (syllable_type) {

    case myanmar_broken_cluster: /* We already inserted dotted-circles, so just call the consonant_syllable. */
    case myanmar_consonant_syllable:
      initial_reordering_consonant_syllable  (buffer, start, end);
      break;

    case myanmar_non_myanmar_cluster:
      break;
  }
}

static void
reorder_myanmar (const hb_ot_shape_plan_t *plan,
		 hb_font_t *font,
		 hb_buffer_t *buffer)
{
  if (buffer->message (font, "start reordering myanmar"))
  {
    hb_syllabic_insert_dotted_circles (font, buffer,
				       myanmar_broken_cluster,
				       M_Cat(DOTTEDCIRCLE));

    foreach_syllable (buffer, start, end)
      reorder_syllable_myanmar (plan, font->face, buffer, start, end);
    (void) buffer->message (font, "end reordering myanmar");
  }

  HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_category);
  HB_BUFFER_DEALLOCATE_VAR (buffer, myanmar_position);
}

const hb_ot_shaper_t _hb_ot_shaper_myanmar =
{
  collect_features_myanmar,
  nullptr, /* override_features */
  nullptr, /* data_create */
  nullptr, /* data_destroy */
  nullptr, /* preprocess_text */
  nullptr, /* postprocess_glyphs */
  nullptr, /* decompose */
  nullptr, /* compose */
  setup_masks_myanmar,
  nullptr, /* reorder_marks */
  HB_TAG_NONE, /* gpos_tag */
  HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
  HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
  false, /* fallback_position */
};

/* Ugly Zawgyi encoding.
 * Disable all auto processing.
 * https://github.com/harfbuzz/harfbuzz/issues/1162 */
const hb_ot_shaper_t _hb_ot_shaper_myanmar_zawgyi =
{
  nullptr, /* collect_features */
  nullptr, /* override_features */
  nullptr, /* data_create */
  nullptr, /* data_destroy */
  nullptr, /* preprocess_text */
  nullptr, /* postprocess_glyphs */
  nullptr, /* decompose */
  nullptr, /* compose */
  nullptr, /* setup_masks */
  nullptr, /* reorder_marks */
  HB_TAG_NONE, /* gpos_tag */
  HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
  HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
  false, /* fallback_position */
};

#endif


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.IO;

namespace WYZTracker
{
    public class FxManager
    {
        public static void Import(Song currentSong)
        {
            Effects loadedFX = null;
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = WYZTracker.Core.Properties.Resources.FXFilter;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                XmlSerializer formatter = new XmlSerializer(typeof(Effects));
                Stream objFileStream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.None);
                try
                {
                    loadedFX = (Effects)formatter.Deserialize(objFileStream);
                }
                catch
                {
                    try
                    {
                        formatter = new XmlSerializer(typeof(Song));
                        objFileStream.Seek(0, SeekOrigin.Begin);
                        objFileStream = SongManager.GetStream(objFileStream);
                        loadedFX = ((Song)formatter.Deserialize(objFileStream)).Effects;
                    }
                    catch
                    {
                        loadedFX = null;
                    }
                }
                objFileStream.Close();
            }
            if (loadedFX != null)
            {
                foreach (Effect fx in loadedFX)
                {
                    fx.ID = currentSong.Effects.GetSafeId();
                    currentSong.Effects.Add(fx);
                }
            }
        }

        public static void Export(Effect effect)
        {
            Export(new Effects() { effect });
        }

        public static void Export(Song currentSong)
        {
            Export(currentSong.Effects);
        }

        public static void Export(Effects effects)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = WYZTracker.Core.Properties.Resources.FXFilter;
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                XmlSerializer formatter = new XmlSerializer(typeof(Effects));
                Stream objFileStream = new FileStream(sfd.FileName, FileMode.Create, FileAccess.Write, FileShare.None);
                formatter.Serialize(objFileStream, effects);
                objFileStream.Close();
            }
        }

        public static void AddNew(Song currentSong)
        {
            Effect nuevo = new Effect();

            nuevo.SetEffectLength(5);

            nuevo.Name = WYZTracker.Core.Properties.Resources.New;
            nuevo.Volumes = new byte[] { 8, 8, 8, 8, 8 };
            nuevo.Frequencies = new int[] { 440, 440, 440, 440, 440 };
            nuevo.Noises = new byte[] { 0, 1, 2, 3, 4 };
            nuevo.ID = currentSong.Effects.GetSafeId();
            currentSong.Effects.Add(nuevo);
        }

        public static void Remove(Song currentSong, Effect effect)
        {
            currentSong.Effects.Remove(effect);
        }
    }
}


text:
package org.jetbrains.plugins.scala.lang.completion.filters.other

import com.intellij.psi._
import com.intellij.psi.filters.ElementFilter
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.annotations.{NonNls, Nullable}
import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.lang.completion.ScalaCompletionUtil._
import org.jetbrains.plugins.scala.lang.completion.filters.other.DerivesFilter._
import org.jetbrains.plugins.scala.lang.lexer.{ScalaTokenType, ScalaTokenTypes}
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.ScTypeDefinition

class DerivesFilter extends ElementFilter {
  override def isAcceptable(element: Object, @Nullable context: PsiElement): Boolean = {
    if (context == null || !context.isInScala3File || context.is[PsiComment]) return false
    val leaf = PsiTreeUtil.getDeepestFirst(context)
    if (leaf == null) return false

    val errorBeforeDerivesStart = leaf.prevLeafs.filterNot(_.is[PsiComment, PsiWhiteSpace]).nextOption()

    errorBeforeDerivesStart match {
      case Some((_: PsiErrorElement) && PrevSibling(typeDefBeforeError: ScTypeDefinition)) =>
        if (typeDefBeforeError.extendsBlock.derivesClause.isDefined) false
        else {
          // Do not suggest `derives` before `extends` or another `derives`
          !leaf.nextVisibleLeaf.exists(l => isExtendsKeyword(l) || isDerivesSoftKeyword(l))
        }
      case _ => false
    }
  }

  override def isClassAcceptable(hintClass: Class[_]): Boolean = true

  @NonNls
  override def toString: String = "derives keyword filter"
}

object DerivesFilter {
  private def isExtendsKeyword(leaf: PsiElement): Boolean = leaf.elementType == ScalaTokenTypes.kEXTENDS

  private def isDerivesSoftKeyword(leaf: PsiElement): Boolean =
    leaf.elementType == ScalaTokenType.DerivesKeyword ||
      // Scala 3 Soft Keywords can be parsed as identifiers
      leaf.elementType == ScalaTokenTypes.tIDENTIFIER && leaf.textMatches(ScalaTokenType.DerivesKeyword.keywordText)
}


text:
using UnityEngine;
using System.Collections;
using UnityStandardAssets.ImageEffects;

/// <summary>
/// Special move trigger to handle throwing objects into the lava in the Shrine.
/// </summary>
public class ShrineLava : UWEBase
{

    /// <summary>
    /// Detects if a talisman has been thrown into the abyss lava trigger.
    /// </summary>
    /// <param name="other">Other.</param>
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.GetComponent<ObjectInteraction>() != null)
        {
            if (Quest.instance.isGaramonBuried == false)
            {
                return;
            }
            ObjectInteraction objInt = other.gameObject.GetComponent<ObjectInteraction>();
            switch (objInt.item_id)
            {
                case Quest.TalismanHonour:
                case Quest.TalismanBook:
                case Quest.TalismanCup:
                case Quest.TalismanRing:
                case Quest.TalismanShield:
                case Quest.TalismanSword:
                case Quest.TalismanTaper:
                case Quest.TalismanTaperLit:
                case Quest.TalismanWine:
                    Quest.instance.TalismansRemaining--;
                    break;
                default:
                    return;
            }

            Impact.SpawnHitImpact(Impact.ImpactMagic(), objInt.GetImpactPoint(), 40, 44);

            objInt.consumeObject();

            //Suck the avatar into the ethereal void.
            if (Quest.instance.TalismansRemaining <= 0)
            {
                StartCoroutine(SuckItAvatar());
            }
        }
    }

    /// <summary>
    /// Sends the avatar into the ethereal void.
    /// </summary>
    /// Spins the avatar and the slasher (specific object name) towards a newly spawned moongate.
    IEnumerator SuckItAvatar()
    {

        ObjectInteraction slasher = CurrentObjectList().objInfo[129].instance;//Assumes slasher will be at this index.
        Vector3 slasherPos = Vector3.zero;
        if (slasher != null)
        {
            slasherPos = slasher.transform.position;
        }

        //Spawn a moon gate at the center of the lava
        ObjectLoaderInfo newobjt = ObjectLoader.newWorldObject(346, 0, 0, 0, 256);
        GameObject myObj = ObjectInteraction.CreateNewObject(CurrentTileMap(),
            newobjt,
            CurrentObjectList().objInfo,
            GameWorldController.instance.DynamicObjectMarker().gameObject,
            GameWorldController.instance.InventoryMarker.transform.position).gameObject;
        GameWorldController.MoveToWorld(myObj.GetComponent<ObjectInteraction>());
        myObj.transform.localPosition = this.transform.position + new Vector3(0.0f, 0.5f, 0.0f);

        //Suck the player and the slasher into the moon gate.
        Quaternion playerRot = UWCharacter.Instance.transform.rotation;
        Quaternion EndRot = new Quaternion(playerRot.x, playerRot.y, playerRot.z + 1.2f, playerRot.w);
        Vector3 StartPos = UWCharacter.Instance.transform.position;
        Vector3 EndPos = myObj.transform.localPosition;
        float rate = 1.0f / 2.0f;
        float index = 0.0f;
        while (index < 1.0f)
        {
            UWCharacter.Instance.transform.position = Vector3.Lerp(StartPos, EndPos, index);
            UWCharacter.Instance.transform.rotation = Quaternion.Lerp(playerRot, EndRot, index);
            if (slasher != null)
            {
                slasher.transform.position = Vector3.Lerp(slasherPos, EndPos, index);
            }
            index += rate * Time.deltaTime;
            yield return new WaitForSeconds(0.01f);
        }
        UWCharacter.Instance.transform.rotation = playerRot;
        GameWorldController.instance.SwitchLevel(8, 26, 24);//One way trip.
    }
}


text:
package ch.jalu.configme.properties;

import ch.jalu.configme.properties.convertresult.ConvertErrorRecorder;
import ch.jalu.configme.properties.types.PropertyType;
import ch.jalu.configme.resource.PropertyReader;
import org.jetbrains.annotations.NotNull;

import org.jetbrains.annotations.Nullable;
import java.util.Objects;

/**
 * Property implementation which relies on a {@link PropertyType}.
 *
 * @param <T> type of property value
 */
public class TypeBasedProperty<T> extends BaseProperty<T> {

    private final PropertyType<T> type;

    /**
     * Constructor.
     *
     * @param path the path of the property
     * @param defaultValue the default value of the property
     * @param type the property type
     */
    public TypeBasedProperty(@NotNull String path, @NotNull T defaultValue, @NotNull PropertyType<T> type) {
        super(path, defaultValue);
        Objects.requireNonNull(type, "type");
        this.type = type;
    }

    @Override
    protected @Nullable T getFromReader(@NotNull PropertyReader reader, @NotNull ConvertErrorRecorder errorRecorder) {
        return type.convert(reader.getObject(getPath()), errorRecorder);
    }

    @Override
    public @Nullable Object toExportValue(T value) {
        return type.toExportValue(value);
    }
}


text:
package com.github.kennycyb.uifactory.core.factory.impl.components.swing;

import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import javax.xml.bind.JAXB;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.kennycyb.uifactory.core.factory.ComponentContext;
import com.github.kennycyb.uifactory.core.factory.annotations.UiFont;
import com.github.kennycyb.uifactory.core.factory.annotations.UiResource;
import com.github.kennycyb.uifactory.core.factory.annotations.frame.UiFrameMenu;
import com.github.kennycyb.uifactory.core.factory.impl.UiAnnotationHandler;
import com.github.kennycyb.uifactory.core.factory.impl.components.xinfo.menu.MenuBarInfo;
import com.github.kennycyb.uifactory.core.factory.impl.components.xinfo.menu.MenuInfo;
import com.github.kennycyb.uifactory.core.factory.impl.components.xinfo.menu.MenuItemInfo;
import com.github.kennycyb.uifactory.core.factory.impl.components.xinfo.menu.MenuItemType;
import com.github.kennycyb.uifactory.core.listeners.MethodListenerProxy;

/**
 *
 * @author kenny
 * @since 1.0
 */
public class JMenuBarFactory extends JComponentFactory {
	private static final Logger LOGGER = LoggerFactory
			.getLogger(JMenuBarFactory.class);

	/**
	 *
	 * @since 1.0
	 * @param context
	 * @param component
	 * @param annotate
	 */
	@UiAnnotationHandler(UiFrameMenu.class)
	protected void handleUiFrameMenu(final ComponentContext context,
			final JMenuBar component, final UiFrameMenu annotate) {

		if (context.getParentContext() == null
				|| context.getParentContext().getComponent() == null) {
			return;
		}

		if (context.getParentContext().getComponent() instanceof JFrame) {
			((JFrame) context.getParentContext().getComponent())
			.setJMenuBar(component);
		}
	}

	/**
	 *
	 * @since 1.0
	 * @param context
	 * @param component
	 * @param annotate
	 */
	@UiAnnotationHandler(UiResource.class)
	protected void handleUiResource(final ComponentContext context,
			final JMenuBar component, final UiResource annotate) {

		final InputStream in = this.getClass().getClassLoader()
				.getResourceAsStream(annotate.value());

		if (in == null) {
			LOGGER.error("{}|resource {} not found", context.getId(),
					annotate.value());
			return;
		}

		final MenuBarInfo menuInfo = JAXB.unmarshal(in, MenuBarInfo.class);
		final UiFont uiFont = context.getAnnotatedElement().getAnnotation(
				UiFont.class);

		LOGGER.debug("{}|JMenuBar-id={}", context.getId(), menuInfo.getId());

		Font font = null;
		if (uiFont != null) {

			font = new Font(uiFont.name(), uiFont.style().getSwingConstant(),
					uiFont.size());
		}

		final MethodListenerProxy<ActionListener> actionListenerProxy = new MethodListenerProxy<ActionListener>(
				ActionListener.class, context.getActionListeners());

		final MethodListenerProxy<ItemListener> itemListenerProxy = new MethodListenerProxy<ItemListener>(
				ItemListener.class, context.getActionListeners());

		int menuIndex = -1;

		for (final MenuInfo menuItemInfo : menuInfo.getMenu()) {

			final Map<String, ButtonGroup> radioGroup = new HashMap<String, ButtonGroup>();

			menuIndex++;

			final JMenu menu = new JMenu(menuItemInfo.getText());
			component.add(menu);

			if (menuItemInfo.getId() == null) {
				menuItemInfo.setId(menuItemInfo.getId());
			}

			final ComponentContext child = new ComponentContext();
			child.setId(menuItemInfo.getId());
			child.setComponent(menu);
			child.setDeclared(false);
			context.addChild(child);

			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("(JMenuBar){}.addMenu(id=\"{}\", menu=\"{}\")",
						new Object[] { context.getId(), menuItemInfo.getId(),
						menuItemInfo.getText() });
			}

			if (font != null) {
				menu.setFont(font);
			}

			int menuChildIndex = -1;

			for (final MenuItemInfo item : menuItemInfo.getMenuItem()) {
				if (item.getType() == MenuItemType.SEPARATOR) {
					menu.addSeparator();
					continue;
				}

				menuChildIndex++;

				final JMenuItem mi;

				switch (item.getType()) {

				case CHECKBOX:
					mi = new JCheckBoxMenuItem(item.getText());
					if (item.isSelected()) {
						mi.setSelected(true);
					}
					break;

				case RADIOBUTTON:
					mi = new JRadioButtonMenuItem(item.getText());

					ButtonGroup group = radioGroup.get(item.getRadioGroupId());
					if (group == null) {
						group = new ButtonGroup();
						radioGroup.put(item.getRadioGroupId(), group);
					}
					if (item.isSelected()) {
						mi.setSelected(true);
					}
					group.add(mi);
					break;

				default:
					mi = new JMenuItem(item.getText());
					break;
				}

				if (font != null) {
					mi.setFont(font);
				}

				if (item.getIcon() != null) {
					final URL url = getClass().getClassLoader().getResource(
							item.getIcon());
					if (url != null) {
						mi.setIcon(new ImageIcon(url));
					}
				}

				if (item.getId() == null) {
					item.setId(item.getText());
				}

				final ComponentContext menuChild = new ComponentContext();
				menuChild.setId(item.getId());
				menuChild.setComponent(mi);
				child.addChild(menuChild);

				if (LOGGER.isDebugEnabled()) {
					LOGGER.debug(
							"(JMenuBar){}.{}.addItem(id=\"{}\", menu=\"{}\")",
							new Object[] { context.getId(),
									menuItemInfo.getId(), item.getId(),
									item.getText() });
				}

				mi.setActionCommand(item.getId());

				if (actionListenerProxy.hasListeningMethod()) {
					mi.addActionListener(actionListenerProxy.getProxy());
				}

				if (itemListenerProxy.hasListeningMethod()) {
					mi.addItemListener(itemListenerProxy.getProxy());
				}

				menu.add(mi);
			}
		}

	}
}


text:
<?php
/* Prototype  : string hash_file(string algo, string filename[, bool raw_output = false])
 * Description: Generate a hash of a given file
 * Source code: ext/hash/hash.c
 * Alias to functions:
 */

echo "*** Testing hash_file() : basic functionality ***\n";

// Set up file
$filename = 'hash_file_basic_example.txt';
file_put_contents( $filename, 'The quick brown fox jumped over the lazy dog.' );

var_dump( hash_file( 'md5', $filename ) );
var_dump( hash_file( 'sha1', $filename ) );
var_dump( hash_file( 'sha256', $filename ) );
var_dump( hash_file( 'sha512', $filename ) );

var_dump( base64_encode( hash_file( 'md5', $filename, true ) ) );

?>
===DONE===


text:
AlignmentTool::AlignmentTool()
{
	init();
}

AlignmentTool::~AlignmentTool()
{
}

void AlignmentTool::makeCommand(QString &, QString &, QString &, QStringList &)
{
}

void AlignmentTool::writeSettings(QDomDocument &,QDomElement &)
{
}

void AlignmentTool::readSettings(QDomDocument &)
{
}

//
//	Private
//

void AlignmentTool::init()
{
	preferred_=false;
	usesStdOut_=false;
}


text:
'use strict'

const config = {
  SKOLESKYSS_SERVER_PORT_WEB: process.env.SKOLESKYSS_SERVER_PORT_WEB || 8000,
  SKOLESKYSS_DB_CONNECTION_QUEUE: process.env.SKOLESKYSS_DB_CONNECTION_QUEUE || 'mongodb://localhost/skoleskyss',
  SKOLESKYSS_CALLBACK_STATUS_URL: process.env.SKOLESKYSS_CALLBACK_STATUS_URL || 'https://api.buddy.com/status/',
  SKOLESKYSS_AUTH_URL_LOGIN: process.env.SKOLESKYSS_AUTH_URL_LOGIN || '/login',
  SKOLESKYSS_AUTH_URL_LOGOUT: process.env.SKOLESKYSS_AUTH_URL_LOGOUT || '/logout',
  SKOLESKYSS_JWT_SECRET: process.env.SKOLESKYSS_JWT_SECRET || 'Louie Louie, oh no, I got to go. Louie Louie, oh no, I got to go',
  SKOLESKYSS_ENCRYPTOR_KEY: process.env.SKOLESKYSS_ENCRYPTOR_KEY || 'Louie Louie, oh no, I got to go. Louie Louie, oh no, I got to go',
  SKOLESKYSS_COOKIE_SECRET: process.env.SKOLESKYSS_COOKIE_SECRET || 'Louie Louie, oh no, I got to go. Louie Louie, oh no, I got to go',
  SKOLESKYSS_YAR_SECRET: process.env.SKOLESKYSS_YAR_SECRET || 'Louie Louie, oh no, I got to go. Louie Louie, oh no, I got to go',
  SKOLESKYSS_GITHUB_FEEDBACK_URL: process.env.SKOLESKYSS_GITHUB_FEEDBACK_URL || 'https://api.github.com/repos/:user/:repo/issues',
  SKOLESKYSS_GITHUB_USER: process.env.SKOLESKYSS_GITHUB_USER || 'yourgithubuser',
  SKOLESKYSS_GITHUB_TOKEN: process.env.SKOLESKYSS_GITHUB_TOKEN || 'yourgithubtoken'
}

module.exports = config


text:
<!DOCTYPE html>

  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
  <meta charset="utf-8">
  <title>Space Missions</title>
  <link rel="stylesheet" href="styles/main.css" />

Space Missions

        Bavarian bergkase port-salut ricotta. Cheese on toast say cheese cheese
        strings pecorino fromage frais roquefort danish fontina emmental.
        Bishop everyone loves jarlsberg stilton swiss cauliflower cheese fondue
        wiss. Cottage cheese lancashire taleggio goat parmesan.

        Bavarian bergkase port-salut ricotta. Cheese on toast say cheese cheese
        strings pecorino fromage frais roquefort danish fontina emmental.
        Bishop everyone loves jarlsberg stilton swiss cauliflower cheese fondue
        wiss. Cottage cheese lancashire taleggio goat parmesan.

        Bavarian bergkase port-salut ricotta. Cheese on toast say cheese cheese
        strings pecorino fromage frais roquefort danish fontina emmental.
        Bishop everyone loves jarlsberg stilton swiss cauliflower cheese fondue
        wiss. Cottage cheese lancashire taleggio goat parmesan.

home

share

contact

about


text:
module Day18 where

import qualified Data.HashMap.Strict as M
import           Data.Maybe

{- Day 18: Like a GIF For Your Yard -}

type Coord = (Int,Int)
data LightStatus = LightOpen | LightClosed deriving (Show, Eq)
type Grid = M.HashMap Coord LightStatus

parseGrid :: String -> Grid
parseGrid = fst . foldl parseChar (M.empty, (0,0))
  where parseChar (z,(_,y))  '\n' = (z, (0,y+1))
        parseChar (z,c@(x,y)) '#' = (M.insert c LightOpen z, (x+1,y))
        parseChar (z,c@(x,y)) '.' = (M.insert c LightClosed z, (x+1,y))
        parseChar _ _ = error "parsing error"

countNeighborsOn :: Coord -> Grid -> Int
countNeighborsOn (x,y) g = length $ filter (==LightOpen)
  [ fromMaybe LightClosed $ M.lookup (x-1,y-1) g
  , fromMaybe LightClosed $ M.lookup (x,y-1) g
  , fromMaybe LightClosed $ M.lookup (x+1,y-1) g
  , fromMaybe LightClosed $ M.lookup (x+1,y) g
  , fromMaybe LightClosed $ M.lookup (x+1,y+1) g
  , fromMaybe LightClosed $ M.lookup (x,y+1) g
  , fromMaybe LightClosed $ M.lookup (x-1,y+1) g
  , fromMaybe LightClosed $ M.lookup (x-1,y) g
  ]

step :: Grid -> Grid
step g = M.mapWithKey f g
  where f c LightOpen   = case countNeighborsOn c g of
                            2 -> LightOpen
                            3 -> LightOpen
                            _ -> LightClosed
        f c LightClosed = case countNeighborsOn c g of
                            3 -> LightOpen
                            _ -> LightClosed

stepX :: Int -> Grid -> Grid
stepX n g = iterate step g !! n

countLights :: Grid -> Int
countLights = M.size . M.filter (==LightOpen)

day18 :: IO ()
day18 = do
  fileStr <- readFile "resources/day18.txt"
  print $ countLights $ stepX 100 $ parseGrid fileStr

{- Part Two -}

cornerify :: Grid -> Grid
cornerify = M.adjust (const LightOpen) (0,0)
          . M.adjust (const LightOpen) (0,99)
          . M.adjust (const LightOpen) (99,0)
          . M.adjust (const LightOpen) (99,99)

stepX' :: Int -> Grid -> Grid
stepX' n g = iterate (cornerify . step) (cornerify g) !! n

day18' :: IO ()
day18' = do
  fileStr <- readFile "resources/day18.txt"
  print $ countLights $ stepX' 100 $ parseGrid fileStr


text:
__all__ = ['PythonWrapperModule']

import re
import os
import sys

from parser.api import *
from wrapper_base import *
from py_wrap_type import *
from py_wrap_subprogram import *

class PythonWrapperModule(WrapperBase):

    main_template = '''\
#ifdef __cplusplus
extern \"C\" {
#endif
#include "Python.h"

#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"

%(header_list)s

%(typedef_list)s

%(extern_list)s

%(c_code_list)s

%(capi_code_list)s

%(objdecl_list)s

static PyObject *f2py_module;

static PyMethodDef f2py_module_methods[] = {
  %(module_method_list)s
  {NULL,NULL,0,NULL}
};

PyMODINIT_FUNC init%(modulename)s(void) {
  f2py_module = Py_InitModule("%(modulename)s", f2py_module_methods);
  import_array();
  if (PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "failed to load array module.");
    goto capi_err;
  }
  %(module_init_list)s
  return;
capi_err:
  if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_RuntimeError, "failed to initialize %(modulename)s module.");
  }
  return;
}
#ifdef __cplusplus
}
#endif
'''

    main_fortran_template = '''\
%(fortran_code_list)s
'''

    def __init__(self, modulename):
        WrapperBase.__init__(self)
        self.modulename = modulename
        self.cname = 'f2py_' + modulename

        self.defined_cpp_code = []
        self.defined_c_code = []
        self.defined_types = []
        self.defined_capi_codes = []

        self.header_list = []
        self.typedef_list = []
        self.extern_list = []
        self.objdecl_list = []
        self.c_code_list = []
        self.capi_code_list = []

        self.module_method_list = []
        self.module_init_list = []

        self.fortran_code_list = []

        self.list_names = ['header', 'typedef', 'extern', 'objdecl',
                           'c_code','capi_code','module_method','module_init',
                           'fortran_code']
        self.isf90 = False
        return

    def add(self, block):
        if isinstance(block, BeginSource):
            for name, moduleblock in block.a.module.items():
                self.add(moduleblock)
            #for name, subblock in block.a.external_subprogram.items():
            #    self.add(subblock)
        elif isinstance(block, Subroutine):
            PythonCAPISubProgram(self, block)
        elif isinstance(block, Function):
            fcode = block.subroutine_wrapper_code()
            self.fortran_code_list.append(fcode)
            wrapper_block = block.subroutine_wrapper()
            PythonCAPISubProgram(self, wrapper_block)
        elif isinstance(block, Module):
            self.isf90 = True
            for name,declblock in block.a.type_decls.items():
                self.add(declblock)
            for name,subblock in block.a.module_subprogram.items():
                self.add(subblock)
        elif isinstance(block, tuple([TypeDecl]+declaration_type_spec)):
            if isinstance(block, (TypeDecl, TypeStmt)):
                self.isf90 = True
            PythonCAPIType(self, block)
        else:
            raise NotImplementedError,`block.__class__.__name__`
        return

    def c_code(self):
        return self.apply_attributes(self.main_template)
    def fortran_code(self):
        return self.apply_attributes(self.main_fortran_template)


text:
<?php

/**
 * Vultr.com Curl Adapter
 *
 * NOTE: part of this code was extracted from
 * https://github.com/usefulz/vultr-api-client, updated for PSR compliance and
 * extended with new API calls.
 *
 * @package Vultr
 * @version 1.0
 * @author  https://github.com/malc0mn - https://github.com/usefulz
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 * @see     https://github.com/malc0mn/vultr-api-client
 */

namespace Vultr\ApiCall;

class Snapshot extends AbstractApiCall
{
    /**
     * List all snapshots on the current account.
     *
     * @see https://www.vultr.com/api/#snapshot_snapshot_list
     *
     * @return array
     */
    public function getList()
    {
        return $this->adapter->get('snapshot/list');
    }

    /**
     * Create a snapshot from an existing virtual machine.
     *
     * The virtual machine does not need to be stopped.
     *
     * @see https://www.vultr.com/api/#snapshot_create
     *
     * @param integer $serverId    Identifier of the virtual machine to create a
     * snapshot from
     * @param string  $description (optional) Description of snapshot contents
     *
     * @return string snapshot ID
     */
    public function create($serverId, $description = null)
    {
        $args = ['SUBID' => (int) $serverId];

        if ($description !== null) {
            $args['description'] = $description;
        }

        $snapshot = $this->adapter->post('snapshot/create', $args);

        return $snapshot['SNAPSHOTID'];
    }

    /**
     * Destroy (delete) a snapshot.
     *
     * There is no going back from this call.
     *
     * @see https://www.vultr.com/api/#snapshot_destroy
     *
     * @param string $snapshotId Unique identifier for this snapshot.
     *
     * @return integer HTTP response code
     */
    public function destroy($snapshotId)
    {
        $args = ['SNAPSHOTID' => $snapshotId];

        return $this->adapter->post('snapshot/destroy', $args, true);
    }
}


text:
ALTER TABLE tblProgramEnrolment
    ADD COLUMN dtEnroled DATETIME,
    ADD COLUMN dtUnenroled DATETIME;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WaveEngine.Components.Cameras;
using WaveEngine.Framework;
using WaveEngine.Framework.Graphics;

namespace IsisTempleProject.Components
{
    public class FollowCameraBehavior : Behavior
    {
        #region Variables
        [RequiredComponent]
        public Transform3D transform3D;
        private Camera3D camera;
        #endregion

        #region Initialize
        public FollowCameraBehavior(Entity cameraEntity)
            : base("FollowCamera")
        {
            this.camera = cameraEntity.FindComponent<Camera3D>();
        }
        #endregion

        #region Public Methods
        protected override void Update(TimeSpan gameTime)
        {
            transform3D.Position = camera.Position;
        }
        #endregion
    }
}