text:
package com.google.api.ads.adwords.jaxws.v201406.rm;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
 *             SimilarUserList is a list of users which are similar to users from another UserList.
 *             These lists are readonly and automatically created by google.
 *
 *
 *
Java class for SimilarUserList complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="SimilarUserList">
 *   <complexContent>
 *     <extension base="{https://adwords.google.com/api/adwords/rm/v201406}UserList">
 *       <sequence>
 *         <element name="seedUserListId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *         <element name="seedUserListName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="seedUserListDescription" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="seedUserListStatus" type="{https://adwords.google.com/api/adwords/rm/v201406}UserListMembershipStatus" minOccurs="0"/>
 *         <element name="seedListSize" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SimilarUserList", propOrder = {
    "seedUserListId",
    "seedUserListName",
    "seedUserListDescription",
    "seedUserListStatus",
    "seedListSize"
})
public class SimilarUserList
    extends UserList
{

    protected Long seedUserListId;
    protected String seedUserListName;
    protected String seedUserListDescription;
    protected UserListMembershipStatus seedUserListStatus;
    protected Long seedListSize;

    /**
     * Gets the value of the seedUserListId property.
     *
     * @return
     *     possible object is
     *     {@link Long }
     *
     */
    public Long getSeedUserListId() {
        return seedUserListId;
    }

    /**
     * Sets the value of the seedUserListId property.
     *
     * @param value
     *     allowed object is
     *     {@link Long }
     *
     */
    public void setSeedUserListId(Long value) {
        this.seedUserListId = value;
    }

    /**
     * Gets the value of the seedUserListName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSeedUserListName() {
        return seedUserListName;
    }

    /**
     * Sets the value of the seedUserListName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSeedUserListName(String value) {
        this.seedUserListName = value;
    }

    /**
     * Gets the value of the seedUserListDescription property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSeedUserListDescription() {
        return seedUserListDescription;
    }

    /**
     * Sets the value of the seedUserListDescription property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSeedUserListDescription(String value) {
        this.seedUserListDescription = value;
    }

    /**
     * Gets the value of the seedUserListStatus property.
     *
     * @return
     *     possible object is
     *     {@link UserListMembershipStatus }
     *
     */
    public UserListMembershipStatus getSeedUserListStatus() {
        return seedUserListStatus;
    }

    /**
     * Sets the value of the seedUserListStatus property.
     *
     * @param value
     *     allowed object is
     *     {@link UserListMembershipStatus }
     *
     */
    public void setSeedUserListStatus(UserListMembershipStatus value) {
        this.seedUserListStatus = value;
    }

    /**
     * Gets the value of the seedListSize property.
     *
     * @return
     *     possible object is
     *     {@link Long }
     *
     */
    public Long getSeedListSize() {
        return seedListSize;
    }

    /**
     * Sets the value of the seedListSize property.
     *
     * @param value
     *     allowed object is
     *     {@link Long }
     *
     */
    public void setSeedListSize(Long value) {
        this.seedListSize = value;
    }

}


text:
/*
 * stdlib_Hack.h
 *
 *  Created on: May 6, 2016
 *      Author: avorona
 */

#ifndef STDLIB_HACK_H_
#define STDLIB_HACK_H_

/* Return a master pseudo-terminal handle.  */
extern int posix_openpt (int __oflag);
/* Chown the slave to the calling user.  */
extern int grantpt (int __fd);
/* Release an internal lock so the slave can be opened.
   Call after grantpt().  */
extern int unlockpt (int __fd);
/* Return the pathname of the pseudo terminal slave associated with
   the master FD is open on, or NULL on errors.
   The returned storage is good until the next call to this function.  */
extern char *ptsname (int __fd);

#endif /* STDLIB_HACK_H_ */

redpajama_set_name: RedPajamaGithub


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$lang['error_login_failed'] = "Incorrect username or password";
$lang['error_user_exist'] = "User {0} already exists.";
$lang['mesg_user_created'] = "User {0} created successfully.";
$lang['mesg_user_logged'] = "User {0} logged in successfully.";
$lang['mesg_user_loggedout'] = "User logged out successfully.";
$lang['mesg_profile_updated'] = "User profile updated successfully.";
$lang['mesg_address_updated'] = "User address updated successfully.";


text:
class LitCreateLitIncommingLocalizations < Rails::VERSION::MAJOR >= 5  ?
                                          ActiveRecord::Migration[4.2] :
                                          ActiveRecord::Migration
  def up
    return if table_exists?(:lit_incomming_localizations)
    create_table :lit_incomming_localizations do |t|
      t.text :translated_value
      t.integer :locale_id
      t.integer :localization_key_id
      t.integer :localization_id
      t.string :locale_str
      t.string :localization_key_str
      t.integer :source_id
      t.integer :incomming_id

      t.timestamps
    end

    add_index :lit_incomming_localizations, :locale_id
    add_index :lit_incomming_localizations, :localization_key_id
    add_index :lit_incomming_localizations, :localization_id
    add_index :lit_incomming_localizations, :source_id
    add_index :lit_incomming_localizations, :incomming_id
  end

  def down
    remove_index :lit_incomming_localizations, :locale_id
    remove_index :lit_incomming_localizations, :localization_key_id
    remove_index :lit_incomming_localizations, :localization_id
    remove_index :lit_incomming_localizations, :source_id
    remove_index :lit_incomming_localizations, :incomming_id
    drop_table :lit_incomming_localizations
  end
end


text:
#import "OBADiversionViewController.h"
@import OBAKit;
#import "EXTScope.h"

@interface OBADiversionViewController ()
@property (nonatomic, strong) NSString *tripEncodedPolyline;

@property (nonatomic, strong) MKPolyline *routePolyline;
@property (nonatomic, strong) MKPolylineRenderer *routePolylineRenderer;

@property (nonatomic, strong) MKPolyline *reroutePolyline;
@property (nonatomic, strong) MKPolylineRenderer *reroutePolylineRenderer;

@property (nonatomic, strong) id<OBAModelServiceRequest> request;
@end

@implementation OBADiversionViewController

+ (OBADiversionViewController *)loadFromNibWithappDelegate:(OBAApplicationDelegate *)context {
    NSArray *wired = [[NSBundle mainBundle] loadNibNamed:@"OBADiversionViewController" owner:context options:nil];
    OBADiversionViewController *controller = wired[0];

    return controller;
}

- (void)dealloc {
    [self.request cancel];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    MKMapView *mv = [self mapView];
    NSArray *points = [OBASphericalGeometryLibrary decodePolylineString:self.diversionPath];

    _reroutePolyline = [OBASphericalGeometryLibrary createMKPolylineFromLocations:points];

    [mv addOverlay:_reroutePolyline];

    OBACoordinateBounds *bounds = [OBASphericalGeometryLibrary boundsForLocations:points];

    if (![bounds empty]) {
        [mv setRegion:bounds.region];
    }

    NSString *shapeId = [[self.args[@"arrivalAndDeparture"] trip] shapeId];

    if (!self.tripEncodedPolyline && shapeId) {
        [self requestShapeForID:shapeId];
    }
}

#pragma mark - Lazy Loading

- (OBAModelService*)modelService {
    if (!_modelService) {
        _modelService = [OBAApplication sharedApplication].modelService;
    }
    return _modelService;
}

#pragma mark - Data Loading

- (void)requestShapeForID:(NSString *)shapeId {
    @weakify(self);
    self.request = [self.modelService requestShapeForId:shapeId completionBlock:^(id jsonData, NSUInteger responseCode, NSError *error) {
        @strongify(self);

        if (!jsonData) {
            return;
        }

        self.tripEncodedPolyline = jsonData;
        NSArray *points = [OBASphericalGeometryLibrary decodePolylineString:self.tripEncodedPolyline];

        CLLocationCoordinate2D *pointArr = malloc(sizeof(CLLocationCoordinate2D) * points.count);

        for (NSInteger i = 0; i < points.count; i++) {
            CLLocation *location = points[i];
            CLLocationCoordinate2D p = location.coordinate;
            pointArr[i] = p;
        }

        self.routePolyline = [MKPolyline polylineWithCoordinates:pointArr count:points.count];
        free(pointArr);
        [self.mapView addOverlay:self.routePolyline];
    }];
}

#pragma mark MKMapViewDelegate

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
    if ([annotation isKindOfClass:[OBAPlacemark class]]) {
        static NSString *viewId = @"DiversionView";
        MKPinAnnotationView *view = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:viewId];

        if (view == nil) {
            view = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:viewId];
        }

        view.canShowCallout = NO;
        return view;
    }

    return nil;
}

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
}

- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay {
    MKOverlayRenderer *overlayView = nil;

    if (overlay == _reroutePolyline) {
        //if we have not yet created an overlay view for this overlay, create it now.
        if (_reroutePolylineRenderer == nil) {
            _reroutePolylineRenderer = [[MKPolylineRenderer alloc] initWithPolyline:_reroutePolyline];
            _reroutePolylineRenderer.fillColor = [UIColor redColor];
            _reroutePolylineRenderer.strokeColor = [UIColor redColor];
            _reroutePolylineRenderer.lineWidth = 5;
        }

        overlayView = _reroutePolylineRenderer;
    }
    else if (overlay == _routePolyline) {
        //if we have not yet created an overlay view for this overlay, create it now.
        if (_routePolylineRenderer == nil) {
            _routePolylineRenderer = [[MKPolylineRenderer alloc] initWithPolyline:_routePolyline];
            _routePolylineRenderer.fillColor = [UIColor blackColor];
            _routePolylineRenderer.strokeColor = [UIColor blackColor];
            _routePolylineRenderer.lineWidth = 5;
        }

        overlayView = _routePolylineRenderer;
    }
    else {
        overlayView = [[MKOverlayRenderer alloc] init];
    }

    return overlayView;
}

- (MKMapView *)mapView {
    return (MKMapView *)self.view;
}

@end


text:
package org.duracloud.manifest.impl;

import static org.duracloud.common.util.bulk.ManifestVerifier.DELIM;

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

import org.duracloud.mill.db.model.ManifestItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This class formats content manifests as tab-separated-values (TSV).
 *
 * @author Andrew Woods
 * Date: 3/29/12
 */
public class TsvManifestFormatter extends ManifestFormatterBase {

    private final Logger log =
        LoggerFactory.getLogger(TsvManifestFormatter.class);

    private static Pattern LINE_PATTERN = Pattern.compile("(.+)" + DELIM + "(.+)" + DELIM + "(.+)");

    private static final String HEADER =
        "space-id" + DELIM + "content-id" + DELIM + "MD5";

    @Override
    protected Logger log() {
        return log;
    }

    @Override
    public String getHeader() {
        return HEADER;
    }

    @Override
    protected String formatLine(String contentMd5, String spaceId, String contentId) {
        StringBuilder line = new StringBuilder();
        line.append(spaceId);
        line.append(DELIM);
        line.append(contentId);
        line.append(DELIM);
        line.append(contentMd5);
        return line.toString();
    }

    @Override
    public ManifestItem parseLine(String line) throws ParseException {
        Matcher matcher = LINE_PATTERN.matcher(line);
        if (!matcher.find()) {
            throw new ParseException("Line doesn't match tsv format: unable to parse line: ->"
                                     + line + "<-", 0);
        }

        ManifestItem item = new ManifestItem();
        item.setSpaceId(matcher.group(1));
        item.setContentId(matcher.group(2));
        item.setContentChecksum(matcher.group(3));

        return item;

    }

}


text:
@echo off

rem  Start Specware shell within Lisp shell, no emacs

rem Run Specware under XEmacs as a standalone application built using ACL
rem To run this, the user does not need an ACL license,  but
rem must meet criteria set forth in Kestrel's agreeement with Franz.

rem A hack to try to ensure we connect to the proper directory,
rem so the calls to Find_xxx will succeed.
rem The proper alternative is probably to parse %CMDCMDLINE%,
rem but that is dreadful to contemplate.

call Find_SPECWARE4
call Update_Path
call Update_SWPATH
call Find_Specware_App_ACL

start "ignore" "%LISP_EXECUTABLE%" +t "Specware Shell" +s "%SPECWARE4%\StartSpecwareShell.lisp" -I "%LISP_HEAP_IMAGE%" -e "(setq Emacs::*use-emacs-interface?* nil)"


text:
package com.gs.collections.impl.multimap;

import java.util.Map;

import com.gs.collections.api.RichIterable;
import com.gs.collections.api.bag.Bag;
import com.gs.collections.api.bag.MutableBag;
import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.block.function.Function2;
import com.gs.collections.api.block.predicate.Predicate;
import com.gs.collections.api.block.predicate.Predicate2;
import com.gs.collections.api.block.procedure.Procedure;
import com.gs.collections.api.block.procedure.Procedure2;
import com.gs.collections.api.map.MapIterable;
import com.gs.collections.api.multimap.Multimap;
import com.gs.collections.api.multimap.MutableMultimap;
import com.gs.collections.api.tuple.Pair;
import com.gs.collections.impl.UnmodifiableRichIterable;
import com.gs.collections.impl.block.factory.Functions;
import com.gs.collections.impl.factory.Bags;
import com.gs.collections.impl.tuple.Tuples;

public abstract class AbstractMultimap<K, V, C extends RichIterable<V>>
        implements Multimap<K, V>
{
    private static final Function<AbstractMultimap<?, ?, ?>, ?> CREATE_COLLECTION_BLOCK = new Function<AbstractMultimap<?, ?, ?>, RichIterable<?>>()
    {
        public RichIterable<?> valueOf(AbstractMultimap<?, ?, ?> multimap)
        {
            return multimap.createCollection();
        }
    };

    protected abstract MapIterable<K, C> getMap();

    /**
     * Creates the collection of values for a single key.
     *

     * Collections with weak, soft, or phantom references are not supported.
     * Each call to {@code createCollection} should create a new instance.
     *

     * The returned collection class determines whether duplicate key-value
     * pairs are allowed.
     *
     * @return an empty collection of values
     */
    protected abstract C createCollection();

    protected Function<AbstractMultimap<K, V, C>, C> createCollectionBlock()
    {
        return (Function<AbstractMultimap<K, V, C>, C>) (Function<?, ?>) CREATE_COLLECTION_BLOCK;
    }

    // Query Operations

    public boolean containsKey(Object key)
    {
        return this.getMap().containsKey(key);
    }

    public boolean containsValue(final Object value)
    {
        return this.getMap().anySatisfy(new Predicate<C>()
        {
            public boolean accept(C collection)
            {
                return collection.contains(value);
            }
        });
    }

    public boolean containsKeyAndValue(Object key, Object value)
    {
        C collection = this.getMap().get(key);
        return collection != null && collection.contains(value);
    }

    // Views

    public RichIterable<K> keysView()
    {
        return this.getMap().keysView();
    }

    public RichIterable<RichIterable<V>> multiValuesView()
    {
        return this.getMap().valuesView().collect(new Function<C, RichIterable<V>>()
        {
            public RichIterable<V> valueOf(C multiValue)
            {
                return UnmodifiableRichIterable.of(multiValue);
            }
        });
    }

    public Bag<K> keyBag()
    {
        final MutableBag<K> bag = Bags.mutable.empty();
        this.getMap().forEachKeyValue(new Procedure2<K, C>()
        {
            public void value(K key, C value)
            {
                bag.addOccurrences(key, value.size());
            }
        });
        return bag;
    }

    public RichIterable<V> valuesView()
    {
        return this.getMap().valuesView().flatCollect(Functions.<Iterable<V>>identity());
    }

    public RichIterable<Pair<K, RichIterable<V>>> keyMultiValuePairsView()
    {
        return this.getMap().keyValuesView().collect(new Function<Pair<K, C>, Pair<K, RichIterable<V>>>()
        {
            public Pair<K, RichIterable<V>> valueOf(Pair<K, C> pair)
            {
                return Tuples.<K, RichIterable<V>>pair(pair.getOne(), UnmodifiableRichIterable.of(pair.getTwo()));
            }
        });
    }

    public RichIterable<Pair<K, V>> keyValuePairsView()
    {
        return this.keyMultiValuePairsView().flatCollect(new Function<Pair<K, RichIterable<V>>, Iterable<Pair<K, V>>>()
        {
            public Iterable<Pair<K, V>> valueOf(Pair<K, RichIterable<V>> pair)
            {
                return pair.getTwo().collect(new KeyValuePairFunction<V, K>(pair.getOne()));
            }
        });
    }

    // Comparison and hashing

    @Override
    public boolean equals(Object object)
    {
        if (object == this)
        {
            return true;
        }
        if (object instanceof Multimap)
        {
            Multimap<?, ?> that = (Multimap<?, ?>) object;
            return this.getMap().equals(that.toMap());
        }
        return false;
    }

    /**
     * Returns the hash code for this multimap.
     *

     * The hash code of a multimap is defined as the hash code of the map view,
     * as returned by {@link Multimap#toMap()}.
     *
     * @see Map#hashCode()
     */
    @Override
    public int hashCode()
    {
        return this.getMap().hashCode();
    }

    /**
     * Returns a string representation of the multimap, generated by calling
     * {@code toString} on the map returned by {@link Multimap#toMap()}.
     *
     * @return a string representation of the multimap
     */
    @Override
    public String toString()
    {
        return this.getMap().toString();
    }

    public boolean notEmpty()
    {
        return !this.isEmpty();
    }

    public void forEachValue(final Procedure<? super V> procedure)
    {
        this.getMap().forEachValue(new Procedure<C>()
        {
            public void value(C collection)
            {
                collection.forEach(procedure);
            }
        });
    }

    public void forEachKey(Procedure<? super K> procedure)
    {
        this.getMap().forEachKey(procedure);
    }

    public void forEachKeyValue(final Procedure2<K, V> procedure)
    {
        final Procedure2<V, K> innerProcedure = new Procedure2<V, K>()
        {
            public void value(V value, K key)
            {
                procedure.value(key, value);
            }
        };

        this.getMap().forEachKeyValue(new Procedure2<K, C>()
        {
            public void value(K key, C collection)
            {
                collection.forEachWith(innerProcedure, key);
            }
        });
    }

    public void forEachKeyMultiValues(Procedure2<K, ? super Iterable<V>> procedure)
    {
        this.getMap().forEachKeyValue(procedure);
    }

    public <R extends MutableMultimap<K, V>> R selectKeysValues(final Predicate2<? super K, ? super V> predicate, final R target)
    {
        this.getMap().forEachKeyValue(new Procedure2<K, C>()
        {
            public void value(final K key, C collection)
            {
                RichIterable<V> selectedValues = collection.select(new Predicate<V>()
                {
                    public boolean accept(V value)
                    {
                        return predicate.accept(key, value);
                    }
                });
                target.putAll(key, selectedValues);
            }
        });
        return target;
    }

    public <R extends MutableMultimap<K, V>> R rejectKeysValues(final Predicate2<? super K, ? super V> predicate, final R target)
    {
        this.getMap().forEachKeyValue(new Procedure2<K, C>()
        {
            public void value(final K key, C collection)
            {
                RichIterable<V> selectedValues = collection.reject(new Predicate<V>()
                {
                    public boolean accept(V value)
                    {
                        return predicate.accept(key, value);
                    }
                });
                target.putAll(key, selectedValues);
            }
        });
        return target;
    }

    public <R extends MutableMultimap<K, V>> R selectKeysMultiValues(final Predicate2<? super K, ? super Iterable<V>> predicate, final R target)
    {
        this.forEachKeyMultiValues(new Procedure2<K, Iterable<V>>()
        {
            public void value(K key, Iterable<V> collection)
            {
                if (predicate.accept(key, collection))
                {
                    target.putAll(key, collection);
                }
            }
        });
        return target;
    }

    public <R extends MutableMultimap<K, V>> R rejectKeysMultiValues(final Predicate2<? super K, ? super Iterable<V>> predicate, final R target)
    {
        this.forEachKeyMultiValues(new Procedure2<K, Iterable<V>>()
        {
            public void value(K key, Iterable<V> collection)
            {
                if (!predicate.accept(key, collection))
                {
                    target.putAll(key, collection);
                }
            }
        });
        return target;
    }

    private static final class KeyValuePairFunction<V, K> implements Function<V, Pair<K, V>>
    {
        private static final long serialVersionUID = 1L;

        private final K key;

        private KeyValuePairFunction(K key)
        {
            this.key = key;
        }

        public Pair<K, V> valueOf(V value)
        {
            return Tuples.pair(this.key, value);
        }
    }

    public <K2, V2, R extends MutableMultimap<K2, V2>> R collectKeysValues(final Function2<? super K, ? super V, Pair<K2, V2>> function, final R target)
    {
        this.getMap().forEachKeyValue(new Procedure2<K, C>()
        {
            public void value(final K key, C collection)
            {
                collection.forEach(new Procedure<V>()
                {
                    public void value(V value)
                    {
                        Pair<K2, V2> pair = function.value(key, value);
                        target.add(pair);
                    }
                });
            }
        });
        return target;
    }

    public <V2, R extends MutableMultimap<K, V2>> R collectValues(final Function<? super V, ? extends V2> function, final R target)
    {
        this.getMap().forEachKeyValue(new Procedure2<K, C>()
        {
            public void value(K key, C collection)
            {
                target.putAll(key, collection.collect(function));
            }
        });
        return target;
    }
}


text:
using content::BrowserThread;
using search_provider_logos::Logo;
using search_provider_logos::LogoDelegate;
using search_provider_logos::LogoTracker;

namespace {

const char kCachedLogoDirectory[] = "Search Logo";
const int kDecodeLogoTimeoutSeconds = 30;

// Returns the URL where the doodle can be downloaded, e.g.
// https://www.google.com/async/newtab_mobile. This depends on the user's
// Google domain.
GURL GetGoogleDoodleURL(Profile* profile) {
  GURL google_base_url(UIThreadSearchTermsData(profile).GoogleBaseURLValue());
  const char kGoogleDoodleURLPath[] = "async/newtab_mobile";
  GURL::Replacements replacements;
  replacements.SetPathStr(kGoogleDoodleURLPath);
  return google_base_url.ReplaceComponents(replacements);
}

class LogoDecoderDelegate : public ImageDecoder::ImageRequest {
 public:
  LogoDecoderDelegate(
      const base::Callback<void(const SkBitmap&)>& image_decoded_callback)
      : ImageRequest(base::MessageLoopProxy::current()),
        image_decoded_callback_(image_decoded_callback),
        weak_ptr_factory_(this) {
    // If the ImageDecoder crashes or otherwise never completes, call
    // OnImageDecodeTimedOut() eventually to ensure that image_decoded_callback_
    // is run.
    base::MessageLoopProxy::current()->PostDelayedTask(
        FROM_HERE, base::Bind(&LogoDecoderDelegate::OnDecodeImageFailed,
                              weak_ptr_factory_.GetWeakPtr()),
        base::TimeDelta::FromSeconds(kDecodeLogoTimeoutSeconds));
  }

  ~LogoDecoderDelegate() override {}

  // ImageDecoder::ImageRequest:
  void OnImageDecoded(const SkBitmap& decoded_image) override {
    image_decoded_callback_.Run(decoded_image);
    delete this;
  }

  void OnDecodeImageFailed() override {
    image_decoded_callback_.Run(SkBitmap());
    delete this;
  }

 private:
  base::Callback<void(const SkBitmap&)> image_decoded_callback_;
  base::WeakPtrFactory<LogoDecoderDelegate> weak_ptr_factory_;

  DISALLOW_COPY_AND_ASSIGN(LogoDecoderDelegate);
};

class ChromeLogoDelegate : public search_provider_logos::LogoDelegate {
 public:
  ChromeLogoDelegate() {}
  ~ChromeLogoDelegate() override {}

  // search_provider_logos::LogoDelegate:
  void DecodeUntrustedImage(
      const scoped_refptr<base::RefCountedString>& encoded_image,
      base::Callback<void(const SkBitmap&)> image_decoded_callback) override {
    LogoDecoderDelegate* delegate =
        new LogoDecoderDelegate(image_decoded_callback);
    ImageDecoder::Start(delegate, encoded_image->data());
  }

 private:
  DISALLOW_COPY_AND_ASSIGN(ChromeLogoDelegate);
};

}  // namespace

// LogoService ----------------------------------------------------------------

LogoService::LogoService(Profile* profile) : profile_(profile) {
}

LogoService::~LogoService() {
}

void LogoService::GetLogo(search_provider_logos::LogoObserver* observer) {
  TemplateURLService* template_url_service =
      TemplateURLServiceFactory::GetForProfile(profile_);
  if (!template_url_service)
    return;

  TemplateURL* template_url = template_url_service->GetDefaultSearchProvider();
  if (!template_url || !template_url->url_ref().HasGoogleBaseURLs(
          template_url_service->search_terms_data()))
    return;

  if (!logo_tracker_) {
    logo_tracker_.reset(new LogoTracker(
        profile_->GetPath().Append(kCachedLogoDirectory),
        BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
        BrowserThread::GetBlockingPool(),
        profile_->GetRequestContext(),
        scoped_ptr<search_provider_logos::LogoDelegate>(
            new ChromeLogoDelegate())));
  }

  logo_tracker_->SetServerAPI(
      GetGoogleDoodleURL(profile_),
      base::Bind(&search_provider_logos::GoogleParseLogoResponse),
      base::Bind(&search_provider_logos::GoogleAppendQueryparamsToLogoURL),
      false);
  logo_tracker_->GetLogo(observer);
}

// LogoServiceFactory ---------------------------------------------------------

// static
LogoService* LogoServiceFactory::GetForProfile(Profile* profile) {
  return static_cast<LogoService*>(
      GetInstance()->GetServiceForBrowserContext(profile, true));
}

// static
LogoServiceFactory* LogoServiceFactory::GetInstance() {
  return Singleton<LogoServiceFactory>::get();
}

LogoServiceFactory::LogoServiceFactory()
    : BrowserContextKeyedServiceFactory(
          "LogoService",
          BrowserContextDependencyManager::GetInstance()) {
}

LogoServiceFactory::~LogoServiceFactory() {}

KeyedService* LogoServiceFactory::BuildServiceInstanceFor(
    content::BrowserContext* context) const {
  Profile* profile = static_cast<Profile*>(context);
  DCHECK(!profile->IsOffTheRecord());
  return new LogoService(profile);
}


text:
<?php

namespace App\Modules\Equipment\Application\Commands;

use App\Modules\Character\Domain\CharacterId;
use App\Modules\Equipment\Domain\ItemId;

class AddItemToInventoryCommand
{
    /**
     * @var CharacterId
     */
    private $characterId;
    /**
     * @var int
     */
    private $slot;
    /**
     * @var ItemId
     */
    private $itemId;

    public function __construct(CharacterId $characterId, int $slot, ItemId $itemId)
    {
        $this->characterId = $characterId;
        $this->slot = $slot;
        $this->itemId = $itemId;
    }

    public function getCharacterId(): CharacterId
    {
        return $this->characterId;
    }

    public function getSlot(): int
    {
        return $this->slot;
    }

    public function getItemId(): ItemId
    {
        return $this->itemId;
    }
}


text:
"""
:mod:`twitchtvnotifier` --- Twitch.tv Notification Plugin
=========================================================
"""

from __future__ import unicode_literals

__docformat__ = "restructuredtext en"

import urllib2
import urllib
import json
import atexit
from threading import Timer

# from Skype4Py.enums import cmsReceived, cmsSent

from plugin import Plugin
from output import ChatMessage
from dispatcher import dispatcher
from pluginmanager import chat_is_whitelisted
import signals

_timer = None

DEFAULT_CHECK_INTERVAL = 60

STATUS_ONLINE = 1
STATUS_OFFLINE = 0

MESSAGE_TEMPLATE = "{display_name} is now streaming {game} at {url}"

class TwitchTvNotifier(Plugin):
    _api_url = 'https://api.twitch.tv/kraken/streams'

    _headers = {
        "User-Agent": "Googlebot/2.1 (+http://www.googlebot.com/bot.html)",
        "Accept-Language": "en-US,en;q=0.5",
        "Connection": "Keep-Alive",
    }
    _opener = urllib2.build_opener()
    _opener.addheaders = [(k, v) for k, v in _headers.iteritems()]

    @staticmethod
    @atexit.register
    def _cleanup():
        global _timer
        try:
            _timer.cancel()
            _timer.join()
        except AttributeError:
            pass
        finally:
            del _timer

    def _check_streams(self):
        if not self.stream_names:
            return

        global _timer
        output = []
        try:
            data = self.retrieve_stream_data(self.stream_names)
        except:
            data = dict()
        for stream, params in data.iteritems():
            if not params:
                self.cache.set(stream, STATUS_OFFLINE)
                continue
            try:
                previous_state = int(self.cache.get(stream))
            except (TypeError, ValueError):
                previous_state = None
            if previous_state in (None, STATUS_OFFLINE):
                output.append(MESSAGE_TEMPLATE.format(**params))
            self.cache.set(stream, STATUS_ONLINE)

        if self.whitelist and output:
            message = "\n".join(output)
            responses = dispatcher.send(signals.REQUEST_CHATS)
            chats = responses[0]
            for chat in chats:
                if chat_is_whitelisted(chat, self.whitelist):
                    self.output.append(ChatMessage(chat, message))

        _timer = Timer(self.check_interval, self._check_streams)
        _timer.daemon = True
        _timer.start()

    def __init__(self, priority=0, whitelist=None, **kwargs):
        super(TwitchTvNotifier, self).__init__(priority, whitelist, **kwargs)
        self.check_interval = self.options.get('check_interval',
                                               DEFAULT_CHECK_INTERVAL)
        self.stream_names = self.options.get('streams', list())
        self.logger.info("Watching %s", self.stream_names)
        self._check_streams()

    def retrieve_stream_data(self, channels):
        """
        >>> plugin = TwitchTvNotifier()
        >>> data = plugin.retrieve_stream_data(['pingeee', 'beyondthesummit'])
        >>> data  #doctest: +NORMALIZE_WHITESPACE
        {u'beyondthesummit': {}, u'pingeee':
        {u'url': u'http://www.twitch.tv/pingeee', u'game':
        u'Heroes of the Storm', u'display_name': u'Pingeee'}}
        """

        args = dict()
        args.update({'channel': ','.join(channels)})
        url = ''.join((self._api_url, '?', urllib.urlencode(args)))
        data = json.loads(self._opener.open(url).read())
        streams = dict()
        for stream_data in data.get('streams'):
            try:
                name = stream_data.get('channel').get('name')
            except AttributeError:
                continue
            streams.setdefault(name, {
                'display_name': stream_data.get('channel').get('display_name'),
                'url': stream_data.get('channel').get('url'),
                'game': stream_data.get('game'),
            })
        for channel in channels:
            if channel not in streams:
                streams.update({channel: dict()})
        return streams

if __name__ == '__main__':
    import doctest
    doctest.testmod()


text:
module Evaluator
(
  evl
) where

import Types
import Subr
import Env
import Control.Monad.State
import Control.Monad.Except

evl :: SObj -> Env -> SError (SObj, Env)
evl exp env = do
   (val, (env, _)) <- runStateT (eval exp) (env, [])
   return (val, env)

eval :: SObj -> StateE SEnv SObj
-- self evaluating
eval (SInt x) = return $ SInt x
eval (SBool x) = return $ SBool x
-- variable
eval (SSymbol x) = do
  env <- get
  let val = lookupEnv x env
  case val of
    Nothing -> throwError $ "Unbound variable -- " ++ x
    Just v  -> return v
-- quotation
eval (SList [SSymbol "quote", exp] _) = return exp
-- assignment
eval (SList (SSymbol "set!" : exps) _) = evalSet exps
-- definition
eval (SList (SSymbol "define" : exps) _) = evalDef exps
---- if
eval (SList (SSymbol "if" : exps) _) = evalIf exps
-- cond
eval (SList (SSymbol "cond" : exps) _) = eval (cond2if $ SList (SSymbol "cond" : exps) Nil)
-- lambda
eval (SList (SSymbol "lambda" : exps) _) = do
  (_, r) <- get
  return $ makeLambda exps r
-- begin
eval (SList (SSymbol "begin" : exps) _) = evalSeq exps
-- application
eval (SList (op:args) _) = do
  op' <- eval op
  args' <- evalArgs args
  apply op' args'
eval exp = throwError $ "Unknown expression type -- " ++ show exp

evalArgs :: [SObj] -> StateE SEnv [SObj]
evalArgs exps = mapM eval exps

apply :: SObj -> [SObj] -> StateE SEnv SObj
apply (Primitive x) args = do
  let result = lookupPrimitive (Primitive x)
  case result of
    Nothing -> return Nil
    Just p  -> return (p args)
apply (SLambda params "" body lr) args = do
  when (length params < length args) $ throwError $ "Too many arguments supplied -- " ++ show params ++ ":" ++ show args
  when (length params > length args) $ throwError $ "Too few arguments supplied -- " ++ show params ++ ":" ++ show args
  (env, r) <- get
  put $ (extendEnv params args env, extendRef env lr)
  val <- evalSeq body
  modify (\(env', _) -> (env', r))
  return val
apply (SLambda params p body lr) args = do
  (env, r) <- get
  let n = length params
  let params' = params ++ [p]
  let args'   = take n args ++ [SList (drop n args) Nil]
  when (length params > length args) $ throwError $ "Too few arguments supplied -- " ++ show params ++ ":" ++ show args
  let newEnv = extendEnv params' args' env
  let newRef = extendRef env lr
  put $ (newEnv, newRef)
  val <- evalSeq body
  modify (\(env', _) -> (env', r))
  return val
apply exp args = throwError $ "Invalid application -- " ++ show exp

evalIf :: [SObj] -> StateE SEnv SObj
evalIf [pred, cnsq] = do
  result <- eval pred
  case result of
    SBool False -> return $ SBool False
    _           -> eval cnsq
evalIf [pred, cnsq, alt] = do
  result <- eval pred
  case result of
    SBool False -> eval alt
    _           -> eval cnsq
evalIf exps = throwError $ "Syntax error: if -- " ++ show exps

cond2if :: SObj -> SObj
cond2if (SList (SSymbol "cond" : clauses) _) = expandClause clauses

expandClause :: [SObj] -> SObj
expandClause [] = SBool False
expandClause (SList (SSymbol "else" : clause) _ : _) = seq2begin clause
expandClause (SList (pred:cnsq) _ : clauses) = SList [SSymbol "if", pred, seq2begin cnsq, expandClause clauses] Nil

seq2begin :: [SObj] -> SObj
seq2begin []   = Nil
seq2begin exps = SList (SSymbol "begin" : exps) Nil

makeLambda :: Body -> [Ref] -> SObj
makeLambda (Nil:body) = SLambda [] "" body
makeLambda (SList exps Nil : body) = SLambda (makeParams exps) "" body
makeLambda (SList exps (SSymbol tail) : body) = SLambda (makeParams exps) tail body

makeParams :: [SObj] -> [String]
makeParams exps = map (\(SSymbol name) -> name) exps

evalSeq :: [SObj] -> StateE SEnv SObj
evalSeq exps = foldM (\x y ->  eval y) Nil exps

evalSet :: [SObj] -> StateE SEnv SObj
evalSet [SSymbol var, val] = do
  val' <- eval val
  env <- get
  put $ setVar var val' env
  return $ SSymbol "ok"

evalDef :: [SObj] -> StateE SEnv SObj
evalDef [SSymbol var, SList (SSymbol "lambda" : body) _] = do
  (env, r) <- get
  put $ defineVar var (makeLambda body r) (env, r)
  return $ SSymbol "ok"
evalDef (SList (SSymbol var : params) Nil : body) = do
  (env, r) <- get
  put $ defineVar var (makeLambda (SList params Nil : body) r) (env, r)
  return $ SSymbol "ok"
evalDef (SList (SSymbol var : params) tail : body) = do
  (env, r) <- get
  put $ defineVar var (makeLambda (SList params tail : body) r) (env, r)
  return $ SSymbol "ok"
evalDef [SSymbol var, val] = do
  val' <- eval val
  env <- get
  put $ defineVar var val' env
  return $ SSymbol "ok"