text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.IO;
using System.Reflection;
using System.Security;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using CoreFXTestLibrary;

public class CopyByteArrayTest
{
    private byte[] TestArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

    private bool IsArrayEqual(byte[] array1, byte[] array2)
    {
        if (array1.Length != array2.Length)
        {

            return false;
        }

        for (int i = 0; i < array1.Length; i++)
            if (!array1[i].Equals(array2[i]))
            {

                return false;
            }

        return true;
    }

    private bool IsSubArrayEqual(byte[] array1, byte[] array2, int startIndex, int Length)
    {
        if (startIndex + Length > array1.Length)
        {

            return false;
        }

        if (startIndex + Length > array2.Length)
        {

            return false;
        }

        for (int i = 0; i < Length; i++)
            if (!array1[startIndex + i].Equals(array2[startIndex + i]))
            {

                return false;
            }

        return true;
    }

    private void NullValueTests()
    {
        byte[] array = null;

        try
        {
            Marshal.Copy(array, 0, IntPtr.Zero, 0);

            Assert.ErrorWriteLine("Failed null values test.");
            Assert.ErrorWriteLine("No exception from Copy when passed null as parameter.");
        }
        catch (ArgumentNullException)
        {

        }
        catch (Exception ex)
        {
            Assert.ErrorWriteLine("Failed null values test.");
        }

        try
        {
            Marshal.Copy(IntPtr.Zero, array, 0, 0);

            Assert.ErrorWriteLine("Failed null values test.");
            Assert.ErrorWriteLine("No exception from Copy when passed null as parameter.");
        }
        catch (ArgumentNullException)
        {

        }
        catch (Exception ex)
        {
            Assert.ErrorWriteLine("Failed null values test.");
        }
    }

    private void OutOfRangeTests()
    {
        int sizeOfArray = sizeof(byte) * TestArray.Length;

        IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);

        try //try to copy more elements than the TestArray has
        {
            Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);

            Assert.ErrorWriteLine("Failed out of range values test.");
            Assert.ErrorWriteLine("No exception from Copy when trying to copy more elements than the TestArray has.");
        }
        catch (ArgumentOutOfRangeException)
        {

        }
        catch (Exception ex)
        {
            Assert.ErrorWriteLine("Failed out of range values test.");
        }

        try //try to copy from an out of bound startIndex
        {
            Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);

            Assert.ErrorWriteLine("Failed out of range values test.");
            Assert.ErrorWriteLine("No exception from Copy when trying to copy from an out of bound startIndex.");
        }
        catch (ArgumentOutOfRangeException)
        {

        }
        catch (Exception ex)
        {
            Assert.ErrorWriteLine("Failed out of range values test.");
        }

        try //try to copy from a positive startIndex, with length taking it out of bounds
        {
            Marshal.Copy(TestArray, 2, ptr, TestArray.Length);

            Assert.ErrorWriteLine("Failed out of range values test.");
            Assert.ErrorWriteLine("No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
        }
        catch (ArgumentOutOfRangeException)
        {

        }
        catch (Exception ex)
        {
            Assert.ErrorWriteLine("Failed out of range values test.");
        }

        Marshal.FreeCoTaskMem(ptr);
    }

    private void CopyRoundTripTests()
    {
        int sizeOfArray = sizeof(byte) * TestArray.Length;

        IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);

        try //try to copy the entire array
        {
            Marshal.Copy(TestArray, 0, ptr, TestArray.Length);

            byte[] array = new byte[TestArray.Length];

            Marshal.Copy(ptr, array, 0, TestArray.Length);

            if (!IsArrayEqual(TestArray, array))
            {
                Assert.ErrorWriteLine("Failed copy round trip test");
                Assert.ErrorWriteLine("Original array and round trip copied arrays do not match.");
            }
        }
        catch (Exception ex)
        {
            Assert.ErrorWriteLine("Failed copy round trip test.");
        }

        try //try to copy part of the array
        {
            Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);

            byte[] array = new byte[TestArray.Length];

            Marshal.Copy(ptr, array, 2, TestArray.Length - 4);

            if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
            {
                Assert.ErrorWriteLine("Failed copy round trip test");
                Assert.ErrorWriteLine("Original array and round trip partially copied arrays do not match.");
            }
        }
        catch (Exception ex)
        {
            Assert.ErrorWriteLine("Failed copy round trip test.");
        }

        Marshal.FreeCoTaskMem(ptr);
    }

    public bool RunTests()
    {
        NullValueTests();
        OutOfRangeTests();
        CopyRoundTripTests();
        return true;
    }

    public static int Main(String[] unusedArgs)
    {
        if (new CopyByteArrayTest().RunTests())
            return 100;

        return 99;
    }

}


text:
namespace base {
class WaitableEvent;
}  // namespace base

namespace IPC {
struct ChannelHandle;
class Message;
class SyncChannel;
}  // namespace IPC

namespace nacl {

class ManifestServiceChannel : public IPC::Listener {
 public:
  typedef base::OnceCallback<void(base::File, uint64_t, uint64_t)>
      OpenResourceCallback;

  class Delegate {
   public:
    virtual ~Delegate() {}

    // Called when PPAPI initialization in the NaCl plugin is finished.
    virtual void StartupInitializationComplete() = 0;

    // Called when irt_open_resource() is invoked in the NaCl plugin.
    // Upon completion, callback is invoked with the file.
    virtual void OpenResource(const std::string& key,
                              OpenResourceCallback callback) = 0;
  };

  ManifestServiceChannel(const IPC::ChannelHandle& handle,
                         base::OnceCallback<void(int32_t)> connected_callback,
                         std::unique_ptr<Delegate> delegate,
                         base::WaitableEvent* waitable_event);

  ManifestServiceChannel(const ManifestServiceChannel&) = delete;
  ManifestServiceChannel& operator=(const ManifestServiceChannel&) = delete;

  ~ManifestServiceChannel() override;

  void Send(IPC::Message* message);

  // Listener implementation.
  bool OnMessageReceived(const IPC::Message& message) override;
  void OnChannelConnected(int32_t peer_pid) override;
  void OnChannelError() override;

 private:
  void OnStartupInitializationComplete();
  void OnOpenResource(const std::string& key, IPC::Message* reply);
  void DidOpenResource(IPC::Message* reply,
                       base::File file,
                       uint64_t token_lo,
                       uint64_t token_hi);
  base::OnceCallback<void(int32_t)> connected_callback_;
  std::unique_ptr<Delegate> delegate_;
  std::unique_ptr<IPC::SyncChannel> channel_;

  base::ProcessId peer_pid_;

  // Note: This should remain the last member so it'll be destroyed and
  // invalidate the weak pointers before any other members are destroyed.
  base::WeakPtrFactory<ManifestServiceChannel> weak_ptr_factory_{this};
};

}  // namespace nacl

#endif  // COMPONENTS_NACL_RENDERER_MANIFEST_SERVICE_CHANNEL_H_

redpajama_set_name: RedPajamaGithub


text:
package com.speedment.generator.standard.lifecycle;

import com.speedment.common.codegen.constant.SimpleType;
import com.speedment.common.codegen.model.Class;
import com.speedment.common.codegen.model.File;
import com.speedment.common.injector.Injector;
import com.speedment.generator.translator.AbstractJavaClassTranslator;
import com.speedment.runtime.config.Project;
import com.speedment.runtime.core.Speedment;

import java.lang.reflect.Type;

/**
 *
 * @author Emil Forslund
 * @since  2.4.0
 */
public final class ApplicationImplTranslator extends AbstractJavaClassTranslator<Project, Class> {

    public ApplicationImplTranslator(Injector injector, Project project) {
        super(injector, project, Class::of);
    }

    @Override
    protected String getClassOrInterfaceName() {
        return getSupport().typeName(getSupport().projectOrThrow()) + "ApplicationImpl";
    }

    @Override
    protected Class makeCodeGenModel(File file) {
        return newBuilder(file, getClassOrInterfaceName())
            .forEveryProject((clazz, project)
                -> clazz.public_().final_()
                .setSupertype(generatedImplType())
                .add(applicationType())
            ).build();
    }

    @Override
    protected String getJavadocRepresentText() {
        return "The default {@link " + Speedment.class.getName() +
            "} implementation class for the {@link " + Project.class.getName() +
            "} named " + getSupport().projectOrThrow().getId() + ".";
    }

    private Type applicationType() {
        return SimpleType.create(
            getSupport().basePackageName() + "." +
            getSupport().typeName(getSupport().projectOrThrow()) + "Application"
        );
    }

    private Type generatedImplType() {
        return SimpleType.create(
            getSupport().basePackageName() + ".generated.Generated" +
            getSupport().typeName(getSupport().projectOrThrow()) + "ApplicationImpl"
        );
    }
}


text:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Jekyll v{{ jekyll.version }}">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,700|Source+Code+Pro:300,400,700,900&subset=cyrillic,cyrillic-ext,latin-ext,vietnamese" rel="stylesheet">
<link rel="stylesheet" href="{{ "/css/main.css" | relative_url }}">
<link rel="icon" type="image/x-icon" href=" /favicon.ico ">
{% seo %}
<meta http-equiv="Content-Language" content="{{site.active_lang}}">


text:
package org.jboss.quickstarts.portal.navigation;

import java.io.IOException;
import java.util.List;
import java.util.logging.Logger;

import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.ResourceRequest;
import javax.portlet.ResourceResponse;
import javax.portlet.PortletRequestDispatcher;

import org.gatein.api.PortalRequest;
import org.gatein.api.navigation.Navigation;
import org.gatein.api.navigation.Node;
import org.gatein.api.navigation.NodePath;
import org.gatein.api.navigation.Nodes;

/**
 * Navigation portlet implemented using the GateIn navigation API.
 *
 * @author Viliam Rockai
 */
public class NavigationPortlet extends GenericPortlet {
    private static final Logger log = Logger.getLogger(NavigationPortlet.class.getName());

    // The root navigation bean contains the top-menu elements (Home and Sitemap by default) as its direct children nodes.
    private NavigationNodeBean navigationRootNodeBean;

    /**
     * Method responsible for the VIEW mode of the navigation portlet.
     * This method passes the navigationRootNodeBean as an attribute to the JSP page.
     * The navigationRootNodeBean is the root node of the navigation and contains main menu (top-menu) elements (Home and Sitemap
     * by default) as children nodes.
     *
     * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
     * @param request the portlet request
     * @param response the render response
     * @throws PortletException if the portlet cannot fulfilling the request
     * @throws IOException if the streaming causes an I/O problem
     */
    @Override
    protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {

        PortalRequest portalRequest = PortalRequest.getInstance();

        Navigation navigation = PortalRequest.getInstance().getNavigation();

        // Diving two levels so the information about children count of children nodes is available
        Node rootNode = navigation.getRootNode(Nodes.visitNodes(2));

        navigationRootNodeBean = new NavigationNodeBean(rootNode);

        List<NavigationNodeBean> rootNodeChildrenList = navigationRootNodeBean.getChildren();

        /* Setting the 1st node to be active when accesing the root node "/" */
        if (!rootNodeChildrenList.isEmpty() && portalRequest.getNodePath().equals(NodePath.root())) {
            navigationRootNodeBean.setFirstActive();
        }

        request.setAttribute("navigationRootNode", navigationRootNodeBean);

        PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/navigation.jsp");
        prd.include(request, response);
    }

    /**
     * The serveResource method is used for handling AJAX requests. It's used for the rendering of sub-menus. Anytime
     * users clicks on the menu item, the URI parameter is passed to the serveResource method. This parameter contains the URI
     * of the node which sub-menu is about to be rendered.
     *
     * @see javax.portlet.GenericPortlet#serveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)
     *
     * @param request the resource request
     * @param response the resource response
     * @throws PortletException if the portlet has problems fulfilling the rendering request
     * @throws IOException if the streaming causes an I/O problem
     */
    @Override
    public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {

        Navigation navigation = PortalRequest.getInstance().getNavigation();

        String chosenNodeURI = request.getParameter("uri");

        log.info("Serving resource '"+ chosenNodeURI +"'.");

        Node chosenNode = navigation.getNode(NodePath.fromString(chosenNodeURI), Nodes.visitNodes(2));

        request.setAttribute("parentNode", new NavigationNodeBean(chosenNode));

        PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/node.jsp");
        prd.include(request, response);
    }
}


text:
first_name: Mireia
last_name: Codina Tobias
img:
email: first.middle.last@imp.ac.at
country: Spain
member_from: July
member_till: August 2021
position: VBC Summer Student
---


text:
<ion-header>
  <ion-navbar>
    <ion-title class="bp-title">{{'Transactions' | translate}}</ion-title>
    <ion-buttons left>
      <button class="close-container disable-hover" (click)="close()" ion-button>
        <ion-icon ios="md-close" md="md-close"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>
</ion-header>

<ion-content>
  <ion-item class="search-container" no-lines padding>
    <ion-input class="search-wrapper" placeholder="{{'Search Transactions' | translate}}" [(ngModel)]="search" (ngModelChange)="updateSearchInput(search)"></ion-input>
  </ion-item>

  <ion-list *ngIf="txHistorySearchResults && txHistorySearchResults[0]" class="bp-list tx-history">

        <button ion-item (click)="close(tx.txid)">
          <ion-icon item-start>

 0">

                <ng-container *ngIf="supportedCards | async as cardConfig">

                </ng-container>

          </ion-icon>

            {{'Sending'
              | translate}}
            {{'Moving'
              | translate}}
            {{addressbook[tx.outputs[0].address].name
              || addressbook[tx.outputs[0].address]}}
            {{'Receiving' | translate}}

 0 && tx.action == 'received'">
            {{'Received'
              | translate}}
            {{tx.note.body}}

              {{addressbook[tx.outputs[0].address].name || addressbook[tx.outputs[0].address]}}

 0 && tx.action == 'sent'">
            {{'Sent'
              | translate}}
            {{tx.message}}
            {{tx.note.body}}

              {{addressbook[tx.outputs[0].address].name || addressbook[tx.outputs[0].address]}}

 0 && tx.action == 'moved'">
            Sent to self
            {{tx.note.body}}

 0 && tx.action == 'invalid'">
            Invalid

          <ion-note item-end text-end>

              {{tx.amount |
                satToUnit: wallet.coin}}
              (possible double spend)

              {{tx.time * 1000 | amTimeAgo}}
              {{tx.time * 1000 | amDateFormat:'MMM D,
                YYYY'}}

          </ion-note>
        </button>

      {{filteredTxHistory.length - txHistorySearchResults.length}} more

      <ion-icon name="arrow-down"></ion-icon>

  </ion-list>

  <ion-infinite-scroll *ngIf="txHistoryShowMore" (ionInfinite)="moreSearchResults($event)">
    <ion-infinite-scroll-content></ion-infinite-scroll-content>
  </ion-infinite-scroll>
</ion-content>


text:
VG Feed
==============

Read VG (Verdens Gang) latest news in terminal window.

![image](https://i.imgur.com/TTDo3Lv.png)

Install
--
```bash
npm install -g vg-feed
```

Usage
---
```bash
vgno
```

Limit news items
---
```bash
vgno -l 3
```


text:
package net.sf.mmm.content.parser.impl.java;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.inject.Named;
import javax.inject.Singleton;

import net.sf.mmm.content.parser.impl.text.AbstractContentParserTextMarkupAware;
import net.sf.mmm.util.context.api.MutableGenericContext;

/**
 * This is the implementation of the
 * {@link net.sf.mmm.content.parser.api.ContentParser} interface for Java
 * sources (content with the mimetype "text/java-source").
 *
 * @author Joerg Hohwiller (hohwille at users.sourceforge.net)
 */
@Singleton
@Named
public class ContentParserJava extends AbstractContentParserTextMarkupAware {

  /** The mimetype. */
  @SuppressWarnings("hiding")
  public static final String KEY_MIMETYPE = "text/java-source";

  /** The default extension. */
  @SuppressWarnings("hiding")
  public static final String KEY_EXTENSION = "java";

  /** the string used to separate package names */
  private static final String PACKAGE_SEPARATOR = ".";

  /** pattern to extract the package name */
  private static final Pattern PACKAGE_PATTERN = Pattern.compile("package\\s+([\\w\\.]*).*");

  /** pattern to extract the class name */
  private static final Pattern CLASS_PATTERN = Pattern
      .compile("[\\sa-z]*(class|interface)\\s+(\\w*).*");

  /** pattern to extract the author */
  private static final Pattern AUTHOR_PATTERN = Pattern
      .compile("[\\s/*]*@author\\s+(<[^>]*>)?\"?([^(</\"]*).*");

  /**
   * The constructor.
   */
  public ContentParserJava() {

    super();
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public String getExtension() {

    return KEY_EXTENSION;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public String getMimetype() {

    return KEY_MIMETYPE;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected void parseLine(MutableGenericContext context, String line) {

    String title = context.getVariable(VARIABLE_NAME_TITLE, String.class);
    if (title == null) {
      Matcher m = PACKAGE_PATTERN.matcher(line);
      if (m.matches()) {
        title = m.group(1) + PACKAGE_SEPARATOR;
        context.setVariable(VARIABLE_NAME_TITLE, title);
      }
    }
    if ((title != null) && (title.endsWith(PACKAGE_SEPARATOR))) {
      Matcher m = CLASS_PATTERN.matcher(line);
      if (m.matches()) {
        title = title + m.group(2);
        context.setVariable(VARIABLE_NAME_TITLE, title);
      }
      // author tag can only appear before class name was detected...

      String author = parseProperty(line, AUTHOR_PATTERN, 2);
      if (author != null) {
        String authorProperty = context.getVariable(VARIABLE_NAME_CREATOR, String.class);
        if (authorProperty == null) {
          authorProperty = author;
        } else {
          authorProperty = authorProperty + ", " + author;
        }
        context.setVariable(VARIABLE_NAME_CREATOR, authorProperty);
      }
    }
  }

}


text:
title:   Rapat Koordinasi
date: 2012-10-09
categories:
- laporan
- Border Blogger Movement
layout: laporancmb
---

**Tujuan** :   Rapat Koordinasi

**Lokasi** :  Pontianak

**Alamat** :  Sekretariat Mata Enggang

**Jam** :  09.00-13.00

**Hadir** :
* Budi Miank,  Basilius Andreas Gas, Bosio, Laurensius Edi, Asriyadi Alexander Mering

**Ringkasan** :
* Rapat rutin


text:
package org.diorite.material.blocks.redstone;

import java.util.Map;

import org.diorite.cfg.magic.MagicNumbers;
import org.diorite.utils.collections.maps.CaseInsensitiveMap;

import gnu.trove.map.TByteObjectMap;
import gnu.trove.map.hash.TByteObjectHashMap;

/**
 * Class representing block "StonePressurePlate" and all its subtypes.
 */
public class StonePressurePlateMat extends PressurePlateMat
{
    /**
     * Sub-ids used by diorite/minecraft by default
     */
    public static final byte  USED_DATA_VALUES = 2;
    /**
     * Blast resistance of block, can be changed only before server start.
     * Final copy of blast resistance from {@link MagicNumbers} class.
     */
    public static final float BLAST_RESISTANCE = MagicNumbers.MATERIAL__STONE_PRESSURE_PLATE__BLAST_RESISTANCE;
    /**
     * Hardness of block, can be changed only before server start.
     * Final copy of hardness from {@link MagicNumbers} class.
     */
    public static final float HARDNESS         = MagicNumbers.MATERIAL__STONE_PRESSURE_PLATE__HARDNESS;

    public static final StonePressurePlateMat STONE_PRESSURE_PLATE         = new StonePressurePlateMat();
    public static final StonePressurePlateMat STONE_PRESSURE_PLATE_POWERED = new StonePressurePlateMat(0x1, true);

    private static final Map<String, StonePressurePlateMat>    byName = new CaseInsensitiveMap<>(USED_DATA_VALUES, SMALL_LOAD_FACTOR);
    private static final TByteObjectMap<StonePressurePlateMat> byID   = new TByteObjectHashMap<>(USED_DATA_VALUES, SMALL_LOAD_FACTOR);

    @SuppressWarnings("MagicNumber")
    protected StonePressurePlateMat()
    {
        super("STONE_PRESSURE_PLATE", 70, "minecraft:stone_pressure_plate", "STONE_PRESSURE_PLATE", (byte) 0x00, false);
    }

    protected StonePressurePlateMat(final int type, final boolean powered)
    {
        super(STONE_PRESSURE_PLATE.name(), STONE_PRESSURE_PLATE.ordinal(), STONE_PRESSURE_PLATE.getMinecraftId(), powered ? "POWERED" : "WOODEN_PRESSURE_PLATE", (byte) type, powered);
    }

    protected StonePressurePlateMat(final String enumName, final int id, final String minecraftId, final int maxStack, final String typeName, final byte type, final boolean powered)
    {
        super(enumName, id, minecraftId, maxStack, typeName, type, powered);
    }

    @Override
    public float getBlastResistance()
    {
        return BLAST_RESISTANCE;
    }

    @Override
    public float getHardness()
    {
        return HARDNESS;
    }

    @Override
    public StonePressurePlateMat getType(final String name)
    {
        return getByEnumName(name);
    }

    @Override
    public StonePressurePlateMat getType(final int id)
    {
        return getByID(id);
    }

    @Override
    public StonePressurePlateMat getPowered(final boolean powered)
    {
        return getByID(powered ? 1 : 0);
    }

    /**
     * Returns one of StonePressurePlate sub-type based on sub-id, may return null
     *
     * @param id sub-type id
     *
     * @return sub-type of StonePressurePlate or null
     */
    public static StonePressurePlateMat getByID(final int id)
    {
        return byID.get((byte) id);
    }

    /**
     * Returns one of StonePressurePlate sub-type based on name (selected by diorite team), may return null
     * If block contains only one type, sub-name of it will be this same as name of material.
     *
     * @param name name of sub-type
     *
     * @return sub-type of StonePressurePlate or null
     */
    public static StonePressurePlateMat getByEnumName(final String name)
    {
        return byName.get(name);
    }

    /**
     * Returns one of StonePressurePlate sub-type based on powered state.
     * It will never return null.
     *
     * @param powered if pressure player should be powered.
     *
     * @return sub-type of StonePressurePlate
     */
    public static StonePressurePlateMat getStonePressurePlate(final boolean powered)
    {
        return getByID(powered ? 1 : 0);
    }

    /**
     * Register new sub-type, may replace existing sub-types.
     * Should be used only if you know what are you doing, it will not create fully usable material.
     *
     * @param element sub-type to register
     */
    public static void register(final StonePressurePlateMat element)
    {
        byID.put((byte) element.getType(), element);
        byName.put(element.name(), element);
    }

    @Override
    public StonePressurePlateMat[] types()
    {
        return StonePressurePlateMat.stonePressurePlateTypes();
    }

    /**
     * @return array that contains all sub-types of this block.
     */
    public static StonePressurePlateMat[] stonePressurePlateTypes()
    {
        return byID.values(new StonePressurePlateMat[byID.size()]);
    }

    static
    {
        StonePressurePlateMat.register(STONE_PRESSURE_PLATE);
        StonePressurePlateMat.register(STONE_PRESSURE_PLATE_POWERED);
    }
}


text:
package org.apache.camel.component.caffeine.resume.multi;

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

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.apache.camel.resume.cache.MultiEntryCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A cache that can store multiple key/valued resumables where the value is a list containing multiple values
 *
 * @param <K> the type of the key
 * @param <V> the type of the value
 */
public class CaffeineCache<K, V> implements MultiEntryCache<K, V> {
    private static final Logger LOG = LoggerFactory.getLogger(CaffeineCache.class);

    private final Cache<K, List<V>> cache;
    private final long cacheSize;

    /**
     * Builds a new instance of this object with the given cache size
     *
     * @param cacheSize the size of the cache
     */
    public CaffeineCache(long cacheSize) {
        this(Caffeine.newBuilder().maximumSize(cacheSize).build(), cacheSize);
    }

    /**
     * Builds a new instance of this object
     *
     * @param cache     an instance of a pre-constructed cache object
     * @param cacheSize the size of the pre-constructed cache object
     */
    public CaffeineCache(Cache<K, List<V>> cache, long cacheSize) {
        this.cache = cache;
        this.cacheSize = cacheSize;
    }

    @Override
    public long capacity() {
        return cacheSize;
    }

    @Override
    public synchronized void add(K key, V offsetValue) {
        LOG.trace("Adding entry to the cache (k/v): {}/{}", key, offsetValue);
        LOG.trace("Adding entry to the cache (k/v) with types: {}/{}", key.getClass(), offsetValue.getClass());
        List<V> entries = cache.get(key, k -> new ArrayList<>());

        entries.add(offsetValue);
    }

    @Override
    public synchronized boolean contains(K key, V entry) {
        final List<V> entries = cache.getIfPresent(key);

        if (entries == null) {
            return false;
        }

        boolean ret = entries.contains(entry);
        LOG.trace("Checking if cache contains key {} with value {} ({})", key, entry, ret);

        return ret;
    }

    @Override
    public boolean isFull() {
        if (cache.estimatedSize() >= cacheSize) {
            return true;
        }

        return false;
    }

}


text:
/* global vontology */

const vowlHelper = (function () {
  let ontology = vontology;
  return {
    setVowlOntology: function (newOntology) {
      ontology = newOntology;
    },
    byAnnotation: function (target) { // merge byAnnotation and byProperty
      if (target == undefined)
        return [];
      target = target.toLowerCase();
      return ontology.classAttribute.filter(function (entry) {
        if (entry.annotations != undefined) {
          for (let[annoLabel, anno] of Object.entries(entry.annotations)) {
            if (anno[0].value)
              if (anno[0].value.toLowerCase().includes(target))
                return true;
          }
        }
        return false;

      });
    },
    byProperty: function (prop, target) {
      if (target == undefined)
        return [];
      target = target.toLowerCase();
      return ontology.classAttribute.filter(function (entry) {
        if (entry[prop])
          for (let [key, value] of Object.entries(entry[prop])) {
            if (value)
              if (value.toLowerCase().includes(target))
                return true;
          }
      });
    },

    byLabel: function (target) {
      return vowlHelper.byProperty("label", target);
    },
    byLabelAndAnnotation: function (target) {
      let res = vowlHelper.byLabel(target).concat(vowlHelper.byAnnotation(target));
      let nodupes = res.filter((item, index) => res.indexOf(item) === index);
      return nodupes;
    },

    getLabels: function (includeAnnotations = false) {
      let labels = [];
      ontology.classAttribute.forEach(function (term) {
        if (term.label)
          if (term.label["undefined"])
            labels[labels.length] = term.label["undefined"];
          else if (term.label["IRI-based"])
            labels[labels.length] = term.label["IRI-based"];

      });
      return labels;
    },
    getTermById: function(id) {
      let term = ontology.classAttribute.find(term => term.id == id)
      return term;
    }
  };

})();
let vh = vowlHelper;


text:
title: Telerik.Web.UI.RadListViewSortExpressions
page_title: Client-side API Reference
description: Client-side API Reference
slug: Telerik.Web.UI.RadListViewSortExpressions
---

# Telerik.Web.UI.RadListViewSortExpressions

## Inheritance Hierarchy

* *[Telerik.Web.UI.RadListViewSortExpressions]({%slug Telerik.Web.UI.RadListViewSortExpressions%})*

## Methods

###  add

Adds a sort expression to the collection

#### Parameters

##### field `String`

The field name that is sorted

##### order `String`

Optional

#### Returns

`None`

###  build

Retrieves a Telerik.Web.UI.RadListViewSortExpressionBuilder instance that can be used for fluent expression building.

#### Parameters

#### Returns

`None`

###  clear

Clears the sort expressions collection

#### Parameters

#### Returns

`None`

###  getItem

Retrieves a sort expression by specified index or field name.

#### Parameters

##### fieldOrIndex `String`

The field or index to find the expression by

#### Returns

`None`

###  getSortOrder

Retrieves the sort order for the specified sort expression

#### Parameters

##### field `String`

The field name whose sort order to retrieve

#### Returns

`None`

###  get_count

Retrieves the number of expressions in the collection

#### Parameters

#### Returns

`Number`

###  indexOf

Retrieves the index of the sort expression with the specified field name

#### Parameters

##### field `String`

The field of the expression whose index to find

#### Returns

`None`

###  remove

Removes a field from the sort expressions

#### Parameters

##### field `String`

The field name to remove

#### Returns

`None`

###  toLinq

Returns a Dynamic LINQ representation of the current sort expression collection.

#### Parameters

#### Returns

`None`

###  toList

Returns a list representation of the current sort expression collection.

#### Parameters

#### Returns

`None`

###  toOData

Returns an OData formatted representation of the current sort expression collection.

#### Parameters

#### Returns

`None`

###  toSql

Returns an SQL representation of the current sort expression collection.

#### Parameters

#### Returns

`None`

###  toggle

Toggles the sort order of the specified field

#### Parameters

##### field `String`

The field whose sort order to toggle

#### Returns

`None`


text:
export function isMovile(ua) {
    return /mobile/i.test(ua);
};


text:
using UnityEngine;
using System.Collections;

public class Crosshair : MonoBehaviour {

	public float sensitivity;
	public Camera cam;

	public enum State { IDLE, LOCKING }
	public State currentState;
	private Transform target;
	private int lockCount;
	public int maxLockCount;

	// Force push controllers
	public float power;
	public float radius;

	void Start() {
		currentState = State.IDLE;
	}

	void Update () {
		processInput();
		checkLockOn();
	}

	// PROCESS USER INPUT
	private void processInput() {
		// Receive Input
		if (Input.GetKey(KeyCode.LeftArrow)) {
			transform.position += new Vector3(-1 * sensitivity * Time.deltaTime, 0, 0);
		}
		if (Input.GetKey(KeyCode.RightArrow)) {
			transform.position += new Vector3(sensitivity * Time.deltaTime, 0, 0);
		}
		if (Input.GetKey(KeyCode.UpArrow)) {
			transform.position += new Vector3(0, sensitivity * Time.deltaTime, 0);
		}
		if (Input.GetKey(KeyCode.DownArrow)) {
			transform.position += new Vector3(0, -1 * sensitivity * Time.deltaTime, 0);
		}
	}

	private void reset() {
		lockCount = 0;
		currentState = State.IDLE;
		target = null;
	}

	// CHECK IF A TARGET IS LOCKABLE AND ALIVE
	private bool checkLockable(RaycastHit hit) {
		Component[] ls = hit.transform.GetComponents(typeof(Lockable));

		if (ls.Length > 0 && ((Lockable)ls[0]).isItAlive()) {
			return true;
		}

		return false;
	}

	// RAYCAST TO SEE IF WE ARE LOCKING ON TO ANYTHING
	private void checkLockOn() {
		// initialize RaycastHits
		RaycastHit hitClose = new RaycastHit();
		RaycastHit hitFar = new RaycastHit();

		// Get vectors from camera to crosshair and beyond
		Vector3 aim = transform.position - cam.transform.position;
		Vector3 offset = Vector3.Normalize(aim) * .75f;
		Debug.DrawRay(cam.transform.position, aim, Color.yellow);
		Debug.DrawRay(transform.position, aim*2, Color.blue);

		// Raycast in front of and behind the crosshair
		bool c = Physics.Raycast(cam.transform.position, aim, out hitClose, 100);
		bool f = Physics.Raycast (transform.position, aim*2, out hitFar, 100);

		// Lock on to a close target
		if (c && checkLockable(hitClose)) {
			transform.position = hitClose.point - offset;
			updateState (hitClose);
		}

		// Or else lock on to a far target
		else if (f && checkLockable(hitFar)) {
			transform.position = hitFar.point - offset;
			updateState(hitFar);
		}

		// Or else do a reset check
		else if (currentState != State.IDLE) {
			reset ();
		}
	}

	// IF WE ARE LOCKING ON, UPDATE OUR STATE
	private void updateState(RaycastHit hit) {
		// If IDLE, set target and set state to LOCKING
		if (currentState == State.IDLE) {
			target = hit.transform;
			currentState = State.LOCKING;
		}

		// If LOCKING and SAME TARGET, increment count or FIRE!!
		if (currentState == State.LOCKING && hit.transform == target) {
			if (lockCount < maxLockCount) { lockCount = lockCount + 1; }
			else {
				fire(hit);
				reset();
			}
		}

		// If LOCKING and NEW TARGET, reset
		else if (currentState == State.LOCKING) {
			target = hit.transform;
			lockCount = 0;
		}
	}

	private void fire(RaycastHit hit) {
		// If we have a Rigidbody, apply an explosive force to it
		if (hit.rigidbody) {
			hit.rigidbody.AddExplosionForce(power, transform.position, radius);
		}

		// Call the target's onFire function
		Lockable l = (Lockable)hit.transform.GetComponents(typeof(Lockable))[0];
		l.onFire();
	}
}


text:
civ-kie
=======

Project containing definitions and tests of rules and processes implemented with jBPM 6.0 and Drools 6.0

**purpose:**

Project defines a kmodule which contains all the definitions of rules and processes. After installing into local repository the kmodule is available to be injected.

**requirements:**

* dependency to civ-persistence-api

**usage:**

mvn install

after that following dependency is available

```xml
<dependency>
    <groupId>cz.muni.fi.civ</groupId>
    <artifactId>civ-kie</artifactId>
    <version>...</version>
</dependency>
```


text:
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';

import { JhipsSharedModule } from '../shared';

import {
    Register,
    ActivateService,
    PasswordService,
    PasswordResetInitService,
    PasswordResetFinishService,
    SessionsService,
    SessionsComponent,
    PasswordStrengthBarComponent,
    RegisterComponent,
    ActivateComponent,
    PasswordComponent,
    PasswordResetInitComponent,
    PasswordResetFinishComponent,
    SettingsComponent,
    accountState
} from './';

@NgModule({
    imports: [
        JhipsSharedModule,
        RouterModule.forRoot(accountState, { useHash: true })
    ],
    declarations: [
        ActivateComponent,
        RegisterComponent,
        PasswordComponent,
        PasswordStrengthBarComponent,
        PasswordResetInitComponent,
        PasswordResetFinishComponent,
        SessionsComponent,
        SettingsComponent
    ],
    providers: [
        SessionsService,
        Register,
        ActivateService,
        PasswordService,
        PasswordResetInitService,
        PasswordResetFinishService
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class JhipsAccountModule {}


text:
A modern C++ re/implementation of some ITU-T OSI protocols X Series -- in short, **an OSI stack** --
found here: [ITU-T X Series](http://www.itu.int//en/ITU-T/publications/Pages/structure.aspx#X)
based on the public domain ISODE-8 source code [ISODE](https://en.wikipedia.org/wiki/ISO_Development_Environment)

For an introduction to the OSI model and specifications, see
[OSI model](https://en.wikipedia.org/wiki/OSI_model)

A tribute to
Marshall T [Rose](https://en.wikipedia.org/wiki/Marshall_Rose)
Colin [Robbins](https://en.wikipedia.org/wiki/Colin_Robbins_%28software_engineer%29)
Julian P [Onions](https://en.wikipedia.org/wiki/Nexor#Personnel_and_alumni)
Steve [Kille](https://en.wikipedia.org/wiki/Steve_Kille)

Build Status
------------

- Travis: [![Travis Build Status](https://travis-ci.org/kampbell/isode.png?branch=develop)](https://travis-ci.org/kampbell/isode)
- AppVeyor: [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/7iyrx3f233s3akae)](https://ci.appveyor.com/project/zosrothko/ISODE)

This c++ version is using a FiniteStateMachine to manage the protocol of each OSI layer as described verbatim by the
X.2xx specifications.

Notice:
On the server/responder side, the OSI stack is build from the TSAP layer up to the AcSAP layer using one dynamic shared module per layer, shared modules that are selected by each corresponding address selectors.

Read the cpp/README for building & testing the ISODE++ stack.

**This is a Work In Progress with numerous bugs, not yet designed areas**
**Contributions are wellcome.**


text:
<?php

class Ebanx_Gateway_Block_Form_Rapipago extends Ebanx_Gateway_Block_Form_Abstract
{
    /**
     * @return Ebanx_Gateway_Block_Form_Rapipago
     */
    protected function _construct()
    {
        parent::_construct();
        $this->setTemplate('ebanx/form/rapipago.phtml');
    }
}


text:
package com.artemis.io;

import com.artemis.Component;
import com.artemis.Entity;
import com.artemis.utils.Bag;
import com.artemis.utils.IntBag;
import com.artemis.utils.reflect.Field;
import com.artemis.utils.reflect.ReflectionException;

class EntityReference {
	public final Class<?> componentType;
	public final Field field;
	public final FieldType fieldType;
	public transient final Bag<Component> operations = new Bag<Component>();

	EntityReference(Class<?> componentType, Field field) {
		this.componentType = componentType;
		this.field = field;
		this.fieldType = FieldType.resolve(field);
	}

	void translate(Bag<Entity> translatedIds) {
		for (Component c : operations)
			fieldType.translate(c, field, translatedIds);

		operations.clear();
	}

	@Override
	public String toString() {
		return "EntityReference{" +
				componentType.getSimpleName() +
				"." + field.getName() +
				" (" + fieldType +
				"), operations=" + operations.size() +
				'}';
	}

	enum FieldType {
		INT {
			void translate(Component c, Field field, Bag<Entity> translatedIds) {
				try {
					int oldId = ((Integer)field.get(c)).intValue();
					field.set(c, translatedIds.get(oldId).id);
				} catch (ReflectionException e) {
					throw  new RuntimeException(e);
				}
			}
		},
		INT_BAG {
			void translate(Component c, Field field, Bag<Entity> translatedIds) {
				try {
					IntBag bag = (IntBag) field.get(c);
					for (int i = 0, s = bag.size(); s > i; i++) {
						int oldId = bag.get(i);
						bag.set(i, translatedIds.get(oldId).id);
					}
				} catch (ReflectionException e) {
					throw  new RuntimeException(e);
				}
			}
		},
		ENTITY {
			void translate(Component c, Field field, Bag<Entity> translatedIds) {
				try {
					int oldId = ((Entity) field.get(c)).id;
					field.set(c, translatedIds.get(oldId));
				} catch (ReflectionException e) {
					throw new RuntimeException(e);
				}
			}
		},
		ENTITY_BAG {
			void translate(Component c, Field field, Bag<Entity> translatedIds) {
				try {
					Bag<Entity> bag = (Bag<Entity>) field.get(c);
					for (int i = 0, s = bag.size(); s > i; i++) {
						Entity e = bag.get(i);
						bag.set(i, translatedIds.get(e.id));
					}
				} catch (ReflectionException e) {
					throw new RuntimeException(e);
				}
			}
		};

		abstract void translate(Component c, Field field, Bag<Entity> translatedIds);

		static FieldType resolve(Field f) {
			Class type = f.getType();
			if (int.class == type)
				return INT;
			else if (Entity.class == type)
				return ENTITY;
			else if (IntBag.class == type)
				return INT_BAG;
			else if (Bag.class == type)
				return ENTITY_BAG;
			else
				throw new RuntimeException("missing case: " + type.getSimpleName());
		}
	}
}


text:
module ChessPieceMoves
    #     Unicode for chess pieces:
    #
    #     Piece              UTF8      Ord     Piece              UTF8      Ord
    #     White Pawn   =   "\u2659"  = 9817    Black Pawn   =  "\u265f"  = 9823
    #     White Rook   =   "\u2656"  = 9814    Black Rook   =  "\u265c"  = 9820
    #     White Knight =   "\u2658"  = 9816    Black Knight =  "\u265e"  = 9822
    #     White Bishop =   "\u2657"  = 9815    Black Bishop =  "\u265d"  = 9821
    #     White Queen  =   "\u2655"  = 9813    Black Queeen =  "\u265b"  = 9819
    #     White King   =   "\u2654"  = 9812    Black King   =  "\u265a"  = 9818

    #returns true if there is a clear, legal path from move_from to move_to for each chess piece
    #calls piece_can_move_there a large switch which finds which piece is to be moved and routes it to an individual helper method
    def validate_move_to(move_from, move_to)
        # automatically invalid if own piece at terminus --covers selecting same square --exception  Castling
        if (is_white?(move_from) && is_white?(move_to)) || (is_black?(move_from) && is_black?(move_to))
            puts 'cannot move onto own piece! unless castling'
            return can_castle?(move_from, move_to)
        end
        return false if !piece_can_move_there?(move_from, move_to)
        true
        #cannot move into check
        #here is a wonky work around to not rewrite a bunch of code to check for check
        #switches @board to reflect what it would look like then checks for check
        #finally returns board to original state before sending it to register move
        temp_piece = piece_at(move_to).dup
        @board[move_to[0]][move_to[1]] = piece_at(move_from)
        @board[move_from[0]][move_from[1]] = "."
        valid = !in_check?
        @board[move_from[0]][move_from[1]] = piece_at(move_to)
        @board[move_to[0]][move_to[1]] = temp_piece
        return valid
    end

    #returns true if active player is in check given current @board set-up
    def in_check?
      #whose turn?
      @white ? color = "white" : color = "black"
      #where's king
      kings_sq = find_kings_position(color)
      #cycle through all pieces and see if their next move is a valid move on king  return true
      0.upto(7) do |y|
        0.upto(7) do |x|
           if (color == "white" && is_black?([y ,x]) )|| (color == "black" && is_white?([y ,x]) )
             if piece_can_move_there?([y ,x] , kings_sq)
               puts "In Check!"
               return true
             end
           end
        end
      end
      false
    end

    #returns position of king for given color  -- Helper for in_check?
    def find_kings_position(color)
      color == "white"  ? piece = 9812 : piece = 9818
      0.upto(7) do |y|
        0.upto(7) { |x| return [y , x] if @board[y][x].ord == piece}
      end
    end

    #returns true if King can legally move: from...to
    def king_move(move_from, move_to)
        # invalid if king moves more than one space in any direction
        if (move_from[0] - move_to[0]).abs > 1 || (move_from[1] - move_to[1]).abs > 1
            return false
        end
        toggle_can_castle(move_from)
        true
    end

    #returns true if Queen can legally move: from...to
    def queen_move(move_from, move_to)
        # if a diagonal move then test it
        if (move_from[0] - move_to[0]).abs == (move_from[1] - move_to[1]).abs
            return !piece_in_path_diagonal?(move_from, move_to)
        end
        # if not linear or diagonal(see previous block) return false
        return false if move_to[0] != move_from[0] && move_to[1] != move_from[1]
        # if there is a NOT piece in the path return true
        !piece_in_path_straight?(move_from, move_to)
    end

    #returns true if Bishop can legally move: from...to
    def bishop_move(move_from, move_to)
        # not a diagonal move
        if (move_from[0] - move_to[0]).abs != (move_from[1] - move_to[1]).abs
            return false
        end
        # piece in path diagonal
        !piece_in_path_diagonal?(move_from, move_to)
    end

    #returns true if Knight can legally move: from...to
    def knight_move(move_from, move_to)
        # move is only valid if it is plus 2 and over 1 and not own piece at terminus
        if (move_from[0] - move_to[0]).abs == 2 && (move_from[1] - move_to[1]).abs == 1
            true
        elsif (move_from[0] - move_to[0]).abs == 1 && (move_from[1] - move_to[1]).abs == 2
            true
        else
            false
        end
    end

    #returns true if Rook can legally move: from...to
    def rook_move(move_from, move_to)
        # cases where move is not valid
        # diagonal
        return false if move_to[0] != move_from[0] && move_to[1] != move_from[1]
        # a piece in its path piece_in_path_straight
        return false if piece_in_path_straight?(move_from, move_to)
        toggle_can_castle(move_from)
        true
    end

    #returns true if a White Pawn can legally move: from...to
    def white_pawn_move(move_from, move_to)
        # Cases where move is not valid
        # check to see if legal, diagonal take occurs
        if move_to[0] == (move_from[0] + 1) && (move_from[1] == (move_to[1] + 1) || move_from[1] == (move_to[1] - 1))
            return is_take?(move_from, move_to)
        end
        # not the same column
        return false if move_to[1] != move_from[1]
        # if blocked by piece
        return false if is_white?(move_to) || is_black?(move_to)
        # more than 1 space forward  except from row 2
        return false if (move_to[0] != (move_from[0] + 1)) && move_from[0] != 1
        # move from row 2 is greater than 2
        return false if move_to[0] > move_from[0] + 2
        # a piece in its straight piece_in_path_straight
        return false if piece_in_path_straight?(move_from, move_to)
        true
    end

    #returns true if a Black Pawn can legally move: from...to
    def black_pawn_move(move_from, move_to)
        # Cases where move is not valid
        # check to see if legal, diagonal take occurs
        if move_to[0] == (move_from[0] - 1)
            if  move_from[1] == (move_to[1] + 1) || move_from[1] == (move_to[1] - 1)
              return  is_take?(move_from, move_to)
            end
        end
        # not the same column
        return false if move_to[1] != move_from[1]
        # if blocked by piece
        return false if is_white?(move_to) || is_black?(move_to)
        # more than 1 space forward  except from row 2
        return false if (move_to[0] != (move_from[0] - 1)) && move_from[0] != 6
        # move from row 2 is greater than 2
        return false if move_to[0] < move_from[0] - 2
        # a piece in its straight piece_in_path_straight
        return false if piece_in_path_straight?(move_from, move_to)
        true
    end

    #helper function for pawn diagonal moves
    #returns true if there is an opponent in the move_to square
    def is_take?(move_from, move_to)
        return is_black?(move_to) if is_white?(move_from)
        return is_white?(move_to) if is_black?(move_from)
    end

    #returns true if there is a piece blocking a diagonal move between move_from and move_to
    def piece_in_path_diagonal?(move_from, move_to)
        # sticking to matrix format where row axis is first element
        move_to[0] > move_from[0] ? increment_row = 1 : increment_row = -1
        move_to[1] > move_from[1] ? increment_col = 1 : increment_col = -1
        row = move_from[0].dup + increment_row
        col = move_from[1].dup + increment_col
        until row == move_to[0]
            return true if @board[row][col] != '.'
            row += increment_row
            col += increment_col
        end
        false
    end

    #returns true if there is a piece blocking a straight move between move_from and move_to
    def piece_in_path_straight?(move_from, move_to)
        if move_from[1] == move_to[1]
            col = move_from[1]
            # marks spot after or before piece
            start = move_from[0] < move_to[0] ? move_from[0] + 1 : move_to[0] + 1
            stop = move_from[0] < move_to[0] ? move_to[0] - 1 : move_from[0] - 1
            start.upto(stop) { |l| return true if @board[l][col] != '.' }
        else
            row = move_from[0]
            # marks spot after or before piece
            start = move_from[1] < move_to[1] ? move_from[1] + 1 : move_to[1] + 1
            stop = move_from[1] < move_to[1] ? move_to[1] - 1 : move_from[1] - 1
            start.upto(stop) { |l| return true if @board[row][l] != '.' }
         end
        false
    end

    # uses .ord to see if piece is in range of white or black pieces: see chart above.
    #returns true if square holds a White Piece
    def is_white?(sqr)
        (9812..9817).cover?(@board[sqr[0]][sqr[1]].ord)
    end

    #returns true if square holds a Black Piece
    def is_black?(sqr)
        (9818..9823).cover?(@board[sqr[0]][sqr[1]].ord)
    end

    #returns string 'UTF8 ' code for the given square or string '.'  if no piece is in the square
    def piece_at(sqr)
        @board[sqr[0]][sqr[1]]
    end

    #returns ascii value of item in square
    def ord_at(sqr)
        @board[sqr[0]][sqr[1]].ord
    end

    #loops until player choses their own piece to move_from
    #returns square/coords of piece
    def validate_move_from
        move_from = get_move
        # validate White's turn and white piece chosen or Black's turn and black piece chosen
        until (@white && is_white?(move_from)) || (!@white && is_black?(move_from))
            puts 'Invalid selection!  Try a different square:'
            move_from = get_move
        end
        move_from
    end

    #loops until player choses a square on the board
    #converts row[A-F], col[1-8]  to  0-7 , 0-7  in format [row, col]
    #returns row, col in [y ,x] format
    def get_move
        puts "Enter Square (e.g. a1)  --  R to Resign  --  S to Save"
        choice = 'XXX'
        scanned = choice.scan(/[a-h][1-8]/).join
        until choice.size == 2 && scanned.size == 2
            choice = gets.chomp
            # kill switch for testing
            exit(0) if choice == 'q' || choice == 'Q'
            scanned = choice.scan(/[a-h][1-8]/).join
        end
        # convert to coords on @board array
        #  -97  to get column  'a' = 97 ascii
        # @board format is [row][col]
        col = scanned[0].ord - 97
        row = scanned[1].to_i - 1
        [row, col]
    end

        #sorts by piece and directs to pieces move validation method
        #returns result from individual methods
        #returns true if piece can move: from...to
        def piece_can_move_there?(move_from, move_to)
          # test --- puts "in can move there   move_from: #{move_from}  move_to:#{move_to}"
          # selects chess piece
          case ord_at(move_from)
          when 9817
              return white_pawn_move(move_from, move_to)
          when 9823
              return black_pawn_move(move_from, move_to)
          when 9814, 9820
              return rook_move(move_from, move_to)
          when 9816, 9822
              return knight_move(move_from, move_to)
          when 9815, 9821
              return bishop_move(move_from, move_to)
          when 9813, 9819
              return queen_move(move_from, move_to)
          when 9812, 9818
              return king_move(move_from, move_to)
          else
              puts 'Something went terribly wrong in can-move-there?'
          end
        end

    #-------------CASTLING----------  THEN END

    def can_castle?(move_from, move_to)
      #make sure lane is empty first
      return false if piece_in_path_straight?(move_from, move_to)
      #check each of four possible moves to make sure piece hasn't already been moved
      if ord_at(move_from) == 9814 && move_from == [0, 0] && ord_at(move_to) == 9812
          return @white_qr_can_castle
      elsif ord_at(move_from) == 9814 && move_from == [0, 7] && ord_at(move_to) == 9812
          return @white_kr_can_castle
      elsif ord_at(move_from) == 9820 && move_from == [7, 0] && ord_at(move_to) == 9818
          return @black_qr_can_castle
      elsif ord_at(move_from) == 9820 && move_from == [7, 7] && ord_at(move_to) == 9818
          return @black_kr_can_castle
      elsif ord_at(move_from) == 9812 && move_from == [0, 4] && move_to == [0,0]
          return @white_qr_can_castle
      elsif ord_at(move_from) == 9812 && move_from == [0, 4] && move_to == [0,7]
          return @white_kr_can_castle
      elsif ord_at(move_from) == 9818 && move_from == [7, 4] && move_to == [7,0]
          return @black_qr_can_castle
        elsif ord_at(move_from) == 9818 && move_from == [7, 4] && move_to == [7,7]
          return @black_kr_can_castle
      end
      false
    end

    #if rook or king is moved from their starting position castling becomes invalid
    def toggle_can_castle(move_from)
        if ord_at(move_from) == 9814 && move_from == [0, 0]
            @white_qr_can_castle = false
        elsif ord_at(move_from) == 9814 && move_from == [0, 7]
            @white_kr_can_castle = false
        elsif ord_at(move_from) == 9820 && move_from == [7, 0]
            @black_qr_can_castle = false
        elsif ord_at(move_from) == 9820 && move_from == [7, 7]
            @black_kr_can_castle = false
        elsif ord_at(move_from) == 9812 && move_from == [0, 4]
            @white_kr_can_castle = false
            @white_qr_can_castle = false
        elsif ord_at(move_from) == 9818 && move_from == [7, 4]
            @black_kr_can_castle = false
            @black_qr_can_castle = false
        end
    end

end


text:
package cn.imrhj.pushmsg.Activity.LoginActivity.Model;

/**
 * Created by rhj on 16/3/26.
 */
public class UserInfo {
    private String userName;
    private String password;
    private String userEmail;

    public UserInfo(String userName, String password, String userEmail) {
        this.userName = userName;
        this.password = password;
        this.userEmail = userEmail;
    }

    public UserInfo(String password, String userEmail) {
        this.password = password;
        this.userEmail = userEmail;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }
}


text:
package org.waveprotocol.wave.client.widget.popup;

import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.user.client.ui.RootPanel;

import org.waveprotocol.wave.client.scheduler.Scheduler;
import org.waveprotocol.wave.client.scheduler.ScheduleCommand;

/**
 * Show the popup in the center of the screen.
 *
 */
public class CenterPopupPositioner implements RelativePopupPositioner {

  /**
   * {@inheritDoc}
   */
  public void setPopupPositionAndMakeVisible(Element relative, final Element p) {
    ScheduleCommand.addCommand(new Scheduler.Task() {
      public void execute() {
        p.getStyle().setLeft((RootPanel.get().getOffsetWidth() - p.getOffsetWidth()) / 2, Unit.PX);
        p.getStyle().setTop((RootPanel.get().getOffsetHeight() - p.getOffsetHeight()) / 2, Unit.PX);
        p.getStyle().setVisibility(Visibility.VISIBLE);
      }
    });
  }
}


text:
from core.brain.hello.reaction import Reaction

class ReactionCopy(Reaction):
    def __init__(self, *args, **kwargs):
        """docstring for __init__"""
        super(ReactionCopy, self).__init__()


text:
/* ========================================================================= */
/* =================== Workbook Page CSS =================================== */
/* ========================================================================= */

/* NAVIGATION */
/*=235-23*/
/*a.togleft{cursor:pointer;position:absolute;left:212px;top:9px;height:29px;z-index:2}
a.togleft.c{background:url(../images/grip-rtl.png) no-repeat;width:23px;left:212px}
a.togleft.e{background:url(../images/grip-ltr.png) no-repeat;width:18px;left:235px}
*/
/* =================== Workbook Page ==================================== */
/* Wireframe (also in a2)*/
/* Header */
#contextHelp{background-image:url(../images/backgrounds/k8.png);bottom:0;color:#CCC;left:0;margin:0 auto;padding:0 1.5em 1.5em;position:fixed;right:0;top:0;z-index:205}
#contextHelp a{color:#8abee5;text-decoration:none}
#contextHelp a span{color:#8abee5;font-weight:400}
#contextHelp div{margin:0 auto;max-width:992px;padding:.25em}
#contextHelp h5{color:#CCC;margin:1.5em auto 0;max-width:992px}
#contextHelp li{padding:0 0 .5em}
#contextHelp span{color:#e6cb45;font-weight:700}
#contextHelp ul{list-style:none;margin:0}
#coursetitle{display:inline;font-size:1.5em;padding:0;vertical-align:middle; padding:19px 0 0}
#coursetitle a{display:inline-block;padding:.25em 0;text-decoration:none}
#coursetitle a:focus,#coursetitle a:hover,#sysnav a:hover,#sysnav a:focus,#pagecontext a[href]:hover,#pagecontext a[href]:focus,.menou li a:hover{text-decoration:underline}
#expInstr{background-color:#FFF8D4;border:1px solid #CCC399;clear:both;font-size:14px;line-height:1.35em;margin:1em;padding:.5em}
#exp_controls{float:right;font-size:12px;padding:0 1.25em .3em}
#hdr .logo{float:left;padding:.5em}
#hdr .logo img{vertical-align:middle}
#hdr a{color:#423A20;outline:medium;padding:6px 9px}
#headnav{float:left;padding-right:1em; position:relative; top:7px}

#lobjh{background:url("../images/learning-obj-bg.png") repeat-x bottom; height:auto;}
#lobjh p{display:none}
#lobjh.multi h3{background:url("../images/learning-objs.png") no-repeat;}
#lobjh h3{background:url("../images/learning-obj.png") no-repeat; width:121px; height:61px; text-indent:-9999px; overflow:none; position:absolute; margin:9px 0px 0px -12px;}

#lobjh ul {display:table; margin:0px; list-style:none; padding:0px 0px 0px 110px; border-collapse:separate; border-spacing:10px; position:relative; top:10px;}
#lobjh ul li { display:table-row;}
#lobjh ul li div { display:table-cell; width:188px; background:#eef6e3; border:1px solid #8bc541; padding:22px; font:normal 12px/18px Georgia, "Times New Roman", serif; height:100px;}

#lobjh ul li div ul { margin:0px; padding:0px; display:block;}
#lobjh ul li div ul li { margin:0px 0px 5px 0px; padding: 0px 0px 0px 18px; display:block; background: url("../images/fillBul.gif") no-repeat 2px 5px;}

#md-activitycurrent a{background-color:#FEA;display:block;padding:5px 5px 5px 10px;}
#md-sectioncurrent{background-color:#FEA;padding:.5em .1em .5em 1em}
#md-syllabus_navigation h5 span{color:#999;font-variant:small-caps}
#md-syllabus_navigation ol{margin-left:3em}
#modnumInput{border:0;color:#656F7A;cursor:pointer;font:180% georgia,serif;text-shadow:0 0 1px #656F7A, 0 0 1px #656F7A, 3px 3px 5px #CCC;width:3em}
#moduleOutline{line-height:1.5em}
#modulePageH1{padding:.5em .5em 0;text-shadow:0 0 1px #656F7A, 0 0 1px #656F7A, 3px 3px 5px #CCC}
#modulePageH1n{font-size:180%;margin:.25em 0 .25em -.25em;white-space:nowrap}
#modulePageH1n span{display:inline;font-size:180%}
#oli-content{padding:35px 87px 0 110px}
.workbook_page detach #oli-content {padding:0}
#oli-content > .section{border-bottom:1px solid #EFEFEF;margin-bottom:1.5em}
#oli-content.activity{background-position:10px 12px;background-repeat:no-repeat;padding-left:112px}
#oli-content.activity .graded{background-color:inherit;color:#b32d00;display:block;font-weight:700}
#oli-content.activity .practice{background-color:inherit;color:#68b300;display:block;font-weight:700}
#oli-content.activity .purposeType{font-size:8px;left:14px;padding-top:92px;position:absolute;text-align:center;width:92px}
#oli-content.activity div.activity{padding:0 10px}
#oli-content.activity.didigetthis{background-image:url(../images/icon_didigetthis.png)}
#oli-content.activity.lab{background-image:url(../images/icon_lab.png)}
#oli-content.activity.learnbydoing{background-image:url(../images/icon_learnbydoing.png)}
#oli-content.activity.manystudentswonder{background-image:url(../images/icon_manywonder.png)}
#oli-content.activity.myresponse{background-image:url(../images/icon_feedback.png)}
#oli-content.activity.quiz{background-image:url(../images/icon_quiz.png)}
#oli-content.activity.simulation{background-image:url(../images/icon_simulation.png)}
#oli-content.activity.walkthrough{background-image:url(../images/icon_walkthrough.png)}
#oli-footer{color:#777;padding:10px 0 0}
#oli-footer .activityfooter{border-top:1px solid #09354B;color:#6D9BAF;margin:0 0 10px 10px;padding:10px;text-align:center}
#oli-footer .activityfooter .oli{text-decoration:none}
#oli-footer .activityfooter a{color:#6D9BAF}
#oli-footer a,#oli-footer a:hover{color:#777}
#oli-footerwrap{background:url(/branding/images/backgrounds/left-velvetstripes.png) repeat-y;margin:0 0 235px;padding:0 0 0 235px}
#pHeadings{-moz-border-radius:10px;-webkit-border-radius:10px;border:1px solid #999;border-collapse:separate;border-radius:10px;color:#999;display:table;margin-left:0;min-width:250px}
#pHeadings li,.material div.activitywrap.wbactivity{padding-bottom:0}
#pHeadings ol{font-family:Georgia,"Times New Roman",Times,serif;list-style-type:none;margin:0 .5em .5em 1.75em}
#pHeadings ol ol{font-size:93%;margin:0 0 0 2em}
#pHeadings span.anchor{color:#5366a6;cursor:pointer;text-decoration:underline}
#pHeadings td{padding:0 .25em}
#pHeadings.off #pHeadingsTitle{background-image:url(../images/icons/16x16/actions/tgl0.gif)}
#pHeadings.off ol{display:none}
#pHeadingsTitle{background:url(../images/icons/16x16/actions/tgl1.gif) no-repeat 0 50%;color:#8a9196;cursor:pointer;font-size:12px;font-weight:700;padding:3px .25em 3px 20px;text-decoration:none}
#pagecontext{color:#a9a79b;font-size:.87em;padding:.75em 0 .15em; display:none}
#pagecontext a{color:#8C8B81;text-decoration:none}
#pagecontext a.bcunit,#pagecontext a.bcmodule{font-size:1.14em;font-variant:small-caps}
#paginationtop .prevnext{float:right;margin:5px 5px 0 0}
#paginationtop .prevnext button{margin:5px 0 5px 10px;padding-bottom:3px;padding-top:3px}
#paginationtop h1{margin:0px 0 5px 18px; padding:26px 0px 0px 0px;}
#paginationtop h3{margin:0px 0 5px 18px; padding:26px 0px 0px 0px; color: #78828D; font-size: 28px; font-weight:normal; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; width:855px; height:30px;}
#simAsmtSubmit{margin:1em auto;text-align:center}
#sysnav{float:right;font-size:14px;margin-right:-150px;position:relative}
#sysnav #sysusr{color:#667;font-size:11px;padding-top:.25em;text-align:right;white-space:nowrap; line-height:4px}
#sysnav #sysusr a{color:#625b41;padding:5px 0}
#sysnav #sysusr a.signout{letter-spacing:.15em}
#sysnav a{display:inline-block;padding-bottom:3px;text-decoration:none;vertical-align:middle;white-space:nowrap}
#sysnav h3{left:-999%;position:absolute}
#tgllobj{color:#808079;cursor:pointer;font-size:12px;padding:.5em 1em;position:absolute;right:0;text-decoration:none;top:0}
#tgllobj.off{background:url(../images/learning-obj.png) no-repeat;float:left;height:51px;margin:0 0 115px;overflow:hidden;position:static;text-indent:-9999px;width:121px}
#tinyfooter{clear:right;font-size:75%;padding:10px;text-align:center}
#xrefReviewUser{background:#D1DEF0;font-size:14px;padding:1em}
* html #contextHelp{position:absolute}
* html #pHeadings div{width:250px}
* html .material div.activitywrap,.material div.activitywrap div.activityhead,.material div.activitywrap div.activity,.material div.activitywrap div.captionwrap,.material div.report,div.activityhead div.report{margin-left:0}
* html div.activity{border:0}
* html div.activitywrap{margin-left:-10%}

.activityhead .purposeType{color:#666;font-size:10px;font-weight:700;width:auto;height:31px;overflow:hidden;/*text-indent:-9999px;*/}
.activityhead .purposeType .graded{color:#b32d00;display:block}
.activityhead .purposeType .practice{color:#68b300;display:block}
.assessmentStatus{font-size:12px;padding:0 1.25em .3em}
.details{font-size:75%;line-height:1.25em;padding:1em 0 .5em}
.details label{color:#999;font-weight:400}
.errorwrap{background-color:#FAF5EE;border-color:#BA5C39 #C87E5F;border-style:solid;border-width:1px;clear:both;padding:.25em .5em}
.material div.activitywrap{margin:0}
.md-activity span{ position: absolute; right: 0px; text-decoration: underline;}
.md-module{padding:.25em 0 .5em 0em}
.md-section{clear:right;padding:.5em 0 0 0em}
.md-section h5{display:inline}
.md-section span{clear:right;float:right}
.md-section span a{margin-left:.3em}
.md-section .md-section { padding:0px 0px 0px 1em;}
.md-sequence{line-height:1.5em;padding-bottom:1em}
.md-unit{padding:.5em 0 0 0}
.menou li a{color:#545143;display:block;padding:5px;text-decoration:none}
.olunit{width:500px;}
.olmodule{width:475px;}
.outlinectrl{font-size:12px;padding:.5em 0 1em}
a.bigpicture{display:block;margin:1px 5px 1px 0;padding:0 0 5px;text-align:center}
div#oli-container2,#oli-user4wrap{background-image:url(/branding/images/backgrounds/left-velvetstripes.png);background-repeat:repeat-y}
div#oli-content.activity{background-color:transparent;border:0}
.purpose.didigetthis .actContain {background:#F1F6DD}
.purpose.checkpoint .actContain {background:#FCF8E9}

#body .section-didigetthis .didigetthis, #body .section-learnbydoing .didigetthis
{background:url(../images/digt.png) #F1F6DD no-repeat; padding-top:35px; margin-left:60px; width:615px}

#body .section-didigetthis .didigetthis h5, #body .section-learnbydoing .didigetthis h5 {margin-left:40px}
 #body .section-didigetthis .didigetthis .activity, #body .section-learnbydoing .didigetthis .activity {padding-left:10px}
.section-didigetthis p, .section-learnbydoing p {padding:0 95px 0 0px}
.purpose.quiz .actContain {background:#FBF1EE}
.purpose.learnbydoing .actContain {background:#E2F2FC}
.section-didigetthis .purpose.learnbydoing {background:url(../images/lbd.png) no-repeat #E2F2FC; padding-top:31px; margin-left:60px; width:615px}
#body .section-learnbydoing {background:url(../images/lbd.png) #E2F2FC no-repeat; padding:35px 0 0 0; width:auto}
#body .section-learnbydoing h2 {color: #0A334C;margin: 10px 95px 0 60px;}
#body .section-didigetthis .learnbydoing h5 {margin-left:40px}
 #body .section-didigetthis .learnbydoing .activity {padding-left:10px}
.material .didigetthis, .material .purpose.quiz {background:none}
.didigetthis h5, .didigetthis h3 a, .section-didigetthis h5, .section-didigetthis h3,.section-didigetthis h2 {color:#2B582B;  margin: 10px 95px 0 0px; display:block; font-size:21px; font-weight:normal; line-height:28px;}
.learnbydoing h5, .section-learnbydoing h2, .sectionNest h5 {color:#0A334C;  margin: 10px 95px 0 30px; font-size:21px; font-weight:normal; line-height:28px;}
.quiz h3 a.quiz {color:#BF0000; /*padding:22px 95px 20px 20px;*/ display:block;}
.activityinfo {padding:10px 95px 0 60px}
.activitywrap .activityinfo {padding:0}
.purpose .activity {padding:15px 30px 0px 0px; width:auto}
.material div.purpose div.activity {padding:0; width:auto}
.material div.didigetthis h5 {margin:0}
.activityhead .purposecheckpoint{background:url(../images/purpose-sprite.png) #FFF no-repeat 0 -65px; height:31px;}
.activityhead .purposedidigetthis{background:url(../images/purpose-sprite.png) #FFF no-repeat 0 -32px; height:31px}
.activityhead .purposedidigetthis span { font-family: Georgia,"Times New Roman",Times,serif;font-size: 15px;font-weight: bold; left: 57px; position: relative; top: 3px; color: #6F9E2F;}
.activityhead .purposecheckpoint span { font-family: Georgia,"Times New Roman",Times,serif;font-size: 18px;font-weight: bold; left: 57px; position: relative; top: 3px; color: #FF8A00;}

.material .activityhead div.purposedidigetthis {display:none}
.lab .purposeType { }
/*.lab .activityinfo {background:url(../images/lab.png) no-repeat; width:auto; height:31px}*/
.lab .activityinfo h5 {background:#FFF; height:31px; line-height:28px; display:inline-block; padding:0 10px; margin-left:62px}

.activityhead .purposelearnmore, .activityhead .purposemanystudentswonder { background:url(../images/purpose-sprite.png); background-position:0px 121px;}
.activityhead .purposemanystudentswonder span,.activityhead .purposelearnmore span { font-size:10px; color:#47331C; text-transform:uppercase; letter-spacing:0.2em; font-weight:bold; position:relative; left:31px; top:3px;}
.manystudentswonder h3 {margin:12px 94px 12px 23px; color:#ac9d74}
.manystudentswonder h3 a {color:#6E5946; text-decoration:none;}
.manystudentswonder h3 a:hover { text-decoration:underline;}
.activityhead .purposemyresponse{background:url(../images/purpose-sprite.png) no-repeat 0 -192px #FFF; height:31px; width:auto;}
.activityhead .purposemyresponse .scnReader { font-weight: bold !important; font-family: Georgia,"Times New Roman",Times,serif; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; left: 18px; top: 3px; color:#75a150;}
.myresponse h3, .myresponse h3 a, .myresponse h5, .myresponse h5 a {color:#709e30; text-decoration:none;}
.myresponse h3 a:hover, .myresponse h5, .myresponse h5 a:hover {text-decoration:underline;}
.myresponse h3, .myresponse h5 {margin:12px 93px 12px 60px}
.activityhead .purposepractice,.activityhead .purposelearnbydoing{background:url(../images/purpose-sprite.png) no-repeat 0 0 #FFF}
.purposelearnbydoing span { color:#1270B2; font-family: Georgia,"Times New Roman",Times,serif; font-size: 15px; font-weight: bold; position:relative; top:3px; left: 57px; text-transform: lowercase;}
.activityhead .purposequiz{background:url(../images/purpose-sprite.png) no-repeat 0 -96px #FFF}
.activityhead .purposesimulation{width:auto; height:30px; overflow:hidden; background:#d7cfbf; height:30px; text-transform:uppercase; letter-spacing:0.2em;}
.activityhead .purposesimulation .scnReader{font-weight:bold !important; font-family:Georgia, "Times New Roman", Times, serif; left:13px; font-size:10px; color:#47331C; top:3px;}
.simulation  .actContain	{ border:none;}
.activityhead .purposewalkthrough{background:url(../images/purpose-sprite.png) no-repeat 0 -285px #FFF; width:100%; overflow:hidden; height:30px}
.activityhead .purposewalkthrough .scnReader { font-weight:bold !important; font-family:Georgia, "Times New Roman", Times, serif; left:13px; font-size:10px; color:#47331C; top:2px; letter-spacing: 0.2em; text-transform: uppercase;}
.activitywrap.wbactivity{padding-bottom:0px}
.pulloutwrap .activitywrap div  {margin-left:0}
.pulloutwrap .activitywrap .captionwrap {margin:0 auto; width:80%;}

/*div.section div.section{padding:0 1.5em 1.5em}*/

h3.toggle,h4.toggle{background:url(../images/icons/16x16/actions/tgl0.gif) no-repeat 0 50%;color:#000;cursor:pointer;padding:3px 0 3px 20px;text-decoration:none}
h3.togglecurrent,h3.toggleopen,h4.togglecurrent,h4.toggleopen{background:url(../images/icons/16x16/actions/tgl1.gif) no-repeat 0 50%;color:#000;cursor:pointer;padding:3px 0 3px 20px;text-decoration:none}
table#pHeadings{margin:0 11% 1em;}
table#pHeadings.off{-moz-opacity:.50;filter:alpha(opacity=50);opacity:.50}
td.loaded{background:transparent none;cursor:auto;padding:0}
td.loading{background:url(/branding/images/icons/16x16/animations/process-working-squares.gif) no-repeat;cursor:wait;padding:20px}

/*ORGANIZE AND CLEAN UP*/

/*SECTION*/
.sectionContain											{ padding:0px 0px 0px 30px;}
.sectionContain h1,.sectionContain h2,.sectionContain h3,.sectionContain h4,.sectionContain h5										{ margin-left:0px;}
.sectionContain .image									{ padding:0px 0px 0px 0px; /*overflow:auto; IE7 Scroll Bar*/ display:block;}
.sectionNest 											{ }
.sectionNest .actContain								{ border:none;}
/*.sectionNest h5											{ margin: 10px 0px 10px 60px; }*/
.sectionNest .activity 									{padding:15px 30px 15px 0px; margin: 0px 0px 0px 0px; }

.section-learnbydoing h2								{ width:auto;}
.section-learnbydoing .sectionContain					{ border:1px solid #1371B2;}/* padding:.5em 0px .5em 30px;}*/
.section-learnbydoing .sectionContain h2,.section-learnbydoing .sectionContain h3,.section-learnbydoing .sectionContain h1				{ margin-left:0px; }
.section-learnbydoing .sectionContain p					{ padding-left:0px;}

.section-didigetthis h2									{ width:auto; }
.section-didigetthis .sectionContain					{ border:1px solid #8FC642; padding:.5em 0px .5em 30px;}

/*SECTION SPRITES*/
.section												{ margin:0px 0px 1.5em 0px;}
.section .head											{ background:url(../images/purpose-sprite.png) no-repeat #FFF; height:30px;}
.section-didigetthis .head								{ background-position:0px -32px;}
.section-learnbydoing .head								{ background-position:0px 0px;}
.section-checkpoint .head								{ background-position:0px -64px;}
.section-lab .head 										{ background-position:0px -128px;}
.section-manystudentswonder .head 						{ background-position:0px -223px;}
.section-myresponse .head 								{ background-position:0px -192px;}
.section-simulation .head 								{ background-position:0px -314px;}
.section-walkthrough .head 								{ background-position:0px -284px;}
.section.quiz .head 									{ background-position:0px -96px;}
.section-didigetthis .sectionContain					{ background:#F1F6DD;}
.section-learnbydoing .sectionContain					{ background:#E2F2FC;}
.section-checkpoint .sectionContain						{ background:#FCF8E9;}
.section-lab .sectionContain							{ background:#FCF8E9;}
.section-manystudentswonder .sectionContain				{ background:#;}
.section-myresponse .sectionContain						{ background:#;}
.section-simulation .sectionContain						{ background:#;}
.section-walkthrough .sectionContain					{ background:#;}
.section.quiz .sectionContain							{ background:#FBF1EE;}

/*.section-didigetthis .sectionContain, .section-learnbydoing .sectionContain, .section-checkpoint .sectionContain, .section-lab .sectionContain, .section-manystudentswonder .sectionContain, .section-myresponse .sectionContain, .section-simulation .sectionContain, .section-walkthrough .sectionContain, .section.quiz .sectionContain {padding: 0.5em 0 0.5em 30px;}*/

/*ACTIVITY BORDERS*/
.actContain												{ }
.didigetthis .actContain								{ border:1px solid #8FC642;}
.learnbydoing .actContain								{ border:1px solid #1371B2;}
.quiz .actContain										{ border:1px solid #BF0000;}
.checkpoint .actContain									{ border:1px solid #FF8A00;}
.manystudentswonder .actContain							{ border:none; color:#AC9D74;}


text:
import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';

import { FoursquareUserinfoResponseInterface } from './../interface/foursquare-userinfo-response.interface';

@Injectable()
export class FoursquareHttpService {
    public static handleError(error: Response): Observable<any> {
        return Observable.throw(error.json().error || 'Server error');
    }

    constructor(private http: Http) {

    }

    public userinfo(url: string): Observable<FoursquareUserinfoResponseInterface> {
        return this.http.get(url)
            .map((res) => res.json()).catch(FoursquareHttpService.handleError);
    }
}


text:
using System;
using Foundation;
using ObjCRuntime;
using XFScrollviewAnimations.Plugin;
using XFScrollviewAnimations.Plugin.Abstractions;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using CoreGraphics;

[assembly: ExportRenderer(typeof(AnimatedScrollView), typeof(AnimatedScrollViewiOSRenderer))]
namespace XFScrollviewAnimations.Plugin
{

	public interface IAnimatedScrollViewController
	{
		NSObject WeakDelegate { get; set; }
		void AnimatedScrollViewControllerDidScrollToEnd(AnimatedScrollViewiOSRenderer animatedScrollViewController);
		void AnimatedScrollViewControllerDidEndDraggingAtEnd(AnimatedScrollViewiOSRenderer animatedScrollViewController);
	}

	public class AnimatedScrollViewiOSRenderer : ScrollViewRenderer
	{
		public Animator Animator { get; set; }
		public UIScrollView ScrollView { get; set; }
		private int _pages;

		public IAnimatedScrollViewController animatedScrolledService;

		private bool _isAtEnd;
		private UIScrollView nativeScrollView { get; set; }

		static nfloat MaxContentOffsetXForScrollView(UIScrollView scrollView)
		{
			return scrollView.ContentSize.Width + scrollView.ContentInset.Right - scrollView.Bounds.Width;
		}

		protected override void OnElementChanged(VisualElementChangedEventArgs e)
		{
			base.OnElementChanged(e);

			if (this.NativeView == null)
			{
				return;
			}

			//Accessing page numbers from the ScrollView abstraction renderer
			AnimatedScrollView animatedScrollView = (AnimatedScrollView)Element;
			_pages = animatedScrollView.NumberOfPage;

			nativeScrollView = (UIScrollView)this.NativeView;

			nativeScrollView.ContentSize = new CGSize(_pages * (float)this.NativeView.Frame.Width, (float)this.NativeView.Frame.Height);

			//TODO: Put these 2 parameters into the Abstraction renderer
			nativeScrollView.PagingEnabled = true;
			nativeScrollView.ShowsHorizontalScrollIndicator = false;
			//

			_isAtEnd = false;
			Animator = new Animator();

			ScrollView = new UIScrollView(nativeScrollView.Bounds);
			ScrollView.Scrolled += (sender, args) =>
		   {
			   Animator.Animate(Convert.ToInt32(ScrollView.ContentOffset.X));

			   _isAtEnd = ScrollView.ContentOffset.X >= MaxContentOffsetXForScrollView(ScrollView);

				//animatedScrolledService = ScrollView.Delegate;

				if (_isAtEnd && this.RespondsToSelector(new Selector("AnimatedScrollViewControllerDidScrollToEnd:")))
			   {
					//animatedScrolledService.AnimatedScrollViewControllerDidScrollToEnd(this);
				}
		   };

			ScrollView.ScrollAnimationEnded += (sender, args) =>
			{
				//WeakDelegate = scrollView.Delegate;
				//animatedScrolledService =  ScrollView.Delegate;

				if (_isAtEnd && this.RespondsToSelector(new Selector("AnimatedScrollViewControllerDidEndDraggingAtEnd:")))
				{
					//animatedScrolledService.AnimatedScrollViewControllerDidEndDraggingAtEnd(this);
				}
			};

			nativeScrollView.Add(ScrollView);
		}
	}
}


text:
/* globals __DEV__ */
import Phaser from 'phaser';
import Player from '../sprites/Player';
import Enemy from '../sprites/Enemy';

export default class extends Phaser.State {
  init() {}

  preload() {}

  create() {
    this.physics.startSystem(Phaser.Physics.ARCADE);

    this.map = this.game.add.tilemap('map1');
    this.map.addTilesetImage('meta_tiles');
    this.map.addTilesetImage('tileset01');
    this.map.addTilesetImage('tileset02');
    this.map.addTilesetImage('tileset03');

    this.collisionLayer = this.map.createLayer('Collisions');
    this.map.createLayer('Background');
    this.map.createLayer('Partials1');
    this.map.createLayer('Partials2');
    // this.collisionLayer.debug = true;

    this.collisionLayer.resizeWorld();
    this.map.setCollisionBetween(0, 10000, true, this.collisionLayer);

    this.enemies = [];
    for (let i = 0; i < 1; i++) {
      this.enemies.push(new Enemy({
        game: this.game,
        x: 50,
        y: 25,
        sprites: [
          // http://gaurav.munjal.us/Universal-LPC-Spritesheet-Character-Generator/#?body=dark&eyes=red&armor=chest_plate&mail=chain&shoulders=none&gloves=metal&hat=hood_chain&shoes=boots_metal&legs=pants_white&arms=plate&hair=none&=eyes_brown
          'gaurd1',
          'weapons:spear'
        ]
      }));
    }

    this.player = new Player({
      game: this.game,
      x: 450,
      y: 150,
      sprites: [
        // http://gaurav.munjal.us/Universal-LPC-Spritesheet-Character-Generator/#?body=tanned&eyes=blue&nose=straight&ears=none&legs=none&clothes=longsleeve_brown&mail=chain&armor=chest_leather&jacket=none&tie=none&hair=messy2_raven&arms=none&shoulders=leather&spikes=none&bracers=none&greaves=none&hat=none&shoes=none&belt=none&bracelet=none
        'player1'
      ]
    });

    this.camera.follow(this.player);
    this.player.debug = true;
  }

  render() {
    if (__DEV__) {
      // this.game.debug.spriteInfo(this.player, 32, 32);
      // this.game.debug.body(this.player);
    }
  }

  update() {
    this.physics.arcade.collide(this.player, this.collisionLayer);
    this.physics.arcade.collide(this.enemies, this.collisionLayer);
    this.physics.arcade.collide(this.player, this.enemies);
  }
}


text:
<?php

namespace troiswa\BackBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class troiswaBackBundle extends Bundle
{
}


text:
A simple wrapper around rjack-logback to make your logging easy.

I wanted a way to just include a module and automatically get logging that integrated with the Java logging I already had. rjack-logback provided all the tools for me to make one.

```ruby

require 'jlogger'

class MyClass
  include JLogger::Simple
  def hello
    log.info "Calling hello" # 'log' method thanks to JLogger::Simple
    puts 'Hello'
  end
end

rootlog = JLogger::RootLogger.new

# Start some log output. By default, NO logging is done!

rootlog.startConsole # starts logging on STDERR
rootlog.startFile 'mylog.log' # starts logging to the file

c = MyClass.new

rootlog.info 'Hello'  # logs to both STDERR and the file mylog.log
c.hello # ditto

rootlog.loglevel = :warn # use :debug, :info, :warn, :error, or :off

rootlog.info 'hello'  # doesn't log to anywhere
c.hello # ditto

MyClass.loglevel = :info # set it just for this class and its subclasses

rootlog.info 'hello'  # doesn't log to anywhere
c.hello # logs again

rootlog.stopFile('mylog.log') # stop logging to the file
rootlog.stopConsole # stop logging to STDERR

```

## Bugs

I can't seem to write a good wrapper to allow the use of File handles (converted to Outputstreams); that's something I would really like.

## Note on Patches/Pull Requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
  future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.

== Copyright

Copyright (c) 2010 BillDueber. See LICENSE for details.


text:
@interface XDColorViewController ()
{
    NSArray *_dataSource;
    UIBarButtonItem *_doneItem;

    NSInteger _selectedRow;
}

@end

@implementation XDColorViewController

@synthesize delegate = _delegate;

@synthesize callerObject = _callerObject;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
        NSString *path = [[NSBundle mainBundle] pathForResource:@"XDColor" ofType:@"plist"];
        _dataSource = [NSArray arrayWithContentsOfFile:path];

        _selectedRow = -1;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    self.title = @"选择颜色";

    _doneItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleBordered target:self action:@selector(doneAction:)];
    self.navigationItem.rightBarButtonItem = _doneItem;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [_dataSource count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ColorCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    // Configure the cell...
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 180.0)];
        imageView.tag = KPLANS_COLOR_CELL_IMAGEVIEW;
        [cell.contentView addSubview:imageView];
    }

    UIImageView *colorView = (UIImageView *)[cell viewWithTag:KPLANS_COLOR_CELL_IMAGEVIEW];
    if (colorView == nil) {
        colorView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 180.0)];
        colorView.tag = KPLANS_COLOR_CELL_IMAGEVIEW;
        [cell.contentView addSubview:colorView];
    }

    colorView.image = [UIImage imageNamed:[[_dataSource objectAtIndex:indexPath.row] objectForKey:KPLANS_COLOR_DATA_IMAGE]];

    if (_selectedRow == indexPath.row) {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
    else{
        cell.accessoryType = UITableViewCellAccessoryNone;
    }

    return cell;
}

#pragma mark - Table view delegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 180.0;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

    if (_selectedRow != indexPath.row) {
        if (_selectedRow >= 0) {
            UITableViewCell *oldCell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:_selectedRow inSection:0]];
            oldCell.accessoryType = UITableViewCellAccessoryNone;
        }

        _selectedRow = indexPath.row;
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
        self.title = [[_dataSource objectAtIndex:indexPath.row] objectForKey:KPLANS_COLOR_DATA_NAME];
    }
    else{
        _selectedRow = -1;
        cell.accessoryType = UITableViewCellAccessoryNone;
        self.title = @"选择颜色";
    }
}

#pragma mark - item action

- (void)doneAction:(id)sender
{
    if (_selectedRow < 0) {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您没有选择任何颜色" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [alertView show];
        return;
    }
    NSDictionary *rgbDic = [[_dataSource objectAtIndex:_selectedRow] objectForKey:KPLANS_COLOR_DATA_RGB];
    UIColor *color = [UIColor colorWithRed:[[rgbDic objectForKey:KPLANS_COLOR_DATA_RED] integerValue] / 255.0 green:[[rgbDic objectForKey:KPLANS_COLOR_DATA_GREEN] integerValue] / 255.0 blue:[[rgbDic objectForKey:KPLANS_COLOR_DATA_BLUE] integerValue] / 255.0 alpha:0.5];
    if (_delegate && [_delegate respondsToSelector:@selector(colorPickerSlectedColor:withCaller:)]) {
        [_delegate colorPickerSlectedColor:color withCaller:_callerObject];
    }
    [self.navigationController popToRootViewControllerAnimated:YES];
}

@end


text:
'use strict';

angular.module('thisApp', ['ui.router','ngResource'])
.config(function($stateProvider, $urlRouterProvider) {
        $stateProvider

            .state('app', {
                url:'/',
                views: {
                    'header': {
                        templateUrl : 'views/header.html'
                    },
                    'content': {
                        templateUrl : 'views/home.html',
                        controller  : 'IndexController'
                    },
                    'footer': {
                        templateUrl : 'views/footer.html'
                    }
                }
            })

            /*.state('app.bla', {
                url:'bla',
                views: {
                    'content@': {
                        templateUrl: 'views/bla.html',
                        controller  : 'BlaController'
                   }
                }
            })*/
            ;

            $urlRouterProvider.otherwise('/');
    });


text:
<?php

namespace ForkCMS\Modules\ContentBlocks\Domain\ContentBlock\Command;

use ForkCMS\Core\Backend\Helper\Model;
use ForkCMS\Modules\ContentBlocks\Domain\ContentBlock\ContentBlock;
use ForkCMS\Modules\ContentBlocks\Domain\ContentBlock\ContentBlockRepository;
use ForkCMS\Modules\Pages\Domain\ModuleExtra\ModuleExtra;
use ForkCMS\Modules\Pages\Domain\ModuleExtra\ModuleExtraRepository;
use ForkCMS\Modules\Pages\Domain\ModuleExtra\ModuleExtraType;
use ForkCMS\Modules\Pages\Domain\Page\Page;
use ForkCMS\Modules\Internationalisation\Domain\Locale\Locale;
use ForkCMS\Core\Common\ForkCMS\Utility\Module\CopyContentToOtherLocale\CopyModuleContentToOtherLocaleHandlerInterface;
use ForkCMS\Core\Common\ForkCMS\Utility\Module\CopyContentToOtherLocale\CopyModuleContentToOtherLocaleInterface;
use RuntimeException;

final class CopyContentBlocksToOtherLocaleHandler implements CopyModuleContentToOtherLocaleHandlerInterface
{
    /** @var ContentBlockRepository */
    private $contentBlockRepository;

    /** @var ModuleExtraRepository */
    private $moduleExtraRepository;

    public function __construct(
        ContentBlockRepository $contentBlockRepository,
        ModuleExtraRepository $moduleExtraRepository
    ) {
        $this->contentBlockRepository = $contentBlockRepository;
        $this->moduleExtraRepository = $moduleExtraRepository;
    }

    public function handle(CopyModuleContentToOtherLocaleInterface $command): void
    {
        if (!$command instanceof CopyContentBlocksToOtherLocale) {
            throw new RuntimeException('The class should be ' . CopyContentBlocksToOtherLocale::class);
        }

        $contentBlocksToCopy = $this->getContentBlocksToCopy($command->getFromLocale(), $command->getPageToCopy());
        $id = $this->contentBlockRepository->getNextIdForLanguage($command->getToLocale());

        /** @var ContentBlock $contentBlock */
        foreach ($contentBlocksToCopy as $contentBlock) {
            $moduleExtra = $this->moduleExtraRepository->find($contentBlock->getExtraId());

            if (!$moduleExtra instanceof ModuleExtra) {
                continue;
            }

            $originalContentBlockData = $moduleExtra->getData();

            [$isNewModuleExtra, $newModuleExtraId] = $this->getExistingModuleExtraIdOrCreate(
                $command->getToLocale()->getLocale(),
                $originalContentBlockData
            );

            $command->setModuleExtraId($contentBlock->getExtraId(), $newModuleExtraId);

            if (!$isNewModuleExtra) {
                continue;
            }

            $dataTransferObject = $contentBlock->getDataTransferObject();

            // Overwrite some variables
            $dataTransferObject->forOtherLocale(
                $id++,
                $command->getModuleExtraId($contentBlock->getExtraId()),
                $command->getToLocale()
            );

            $this->contentBlockRepository->add(ContentBlock::fromDataTransferObject($dataTransferObject));

            // Save the copied id so that we don't copy the module extra again
            $originalContentBlockData['copies'][$command->getToLocale()->getLocale()] = $newModuleExtraId;
            $moduleExtra->setData('copies', $originalContentBlockData['copies']);

            $this->moduleExtraRepository->save($moduleExtra);
        }
    }

    /**
     * @return ContentBlock[]
     */
    private function getContentBlocksToCopy(Locale $locale, ?Page $filterByPage): array
    {
        if (!$filterByPage instanceof Page) {
            return $this->contentBlockRepository->findAllActiveForLocale($locale);
        }

        $contentBlocks = [];

        $moduleExtras = $this->moduleExtraRepository->findModuleExtra(
            'ContentBlocks',
            'Detail',
            ModuleExtraType::widget()
        );

        foreach ($moduleExtras as $moduleExtra) {
            if (!array_key_exists('id', $moduleExtra->getData())) {
                continue;
            }

            $contentBlockId = $moduleExtra->getData()['id'];

            $contentBlock = $this->contentBlockRepository->find($contentBlockId);

            if (!$contentBlock instanceof ContentBlock) {
                continue;
            }

            $contentBlocks[] = $contentBlock;
        }

        return $contentBlocks;
    }

    private function getNewExtraId(): int
    {
        return Model::insertExtra(
            ModuleExtraType::widget(),
            'ContentBlocks',
            'Detail'
        );
    }

    /**
     * @param string $locale
     * @param mixed $originalContentBlockData
     *
     * @return array With two elements. First: is it a new ID? Second: The ID.
     */
    private function getExistingModuleExtraIdOrCreate(string $locale, $originalContentBlockData): array
    {
        $copies = $originalContentBlockData['copies'] ?? [];

        if (array_key_exists($locale, $copies)) {
            return [false, $copies[$locale]];
        }

        return [true, $this->getNewExtraId()];
    }
}