text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@color/button_color_bg"
    android:orientation="vertical" >

    <TextView
        android:id="@id/main_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/button_color_press_grad"
        android:gravity="center"
        android:paddingTop="@dimen/text_view_padding_t_b"
        android:text="17 мая, суббота, 5-а пара."
        android:textColor="#ffffff"
        android:textSize="@dimen/text_size" />

    <TextView
        android:id="@id/main_text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/button_color_press_grad"
        android:gravity="center"
        android:paddingBottom="@dimen/text_view_padding_t_b"
        android:text="Числитель(LAYOUT-sw720dp), 37 тиждень"
        android:textColor="#ffffff"
        android:textSize="@dimen/text_size" />

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingLeft="1dp"
        android:paddingRight="1dp"
        android:layout_marginTop="@dimen/row1_padding_top">

        <LinearLayout
            android:id="@id/l_schedule"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/schedule"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/schedule" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/schedule"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_news"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_schedule"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/news"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/news" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/news"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_teachers"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_news"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/teachers"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/teachers" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/teachers"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingLeft="1dp"
        android:paddingRight="1dp" >

        <LinearLayout
            android:id="@id/l_library"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/library"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/library" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/library"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_maps"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_library"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/maps"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/maps" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/maps"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_transport"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_maps"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/transport"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/transport" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/transport"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingLeft="1dp"
        android:paddingRight="1dp" >

        <LinearLayout
            android:id="@id/l_calendar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/calendar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/calendar" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/calendar"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_webcams"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_calendar"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/webcams"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/webcams" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/webcams"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_freepc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_webcams"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/freepc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/freepc" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/freepc"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingLeft="1dp"
        android:paddingRight="1dp" >

        <LinearLayout
            android:id="@id/l_directory"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/directory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/directory" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/directory"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_blogs"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_directory"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/blogs"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/blogs" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/blogs"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@id/l_clubs"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_toRightOf="@id/l_blogs"
            android:orientation="vertical" >

            <ImageButton
                android:id="@id/clubs"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_style"
                android:src="@drawable/clubs" />

            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/clubs"
                android:textColor="#FFFFFF"
                android:textSize="@dimen/text_button_size"
                android:textStyle="bold" />
        </LinearLayout>
    </RelativeLayout>

</LinearLayout>


text:
<?php

namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;

use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormFactoryBuilder;
use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject;

class MergeCollectionListenerCustomArrayObjectTest extends MergeCollectionListenerTest
{
    protected function getData(array $data)
    {
        return new CustomArrayObject($data);
    }

    protected function getBuilder($name = 'name')
    {
        return new FormBuilder($name, 'Symfony\Component\Form\Tests\Fixtures\CustomArrayObject', new EventDispatcher(), (new FormFactoryBuilder())->getFormFactory());
    }
}

redpajama_set_name: RedPajamaGithub


text:
subreddit = 'ExpandDong'
t_channel = '@r_ExpandDong'

def send_post(submission, r2t):
    return r2t.send_simple(submission)


text:
package node

import (
	"fmt"
	"math"
	"strings"

	"github.com/philharnish/forge/src/data/graph/bloom/mask"
	"github.com/philharnish/forge/src/data/graph/bloom/weight"
)

type Node struct {
	// Non-zero when this node is a match.
	MatchWeight weight.Weight
	// Maximum weight for outgoing edges.
	MaxWeight weight.Weight
	// BitMask for outgoing edges.
	ProvideMask mask.Mask
	// BitMask for edges which lead to matching Nodes.
	RequireMask mask.Mask
	// BitMask for distances matching Nodes.
	LengthsMask mask.Mask
}

func NewNode(matchWeight ...weight.Weight) *Node {
	result := &Node{
		RequireMask: mask.UNSET,
	}
	if len(matchWeight) == 1 {
		result.Match(matchWeight[0])
	}
	return result
}

func (node *Node) Copy() *Node {
	return &Node{
		MatchWeight: node.MatchWeight,
		MaxWeight:   node.MaxWeight,
		ProvideMask: node.ProvideMask,
		RequireMask: node.RequireMask,
		LengthsMask: node.LengthsMask,
	}
}

func (node *Node) Matches() bool {
	return node.LengthsMask&mask.Mask(0b1) == 1
}

func (node *Node) Match(weight weight.Weight) {
	if node.MatchWeight != 0.0 {
		panic(fmt.Errorf("duplicate attempts to set match weight (%f and %f)",
			node.MatchWeight, weight))
	}
	node.MatchWeight = weight
	node.LengthsMask |= 0b1 // Match at current position
	node.Weight(weight)
}

func (node *Node) MaskEdgeMask(edgeMask mask.Mask) {
	// Provide anything the edge provides.
	node.ProvideMask |= edgeMask
	// Require anything the edge provides.
	node.RequireMask &= edgeMask
}

func (node *Node) MaskEdgeMaskToChild(edgeMask mask.Mask, child *Node) {
	oneBitRemoved := edgeMask & (edgeMask - 1)
	if oneBitRemoved == 0 {
		// The path to child has only one option which implies path is required.
		node.maskMaskDistanceToChild(edgeMask, 1, child)
	} else {
		// Inherit requirements from child.
		node.MaskDistanceToChild(1, child)
		node.ProvideMask |= edgeMask
		// If node's RequireMask is still unset...
		if node.RequireMask == mask.UNSET {
			// Clear it because multiple runes implies path to child is not required.
			node.RequireMask = mask.NONE
		}
	}
}

func (node *Node) MaskDistanceToChild(distance int, child *Node) {
	if distance == 0 {
		// Optimized path for zero-length paths.
		node.Union(child)
		return
	}
	// Inherit maxWeight.
	node.Weight(child.MaxWeight)
	// Provide anything ANY children provides.
	node.ProvideMask |= mask.Mask(child.ProvideMask)
	// Inherit matching lengths.
	node.LengthsMask |= mask.ShiftLength(child.LengthsMask, distance)
	if child.RequireMask == mask.UNSET {
		// Ignore the child's require mask if it is UNSET.
	} else if child.Matches() {
		// Since the child is a match no requirements are inherited.
	} else {
		// Require anything ALL children requires.
		node.RequireMask &= child.RequireMask
	}
}

func (node *Node) MaskPath(path string) error {
	edgeMask, runeLength, err := mask.EdgeMaskAndLength(path)
	if err != nil {
		return err
	}
	node.MaskEdgeMask(edgeMask)
	// Set match at the end of path.
	node.LengthsMask |= 1 << runeLength
	return nil
}

func (node *Node) MaskPathToChild(path string, child *Node) error {
	edgeMask, runeLength, err := mask.EdgeMaskAndLength(path)
	if err != nil {
		return err
	}
	return node.maskMaskDistanceToChild(edgeMask, runeLength, child)
}

func (node *Node) MaskPrependChild(child *Node) {
	// Provide anything the child provides.
	node.ProvideMask |= child.ProvideMask
	if node.Matches() {
		// If the (old) end-point was a match then the prepend requirements
		// are the only requirements which matter.
		node.RequireMask = child.RequireMask
	} else if node.RequireMask == mask.UNSET {
		node.RequireMask = child.RequireMask
	} else {
		// Require anything the child requires.
		node.RequireMask |= child.RequireMask
	}
	node.LengthsMask = mask.ConcatLengths(child.LengthsMask, node.LengthsMask)
	if !node.Matches() {
		node.MatchWeight = 0
	}
}

func (node *Node) maskMaskDistanceToChild(edgeMask mask.Mask, distance int, child *Node) error {
	// Inherit maxWeight.
	node.Weight(child.MaxWeight)
	if distance == 0 {
		// Optimized path for zero-length paths.
		node.Union(child)
	} else {
		// Provide anything ANY children provides (including the edge itself).
		node.ProvideMask |= edgeMask | child.ProvideMask
		// Inherit matching lengths.
		node.LengthsMask |= mask.ShiftLength(child.LengthsMask, distance)
		if child.RequireMask == mask.UNSET {
			// Ignore the child's require mask if it is UNSET.
			node.RequireMask &= edgeMask
		} else if child.Matches() {
			// Since the child is a match only the edge is required.
			node.RequireMask &= edgeMask
		} else {
			// Require anything ALL children requires (including the edge itself).
			node.RequireMask &= edgeMask | child.RequireMask
		}
	}
	return nil
}

func (node *Node) RepeatLengthMask(interval int) {
	if interval < 0 {
		node.LengthsMask = mask.ConcatInfinitely(node.LengthsMask)
	} else {
		node.LengthsMask = mask.RepeatLengths(node.LengthsMask, interval)
	}
}

func (node *Node) Intersection(other *Node) *Node {
	// Copy weights using MIN operation.
	node.MatchWeight = math.Min(node.MatchWeight, other.MatchWeight)
	node.MaxWeight = math.Min(node.MaxWeight, other.MaxWeight)
	node.ProvideMask &= other.ProvideMask // Only provide what everyone can.
	// Require whatever anyone requires.
	node.RequireMask |= other.RequireMask
	if node.RequireMask == mask.UNSET {
		// Exit blocked; only keep lowest bit on LengthsMask.
		node.LengthsMask &= other.LengthsMask & mask.Mask(0b1)
	} else if node.RequireMask == node.RequireMask&node.ProvideMask {
		// Only consider aligned matches.
		node.LengthsMask &= other.LengthsMask
	} else {
		// Unsatisfiable requirements
		node.LengthsMask = mask.Mask(0)
	}
	return node
}

func (node *Node) Union(other *Node) *Node {
	// Copy weights using MAX operation.
	node.MatchWeight = math.Max(node.MatchWeight, other.MatchWeight)
	node.MaxWeight = math.Max(node.MaxWeight, other.MaxWeight)
	node.ProvideMask |= other.ProvideMask // Provide anything anyone can.
	node.RequireMask &= other.RequireMask // Only require whatever everyone requires.
	node.LengthsMask |= other.LengthsMask // Consider either matches.
	return node
}

func (node *Node) Weight(weight weight.Weight) {
	node.MaxWeight = math.Max(node.MaxWeight, weight)
}

func (node *Node) String() string {
	return Format("Node", node)
}

func (node *Node) Root() *Node {
	return node
}

func (node *Node) Items(generator NodeGenerator) NodeItems {
	return node
}

func (node *Node) HasNext() bool {
	return false
}

func (node *Node) Next() (string, NodeIterator) {
	panic("Node has no children")
}

func Format(name string, node *Node) string {
	parts := []string{}
	if node.Matches() {
		parts = append(parts, weight.String(node.MatchWeight))
	}
	acc := mask.MaskString(node.ProvideMask, node.RequireMask)
	if len(acc) > 0 {
		parts = append(parts, acc)
	}
	acc = mask.LengthString(node.LengthsMask)
	if len(acc) > 0 {
		parts = append(parts, acc)
	}
	acc = strings.Join(parts, " ")
	if len(acc) > 0 {
		return name + ": " + acc
	}
	return name
}


text:
/* SPDX-License-Identifier: MIT */

let timeZone: string;

export function getTimeZone(): string | null {
  if (!timeZone) {
    try {
      timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
    } catch (err) {
      console.error(err);
      return null;
    }
  }

  return timeZone;
}


text:
package test.remote.api.ws;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import java.io.Serializable;
import java.util.*;

/**
 * @author by Ondřej Buriánek, burianek@marbes.cz.
 * @since 17.3.14
 */
@XmlRootElement
@XmlSeeAlso({PublicWOMapEntry.class})
public class PublicWO  implements Serializable {

    private Long id;
    private String nazev;
    private List mapa = new ArrayList();
    private List list = new ArrayList();
    private byte[] data;

    private Date date1 = new Date();
    private Date date2 = new Date();
    private Boolean enabled = true;
    private Boolean opposite = false;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNazev() {
        return nazev;
    }

    public void setNazev(String nazev) {
        this.nazev = nazev;
    }

    public List getMapa() {
        return mapa;
    }

    public void setMapa(List mapa) {
        this.mapa = mapa;
    }

    public List getList() {
        return list;
    }

    public void setList(List list) {
        this.list = list;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public Date getDate1() {
        return date1;
    }

    public void setDate1(Date date1) {
        this.date1 = date1;
    }

    public Date getDate2() {
        return date2;
    }

    public void setDate2(Date date2) {
        this.date2 = date2;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Boolean getOpposite() {
        return opposite;
    }

    public void setOpposite(Boolean opposite) {
        this.opposite = opposite;
    }
}


text:
module Sequel
  module Plugins
    # The tactical_eager_loading plugin allows you to eagerly load
    # an association for all objects retrieved from the same dataset
    # without calling eager on the dataset.  If you attempt to load
    # associated objects for a record and the association for that
    # object is currently not cached, it assumes you want to get
    # the associated objects for all objects retrieved with the dataset that
    # retrieved the current object.
    #
    # Tactical eager loading only takes affect if you retrieved the
    # current object with Dataset#all, it doesn't work if you
    # retrieved the current object with Dataset#each.
    #
    # Basically, this allows the following code to issue only two queries:
    #
    #   Album.filter{id<100}.all do |a|
    #     a.artists
    #   end
    #
    # Usage:
    #
    #   # Make all model subclass instances use tactical eager loading (called before loading subclasses)
    #   Sequel::Model.plugin :tactical_eager_loading
    #
    #   # Make the Album class use tactical eager loading
    #   Album.plugin :tactical_eager_loading
    module TacticalEagerLoading
      module InstanceMethods
        # The dataset that retrieved this object, set if the object was
        # reteived via Dataset#all.
        attr_accessor :retrieved_by

        # All model objects retrieved with this object, set if the object was
        # reteived via Dataset#all.
        attr_accessor :retrieved_with

        private

        # If there the association is not in the associations cache and the object
        # was reteived via Dataset#all, eagerly load the association for all model
        # objects retrieved with the current object.
        def load_associated_objects(opts, reload=false)
          name = opts[:name]
          if !associations.include?(name) && retrieved_by
            begin
              retrieved_by.send(:eager_load, retrieved_with, name=>{})
            rescue Sequel::UndefinedAssociation
              # This can happen if class table inheritance is used and the association
              # is only defined in a subclass.  This particular instance can use the
              # association, but it can't be eagerly loaded as the parent class doesn't
              # have access to the association, and that's the class doing the eager loading.
              nil
            end
          end
          super
        end
      end

      module DatasetMethods
        private

        # Set the reteived_with and retrieved_by attributes for the object
        # with the current dataset and array of all objects.
        def post_load(objects)
          super
          objects.each do |o|
            next unless o.is_a?(Sequel::Model)
            o.retrieved_by = self
            o.retrieved_with = objects
          end
        end
      end
    end
  end
end


text:
package com.amazonaws.services.identitymanagement.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.identitymanagement.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * UploadSigningCertificateRequest Marshaller
 */

@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UploadSigningCertificateRequestMarshaller implements Marshaller<Request<UploadSigningCertificateRequest>, UploadSigningCertificateRequest> {

    public Request<UploadSigningCertificateRequest> marshall(UploadSigningCertificateRequest uploadSigningCertificateRequest) {

        if (uploadSigningCertificateRequest == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        Request<UploadSigningCertificateRequest> request = new DefaultRequest<UploadSigningCertificateRequest>(uploadSigningCertificateRequest,
                "AmazonIdentityManagement");
        request.addParameter("Action", "UploadSigningCertificate");
        request.addParameter("Version", "2010-05-08");
        request.setHttpMethod(HttpMethodName.POST);

        if (uploadSigningCertificateRequest.getUserName() != null) {
            request.addParameter("UserName", StringUtils.fromString(uploadSigningCertificateRequest.getUserName()));
        }

        if (uploadSigningCertificateRequest.getCertificateBody() != null) {
            request.addParameter("CertificateBody", StringUtils.fromString(uploadSigningCertificateRequest.getCertificateBody()));
        }

        return request;
    }

}


text:
BatchReader::BatchReader(const std::string& file, size_t batch_size)
  : _file(file.c_str())
  , _in(_file)
  , _batch_size(batch_size)
{
}

BatchReader::BatchReader(std::istream& in, size_t batch_size)
  : _in(in)
  , _batch_size(batch_size)
{
}

std::vector<std::string> BatchReader::read_next()
{
  std::vector<std::string> batch;
  batch.reserve(_batch_size);

  std::string line;

  while (batch.size() < _batch_size && std::getline(_in, line))
    batch.push_back(line);

  return batch;
}


text:
.PHONY: build deploy
BUILD_DIR=build
PAGES_DIR=gh-pages
SRC=$(wildcard *.html CNAME pubkey.asc favicon.* keybase.txt)

build: $(SRC) sass/*.scss
	rm -rf $(BUILD_DIR)
	mkdir -p $(BUILD_DIR)/css
	sass --style compressed sass/main.scss:$(BUILD_DIR)/css/main.css
	cp $(SRC) $(BUILD_DIR)/

deploy: build
	rm -rf $(PAGES_DIR)
	git clone --branch gh-pages https://github.com/keith/keith.so.git $(PAGES_DIR)
	rm -rf $(PAGES_DIR)/*
	mv $(BUILD_DIR)/* $(PAGES_DIR)
	git -C ./$(PAGES_DIR) commit -am "`date`"
	git -C ./$(PAGES_DIR) push


text:
package com.skubit.satoshidice.currencies;

import java.io.Serializable;
import java.math.BigDecimal;

import android.text.TextUtils;

// 100,000,000th of a Bitcoin
public class Satoshi extends BitcoinUnit implements Serializable {

    /**
	 *
	 */
    private static final long serialVersionUID = 4975058710268329552L;

    public Satoshi(Bitcoin b) {
        if (b == null) {
            throw new IllegalArgumentException("Bitcoin is null");
        }
        value = b.getValue().movePointRight(UnitUtils.SATOSHI);
    }

    public Satoshi(long value) {
        this.value = new BigDecimal(value);
    }

    public Satoshi(MilliBitcoin mc) {
        if (mc == null) {
            throw new IllegalArgumentException("MilliBitcoin is null");
        }
        value = mc.getValue().movePointRight(5);
    }

    public Satoshi(String s) {
        if (TextUtils.isEmpty(s)) {
            throw new IllegalArgumentException("String is null");
        }
        value = new BigDecimal(s);// UnitUtils.moveRight(s, UnitUtils.SATOSHI);
    }

    public long getValueAsLong() {
        return value.longValue();
    }

}


text:
<TITLE>Review for Crimson Tide (1995)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Crimson Tide (1995)

reviewed by
Andrew Hicks

                               CRIMSON TIDE
                       A film review by Andrew Hicks
                Copyright 1995 Andrew Hicks / Fatboy Productions

(*** out of four)

     Ever since moving in with a gun- and war-obsessed ROTC college
roommate I've found myself despising anything associated with the
military, so when I saw the opening of CRIMSON TIDE, with a bunch of
naval drills and military stereotypes, I wasn't prepared to like the
movie. I fully expected to give it a bad review, letting it join the
ranks of other movies I've sat through for the pleasure of ripping them
apart later in the form of a written review.

     But I got a different kind of pleasure out of CRIMSON TIDE--and
I'm not talking about what Pee Wee Herman does while watching movies
either.  No, I actually found myself liking this movie. Sure, it's got
a very slow start.  After watching it for half an hour, I was thinking
Review be damned, I'm not sitting through this boring movie.  That's
when it grabbed me (and, again I say, this has nothing to do with Pee
Wee Herman).

     CRIMSON TIDE is a well-crafted thriller (except for those first
thirty minutes) with plenty of drama and suspense. Gene Hackman plays a
submarine captain called into action when a Russian revolt attempt
poses a global nuclear threat. Denzel Washington plays the first mate
(forgive me if I don't know the technical term for his position--I'm
sure my roommate could tell you if he ever talked). The two come into
disagreement when an Emergency Action Message dealing with their
impending launch of missiles at Russia is cut off midway through the
message.

     Hackman, itchy macho trigger finger intact, wants to launch the
missiles without full confirmation. Washington, however, realizes such
an action would doom the earth to full-scale nuclear holocaust, so it
might be worth waiting a few minutes to find out for sure whether or
not they'll be ending history as we know it with the touch of a
button.  After that, the rivalry between the two takes off. You know,
mutiny, death, fist fights, the stuff tense action movies are made of.
And CRIMSON TIDE is a good one.

--
Visit the Movie Critic at LARGE website at
http://www.missouri.edu/~c667778/movies.html

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgaModule } from '../../theme/nga.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { DataTableModule, SharedModule, PanelModule, CheckboxModule, AutoCompleteModule } from 'primeng/primeng';

import { Permission } from './permission.component';
import { PermissionTable } from './components/permissionTable/permissionTable.component';
import { PermissionForm } from './components/permissionForm/permissionForm.component';

import { MenuService } from '../../services/menu.service';
import { UserMenuService } from '../../services/userMenu.service';
import { routing } from './permission.routing';
import { StatusService } from '../../services/status.service';
import { TeamService } from '../team/team.service';
import { UserService } from '../user/user.service';

@NgModule({
  imports: [
    CommonModule,
    NgaModule,
    FormsModule,
    ReactiveFormsModule,
    DataTableModule,
    SharedModule,
    PanelModule,
    CheckboxModule,
    AutoCompleteModule,
    routing
  ],
  declarations: [
    Permission,
    PermissionTable,
    PermissionForm
  ],
  providers: [
    MenuService,
    UserService,
    UserMenuService,
    StatusService,
    TeamService
  ]
})
export class PermissionModule { }


text:
package org.activiti.runtime.api.model.impl;

import java.util.Objects;

import org.activiti.api.process.model.ProcessInstance;
import org.activiti.api.runtime.model.impl.ProcessInstanceImpl;

public class APIProcessInstanceConverter extends ListConverter<org.activiti.engine.runtime.ProcessInstance, ProcessInstance>
        implements ModelConverter<org.activiti.engine.runtime.ProcessInstance, ProcessInstance> {

    @Override
    public ProcessInstance from(org.activiti.engine.runtime.ProcessInstance internalProcessInstance) {
        ProcessInstanceImpl processInstance = new ProcessInstanceImpl();
        processInstance.setId(internalProcessInstance.getId());
        processInstance.setParentId(internalProcessInstance.getParentProcessInstanceId());
        processInstance.setName(internalProcessInstance.getName());
        processInstance.setProcessDefinitionId(internalProcessInstance.getProcessDefinitionId());
        processInstance.setProcessDefinitionKey(internalProcessInstance.getProcessDefinitionKey());
        processInstance.setProcessDefinitionVersion(internalProcessInstance.getProcessDefinitionVersion());
        processInstance.setInitiator(internalProcessInstance.getStartUserId());
        processInstance.setStartDate(internalProcessInstance.getStartTime());
        processInstance.setProcessDefinitionKey(internalProcessInstance.getProcessDefinitionKey());
        processInstance.setBusinessKey(internalProcessInstance.getBusinessKey());
        processInstance.setStatus(calculateStatus(internalProcessInstance));
        processInstance.setProcessDefinitionVersion(internalProcessInstance.getProcessDefinitionVersion());
        processInstance.setAppVersion(Objects.toString(internalProcessInstance.getAppVersion(), null));
        processInstance.setProcessDefinitionName(internalProcessInstance.getProcessDefinitionName());
        return processInstance;
    }

    private ProcessInstance.ProcessInstanceStatus calculateStatus(org.activiti.engine.runtime.ProcessInstance internalProcessInstance) {
        if (internalProcessInstance.isSuspended()) {
            return ProcessInstance.ProcessInstanceStatus.SUSPENDED;
        } else if (internalProcessInstance.isEnded()) {
            return ProcessInstance.ProcessInstanceStatus.COMPLETED;
        }else if(internalProcessInstance.getStartTime() == null){
            return ProcessInstance.ProcessInstanceStatus.CREATED;
        }
        return ProcessInstance.ProcessInstanceStatus.RUNNING;
    }
}


text:
[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.20...v2.1.0) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.1.0)

**General**

- Various fixes and improvements.

## [2.0.20-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.20) (2016-04-09)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.19...v2.0.20) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.20)

**General**

- Improve theme Numix Dark.
- Various fixes and improvements.
- Add button to download profile images.
- Add menu item to exclude muted messages from the notifications counter.

## [2.0.19-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.19) (2016-24-07)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.18...v2.0.19) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.19)

**General**

- Make the app 15 MB smaller.
- Make the chat fill the entire window (thanks @levrik).
- Update dependencies and Electron to v1.2.8.

**OS X**

- Fix notifications missing the 'reply' button.

**Windows**

- Fix tray using .png rather than .ico icons.
- Fix crashes for some tray menu items.

**Linux**

- Fix 'Shown in Tray' being always disabled.
- Improve PKGBUILD for publishing to AUR.

## [2.0.18-dev](https://github.com/Aluxian/Whatsie/tree/v2.0.18) (2016-19-07)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.17...v2.0.18) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.18)

**Windows**

- Fix error when receiving notifications (again).

## [2.0.17-dev](https://github.com/Aluxian/Whatsie/tree/v2.0.17) (2016-19-07)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.16...v2.0.17) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.17)

**Windows**

- Fix error when receiving notifications.

## [2.0.16-dev](https://github.com/Aluxian/Whatsie/tree/v2.0.16) (2016-19-07)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.15...v2.0.16) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.16)

**General**

- Add a menu item to enter debug mode more easily.
- Add new themes: Shadow, Numix Dark.
- Improve the build flow and add code linting.
- Improve the context menu.
- Increase min-width of window in mini mode.
- Highlight unread notifications in mini mode.
- Search for spellchecker dictionaries in multiple paths.
- Ship custom dictionaries with the app: en, de, es, fr, ru, ro.
- Update dependencies and Electron to v1.2.7.
- Remove raffle functionality.

**OS X**

- Add showDefinitionForSelection in the context menu.
- Ship LICENSE and LICENSES.chromium.html with the app.

**Windows**

- Implement custom notifications for Windows 7.
- Add menu item to toggle menu bar.
- Auto-update on quit.

**Linux**

- Add X-GNOME-UsesNotifications=true to the deb package.
- Add menu item to toggle menu bar.
- Add dock badge support for Unity.
- Disable "show in tray" menu item on Elementary OS.
- Closing the window will just minimize the app on Elementary OS.
- Fix window icon.

## [2.0.15-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.15) (2016-28-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.14...v2.0.15) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.15)

**General**

- Add a new preference: close with Esc key.
- Add more keyboard shortcuts to the menu.
- Add an item to the tray menu to reset the window's position and size.
- Add a link to FAQ in the help menu.
- Show notifications count in the window's title.
- Disable features that are not yet fully functional.
- Improve logging, analytics and error reporting.
- Remove the native crash reporter.
- Update dependencies, remove redundant ones.
- Update Electron to 0.37.8.

**Windows**

- Show a badge on the taskbar icon with the number of missed notifications.
- Handle Squirrel (installer) error messages better.
- Fix window getting stuck far off-screen.
- Use ico instead of png icons for the tray icon.

**Linux**

- Improve deb dependencies.
- Fix clicking the tray icon not showing the app.
- Fix the auto launcher by simplifying the process.
- Deb releases are now distributed in 3 channels (stable, beta, dev).
- Merge notifications with the same title.

## [2.0.14-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.14) (2016-17-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.13...v2.0.14) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.14)
- Improve the ordering of menu items (Linux, Windows).
- Improve OS X tray icon display.
- Update Electron to v0.37.6.
- Fix Windows notifications.
- Fix exe path used for the squirrel shortcut.
- Handle tray left- and right-clicks correctly (OS X, Windows).
- Make tray icon alert more prominent (Linux, Windows).
- Add hunspell as a recommended package to the deb release.

## [2.0.13-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.13) (2016-16-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.12...v2.0.13) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.13)
- Use dictionaries from Hunspell (Linux, Windows).
- Remove rpm dependency on lsb-core-noarch (Linux).
- Let the app move whatsie.desktop at runtime (Linux).
- Include build number and channel name menus.
- Update dependencies eslint and winreg.

## [2.0.12](https://github.com/Aluxian/Whatsie/tree/v2.0.12) (2016-16-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.11...v2.0.12) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.12)
- Fix rpm build having inconsistent dependencies.
- Fix error about inexistent prefs.
- Fix cp in linux after-install script.
- Fix potential error if a theme would be removed.
- Fix --debug flag for the CLI.
- Add release channels for the auto updater.
- Improve error handling.
- Update dependencies.

## [2.0.11-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.11) (2016-14-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.10...v2.0.11) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.11)
- Fix auto-launch on startup (Linux).
- Fix rpm package build settings and dependencies (Linux).
- Fix preferences not being saved correctly (sometimes).
- Fix dragging and dropping files onto the app window.
- Change keyboard shortcut for quitting the app from Alt-F4 to Ctrl+Q (Windows, Linux).
- Handle connection errors from the auto updater better.
- Handle WAFD cleaner EBUSY and EPERM errors better.
- Improve the .desktop config used for launching on startup (Linux).
- Improve error logging.
- Improve WAFD cleaner.

## [2.0.10-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.10) (2016-06-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.9...v2.0.10) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.10)
- Fix the WAFD cleaner removing other files, too.
- Fix the app window not showing when a notification was clicked on OS X.
- Make the WAFD cleaner dialog show the files that are going to be removed.
- Update how items are grouped in the Help menu.

## [2.0.9-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.9) (2016-04-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.8...v2.0.9) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.9)
- Improve the WhatsApp for Desktop cleaner.
- Fix app closing even with tray icon enabled on Linux.
- Fix category displayed incorrectly on Linux.

## [2.0.8-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.8) (2016-02-04)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.7...v2.0.8) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.8)
- Update Electron to v0.37.3.
- Add 4 new themes: Faded, Fluttershy, Orange, Sephia.
- Re-add keyboard shortcuts for navigation conversations.
- Remove 'Paste and Match Style' context menu item.
- Fix language names on Windows.
- Fix WAFD cleaner.

## [2.0.7-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.7) (2016-26-03)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.6...v2.0.7) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.7)
- Prompt user to update instead of doing it automatically on quit (Windows).
- Disable the crash reporter if stats reporting is disabled.

## [2.0.6-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.6) (2016-25-03)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.5...v2.0.6) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.6)
- Improves support for debugging.
- Improves app launch by adding transitions.
- Adds support for multiple languages for the spell checker.
- Adds option to enable or disable the update checks.
- Adds WAFD cleaner for Windows.
- Updates dependencies.
- Fix for completely black window using Dark theme.
- Fix for crash in Windows auto launcher.

## [2.0.5-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.5) (2016-11-03)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.4...v2.0.5) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.5)
- Adds support for raffles.

## [2.0.4-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.4) (2016-07-03)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.3...v2.0.4) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.4)
- Fixes OS X auto updater.
- Improved logging.

## [2.0.3-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.3) (2016-06-03)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.2...v2.0.3) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.3)
- Upgrades Electron to v0.36.10.
- Upgrades dependencies.

## [2.0.2-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.2) (2016-29-02)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.1...v2.0.2) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.2)
- Fixes for the auto updater.
- Include build number in releases.
- Improved logging.

## [2.0.1-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.1) (2016-12-02)

[Full Changelog](https://github.com/Aluxian/Whatsie/compare/v2.0.0...v2.0.1) • [Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.1)
- Dummy release to test the updating process.

## [2.0.0-beta](https://github.com/Aluxian/Whatsie/tree/v2.0.0) (2015-20-12)

[Download](https://github.com/Aluxian/Whatsie/releases/tag/v2.0.0)
- Initial release.


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';

import { CoreModule } from '../../../../core';
import { InputAuthorsModule, DurationModule } from '../../../../components';
import { InputCourseDataComponent } from './input-course-data.component';

@NgModule({
    declarations: [InputCourseDataComponent],
    imports: [
        CommonModule,
        ReactiveFormsModule,
        CoreModule,
        InputAuthorsModule,
        DurationModule],
    exports: [InputCourseDataComponent]
})
export class InputCourseDataModule {
    constructor() { }
}


text:
from __future__ import unicode_literals

import logging

from django.db.models import Manager
from django.utils import six

from reviewboard.accounts.trophies import get_registered_trophy_types

class ProfileManager(Manager):
    def get_or_create(self, user, *args, **kwargs):
        if hasattr(user, '_profile'):
            return user._profile, False

        profile, is_new = \
            super(ProfileManager, self).get_or_create(user=user, *args,
                                                      **kwargs)
        user._profile = profile

        return profile, is_new

class TrophyManager(Manager):
    """Manager for trophies.

    Creates new trophies, updates the database and fetches trophies from the
    database.
    """
    def compute_trophies(self, review_request):
        """Computes and returns trophies for a review request.

        Computes trophies for a given review request by looping through all
        registered trophy types and seeing if any apply to the review request.

        If trophies are to be awarded, they are saved in the database and
        returned. If no trophies are to be awarded, an empty list is returned.
        """
        if 'calculated_trophies' in review_request.extra_data:
            return list(self.filter(review_request=review_request))

        calculated_trophy_types = []

        registered_trophy_types = get_registered_trophy_types()
        for registered_trophy_type in six.itervalues(registered_trophy_types):
            try:
                instance = registered_trophy_type()
            except Exception as e:
                logging.error('Error instantiating trophy type %r: %s',
                              registered_trophy_type, e, exc_info=1)
                continue

            try:
                if instance.qualifies(review_request):
                    calculated_trophy_types.append(instance)
            except Exception as e:
                logging.error('Error when running %r.instance_qualifies: %s',
                              registered_trophy_type, e, exc_info=1)

        trophies = [
            self.model.objects.create(category=trophy_type.category,
                                      review_request=review_request,
                                      local_site=review_request.local_site,
                                      user=review_request.submitter)
            for trophy_type in calculated_trophy_types
        ]

        review_request.extra_data['calculated_trophies'] = True
        review_request.save(update_fields=['extra_data'])

        return trophies

    def get_trophies(self, review_request):
        """Get all the trophies for a given review request."""
        return self.compute_trophies(review_request)


text:
This example is from my blog on how to [Create a Gooey effect during a transition](http://www.visualcinnamon.com/2015/05/gooey-effect.html) and shows a gooey circle appearing from a bigger stationary circle

The other two examples

- [Gooey falling out of a rectangle](http://bl.ocks.org/nbremer/a3684c52fb527c8fa415)
- [Multiple gooey coming out of a center and then falling back in](http://bl.ocks.org/nbremer/69808ec7ec07542ed7df)

You can find even more gooey examples in my follow-up blog [More fun data visualizations with the gooey effect](http://www.visualcinnamon.com/2016/06/fun-data-visualizations-svg-gooey-effect.html)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace mko.Graphic
{
    public abstract class ContextCmdSetBrush : ContextCmd
    {
        public Brush Brush { get; set; }

    }
}


text:
@class HPSpace;

typedef NS_ENUM(int32_t, HPSharingType) {
    HPInvalidSharingType   = 0,
    HPLinkSharingType      = 1,
    HPDenySharingType      = 1 << 1,
    HPAllowSharingType     = 1 << 2,
    HPDomainSharingType    = 1 << 3,
    HPAnonymousSharingType = 1 << 4,
    HPFriendsSharingType   = 1 << 5,
    HPAskSharingType       = 1 << 6
};

@interface HPSharingOptions (Impl)

@property (nonatomic, readonly) HPSpace *space;

+ (NSString *)stringWithSharingType:(HPSharingType)sharingType;
+ (HPSharingType)sharingTypeWithString:(NSString *)sharingType;

- (void)refreshWithCompletion:(void (^)(HPSharingOptions *, NSError *))handler;

- (void)setModerated:(BOOL)moderated
          completion:(void (^)(HPSharingOptions *, NSError *))handler;

- (void)setSharingType:(HPSharingType)sharingType
            completion:(void (^)(HPSharingOptions *, NSError *))handler;

@end


text:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-destinationschema.html

module Stratosphere.ResourceProperties.KinesisAnalyticsApplicationOutputDestinationSchema where

import Stratosphere.ResourceImports

-- | Full data type definition for
-- KinesisAnalyticsApplicationOutputDestinationSchema. See
-- 'kinesisAnalyticsApplicationOutputDestinationSchema' for a more
-- convenient constructor.
data KinesisAnalyticsApplicationOutputDestinationSchema =
  KinesisAnalyticsApplicationOutputDestinationSchema
  { _kinesisAnalyticsApplicationOutputDestinationSchemaRecordFormatType :: Maybe (Val Text)
  } deriving (Show, Eq)

instance ToJSON KinesisAnalyticsApplicationOutputDestinationSchema where
  toJSON KinesisAnalyticsApplicationOutputDestinationSchema{..} =
    object $
    catMaybes
    [ fmap (("RecordFormatType",) . toJSON) _kinesisAnalyticsApplicationOutputDestinationSchemaRecordFormatType
    ]

-- | Constructor for 'KinesisAnalyticsApplicationOutputDestinationSchema'
-- containing required fields as arguments.
kinesisAnalyticsApplicationOutputDestinationSchema
  :: KinesisAnalyticsApplicationOutputDestinationSchema
kinesisAnalyticsApplicationOutputDestinationSchema  =
  KinesisAnalyticsApplicationOutputDestinationSchema
  { _kinesisAnalyticsApplicationOutputDestinationSchemaRecordFormatType = Nothing
  }

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisanalytics-applicationoutput-destinationschema.html#cfn-kinesisanalytics-applicationoutput-destinationschema-recordformattype
kaaodsRecordFormatType :: Lens' KinesisAnalyticsApplicationOutputDestinationSchema (Maybe (Val Text))
kaaodsRecordFormatType = lens _kinesisAnalyticsApplicationOutputDestinationSchemaRecordFormatType (\s a -> s { _kinesisAnalyticsApplicationOutputDestinationSchemaRecordFormatType = a })


text:
require_relative "../test_helper"

module Plugins
  class StateMachineTest < Minitest::Test
    class Test
      include RocketJob::Plugins::Document
      include RocketJob::Plugins::StateMachine

      field :name, type: String
      field :state, type: String
      validates_presence_of :name, :state

      aasm column: :state, whiny_persistence: true do
        state :pending, initial: true
        state :enabled

        event :enable do
          transitions from: :pending, to: :enabled
        end
      end
    end

    describe RocketJob::Plugins::StateMachine do
      before { Test.delete_all }
      let(:job) { Test.new }

      describe "#create!" do
        it "raises an exception when a validation fails on create!" do
          assert_raises ::Mongoid::Errors::Validations do
            Test.create!
          end
        end
      end

      describe "#save!" do
        it "raises an exception when a validation fails on save" do
          assert_raises ::Mongoid::Errors::Validations do
            job.save!
          end
        end
      end

      describe "#transition!" do
        it "raises an exception when a validation fails on state transition with save" do
          assert_raises ::Mongoid::Errors::Validations do
            job.enable!
          end
          assert job.pending?
          refute job.valid?
        end
      end

      describe "#transition" do
        it "does not raise an exception when a validation fails on state transition without save" do
          job.enable
          assert job.enabled?
        end
      end
    end
  end
end


text:
    request = require('request');
    load    = function(url){ return  request.bind(null,url) };
    Oath    = require('../src/oath.min.js');
new Oath(load('https://google.com'),
         load('http://example.com/'))
  .then(function (e,r,google,e,r,example) {
    console.log(google); // => google page
    console.log(example);// => example page
  });


text:
'use strict';

var expect = require('chai').expect,
	mocha = require('mocha');

var describe = mocha.describe,
	it = mocha.it;

var format = require('..');

describe('#joseToDer', function() {
	describe('should throw for', function() {
		it('no signature', function() {
			function fn() {
				return format.joseToDer();
			}

			expect(fn).to.throw(TypeError);
		});

		it('non buffer or base64 signature', function() {
			function fn() {
				return format.joseToDer(123);
			}

			expect(fn).to.throw(TypeError);
		});

		it('unknown algorithm', function() {
			function fn() {
				return format.joseToDer('Zm9vLmJhci5iYXo=', 'foozleberries');
			}

			expect(fn).to.throw(/"foozleberries"/);
		});

		it('incorrect signature length (ES256)', function() {
			function fn() {
				return format.joseToDer('Zm9vLmJhci5iYXo', 'ES256');
			}

			expect(fn).to.throw(/"64"/);
		});

		it('incorrect signature length (ES384)', function() {
			function fn() {
				return format.joseToDer('Zm9vLmJhci5iYXo', 'ES384');
			}

			expect(fn).to.throw(/"96"/);
		});

		it('incorrect signature length (ES512)', function() {
			function fn() {
				return format.joseToDer('Zm9vLmJhci5iYXo', 'ES512');
			}

			expect(fn).to.throw(/"132"/);
		});
	});
});


text:
package com.jetbrains.edu.learning;

import com.intellij.execution.RunContentExecutor;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.lang.Language;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.impl.DocumentImpl;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.ui.JBColor;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.ui.UIUtil;
import com.jetbrains.edu.EduAnswerPlaceholderDeleteHandler;
import com.jetbrains.edu.EduAnswerPlaceholderPainter;
import com.jetbrains.edu.EduNames;
import com.jetbrains.edu.EduUtils;
import com.jetbrains.edu.courseFormat.*;
import com.jetbrains.edu.learning.actions.StudyCheckAction;
import com.jetbrains.edu.learning.editor.StudyEditor;
import com.jetbrains.edu.learning.run.StudyExecutor;
import com.jetbrains.edu.learning.run.StudyTestRunner;
import com.jetbrains.edu.learning.ui.StudyProgressToolWindowFactory;
import com.jetbrains.edu.learning.ui.StudyToolWindowFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.awt.*;
import java.io.*;
import java.util.Collection;
import java.util.List;

public class StudyUtils {
  private StudyUtils() {
  }

  private static final Logger LOG = Logger.getInstance(StudyUtils.class.getName());

  public static void closeSilently(@Nullable final Closeable stream) {
    if (stream != null) {
      try {
        stream.close();
      }
      catch (IOException e) {
        // close silently
      }
    }
  }

  public static boolean isZip(String fileName) {
    return fileName.contains(".zip");
  }

  public static <T> T getFirst(@NotNull final Iterable<T> container) {
    return container.iterator().next();
  }

  public static boolean indexIsValid(int index, @NotNull final Collection collection) {
    int size = collection.size();
    return index >= 0 && index < size;
  }

  @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
  @Nullable
  public static String getFileText(@Nullable final String parentDir, @NotNull final String fileName, boolean wrapHTML,
                                   @NotNull final String encoding) {
    final File inputFile = parentDir != null ? new File(parentDir, fileName) : new File(fileName);
    if (!inputFile.exists()) return null;
    final StringBuilder taskText = new StringBuilder();
    BufferedReader reader = null;
    try {
      reader = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile), encoding));
      String line;
      while ((line = reader.readLine()) != null) {
        taskText.append(line).append("\n");
        if (wrapHTML) {
          taskText.append("<br>");
        }
      }
      return wrapHTML ? UIUtil.toHtml(taskText.toString()) : taskText.toString();
    }
    catch (IOException e) {
      LOG.info("Failed to get file text from file " + fileName, e);
    }
    finally {
      closeSilently(reader);
    }
    return null;
  }

  public static void updateAction(@NotNull final AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    presentation.setEnabled(false);
    final Project project = e.getProject();
    if (project != null) {
      final StudyEditor studyEditor = getSelectedStudyEditor(project);
      if (studyEditor != null) {
        presentation.setEnabledAndVisible(true);
      }
    }
  }

  public static void updateToolWindows(@NotNull final Project project) {
    final ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    windowManager.getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW).getContentManager().removeAllContents(false);
    StudyToolWindowFactory factory = new StudyToolWindowFactory();
    factory.createToolWindowContent(project, windowManager.getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW));

    windowManager.getToolWindow(StudyProgressToolWindowFactory.ID).getContentManager().removeAllContents(false);
    StudyProgressToolWindowFactory windowFactory = new StudyProgressToolWindowFactory();
    windowFactory.createToolWindowContent(project, windowManager.getToolWindow(StudyProgressToolWindowFactory.ID));
  }

  public static void deleteFile(@NotNull final VirtualFile file) {
    try {
      file.delete(StudyUtils.class);
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }

  public static File copyResourceFile(@NotNull final String sourceName, @NotNull final String copyName, @NotNull final Project project,
                                      @NotNull final Task task)
    throws IOException {
    final StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
    final Course course = taskManager.getCourse();
    int taskNum = task.getIndex();
    int lessonNum = task.getLesson().getIndex();
    assert course != null;
    final String pathToResource = FileUtil.join(course.getCourseDirectory(), EduNames.LESSON + lessonNum, EduNames.TASK + taskNum);
    final File resourceFile = new File(pathToResource, copyName);
    FileUtil.copy(new File(pathToResource, sourceName), resourceFile);
    return resourceFile;
  }

  @Nullable
  public static Sdk findSdk(@NotNull final Task task, @NotNull final Project project) {
    final Language language = task.getLesson().getCourse().getLanguageById();
    return StudyExecutor.INSTANCE.forLanguage(language).findSdk(project);
  }

  @NotNull
  public static StudyTestRunner getTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
    final Language language = task.getLesson().getCourse().getLanguageById();
    return StudyExecutor.INSTANCE.forLanguage(language).getTestRunner(task, taskDir);
  }

  public static RunContentExecutor getExecutor(@NotNull final Project project, @NotNull final Task currentTask,
                                               @NotNull final ProcessHandler handler) {
    final Language language = currentTask.getLesson().getCourse().getLanguageById();
    return StudyExecutor.INSTANCE.forLanguage(language).getExecutor(project, handler);
  }

  public static StudyCheckAction getCheckAction(@NotNull final Course course) {
    final Language language = course.getLanguageById();
    return StudyExecutor.INSTANCE.forLanguage(language).getCheckAction();
  }

  public static void setCommandLineParameters(@NotNull final GeneralCommandLine cmd,
                                              @NotNull final Project project,
                                              @NotNull final String filePath,
                                              @NotNull final String sdkPath,
                                              @NotNull final Task currentTask) {
    final Language language = currentTask.getLesson().getCourse().getLanguageById();
    StudyExecutor.INSTANCE.forLanguage(language).setCommandLineParameters(cmd, project, filePath, sdkPath, currentTask);
  }

  public static void showNoSdkNotification(@NotNull final Task currentTask, @NotNull final Project project) {
    final Language language = currentTask.getLesson().getCourse().getLanguageById();
    StudyExecutor.INSTANCE.forLanguage(language).showNoSdkNotification(project);
  }

  /**
   * shows pop up in the center of "check task" button in study editor
   */
  public static void showCheckPopUp(@NotNull final Project project, @NotNull final Balloon balloon) {
    final StudyEditor studyEditor = getSelectedStudyEditor(project);
    assert studyEditor != null;

    balloon.show(computeLocation(studyEditor.getEditor()), Balloon.Position.above);
    Disposer.register(project, balloon);
  }

  public static RelativePoint computeLocation(Editor editor){

    final Rectangle visibleRect = editor.getComponent().getVisibleRect();
    Point point = new Point(visibleRect.x + visibleRect.width + 10,
                            visibleRect.y + 10);
    return new RelativePoint(editor.getComponent(), point);
  }

  /**
   * returns language manager which contains all the information about language specific file names
   */
  @Nullable
  public static StudyLanguageManager getLanguageManager(@NotNull final Course course) {
    Language language = course.getLanguageById();
    return language == null ? null : StudyLanguageManager.INSTANCE.forLanguage(language);
  }

  public static boolean isTestsFile(@NotNull Project project, @NotNull final String name) {
    Course course = StudyTaskManager.getInstance(project).getCourse();
    if (course == null) {
      return false;
    }
    StudyLanguageManager manager = getLanguageManager(course);
    if (manager == null) {
      return false;
    }
    return manager.getTestFileName().equals(name);
  }

  @Nullable
  public static TaskFile getTaskFile(@NotNull final Project project, @NotNull final VirtualFile file) {
    final Course course = StudyTaskManager.getInstance(project).getCourse();
    if (course == null) {
      return null;
    }
    final VirtualFile taskDir = file.getParent();
    if (taskDir == null) {
      return null;
    }
    final String taskDirName = taskDir.getName();
    if (taskDirName.contains(EduNames.TASK)) {
      final VirtualFile lessonDir = taskDir.getParent();
      if (lessonDir != null) {
        int lessonIndex = EduUtils.getIndex(lessonDir.getName(), EduNames.LESSON);
        List<Lesson> lessons = course.getLessons();
        if (!indexIsValid(lessonIndex, lessons)) {
          return null;
        }
        final Lesson lesson = lessons.get(lessonIndex);
        int taskIndex = EduUtils.getIndex(taskDirName, EduNames.TASK);
        final List<Task> tasks = lesson.getTaskList();
        if (!indexIsValid(taskIndex, tasks)) {
          return null;
        }
        final Task task = tasks.get(taskIndex);
        return task.getFile(file.getName());
      }
    }
    return null;
  }

  public static void drawAllWindows(Editor editor, TaskFile taskFile) {
    editor.getMarkupModel().removeAllHighlighters();
    final Project project = editor.getProject();
    if (project == null) return;
    final StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
    for (AnswerPlaceholder answerPlaceholder : taskFile.getAnswerPlaceholders()) {
      final JBColor color = taskManager.getColor(answerPlaceholder);
      EduAnswerPlaceholderPainter.drawAnswerPlaceholder(editor, answerPlaceholder, true, color);
    }
    final Document document = editor.getDocument();
    EditorActionManager.getInstance()
      .setReadonlyFragmentModificationHandler(document, new EduAnswerPlaceholderDeleteHandler(editor));
    EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, true);
    editor.getColorsScheme().setColor(EditorColors.READONLY_FRAGMENT_BACKGROUND_COLOR, null);
  }

  @Nullable
  public static StudyEditor getSelectedStudyEditor(@NotNull final Project project) {
    try {
      final FileEditor fileEditor = FileEditorManagerEx.getInstanceEx(project).getSplitters().getCurrentWindow().
        getSelectedEditor().getSelectedEditorWithProvider().getFirst();
      if (fileEditor instanceof StudyEditor) {
        return (StudyEditor)fileEditor;
      }
    }
    catch (Exception e) {
      return null;
    }
    return null;
  }

  @Nullable
  public static Editor getSelectedEditor(@NotNull final Project project) {
    final StudyEditor studyEditor = getSelectedStudyEditor(project);
    if (studyEditor != null) {
      return studyEditor.getEditor();
    }
    return null;
  }

  public static void deleteGuardedBlocks(@NotNull final Document document) {
    if (document instanceof DocumentImpl) {
      final DocumentImpl documentImpl = (DocumentImpl)document;
      List<RangeMarker> blocks = documentImpl.getGuardedBlocks();
      for (final RangeMarker block : blocks) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            ApplicationManager.getApplication().runWriteAction(new Runnable() {
              @Override
              public void run() {
                document.removeGuardedBlock(block);
              }
            });
          }
        });
      }
    }
  }

  @Nullable
  public static Document getPatternDocument(@NotNull final TaskFile taskFile, String name) {
    Task task = taskFile.getTask();
    String lessonDir = EduNames.LESSON + String.valueOf(task.getLesson().getIndex());
    String taskDir = EduNames.TASK + String.valueOf(task.getIndex());
    Course course = task.getLesson().getCourse();
    File resourceFile = new File(course.getCourseDirectory());
    if (!resourceFile.exists()) {
      return  null;
    }
    String patternPath = FileUtil.join(resourceFile.getPath(), lessonDir, taskDir, name);
    VirtualFile patternFile = VfsUtil.findFileByIoFile(new File(patternPath), true);
    if (patternFile == null) {
      return null;
    }
    return FileDocumentManager.getInstance().getDocument(patternFile);
  }

  public static boolean isRenameableOrMoveable(@NotNull final Project project, @NotNull final Course course, @NotNull final PsiElement element) {
    if (element instanceof PsiFile) {
      VirtualFile virtualFile = ((PsiFile)element).getVirtualFile();
      if (project.getBaseDir().equals(virtualFile.getParent())) {
        return false;
      }
      TaskFile file = getTaskFile(project, virtualFile);
      if (file != null) {
        return false;
      }
      String name = virtualFile.getName();
      return !isTestsFile(project, name) && !EduNames.TASK_HTML.equals(name);
    }
    if (element instanceof PsiDirectory) {
      VirtualFile virtualFile = ((PsiDirectory)element).getVirtualFile();
      VirtualFile parent = virtualFile.getParent();
      if (parent == null) {
        return true;
      }
      if (project.getBaseDir().equals(parent)) {
        return false;
      }
      Lesson lesson = course.getLesson(parent.getName());
      if (lesson != null) {
        Task task = lesson.getTask(virtualFile.getName());
        if (task != null) {
          return false;
        }
      }
    }
    return true;
  }

  public static boolean canRenameOrMove(DataContext dataContext) {
    Project project = CommonDataKeys.PROJECT.getData(dataContext);
    PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
    if (element == null || project == null) {
      return false;
    }
    Course course = StudyTaskManager.getInstance(project).getCourse();
    if (course == null) {
      return false;
    }
    if (!isRenameableOrMoveable(project, course, element)) {
      return true;
    }
    return false;
  }
}


text:
--------------------------------
--
-- @function [parent=#JumpTiles3D] setAmplitude
-- @param self
-- @param #float amplitude
-- @return JumpTiles3D#JumpTiles3D self (return value: cc.JumpTiles3D)

--------------------------------
--
-- @function [parent=#JumpTiles3D] setAmplitudeRate
-- @param self
-- @param #float amplitudeRate
-- @return JumpTiles3D#JumpTiles3D self (return value: cc.JumpTiles3D)

--------------------------------
--  amplitude of the sin
-- @function [parent=#JumpTiles3D] getAmplitude
-- @param self
-- @return float#float ret (return value: float)

--------------------------------
-- creates the action with the number of jumps, the sin amplitude, the grid size and the duration <br>
-- param duration in seconds
-- @function [parent=#JumpTiles3D] create
-- @param self
-- @param #float duration
-- @param #size_table gridSize
-- @param #unsigned int numberOfJumps
-- @param #float amplitude
-- @return JumpTiles3D#JumpTiles3D ret (return value: cc.JumpTiles3D)

--------------------------------
--
-- @function [parent=#JumpTiles3D] clone
-- @param self
-- @return JumpTiles3D#JumpTiles3D ret (return value: cc.JumpTiles3D)

--------------------------------
-- param time in seconds
-- @function [parent=#JumpTiles3D] update
-- @param self
-- @param #float time
-- @return JumpTiles3D#JumpTiles3D self (return value: cc.JumpTiles3D)

return nil


text:
package com.ggj.service;

import com.ggj.bean.City;
import com.ggj.dao.CityAnnationDao;
import com.ggj.dao.CityDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * author:gaoguangjin
 * Description:
 * Email:335424093@qq.com
 * Date 2016/1/25 9:52
 */
@Service
@Transactional(readOnly = true)
public class CityAnnationService {

    @Autowired
    private CityAnnationDao cityAnnationDao;

    public City getCity(int id){
        return  cityAnnationDao.getCity(id);
    }

    @Transactional(readOnly = false)
    public void insert(City city){
        cityAnnationDao.insert(city);
    }

}


text:
<?php
/**
 * API client for http://isbndb.com/ (ISBN book search api)
 *
 * API documentation:
 * https://isbndb.com/docs/api/
 *
 * Must register for an api key:
 * https://isbndb.com/account/create.html
 *
 */

//STATUS: wip, API works as of 2014-04-25

namespace cd;

require_once('HttpClient.php');
require_once('Isbn.php');
require_once('MediaResource.php'); // for BookResource
require_once('TempStore.php');

class IsbnDbClient
{
    private $api_key;

    public $use_cache = false;

    public function __construct($api_key)
    {
        if (!$api_key)
            throw new \Exception ("API key is required");

        $this->api_key = $api_key;
    }

    function getByISBN($isbn)
    {
        if (!Isbn::isValid($isbn))
            throw new \Exception ('invalid isbn');

        $isbn = str_replace(' ', '', $isbn);
        $isbn = str_replace('-', '', $isbn);

        if ($this->use_cache) {
            $temp = TempStore::getInstance();

            $key = 'IsbnDbClient/isbn/'.$isbn;
            $res = $temp->get($key);

            if ($res)
                return unserialize($res);
        }

        $url =
        'http://isbndb.com/api/books.xml'.
        '?access_key='.$this->api_key.
        '&index1=isbn'.
        '&value1='.$isbn;

        $http = new HttpClient($url);
        $data = $http->getBody();

        $xml = simplexml_load_string($data);

        $attrs = $xml->BookList;
        if ($attrs['total_results'] == 0)
            return false;

        $d = $xml->BookList->BookData;
        $attrs = $d->attributes();
        if (!$attrs)
            throw new \Exception ('no attrs');

        $book = new BookResource();
        $book->title     = strval($d->Title);
        $book->authors   = strval($d->AuthorsText);
        $book->publisher = strval($d->PublisherText);
        $book->isbn10    = strval($attrs['isbn']);
        $book->isbn13    = strval($attrs['isbn13']);

        if ($this->use_cache) {
            $temp->set($key, serialize($book), '24h');
        }

        return $book;
    }

}


text:
package org.apache.solr.kelvin.responseanalyzers;

import java.io.StringReader;
import java.util.Map;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.solr.kelvin.QueryPerformer;
import org.apache.solr.kelvin.ResponseAnalyzer;
import org.xml.sax.InputSource;

import com.fasterxml.jackson.databind.JsonNode;

public class XmlResponseAnalyzer implements ResponseAnalyzer {

	public final static String XML_DOM = "kelvin.dom";

	private DocumentBuilderFactory dbf;
	private DocumentBuilder documentBuilder;

	/*public void config(JsonNode config) throws Exception {
		dbf = DocumentBuilderFactory.newInstance();
		documentBuilder = dbf.newDocumentBuilder();
	}*/

	public void decode(Map<String,Object> previousResponses) throws Exception {
		if (previousResponses.containsKey(QueryPerformer.RAW_RESPONSE) &&
				previousResponses.get(QueryPerformer.RAW_RESPONSE) instanceof String) {
			String rawResponse =(String)previousResponses.get(QueryPerformer.RAW_RESPONSE);
			previousResponses.put(XML_DOM, documentBuilder.parse(new InputSource(new StringReader((String)rawResponse))));
		}
	}

	public void configure(JsonNode config) throws Exception {
		dbf = DocumentBuilderFactory.newInstance();
		documentBuilder = dbf.newDocumentBuilder();

	}

}


text:
package com.juanlitvin.fenix;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.app.Activity;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.ContentResolver;
import android.content.CursorLoader;
import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build.VERSION;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.RequiresApi;
import android.support.design.widget.TextInputLayout;
import android.text.Html;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.common.internal.zzi;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;

import org.json.JSONObject;

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

import static android.Manifest.permission.READ_CONTACTS;

@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
public class LoginActivity extends Activity {

    private static final int REQUEST_READ_CONTACTS = 0;

    private EditText txtEmail;
    private EditText txtPassword;
    private EditText txtConfirmPassword;
    private EditText txtName;
    private Button btnSignIn, btnSignUp, btnSwitchSignIn, btnSwitchSignUp;

    private FirebaseAuth mAuth;
    private FirebaseAuth.AuthStateListener mAuthListener;
    public static Context context;

    //temp fix for firebase bug calling mAuthListener twice
    private boolean shouldLoad = true;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        context = this;

        //if was logged out, skip splash; if not, continue
        if (getIntent().hasExtra("loggedOut")) hideSplash();

        RESTClient.init(this);

        initAuth();

        assignViews();
        setListeners();
    }

    private void hideSplash() {
        findViewById(R.id.layoutLogin).setVisibility(View.VISIBLE);
        findViewById(R.id.layoutSplash).setVisibility(View.GONE);
    }

    private void showProgress(boolean show) {
        if (show) {
            findViewById(R.id.layoutLogin).setVisibility(View.GONE);
            findViewById(R.id.loginProgress).setVisibility(View.VISIBLE);
        } else {
            findViewById(R.id.layoutLogin).setVisibility(View.VISIBLE);
            findViewById(R.id.loginProgress).setVisibility(View.GONE);
        }
    }

    private void initAuth() {
        mAuth = FirebaseAuth.getInstance();
        mAuthListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {

                //temp fix for bug calling listener twice
                if (!shouldLoad) return;
                else shouldLoad = false;

                FirebaseUser user = firebaseAuth.getCurrentUser();
                if (user != null) {
                    // User is signed in
                    User.loadFromFirebaseUser(user.getUid(), new User.LoginCallback() {
                        @Override
                        public void onComplete(int statusCode, JSONObject response) {
                            showProgress(false);
                            startActivity(new Intent(LoginActivity.context, MainActivity.class));
                            finish();
                        }

                        @Override
                        public void onError(int statusCode, Throwable error) {
                            showProgress(false);
                            Toast.makeText(LoginActivity.this, error.getMessage(), Toast.LENGTH_SHORT).show();
                        }
                    });
                } else {
                    //no user signed in
                    new android.os.Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            hideSplash();
                        }
                    }, 3000);
                }
            }
        };
    }

    private void assignViews() {
        txtEmail = (EditText) findViewById(R.id.txtEmail);
        txtPassword = (EditText) findViewById(R.id.txtPassword);
        txtConfirmPassword = (EditText) findViewById(R.id.txtConfirmPassword);
        txtName = (EditText) findViewById(R.id.txtName);

        btnSignIn = (Button) findViewById(R.id.btnSignIn);
        btnSignUp = (Button) findViewById(R.id.btnSignUp);
        btnSwitchSignIn = (Button) findViewById(R.id.btnSwitchSignIn);
        btnSwitchSignUp = (Button) findViewById(R.id.btnSwitchSignUp);
    }

    private void setListeners() {
        btnSignIn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                attemptLogin();
            }
        });
        btnSignUp.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                attemptRegister();
            }
        });
        btnSwitchSignIn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                switchToSignIn();
            }
        });
        btnSwitchSignUp.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                switchToSignUp();
            }
        });
    }

    private void switchToSignUp() {
        clearFields();
        findViewById(R.id.signup).setVisibility(View.VISIBLE);
        findViewById(R.id.signin).setVisibility(View.GONE);
    }

    private void switchToSignIn() {
        clearFields();
        findViewById(R.id.signup).setVisibility(View.GONE);
        findViewById(R.id.signin).setVisibility(View.VISIBLE);
    }

    private void clearFields() {
        txtEmail.setText("");
        txtName.setText("");
        txtPassword.setText("");
        txtConfirmPassword.setText("");
    }

    private void attemptLogin() {
        String email = txtEmail.getText().toString();
        String pass = txtPassword.getText().toString();

        //check if credentials are valid
        if (!areCredentialsValid(email, pass)) return;

        //show progress if credentials are valid
        showProgress(true);

        //temp bug fix
        shouldLoad = true;

        //sing in
        mAuth.signInWithEmailAndPassword(email, pass)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        Toast.makeText(LoginActivity.this, "No se pudo iniciar sesion: " + task.getException().getMessage(), Toast.LENGTH_SHORT).show();
                    }
                }
            });
    }

    private void attemptRegister() {
        showProgress(true);

        final String name = txtName.getText().toString();
        final String email = txtEmail.getText().toString();
        String pass = txtPassword.getText().toString();
        String confirmPass = txtConfirmPassword.getText().toString();

        //check if credentials are valid
        if (!areCredentialsValid(email, pass, confirmPass, name)) return;

        //show progress if credentials are valid
        showProgress(true);

        //temp bug fix
        shouldLoad = true;

        //save email and pass in user
        User.setEmail(email);
        User.setUserName(name);

        //register
        mAuth.createUserWithEmailAndPassword(email, pass)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        Toast.makeText(LoginActivity.this, "No se pudo crear su cuenta: " + task.getException().getMessage(), Toast.LENGTH_LONG).show();
                    }
                }
            });
    }

    @Override
    public void onStart() {
        super.onStart();
        mAuth.addAuthStateListener(mAuthListener);
    }

    @Override
    public void onStop() {
        super.onStop();
        if (mAuthListener != null) {
            mAuth.removeAuthStateListener(mAuthListener);
        }
    }

    private boolean areCredentialsValid(String email, String password) {
        boolean result = true;

        //go from bottom to top, so first error has focus

        if (password.isEmpty()) {
            setEditTextError(R.id.txtPasswordTIL, "You need to enter a password");
            findViewById(R.id.txtPassword).requestFocus();
            result = false;
        } else if (!isPasswordValid(password)) {
            setEditTextError(R.id.txtPasswordTIL, "This password is invalid");
            findViewById(R.id.txtPassword).requestFocus();
            result = false;
        } else {
            setEditTextError(R.id.txtPasswordTIL, null);
        }

        if (email.isEmpty()) {
            setEditTextError(R.id.txtEmailTIL, "You need to enter an email");
            findViewById(R.id.txtEmail).requestFocus();
            result = false;
        } else if (!isEmailValid(email)) {
            setEditTextError(R.id.txtEmailTIL, "This email address is invalid");
            findViewById(R.id.txtEmail).requestFocus();
            result = false;
        } else {
            setEditTextError(R.id.txtEmailTIL, null);
        }

        return result;
    }

    private boolean areCredentialsValid(String email, String password, String confirmPassword, String name) {
        return isEmailValid(email) && isPasswordValid(password);
    }

    private void setEditTextError(int viewId, String error) {
        try {
            ((TextInputLayout)findViewById(viewId)).setError(error);
        } catch (Exception e) {
            Toast.makeText(context, error, Toast.LENGTH_SHORT).show();
        }
    }

    private boolean isEmailValid(String email) {
        return email.contains("@") && email.contains(".");
    }

    private boolean isPasswordValid(String password) {
        return password.length() >= 6;
    }

}


text:
package com.guest.cnbeta.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class BaseDB {

	private BaseDBHelper dbHelper;
	protected SQLiteDatabase db;

	public BaseDB(Context context) {

		if (dbHelper == null) {
			dbHelper = new BaseDBHelper(context, "db.db", null, 1);
		}

		if (db == null) {
			db = dbHelper.getWritableDatabase();
		}else {
			dbHelper.close();
		}
	}

	protected String toSafeString(String str) {

		try {
			str = str.replace("'", "''");
		} catch (NullPointerException e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		return str;
	}

}


text:
package com.darkoverlordofdata.entitas;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.darkoverlordofdata.entitas.demo.ShmupWarz;

public class AndroidLauncher extends AndroidApplication {
	@Override
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
		initialize(new ShmupWarz(), config);
	}
}


text:
package de.codecentric.zucchini.bdd.vars;

/**
 * A variable representing a {@link java.lang.String}.
 */
public class StringVariable extends AbstractVariable<String> {
    /**
     * Initializes a string variable.
     *
     * @param name The name of the variable.
     */
    public StringVariable(String name) {
        super(name);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String convert(String value) {
        return value;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
       "http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>

	<definition name="welcome/index" extends="master.page">
		<put-attribute name="title" value="Shipmee" />
		<put-attribute name="body" value="/views/welcome/index.jsp" />
	</definition>

</tiles-definitions>


text:
namespace chromeos {

namespace libassistant {

class AudioOutputProviderImpl : public assistant_client::AudioOutputProvider {
 public:
  explicit AudioOutputProviderImpl(const std::string& device_id);

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

  ~AudioOutputProviderImpl() override;

  void Bind(
      mojo::PendingRemote<mojom::AudioOutputDelegate> audio_output_delegate,
      mojom::PlatformDelegate* platform_delegate);

  // assistant_client::AudioOutputProvider overrides:
  assistant_client::AudioOutput* CreateAudioOutput(
      assistant_client::OutputStreamMetadata metadata) override;
  std::vector<assistant_client::OutputStreamEncoding>
  GetSupportedStreamEncodings() override;
  assistant_client::AudioInput* GetReferenceInput() override;
  bool SupportsPlaybackTimestamp() const override;
  assistant_client::VolumeControl& GetVolumeControl() override;
  void RegisterAudioEmittingStateCallback(
      AudioEmittingStateCallback callback) override;

  void BindAudioDecoderFactory();
  void UnBindAudioDecoderFactory();

 private:
  void BindStreamFactory(
      mojo::PendingReceiver<media::mojom::AudioStreamFactory> receiver);

  assistant_client::AudioOutput* CreateAudioOutputInternal(
      assistant_client::OutputStreamType type,
      const assistant_client::OutputStreamFormat& stream_format);

  // Owned by |AssistantManagerServiceImpl|.
  mojom::PlatformDelegate* platform_delegate_ = nullptr;

  mojo::Remote<mojom::AudioOutputDelegate> audio_output_delegate_;

  AudioInputImpl loop_back_input_;
  VolumeControlImpl volume_control_impl_;
  scoped_refptr<base::SequencedTaskRunner> main_task_runner_;
  mojo::Remote<chromeos::assistant::mojom::AssistantAudioDecoderFactory>
      audio_decoder_factory_;
  std::string device_id_;
  base::WeakPtrFactory<AudioOutputProviderImpl> weak_ptr_factory_{this};
};

}  // namespace libassistant
}  // namespace chromeos

#endif  // CHROMEOS_SERVICES_LIBASSISTANT_AUDIO_AUDIO_OUTPUT_PROVIDER_IMPL_H_


text:
<?xml version="1.0"?>
<project name="chapter11" default="dist">
  <import file="../build.xml"/>

  <!-- sub-projects have custom Eclipse files -->

  <target name="local.wipe" depends="local.clean">
    <delete dir="${dist}"/>
  </target>

  <target name="local.pde"/>

</project>


text:
<!--
Description: alefsym
Expect:      feed['title'] == u'testing \u2135 entity'
-->
<rss>
<channel>
<title>testing ℵ entity</title>
</channel>
</rss>


text:
module Revolve
  class Variable
    attr_accessor :name
    def initialize(name)
      @name = name
    end

    def inspect
      "(:#{name} variable)"
    end
    alias_method :to_s, :inspect
  end
end


text:
package org.thruway.stdver10;

import java.util.ArrayList;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

public class ThruwayPropertyTypeImplTest
{

    @Test
    public void testBOOLEAN_ValidValues()
    {
        ThruwayPropertyTypeImpl b = ThruwayPropertyTypeImpl.BOOLEAN;
        assertNull("Valid 1", b.validate("true"));
        assertNull("Valid 2", b.validate("false"));
        assertNotNull("Invalid 1", b.validate("bobby"));
        assertNotNull("Invalid 2", b.validate(" "));
        assertNotNull("Invalid 3", b.validate("tru"));
        assertNotNull("Invalid 4", b.validate("fals"));
    }

    @Test
    public void testBOOLEAN_ImproveValues()
    {
        ThruwayPropertyTypeImpl b = ThruwayPropertyTypeImpl.BOOLEAN;
        assertEquals("Improve 1",
            "true",
            b.improvePrevalidatedValue(" true "));
        assertEquals("Improve 2",
            "true",
            b.improvePrevalidatedValue(" TRUE "));
        assertEquals("Improve 3",
            "false",
            b.improvePrevalidatedValue(" false "));
        assertEquals("Improve 4",
            "false",
            b.improvePrevalidatedValue(" FALSE "));
    }

}