text:
<!--
  ~ Copyright 2014 Dmytro Titov
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE tiles-definitions PUBLIC
        "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
        "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
    <definition name="index" template="/WEB-INF/views/index.jsp">
    </definition>
    <definition name="dashboard" template="/WEB-INF/views/dashboard.jsp">
        <put-attribute name="body" value=""/>
    </definition>
    <definition name="home" extends="dashboard">
        <put-attribute name="body" value="/WEB-INF/views/home.jsp"/>
    </definition>
    <definition name="campaigns" extends="dashboard">
        <put-attribute name="body" value="/WEB-INF/views/campaigns.jsp"/>
    </definition>
    <definition name="mentions" extends="dashboard">
        <put-attribute name="body" value="/WEB-INF/views/mentions.jsp"/>
    </definition>
    <definition name="users" extends="dashboard">
        <put-attribute name="body" value="/WEB-INF/views/users.jsp"/>
    </definition>
</tiles-definitions>

redpajama_set_name: RedPajamaGithub


text:
package net.sourceforge.squirrel_sql.client;

import java.awt.Font;

import javax.swing.UIManager;

import net.sourceforge.squirrel_sql.fw.gui.FontInfo;
/**
 * A store of <TT>FontInfo</TT> objects.
 */
public class FontInfoStore
{
	/** Default one. */
	private final FontInfo _defaultFontInfo = new FontInfo();

	/** For statusbars. */
	private FontInfo _statusBarFontInfo;

	/**
	 * Default ctor.
	 */
	public FontInfoStore()
	{
	    Font tmp = (Font)UIManager.get("Label.font");
	    if (tmp != null) {
	        Font font = tmp.deriveFont(10.0f);
	        _statusBarFontInfo = new FontInfo(font);
	    }
	}

	/**
	 * Gets the FontInfo for status bars.
	 *
	 * @return	Returns FontInfo for statusbars
	 */
	public FontInfo getStatusBarFontInfo()
	{
		return _statusBarFontInfo != null ? _statusBarFontInfo : _defaultFontInfo;
	}

	/**
	 * Sets the FontInfo for status bars.
	 *
	 * @param fi	The new FontInfo for status bars
	 */
	public void setStatusBarFontInfo(FontInfo fi)
	{
		_statusBarFontInfo = fi;
	}
}


text:
namespace ZooRestaurant.Services.Data.Contracts
{
    using System.Linq;
    using ZooRestaurant.Data.Models.AddressModels;

    public interface ITownsService : IBaseService<Town>
    {
        IQueryable<Neighborhood> GetTownNeigborhoods(int townId);
    }
}


text:
import { Injectable } from '@angular/core';
import { HttpService } from './http.service';
import { API } from './api.const';
import { Observable } from "rxjs";
import { Subject } from 'rxjs/Subject';

@Injectable()
export class UserService {

  static _url: string;

  userNameSub: Subject<string> = new Subject<string>();

  constructor(private http: HttpService) { }

  tokenExist() {
    return Boolean(localStorage.getItem('currentUser'));
  }

  setRetUrl(url) {
    UserService._url = url;
  }

  getRetUrl() {
    return UserService._url || '/';
  }

  getUserId() {
    const currentUserJson = localStorage.getItem('currentUser');
    if (!currentUserJson) {
      return null;
    }

    const currentUser = JSON.parse(currentUserJson);
    return currentUser.UserId;
  }

  saveCurrentUser(currentUser) {
    localStorage.setItem('currentUser', JSON.stringify(currentUser));
  }

  bindUserName(): Observable<string> {
    return this.userNameSub.asObservable();
  }

  refreshUserName(userName?: string) {
    if (userName !== undefined) {
      this.userNameSub.next(userName);
      return;
    }

    const currentUserJson = localStorage.getItem('currentUser');
    if (!currentUserJson) {
      this.userNameSub.next('');
      return;
    }

    const currentUser = JSON.parse(currentUserJson);
    this.userNameSub.next(currentUser.UserName);
  }

  login(model, suc, fail) {
    this.http.postJSON(API.getAPI("login"), model)
      .subscribe(ret => {
        this.saveCurrentUser(ret);
        this.refreshUserName(ret.UserName);
        suc(ret);
      }, err => fail(err));
  }

  logout() {
    localStorage.setItem('currentUser', '');
    this.refreshUserName('');
  }

  register(model, suc, fail) {
    this.http.postJSON(API.getAPI("register"), model)
      .subscribe(ret => suc(ret), err => fail(err));
  }

}


text:
import { module, test } from 'qunit';
import { setupIntegrationTest } from 'open-event-frontend/tests/helpers/setup-integration-test';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | widgets/forms/color picker', function(hooks) {
  setupIntegrationTest(hooks);

  test('it renders', async function(assert) {

    // Set any properties with this.set('myProperty', 'value');
    // Handle any actions with this.on('myAction', function(val) { ... });

    await render(hbs`{{widgets/forms/color-picker}}`);

    assert.equal(this.element.textContent.trim(), '');

    // Template block usage:
    await render(hbs`
      {{#widgets/forms/color-picker}}
        template block text
      {{/widgets/forms/color-picker}}
    `);

    assert.equal(this.element.textContent.trim(), 'template block text');
  });
});


text:
/**
 * Used to shim class extends.
 *
 * @param d The derived class.
 * @param b The base class.
 */
export declare function __extends(d: Function, b: Function): void;

/**
 * Copy the values of all of the enumerable own properties from one or more source objects to a
 * target object. Returns the target object.
 *
 * @param t The target object to copy to.
 * @param sources One or more source objects from which to copy properties
 */
export declare function __assign(t: any, ...sources: any[]): any;

/**
 * Performs a rest spread on an object.
 *
 * @param t The source value.
 * @param propertyNames The property names excluded from the rest spread.
 */
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;

/**
 * Applies decorators to a target object
 *
 * @param decorators The set of decorators to apply.
 * @param target The target object.
 * @param key If specified, the own property to apply the decorators to.
 * @param desc The property descriptor, defaults to fetching the descriptor from the target object.
 * @experimental
 */
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;

/**
 * Creates an observing function decorator from a parameter decorator.
 *
 * @param paramIndex The parameter index to apply the decorator to.
 * @param decorator The parameter decorator to apply. Note that the return value is ignored.
 * @experimental
 */
export declare function __param(paramIndex: number, decorator: Function): Function;

/**
 * Creates a decorator that sets metadata.
 *
 * @param metadataKey The metadata key
 * @param metadataValue The metadata value
 * @experimental
 */
export declare function __metadata(metadataKey: any, metadataValue: any): Function;

/**
 * Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
 *
 * @param thisArg The reference to use as the `this` value in the generator function
 * @param _arguments The optional arguments array
 * @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
 * @param generator The generator function
 */
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;

/**
 * Creates an Iterator object using the body as the implementation.
 *
 * @param thisArg The reference to use as the `this` value in the function
 * @param body The generator state-machine based implementation.
 *
 * @see [./docs/generator.md]
 */
export declare function __generator(thisArg: any, body: Function): any;

/**
 * Creates bindings for all enumerable properties of `m` on `exports`
 *
 * @param m The source object
 * @param exports The `exports` object.
 */
export declare function __exportStar(m: any, o: any): void;

/**
 * Creates a value iterator from an `Iterable` or `ArrayLike` object.
 *
 * @param o The object.
 * @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
 */
export declare function __values(o: any): any;

/**
 * Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
 *
 * @param o The object to read from.
 * @param n The maximum number of arguments to read, defaults to `Infinity`.
 */
export declare function __read(o: any, n?: number): any[];

/**
 * Creates an array from iterable spread.
 *
 * @param args The Iterable objects to spread.
 * @deprecated since TypeScript 4.2 - Use `__spreadArray`
 */
export declare function __spread(...args: any[][]): any[];

/**
 * Creates an array from array spread.
 *
 * @param args The ArrayLikes to spread into the resulting array.
 * @deprecated since TypeScript 4.2 - Use `__spreadArray`
 */
export declare function __spreadArrays(...args: any[][]): any[];

/**
 * Spreads the `from` array into the `to` array.
 *
 * @param pack Replace empty elements with `undefined`.
 */
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];

/**
 * Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
 * and instead should be awaited and the resulting value passed back to the generator.
 *
 * @param v The value to await.
 */
export declare function __await(v: any): any;

/**
 * Converts a generator function into an async generator function, by using `yield __await`
 * in place of normal `await`.
 *
 * @param thisArg The reference to use as the `this` value in the generator function
 * @param _arguments The optional arguments array
 * @param generator The generator function
 */
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;

/**
 * Used to wrap a potentially async iterator in such a way so that it wraps the result
 * of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
 *
 * @param o The potentially async iterator.
 * @returns A synchronous iterator yielding `__await` instances on every odd invocation
 *          and returning the awaited `IteratorResult` passed to `next` every even invocation.
 */
export declare function __asyncDelegator(o: any): any;

/**
 * Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
 *
 * @param o The object.
 * @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
 */
export declare function __asyncValues(o: any): any;

/**
 * Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
 *
 * @param cooked The cooked possibly-sparse array.
 * @param raw The raw string content.
 */
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;

/**
 * Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
 *
 * ```js
 * import Default, { Named, Other } from "mod";
 * // or
 * import { default as Default, Named, Other } from "mod";
 * ```
 *
 * @param mod The CommonJS module exports object.
 */
export declare function __importStar<T>(mod: T): T;

/**
 * Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
 *
 * ```js
 * import Default from "mod";
 * ```
 *
 * @param mod The CommonJS module exports object.
 */
export declare function __importDefault<T>(mod: T): T | { default: T };

/**
 * Emulates reading a private instance field.
 *
 * @param receiver The instance from which to read the private field.
 * @param state A WeakMap containing the private field value for an instance.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 *
 * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
 */
export declare function __classPrivateFieldGet<T extends object, V>(
    receiver: T,
    state: { has(o: T): boolean, get(o: T): V | undefined },
    kind?: "f"
): V;

/**
 * Emulates reading a private static field.
 *
 * @param receiver The object from which to read the private static field.
 * @param state The class constructor containing the definition of the static field.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The descriptor that holds the static field value.
 *
 * @throws {TypeError} If `receiver` is not `state`.
 */
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
    receiver: T,
    state: T,
    kind: "f",
    f: { value: V }
): V;

/**
 * Emulates evaluating a private instance "get" accessor.
 *
 * @param receiver The instance on which to evaluate the private "get" accessor.
 * @param state A WeakSet used to verify an instance supports the private "get" accessor.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The "get" accessor function to evaluate.
 *
 * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
 */
export declare function __classPrivateFieldGet<T extends object, V>(
    receiver: T,
    state: { has(o: T): boolean },
    kind: "a",
    f: () => V
): V;

/**
 * Emulates evaluating a private static "get" accessor.
 *
 * @param receiver The object on which to evaluate the private static "get" accessor.
 * @param state The class constructor containing the definition of the static "get" accessor.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The "get" accessor function to evaluate.
 *
 * @throws {TypeError} If `receiver` is not `state`.
 */
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
    receiver: T,
    state: T,
    kind: "a",
    f: () => V
): V;

/**
 * Emulates reading a private instance method.
 *
 * @param receiver The instance from which to read a private method.
 * @param state A WeakSet used to verify an instance supports the private method.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The function to return as the private instance method.
 *
 * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
 */
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
    receiver: T,
    state: { has(o: T): boolean },
    kind: "m",
    f: V
): V;

/**
 * Emulates reading a private static method.
 *
 * @param receiver The object from which to read the private static method.
 * @param state The class constructor containing the definition of the static method.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The function to return as the private static method.
 *
 * @throws {TypeError} If `receiver` is not `state`.
 */
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
    receiver: T,
    state: T,
    kind: "m",
    f: V
): V;

/**
 * Emulates writing to a private instance field.
 *
 * @param receiver The instance on which to set a private field value.
 * @param state A WeakMap used to store the private field value for an instance.
 * @param value The value to store in the private field.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 *
 * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
 */
export declare function __classPrivateFieldSet<T extends object, V>(
    receiver: T,
    state: { has(o: T): boolean, set(o: T, value: V): unknown },
    value: V,
    kind?: "f"
): V;

/**
 * Emulates writing to a private static field.
 *
 * @param receiver The object on which to set the private static field.
 * @param state The class constructor containing the definition of the private static field.
 * @param value The value to store in the private field.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The descriptor that holds the static field value.
 *
 * @throws {TypeError} If `receiver` is not `state`.
 */
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
    receiver: T,
    state: T,
    value: V,
    kind: "f",
    f: { value: V }
): V;

/**
 * Emulates writing to a private instance "set" accessor.
 *
 * @param receiver The instance on which to evaluate the private instance "set" accessor.
 * @param state A WeakSet used to verify an instance supports the private "set" accessor.
 * @param value The value to store in the private accessor.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The "set" accessor function to evaluate.
 *
 * @throws {TypeError} If `state` doesn't have an entry for `receiver`.
 */
export declare function __classPrivateFieldSet<T extends object, V>(
    receiver: T,
    state: { has(o: T): boolean },
    value: V,
    kind: "a",
    f: (v: V) => void
): V;

/**
 * Emulates writing to a private static "set" accessor.
 *
 * @param receiver The object on which to evaluate the private static "set" accessor.
 * @param state The class constructor containing the definition of the static "set" accessor.
 * @param value The value to store in the private field.
 * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
 * @param f The "set" accessor function to evaluate.
 *
 * @throws {TypeError} If `receiver` is not `state`.
 */
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
    receiver: T,
    state: T,
    value: V,
    kind: "a",
    f: (v: V) => void
): V;

/**
 * Checks for the existence of a private field/method/accessor.
 *
 * @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
 * @param receiver The object for which to test the presence of the private member.
 */
export declare function __classPrivateFieldIn(
    state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
    receiver: unknown,
): boolean;

/**
 * Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
 *
 * @param object The local `exports` object.
 * @param target The object to re-export from.
 * @param key The property key of `target` to re-export.
 * @param objectKey The property key to re-export as. Defaults to `key`.
 */
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;


text:
/**
 * //TODO add comments.
 *
 * Package for condition of the point
 *
 * @author Alexander Molodid (a.molodid@gmail.com)
 * @version $Id$
 * @since 0.1
 */
package ru.job4j.condition;


text:
import Reveal from './reveal'

Reveal.initialize({
				controls: true,
				progress: true,
				history: true,
				center: true,

				transition: 'slide', // none/fade/slide/convex/concave/zoom

				// Optional reveal.js plugins
				dependencies: [
					{ src: '/lib/js/classList.js', condition: function() { return !document.body.classList; } },
					{ src: '/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
					{ src: '/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
					{ src: '/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
					{ src: '/plugin/zoom-js/zoom.js', async: true },
					{ src: '/plugin/notes/notes.js', async: true }
				]
});


text:
/**
 * @file
 */
#pragma once

#include "src/expression/Expression.hpp"
#include "src/expression/EmptyExpression.hpp"

namespace birch {
/**
 * Object with brackets.
 *
 * @ingroup common
 */
class Bracketed {
public:
  /**
   * Constructor.
   *
   * @param brackets Expression in square brackets.
   */
  Bracketed(Expression* brackets);

  /**
   * Square bracket expression.
   */
  Expression* brackets;
};
}


text:
package com.freakybyte.aliadatest.model.services;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

/**
 * Created by Jose Torres in FreakyByte on 09/06/16.
 */
public class AliadaServiceModel {

    @SerializedName("id")
    @Expose
    private int id;
    @SerializedName("email")
    @Expose
    private String email;
    @SerializedName("full_name")
    @Expose
    private String fullName;
    @SerializedName("created_at")
    @Expose
    private String createdAt;
    @SerializedName("updated_at")
    @Expose
    private String updatedAt;

    /**
     *
     * @return
     * The id
     */
    public int getId() {
        return id;
    }

    /**
     *
     * @param id
     * The id
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     *
     * @return
     * The email
     */
    public String getEmail() {
        return email;
    }

    /**
     *
     * @param email
     * The email
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     *
     * @return
     * The fullName
     */
    public String getFullName() {
        return fullName;
    }

    /**
     *
     * @param fullName
     * The full_name
     */
    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    /**
     *
     * @return
     * The createdAt
     */
    public String getCreatedAt() {
        return createdAt;
    }

    /**
     *
     * @param createdAt
     * The created_at
     */
    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    /**
     *
     * @return
     * The updatedAt
     */
    public String getUpdatedAt() {
        return updatedAt;
    }

    /**
     *
     * @param updatedAt
     * The updated_at
     */
    public void setUpdatedAt(String updatedAt) {
        this.updatedAt = updatedAt;
    }

}


text:
<?php

namespace Tests\Views\Frontend;

use App\Authority;
use App\Elasticsearch\Repositories\AuthorityRepository;
use App\Elasticsearch\Repositories\ItemRepository;
use App\SearchResult;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AuthorViewTest extends TestCase
{
    use RefreshDatabase;

    public function testGetIndex()
    {
        $authorityRepositoryMock = $this->createMock(AuthorityRepository::class);
        $authorityRepositoryMock->expects($this->any())
            ->method('listValues')
            ->willReturn(collect());
        $authorityRepositoryMock->expects($this->once())
            ->method('search')
            ->willReturn(new SearchResult(collect(), 0));
        $this->app->instance(AuthorityRepository::class, $authorityRepositoryMock);

        $response = $this->get('/autori');
        $response->assertStatus(200);
    }

    public function testGetSuggestions()
    {
        $authorityRepositoryMock = $this->createMock(AuthorityRepository::class);
        $authorityRepositoryMock->expects($this->once())
            ->method('getSuggestions')
            ->willReturn(new SearchResult(collect(), 0));
        $this->app->instance(AuthorityRepository::class, $authorityRepositoryMock);

        $response = $this->get('/autori/suggestions?search=test');
        $response->assertStatus(200);
    }

    public function testGetSuggestionsMissingParameter()
    {
        $authorityRepositoryMock = $this->createMock(AuthorityRepository::class);
        $this->app->instance(AuthorityRepository::class, $authorityRepositoryMock);

        $response = $this->get('/autori/suggestions');
        $response->assertStatus(200);
    }

    public function testGetSuggestionsArrayParameter()
    {
        $authorityRepositoryMock = $this->createMock(AuthorityRepository::class);
        $this->app->instance(AuthorityRepository::class, $authorityRepositoryMock);

        $response = $this->get('/autori/suggestions?search[]=test');
        $response->assertStatus(200);
    }

    public function testGetDetail()
    {
        $itemRepositoryMock = $this->createMock(ItemRepository::class);
        $itemRepositoryMock->expects($this->once())
            ->method('getPreviewItems')
            ->willReturn(collect());
        $this->app->instance(ItemRepository::class, $itemRepositoryMock);

        $author = factory(Authority::class)->create();

        $response = $this->get(sprintf('/autor/%s', $author->id));
        $response->assertStatus(200);
    }
}


text:
package org.ayo.richtext.htmlhandler;

import android.graphics.Color;
import android.text.Editable;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;

import org.xml.sax.Attributes;

/**
 * 自定义标签解析类,处理:呵呵呵哈哈哈嘿嘿嘿
 * Created by Administrator on 2016/3/29.
 */
public class SpanStyleHandler extends HtmlTagHandler.AbstractTagHandler {

    private String fontColor = "";

    @Override
    protected Object parseAttrtoSpan(String tag, Attributes attrs) {
        for(int i = 0; i < attrs.getLength(); i++){
            if(attrs.getLocalName(i).equals("style")){
                //style={color:red}
                String style = attrs.getValue(i); //{color:#e60012}
                fontColor = style.replace("{", "").replace("}", "").replace("color", "").replace(":", "");
                return new ForegroundColorSpan(Color.parseColor(fontColor));
            }
        }
        return null;
    }

    @Override
    protected boolean isForTag(String tag) {
        return tag.equalsIgnoreCase("span");
    }
}


text:
import { EMPTY, Observable, of, throwError } from 'rxjs';

import { Injectable } from '@angular/core';
import { Email } from './email';
import { EmailsData } from './emails-data';

@Injectable()
export class EmailService {

  emailData: EmailsData = new EmailsData();

  getEmail(accountName: string, id: number): Observable<Email | never> {
    if (!this.emailData || !this.emailData.eMailsList || !this.emailData.eMailsList.length) {
      return EMPTY;
    }
    const mails = this.emailData.eMailsList.find(mail => mail.account === accountName);
    if (mails && mails.emails && mails.emails.length) {
      const mail = mails.emails.find(m => m.id === id);
      if (mail) {
        return of(mail);
      } else {
        return throwError(() => Error('Email not found'));
      }
    }
    return EMPTY;
  }
}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>ECS160Android: android/src/game/network Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

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

ECS160Android

FortNitta Android platform team

Main Page

Related Pages

Classes

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

android

src

game

network

network Directory Reference

Files

file  	CAuthorizationMessage.java

file  	CCreateRoomMessage.java

file  	CDisconnectMessage.java

file  	CEndGameMessage.java

file  	CEndGameResponse.java

file  	CFiredCannonResponse.java

file  	CGetAvailableRoomsMessage.java

file  	CInGameActionMessage.java

file  	CJoinRoomMessage.java

file  	CLeaveRoomMessage.java

file  	CLoginResponse.java

file  	CNetwork.java

file  	CNetworkConstants.java

file  	CNetworkMessage.java

file  	CNetworkPacketFactory.java

file  	CNetworkReceive.java

file  	CNetworkResponse.java

file  	COwnerLeftRoomResponse.java

file  	CPlacedCannonResponse.java

file  	CPlacedWallResponse.java

file  	CPlayerJoinedResponse.java

file  	CPlayerLeftResponse.java

file  	CPointerLocationResponse.java

file  	CRoomCreatedResponse.java

file  	CRoomDeniedResponse.java

file  	CRoomJoinedResponse.java

file  	CRoomsAvailableResponse.java

file  	CRotatedWallResponse.java

file  	CSelectedCastleResponse.java

file  	CStartGameMessage.java

file  	CStartGameResponse.java

<address class="footer">
Generated on Sun Mar 15 2015 22:20:55 for ECS160Android by

 1.8.9.1
</address>


text:
(function () {
    'use strict';

    var gulp             = require('gulp'),
        sourcemaps       = require('gulp-sourcemaps'),
        less             = require('gulp-less'),
        bower            = require('gulp-bower'),
        mainBowerFiles   = require('main-bower-files'),
        rename           = require('gulp-rename'),
        jshint           = require('gulp-jshint'),
        jscs             = require('gulp-jscs'),
        phpcs            = require('gulp-phpcs'),
        phpcbf           = require('gulp-phpcbf'),
        stylish          = require('jshint-stylish'),
        jsdoc            = require('gulp-jsdoc3'),
        map              = require('map-stream'),
        watch            = require('gulp-watch'),
        del              = require('del'),
        exec             = require('child_process').exec,
        gulpSequence     = require('gulp-sequence'),
        CleanPlugin      = require('less-plugin-clean-css'),
        AutoprefixPlugin = require('less-plugin-autoprefix'),
        jsdocConfig      = require('./jsdocConfig.json'),
        docPath          = '../../ziperrom1.github.io/websocket-doc',
        jsSrc            = ['js/lib/*.js', 'js/app.js', 'js/main.js'],
        phpSrc           = ['../php/**/*.php', '!../php/vendor/**/*.*'],
        clean            = new CleanPlugin({
            advanced: true
        }),
        autoprefix = new AutoprefixPlugin({
            browsers: ["last 2 versions"]
        }),
        jshintReporter;

    /**
     * Add and commit git documentation changes on phpDoc or jsDoc
     *
     * @method     gitDoc
     * @param      {String}    directory  The directory name ("phpDoc" or "jsDoc")
     * @param      {Function}  callback   A callback function to monitor the end of the command
     */
    function gitDoc(directory, callback) {
        exec(
            'cd ' + docPath + ' ' +
            '&call git add ' + directory + ' ' +
            '&call git commit ' + directory + ' -m "update ' + directory + '"',
            function (err, output) {
                console.log(output);
                callback(err);
            }
        );
    }

    /*============================================
    =            Flush vendor sources            =
    ============================================*/

    gulp.task('flush_bower', function () {
        del('.bowerDependencies');
    });

    gulp.task('flush_npm', function () {
        del('node_modules');
    });

    gulp.task('flush_js', function () {
        del('js/lib/vendor');
    });

    gulp.task('flush_less', function () {
        del(['less/vendor/*', '!less/vendor/variables.less']);
    });

    gulp.task('flush_dist', function () {
        del('dist/*');
    });

    gulp.task('flush', function (done) {
        gulpSequence(['flush_bower', 'flush_npm', 'flush_js', 'flush_less', 'flush_dist'], done);
    });

    /*=====  End of Flush vendor sources  ======*/

    /*=============================================
    =            Import vendor sources            =
    =============================================*/

    gulp.task('bower_install', function () {
        return bower({ cmd: 'update'});
    });

    gulp.task('bower_move_js', ['bower_install'], function () {
        return gulp.src(mainBowerFiles()).pipe(gulp.dest('js/lib/vendor'));
    });

    gulp.task('bower_move_less', ['bower_install'], function () {
        gulp.src(mainBowerFiles()).pipe(gulp.dest('less/vendor'));

        return gulp.src(
            ['.bowerDependencies/bootstrap/less/**', '!.bowerDependencies/bootstrap/less/variables.less']
        ).pipe(gulp.dest('less/vendor'));
    });

    gulp.task('bower_move_fonts', ['bower_install'], function () {
        return gulp.src('.bowerDependencies/bootstrap/fonts/**').pipe(gulp.dest('fonts'));
    });

    gulp.task('bower_clean', ['bower_move_js', 'bower_move_less', 'bower_move_fonts'], function () {
        del(['js/lib/vendor/*', '!js/lib/vendor/*.js']);
        del(['less/vendor/*', '!less/vendor/*.less', '!less/vendor/mixins']);
    });

    gulp.task('install', function (done) {
        gulpSequence('bower_install', ['bower_move_js', 'bower_move_less', 'bower_move_fonts'], 'bower_clean', done);
    });

    /*=====  End of Import vendor sources  ======*/

    /*====================================================
    =            Build js / less and optimize            =
    ====================================================*/

    gulp.task('build_js', function (done) {
        exec(
            'cd ./js&node ../node_modules/requirejs/bin/r.js -o app.build.js',
            function (err, output) {
                console.log(output);
                done(err);
            }
        );
    });

    gulp.task('build_less', function () {
        return gulp.src('less/build.less')
            .pipe(sourcemaps.init())
            .pipe(less({
                plugins: [clean, autoprefix]
            }))
            .pipe(sourcemaps.write()) // @todo can't write sourcemap on an external file
            .pipe(rename('style.css'))
            .pipe(gulp.dest('dist'));
    });

    gulp.task('build', function (done) {
        gulpSequence(['build_js', 'build_less'], done);
    });

    /*=====  End of Build js / less and optimize  ======*/

    /*===============================
    =            Linters            =
    ===============================*/

    jshintReporter = map(function (file, cb) {
        if (!file.jshint.success) {
            console.log('[FAIL] ' + file.path);
        } else {
            console.log('[OK]   ' + file.path);
        }

        cb(null, file);
    });

    gulp.task('js_jscs', function () {
        return gulp.src(jsSrc)
            .pipe(jscs({fix: true}))
            .pipe(jscs.reporter())
            .pipe(gulp.dest(function (file) {
                return file.base;
            }));
    });

    gulp.task('js_jshint', function () {
        return gulp.src(jsSrc)
            .pipe(jshint())
            .pipe(jshint.reporter(stylish))
            .pipe(jshintReporter);
    });

    gulp.task('php_phpcs', function () {
        return gulp.src(phpSrc)
            .pipe(phpcs({
                bin            : process.cwd().replace('static', 'php') + '\\vendor\\bin\\phpcs.bat',
                standard       : 'PSR2',
                warningSeverity: 0
            }))
            .pipe(phpcs.reporter('log'));
    });

    gulp.task('php_phpcbf', function () {
        return gulp.src(phpSrc)
            .pipe(phpcbf({
                bin            : process.cwd().replace('static', 'php') + '\\vendor\\bin\\phpcbf.bat',
                standard       : 'PSR2',
                warningSeverity: 0
            }))
            .pipe(gulp.dest(function (file) {
                return file.base;
            }));
    });

    gulp.task('js_lint', function (done) {
        gulpSequence('js_jscs', 'js_jshint', done);
    });

    gulp.task('php_lint', function (done) {
        gulpSequence('php_phpcbf', 'php_phpcs', done);
    });

    /*=====  End of Linters  ======*/

    /*================================================
    =            Documentation generation            =
    ================================================*/

    gulp.task('jsdoc_generation', function (cb) {
        gulp.src(['../README.md', './js/**/*.js'], {read: false}).pipe(jsdoc(jsdocConfig, cb));
    });

    gulp.task('phpdoc_generation', function (done) {
        exec(
            'cd ../php ' +
            '&"./vendor/bin/phpdoc" --quiet',
            function (err, output) {
                console.log(output);
                done(err);
            }
        );
    });

    gulp.task('git_js_doc', function (done) {
        gitDoc('jsDoc', done);
    });

    gulp.task('git_php_doc', function (done) {
        gitDoc('phpDoc', done);
    });

    gulp.task('jsDoc', function (done) {
        gulpSequence('jsdoc_generation', 'git_js_doc', done);
    });

    gulp.task('phpDoc', function (done) {
        gulpSequence('phpdoc_generation', 'git_php_doc', done);
    });

    gulp.task('push_doc', function (done) {
        exec(
            'cd ' + docPath + ' ' +
            '&call git pull origin master ' +
            '&call git push origin master',
            function (err, output) {
                console.log(output);
                done(err);
            }
        );
    });

    gulp.task('doc', function (done) {
        gulpSequence('jsDoc', 'phpDoc', done);
    });

    /*=====  End of Documentation generation  ======*/

    /*=================================================
    =            Deployment preprocessing            =
    =================================================*/

    gulp.task('deploy_static', function (done) {
        gulpSequence('install', 'js_lint', 'build', 'jsDoc', 'push_doc', done);
    });

    gulp.task('deploy_php', function (done) {
        gulpSequence('php_lint', 'phpDoc', 'push_doc', done);
    });

    gulp.task('deploy', function (done) {
        gulpSequence('deploy_static', 'deploy_php', done);
    });

    /*=====  End of Deployment preprocessing  ======*/

    /*========================================
    =            Watch less files            =
    ========================================*/

    gulp.task('watch', function () {
        watch('less/**/*.less', {read: false}, function (vinyl) {
            var string = vinyl.path;

            switch (vinyl.event) {
            case 'add':
                string += ' has been created';
                break;

            case 'change':
                string += ' has changed';
                break;

            case 'unlink':
            case 'unlinkDir':
                string += ' has been removed';
                break;
            }

            console.log(string);
            gulp.start('build_less');
        });
    });

    /*=====  End of Watch less files  ======*/

    gulp.task('default', ['install']);
}());


text:
require 'fileutils'

class InstanceObserver < ActiveRecord::Observer
	@state_changed = false
	@dns_active_changed = false
	@ready_changed = false

	def before_save(instance)
		@state_changed = true if instance.state_changed?
		@dns_active_changed = true if instance.dns_active_changed?
		@ready_changed = true if instance.is_ready_changed?
		return true
	end

	def after_create(instance)
		# get launch configuration from the server (if available)
		unless instance.server_id.blank? or !instance.server.has_resource_bundles?
			begin
				server = instance.server
				# default prefix for messages
				msg_prefix = "instance.after_create: server #{server.name} [#{server.id}], instance #{instance.name} [#{instance.id}]"
				unless instance.pending_launch_configuration_id.blank?
					rb = server.resource_bundles.detect{ |rb| rb.id == instance.pending_launch_configuration_id }
				end
				# if not specified - find available in the instance's zone
				if rb.nil?
					rb = server.next_available_resource_bundle(instance.zone)
				end
				# configure resources if any
				unless rb.nil?
					rb.allocate!(instance)
					msg = "#{msg_prefix} - successfully allocated launch configuration [#{rb.id}]"
					Rails.logger.debug msg
				end
			rescue Exception => e
				msg = "#{msg_prefix} - failed to allocate launch configuration due to: #{e.message}"
				Rails.logger.error msg+"\n\t#{e.backtrace.join("\n\t")}"
				instance.errors.add(:state, msg)
				server.errors.add(:state, msg)
			end
		end

		return true
	end

	def after_save(instance)
		# acquire / release dns leases
		if instance.is_ready?
			instance.acquire_dns_leases if (@ready_changed || @dns_active_changed) && instance.dns_assignable?
			if (@state_changed && instance.terminating?) || (@dns_active_changed && instance.dns_inactive?)
				instance.release_dns_leases
			end
		end
		# release resources
		if @state_changed and instance.terminating? and !instance.resource_bundle.nil?
			instance.resource_bundle.release!
		end
		return true
	end
end


text:
import json

from channels import Group
from channels.auth import channel_session_user_from_http

@channel_session_user_from_http
def ws_connect(message):
    user = message.user.username
    Group(user).add(message.reply_channel)
    Group(user).send({'text': json.dumps({'connected': True})})

def send_message_to_group(user, message):
    Group(user).send({
        "text": json.dumps(message)
    })

def send_message(user, priority, contents):
    send_message_to_group(user, {'priority': priority, 'contents': contents})

def send_exp_package_creation_status_update(user, progress_nr, completed=False, redirect_url=None, error=None):
    message_dict = {}
    message_dict['completed'] = completed
    message_dict['progress_nr'] = progress_nr
    if redirect_url:
        message_dict['redirect_url'] = redirect_url
    if error:
        message_dict['error'] = error
    send_message_to_group(user, message_dict)