text:
package fixtures

import java.net.URLEncoder

trait LoginFixture {
  val signInUri: String = """http://localhost:9025/gg/sign-in"""
  val encodedContinueUrl: String = URLEncoder.encode(s"http://localhost:9895/register-for-vat/post-sign-in", "UTF-8")
  lazy val authUrl = s"$signInUri?accountType=organisation&continue=$encodedContinueUrl&origin=vat-registration-frontend"
}

redpajama_set_name: RedPajamaGithub


text:
import pytest as pytest

from sanic import Sanic
from sanic.exceptions import InvalidUsage
from sanic.response import text, HTTPResponse
from sanic.views import HTTPMethodView, CompositionView
from sanic.blueprints import Blueprint
from sanic.request import Request
from sanic.constants import HTTP_METHODS

@pytest.mark.parametrize('method', HTTP_METHODS)
def test_methods(method):
    app = Sanic('test_methods')

    class DummyView(HTTPMethodView):

        async def get(self, request):
            assert request.stream is None
            return text('', headers={'method': 'GET'})

        def post(self, request):
            return text('', headers={'method': 'POST'})

        async def put(self, request):
            return text('', headers={'method': 'PUT'})

        def head(self, request):
            return text('', headers={'method': 'HEAD'})

        def options(self, request):
            return text('', headers={'method': 'OPTIONS'})

        async def patch(self, request):
            return text('', headers={'method': 'PATCH'})

        def delete(self, request):
            return text('', headers={'method': 'DELETE'})

    app.add_route(DummyView.as_view(), '/')
    assert app.is_request_stream is False

    request, response = getattr(app.test_client, method.lower())('/')
    assert response.headers['method'] == method

def test_unexisting_methods():
    app = Sanic('test_unexisting_methods')

    class DummyView(HTTPMethodView):

        def get(self, request):
            return text('I am get method')

    app.add_route(DummyView.as_view(), '/')
    request, response = app.test_client.get('/')
    assert response.text == 'I am get method'
    request, response = app.test_client.post('/')
    assert response.text == 'Error: Method POST not allowed for URL /'

def test_argument_methods():
    app = Sanic('test_argument_methods')

    class DummyView(HTTPMethodView):

        def get(self, request, my_param_here):
            return text('I am get method with %s' % my_param_here)

    app.add_route(DummyView.as_view(), '/<my_param_here>')

    request, response = app.test_client.get('/test123')

    assert response.text == 'I am get method with test123'

def test_with_bp():
    app = Sanic('test_with_bp')
    bp = Blueprint('test_text')

    class DummyView(HTTPMethodView):

        def get(self, request):
            assert request.stream is None
            return text('I am get method')

    bp.add_route(DummyView.as_view(), '/')

    app.blueprint(bp)
    request, response = app.test_client.get('/')

    assert app.is_request_stream is False
    assert response.text == 'I am get method'

def test_with_bp_with_url_prefix():
    app = Sanic('test_with_bp_with_url_prefix')
    bp = Blueprint('test_text', url_prefix='/test1')

    class DummyView(HTTPMethodView):

        def get(self, request):
            return text('I am get method')

    bp.add_route(DummyView.as_view(), '/')

    app.blueprint(bp)
    request, response = app.test_client.get('/test1/')

    assert response.text == 'I am get method'

def test_with_middleware():
    app = Sanic('test_with_middleware')

    class DummyView(HTTPMethodView):

        def get(self, request):
            return text('I am get method')

    app.add_route(DummyView.as_view(), '/')

    results = []

    @app.middleware
    async def handler(request):
        results.append(request)

    request, response = app.test_client.get('/')

    assert response.text == 'I am get method'
    assert type(results[0]) is Request

def test_with_middleware_response():
    app = Sanic('test_with_middleware_response')

    results = []

    @app.middleware('request')
    async def process_response(request):
        results.append(request)

    @app.middleware('response')
    async def process_response(request, response):
        results.append(request)
        results.append(response)

    class DummyView(HTTPMethodView):

        def get(self, request):
            return text('I am get method')

    app.add_route(DummyView.as_view(), '/')

    request, response = app.test_client.get('/')

    assert response.text == 'I am get method'
    assert type(results[0]) is Request
    assert type(results[1]) is Request
    assert isinstance(results[2], HTTPResponse)

def test_with_custom_class_methods():
    app = Sanic('test_with_custom_class_methods')

    class DummyView(HTTPMethodView):
        global_var = 0

        def _iternal_method(self):
            self.global_var += 10

        def get(self, request):
            self._iternal_method()
            return text('I am get method and global var is {}'.format(self.global_var))

    app.add_route(DummyView.as_view(), '/')
    request, response = app.test_client.get('/')
    assert response.text == 'I am get method and global var is 10'

def test_with_decorator():
    app = Sanic('test_with_decorator')

    results = []

    def stupid_decorator(view):
        def decorator(*args, **kwargs):
            results.append(1)
            return view(*args, **kwargs)
        return decorator

    class DummyView(HTTPMethodView):
        decorators = [stupid_decorator]

        def get(self, request):
            return text('I am get method')

    app.add_route(DummyView.as_view(), '/')
    request, response = app.test_client.get('/')
    assert response.text == 'I am get method'
    assert results[0] == 1

def test_composition_view_rejects_incorrect_methods():
    def foo(request):
        return text('Foo')

    view = CompositionView()

    with pytest.raises(InvalidUsage) as e:
        view.add(['GET', 'FOO'], foo)

    assert str(e.value) == 'FOO is not a valid HTTP method.'

def test_composition_view_rejects_duplicate_methods():
    def foo(request):
        return text('Foo')

    view = CompositionView()

    with pytest.raises(InvalidUsage) as e:
        view.add(['GET', 'POST', 'GET'], foo)

    assert str(e.value) == 'Method GET is already registered.'

@pytest.mark.parametrize('method', HTTP_METHODS)
def test_composition_view_runs_methods_as_expected(method):
    app = Sanic('test_composition_view')

    view = CompositionView()

    def first(request):
        assert request.stream is None
        return text('first method')
    view.add(['GET', 'POST', 'PUT'], first)
    view.add(['DELETE', 'PATCH'], lambda x: text('second method'))

    app.add_route(view, '/')
    assert app.is_request_stream is False

    if method in ['GET', 'POST', 'PUT']:
        request, response = getattr(app.test_client, method.lower())('/')
        assert response.text == 'first method'

    if method in ['DELETE', 'PATCH']:
        request, response = getattr(app.test_client, method.lower())('/')
        assert response.text == 'second method'

@pytest.mark.parametrize('method', HTTP_METHODS)
def test_composition_view_rejects_invalid_methods(method):
    app = Sanic('test_composition_view')

    view = CompositionView()
    view.add(['GET', 'POST', 'PUT'], lambda x: text('first method'))

    app.add_route(view, '/')

    if method in ['GET', 'POST', 'PUT']:
        request, response = getattr(app.test_client, method.lower())('/')
        assert response.status == 200
        assert response.text == 'first method'

    if method in ['DELETE', 'PATCH']:
        request, response = getattr(app.test_client, method.lower())('/')
        assert response.status == 405


text:
Pattern: Missing use of JSON notation for `CMD`/`ENTRYPOINT`

Issue: -

## Description

When using the plain text version of passing arguments, signals from the OS are not correctly passed to the executables, which is in the majority of the cases what you would expect.

Example of **incorrect** code:

```dockerfile
FROM busybox
ENTRYPOINT s3cmd
```

```dockerfile
FROM busybox
CMD my-service server
```

Example of **correct** code:

```dockerfile
FROM busybox
ENTRYPOINT ["s3cmd"]
```

```dockerfile
FROM busybox
CMD ["my-service", "server"]
```

**Warning**: Docker `CMD` does not process `$ENVIRONMENT_VARIABLE`s, that's a side-effect of using `sh -c` as the default entry-point. Using the JSON notation means that you have to figure out how to handle environment variables yourself.

## Further Reading

* [Hadolint - DL3025](https://github.com/hadolint/hadolint/wiki/DL3025)
* [Best practices for writing Dockerfiles - CMD](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#cmd)


text:
<!DOCTYPE html>

    <title>Dir Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>

RbSwift Docs (73% documented)

View on GitHub

        RbSwift Reference

        Dir Class Reference

            Classes

                Dir

                – HomeDirectory

                – RemoveDirectoryError

                File

                FileUtils

                IO

                – SeekPosition

                Stat

            Extensions

                Array

                Calendar

                Character

                Data

                Date

                – Period

                Double

                Error

                Float

                Hash

                IndexPath

                IndexSet

                Int

                Int16

                Int32

                Int64

                Integer

                NSCalendar

                NSData

                NSDate

                NSError

                NSIndexPath

                NSIndexSet

                NSRange

                NSString

                NSTimeZone

                NSURL

                NSURLComponents

                NSURLRequest

                Sequence

                String

                – LetterCase

                TimeZone

                UInt

                UInt16

                UInt32

                UInt64

                URL

                URLComponents

                URLRequest

            Functions

                &(_:_:)

                *(_:_:)

                *(_:_:)

                *(_:_:)

                *(_:_:)

                **(_:_:)

                **(_:_:)

                +(_:_:)

                +(_:_:)

                +(_:_:)

                +(_:_:)

                -(_:_:)

                <<(_:_:)

                ==(_:_:)

                =~(_:_:)

                =~(_:_:)

            Protocols

                OptionalType

                RegexConvertible

            Structs

                DateFormat

                Duration

                MatchData

                Pathname

                Regex

            Typealiases

                Hash

Dir

Undocumented

                    path

Returns the path parameter passed to dir's constructor.

Declaration

Swift

public let path: String

                        Show on GitHub

                    fileno

Returns the file descriptor used in dir.
This method uses dirfd() function defined by POSIX 2008.

Declaration

Swift

public var fileno: Int

                        Show on GitHub

                    pos

Returns the current position in dir. See also Dir#seek(pos:).

Declaration

Swift

public var pos: Int

                        Show on GitHub

                    tell

Returns the current position in dir.

Declaration

Swift

public var tell: Int

                        Show on GitHub

                    to_path

Returns the path parameter passed to dir's constructor.

Declaration

Swift

public var to_path: String

                        Show on GitHub

                    inspect

Return a string describing this Dir object.

Declaration

Swift

public var inspect: String

                        Show on GitHub

                    description

Return a string describing this Dir object.

Declaration

Swift

public var description: String

                        Show on GitHub

                    init(_:)

Returns a new directory object for the named directory.

Declaration

Swift

public init?(_ path: String)

                        Show on GitHub

                    new(_:)

Returns a new directory object for the named directory.

Declaration

Swift

public static func new(_ path: String) -> Dir?

Parameters

                                path

A directory path.

Return Value

A new Dir object or nil.

                        Show on GitHub

                    open(_:)

Returns a new directory object for the named directory.

Declaration

Swift

public static func open(_ path: String) -> Dir?

Parameters

                                path

A directory path.

Return Value

A new Dir object or nil.

                        Show on GitHub

                    getwd

Returns the path to the current working directory of this process as a string.

Declaration

Swift

public static var getwd: String

                        Show on GitHub

                    pwd

Returns the path to the current working directory of this process as a string.
An alias to Dir#getwd var.

Declaration

Swift

public static var pwd: String

                        Show on GitHub

                    home

Returns the home directory of the current user or the named user if given.

Dir.home       #=> "/Users/username"

Declaration

Swift

public static var home: String

                        Show on GitHub

                    HomeDirectory

Error throws when user doesn’t exists.

notExists: User doesn’t exists

                        See more

Declaration

Swift

public enum HomeDirectory: Error

                        Show on GitHub

                    home(_:)

Returns the home directory of the current user or the named user if given.

Dir.home()       #=> "/Users/username"
Dir.home("user") #=> "/user"

Throws

    HomeDirectory.notExists if user doesn’t exist.

Declaration

Swift

public static func home(_ user: String? = nil) throws -> String

Parameters

                                path

The name of user.

Return Value

Home directory.

                        Show on GitHub

                    chdir(_:)

Changes the current working directory of the process to the given string.

Dir.chdir("/var/spool/mail")
Dir.pwd     #=> "/var/spool/mail"

Declaration

Swift

public static func chdir(_ path: String = "~") -> Bool

Parameters

                                path

A new current working directory.

Return Value

A bool indicates the result of Dir#chdir(path:)

                        Show on GitHub

                    chroot(_:)

Changes this process's idea of the file system root.

See also

    Darwin.chroot.

Declaration

Swift

public static func chroot(_ path: String) -> Bool

Parameters

                                path

A directory path.

Return Value

A bool value indicates the result of Darwin.chroot

                        Show on GitHub

                    chdir(_:closure:)

Changes the current working directory of the process to the given string.
Block is passed the name of the new current directory, and the block
is executed with that as the current directory. The original working directory
is restored when the block exits. The return value of chdir is the value of the block.

Dir.pwd         #=> "/work"
let value = Dir.chdir("/var") {
    Dir.pwd     #=> "/var"
    return 1
}
Dir.pwd         #=> "/work"
value   #=> 1

Declaration

Swift

public static func chdir<T>(_ path: String = "~", closure: ((Void) -> T)) -> T

Parameters

                                path

A new current working directory.

                                closure

A block executed in target directory.

Return Value

The value of the closure.

                        Show on GitHub

                    mkdir(_:recursive:_:)

Makes a new directory named by string, with permissions specified by the optional parameter anInteger.

try Dir.mkdir("draveness")
try! Dir.mkdir("draveness/spool/mail", recursive: true)

Throws

    When FileManager#createDirectory(atPath:withIntermediateDirectories:attributes:) throws.

Declaration

Swift

public static func mkdir(_ path: String, recursive: Bool = false, _ permissions: Int? = nil) throws

Parameters

                                path

A new directory path.

                                recursive

Whether creats intermeidate directories.

                                permissions

An integer represents the posix permission.

                        Show on GitHub

                    RemoveDirectoryError

Error throws when called Dir#rmdir(path:) method.

notEmpty: Directory is not empty.

notExists: Directory is not exists.

                        See more

Declaration

Swift

public enum RemoveDirectoryError: Error

                        Show on GitHub

                    rmdir(_:)

Deletes the named directory.

try Dir.rmdir("/a/folder/path")

Throws

    RemoveDirectoryError if the directory isn't empty.

Declaration

Swift

public static func rmdir(_ path: String) throws

Parameters

                                path

A directory path

                        Show on GitHub

                    unlink(_:)

Deletes the named directory. An alias to Dir.rmdir(path:).

try Dir.unlink("/a/folder/path")

Throws

    RemoveDirectoryError if the directory isn't empty.

Declaration

Swift

public static func unlink(_ path: String) throws

Parameters

                                path

A directory path

                        Show on GitHub

                    isExist(_:)

Returns true if the named file is a directory, false otherwise.

Dir.isExist("/a/folder/path/not/exists")     #=> false
Dir.isExist("/a/folder/path/exists")         #=> true

Declaration

Swift

public static func isExist(_ path: String) -> Bool

Parameters

                                path

A file path.

Return Value

A bool value indicates whether there is a directory in given path.

                        Show on GitHub

                    isEmpty(_:)

Returns true if the named file is an empty directory, false if it is
not a directory or non-empty.

Dir.isEmpty("/a/empty/folder")           #=> true
Dir.isEmpty("/a/folder/not/exists")      #=> true
Dir.isEmpty("/a/folder/with/files")      #=> false

Declaration

Swift

public static func isEmpty(_ path: String) -> Bool

Parameters

                                path

A directory path.

Return Value

A bool value indicates the directory is not exists or is empty.

                        Show on GitHub

                    entries(_:)

Returns an array containing all of the filenames in the given directory. Will return an empty array
 if the named directory doesn't exist.

Declaration

Swift

public static func entries(_ path: String) -> [String]

Parameters

                                path

A directory path.

Return Value

An array of all filenames in the given directory.

                        Show on GitHub

                    foreach(_:closure:)

Calls the block once for each entry in the named directory, passing the filename of each
entry as a parameter to the block.

Declaration

Swift

public static func foreach(_ path: String, closure: (String) -> ())

Parameters

                                path

A directory path.

                                closure

A closure accepts all the entries in current directory.

                        Show on GitHub

                    delete(_:)

Deletes the named directory.

Declaration

Swift

public static func delete(_ path: String) -> Bool

Parameters

                                path

A directory path.

Return Value

A bool value indicates the result of Dir.delete(path:)

                        Show on GitHub

                    seek(_:)

Seeks to a particular location in dir.

Declaration

Swift

public func seek(_ pos: Int)

Parameters

                                pos

A particular location.

                        Show on GitHub

                    rewind()

Repositions dir to the first entry.

Declaration

Swift

public func rewind()

                        Show on GitHub

© 2017 Draveness. All rights reserved. (Last updated: 2017-05-15)

Generated by jazzy ♪♫ v0.8.2, a Realm project.


text:
package org.elasticsearch.indices;

import org.elasticsearch.action.admin.indices.rollover.Condition;
import org.elasticsearch.action.admin.indices.rollover.MaxAgeCondition;
import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition;
import org.elasticsearch.action.admin.indices.rollover.MaxSizeCondition;
import org.elasticsearch.action.resync.TransportResyncReplicationAction;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.index.mapper.BinaryFieldMapper;
import org.elasticsearch.index.mapper.BooleanFieldMapper;
import org.elasticsearch.index.mapper.CompletionFieldMapper;
import org.elasticsearch.index.mapper.DateFieldMapper;
import org.elasticsearch.index.mapper.FieldAliasMapper;
import org.elasticsearch.index.mapper.FieldNamesFieldMapper;
import org.elasticsearch.index.mapper.GeoPointFieldMapper;
import org.elasticsearch.index.mapper.IdFieldMapper;
import org.elasticsearch.index.mapper.IgnoredFieldMapper;
import org.elasticsearch.index.mapper.IndexFieldMapper;
import org.elasticsearch.index.mapper.IpFieldMapper;
import org.elasticsearch.index.mapper.KeywordFieldMapper;
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MetadataFieldMapper;
import org.elasticsearch.index.mapper.NestedPathFieldMapper;
import org.elasticsearch.index.mapper.NumberFieldMapper;
import org.elasticsearch.index.mapper.ObjectMapper;
import org.elasticsearch.index.mapper.RangeType;
import org.elasticsearch.index.mapper.RoutingFieldMapper;
import org.elasticsearch.index.mapper.SeqNoFieldMapper;
import org.elasticsearch.index.mapper.SourceFieldMapper;
import org.elasticsearch.index.mapper.TextFieldMapper;
import org.elasticsearch.index.mapper.TypeFieldMapper;
import org.elasticsearch.index.mapper.VersionFieldMapper;
import org.elasticsearch.index.seqno.RetentionLeaseBackgroundSyncAction;
import org.elasticsearch.index.seqno.RetentionLeaseSyncAction;
import org.elasticsearch.index.seqno.RetentionLeaseSyncer;
import org.elasticsearch.index.shard.PrimaryReplicaSyncer;
import org.elasticsearch.indices.cluster.IndicesClusterStateService;
import org.elasticsearch.indices.mapper.MapperRegistry;
import org.elasticsearch.indices.store.IndicesStore;
import org.elasticsearch.plugins.MapperPlugin;

import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;

/**
 * Configures classes and services that are shared by indices on each node.
 */
public class IndicesModule extends AbstractModule {
    private final MapperRegistry mapperRegistry;

    public IndicesModule(List<MapperPlugin> mapperPlugins) {
        this.mapperRegistry = new MapperRegistry(getMappers(mapperPlugins), getMetadataMappers(mapperPlugins),
                getFieldFilter(mapperPlugins));
    }

    public static List<NamedWriteableRegistry.Entry> getNamedWriteables() {
        return Arrays.asList(
                new NamedWriteableRegistry.Entry(Condition.class, MaxAgeCondition.NAME, MaxAgeCondition::new),
                new NamedWriteableRegistry.Entry(Condition.class, MaxDocsCondition.NAME, MaxDocsCondition::new),
                new NamedWriteableRegistry.Entry(Condition.class, MaxSizeCondition.NAME, MaxSizeCondition::new));
    }

    public static List<NamedXContentRegistry.Entry> getNamedXContents() {
        return Arrays.asList(
            new NamedXContentRegistry.Entry(Condition.class, new ParseField(MaxAgeCondition.NAME), (p, c) ->
                MaxAgeCondition.fromXContent(p)),
            new NamedXContentRegistry.Entry(Condition.class, new ParseField(MaxDocsCondition.NAME), (p, c) ->
                MaxDocsCondition.fromXContent(p)),
            new NamedXContentRegistry.Entry(Condition.class, new ParseField(MaxSizeCondition.NAME), (p, c) ->
                MaxSizeCondition.fromXContent(p))
        );
    }

    public static Map<String, Mapper.TypeParser> getMappers(List<MapperPlugin> mapperPlugins) {
        Map<String, Mapper.TypeParser> mappers = new LinkedHashMap<>();

        // builtin mappers
        for (NumberFieldMapper.NumberType type : NumberFieldMapper.NumberType.values()) {
            mappers.put(type.typeName(), type.parser());
        }
        for (RangeType type : RangeType.values()) {
            mappers.put(type.typeName(), type.parser());
        }
        mappers.put(BooleanFieldMapper.CONTENT_TYPE, BooleanFieldMapper.PARSER);
        mappers.put(BinaryFieldMapper.CONTENT_TYPE, BinaryFieldMapper.PARSER);
        DateFieldMapper.Resolution milliseconds = DateFieldMapper.Resolution.MILLISECONDS;
        mappers.put(milliseconds.type(), DateFieldMapper.MILLIS_PARSER);
        DateFieldMapper.Resolution nanoseconds = DateFieldMapper.Resolution.NANOSECONDS;
        mappers.put(nanoseconds.type(), DateFieldMapper.NANOS_PARSER);
        mappers.put(IpFieldMapper.CONTENT_TYPE, IpFieldMapper.PARSER);
        mappers.put(TextFieldMapper.CONTENT_TYPE, new TextFieldMapper.TypeParser());
        mappers.put(KeywordFieldMapper.CONTENT_TYPE, KeywordFieldMapper.PARSER);
        mappers.put(ObjectMapper.CONTENT_TYPE, new ObjectMapper.TypeParser());
        mappers.put(ObjectMapper.NESTED_CONTENT_TYPE, new ObjectMapper.TypeParser());
        mappers.put(CompletionFieldMapper.CONTENT_TYPE, CompletionFieldMapper.PARSER);
        mappers.put(FieldAliasMapper.CONTENT_TYPE, new FieldAliasMapper.TypeParser());
        mappers.put(GeoPointFieldMapper.CONTENT_TYPE, new GeoPointFieldMapper.TypeParser());

        for (MapperPlugin mapperPlugin : mapperPlugins) {
            for (Map.Entry<String, Mapper.TypeParser> entry : mapperPlugin.getMappers().entrySet()) {
                if (mappers.put(entry.getKey(), entry.getValue()) != null) {
                    throw new IllegalArgumentException("Mapper [" + entry.getKey() + "] is already registered");
                }
            }
        }
        return Collections.unmodifiableMap(mappers);
    }

    private static final Map<String, MetadataFieldMapper.TypeParser> builtInMetadataMappers = initBuiltInMetadataMappers();

    private static Set<String> builtInMetadataFields = Collections.unmodifiableSet(builtInMetadataMappers.keySet());

    private static Map<String, MetadataFieldMapper.TypeParser> initBuiltInMetadataMappers() {
        Map<String, MetadataFieldMapper.TypeParser> builtInMetadataMappers;
        // Use a LinkedHashMap for metadataMappers because iteration order matters
        builtInMetadataMappers = new LinkedHashMap<>();
        // _ignored first so that we always load it, even if only _id is requested
        builtInMetadataMappers.put(IgnoredFieldMapper.NAME, IgnoredFieldMapper.PARSER);
        // ID second so it will be the first (if no ignored fields) stored field to load
        // (so will benefit from "fields: []" early termination
        builtInMetadataMappers.put(IdFieldMapper.NAME, IdFieldMapper.PARSER);
        builtInMetadataMappers.put(RoutingFieldMapper.NAME, RoutingFieldMapper.PARSER);
        builtInMetadataMappers.put(IndexFieldMapper.NAME, IndexFieldMapper.PARSER);
        builtInMetadataMappers.put(SourceFieldMapper.NAME, SourceFieldMapper.PARSER);
        builtInMetadataMappers.put(TypeFieldMapper.NAME, TypeFieldMapper.PARSER);
        builtInMetadataMappers.put(NestedPathFieldMapper.NAME, NestedPathFieldMapper.PARSER);
        builtInMetadataMappers.put(VersionFieldMapper.NAME, VersionFieldMapper.PARSER);
        builtInMetadataMappers.put(SeqNoFieldMapper.NAME, SeqNoFieldMapper.PARSER);
        //_field_names must be added last so that it has a chance to see all the other mappers
        builtInMetadataMappers.put(FieldNamesFieldMapper.NAME, FieldNamesFieldMapper.PARSER);
        return Collections.unmodifiableMap(builtInMetadataMappers);
    }

    public static Map<String, MetadataFieldMapper.TypeParser> getMetadataMappers(List<MapperPlugin> mapperPlugins) {
        Map<String, MetadataFieldMapper.TypeParser> metadataMappers = new LinkedHashMap<>();

        int i = 0;
        Map.Entry<String, MetadataFieldMapper.TypeParser> fieldNamesEntry = null;
        for (Map.Entry<String, MetadataFieldMapper.TypeParser> entry : builtInMetadataMappers.entrySet()) {
            if (i < builtInMetadataMappers.size() - 1) {
                metadataMappers.put(entry.getKey(), entry.getValue());
            } else {
                assert entry.getKey().equals(FieldNamesFieldMapper.NAME) : "_field_names must be the last registered mapper, order counts";
                fieldNamesEntry = entry;
            }
            i++;
        }
        assert fieldNamesEntry != null;

        for (MapperPlugin mapperPlugin : mapperPlugins) {
            for (Map.Entry<String, MetadataFieldMapper.TypeParser> entry : mapperPlugin.getMetadataMappers().entrySet()) {
                if (entry.getKey().equals(FieldNamesFieldMapper.NAME)) {
                    throw new IllegalArgumentException("Plugin cannot contain metadata mapper [" + FieldNamesFieldMapper.NAME + "]");
                }
                if (metadataMappers.put(entry.getKey(), entry.getValue()) != null) {
                    throw new IllegalArgumentException("MetadataFieldMapper [" + entry.getKey() + "] is already registered");
                }
            }
        }

        // we register _field_names here so that it has a chance to see all the other mappers, including from plugins
        metadataMappers.put(fieldNamesEntry.getKey(), fieldNamesEntry.getValue());
        return Collections.unmodifiableMap(metadataMappers);
    }

    /**
     * Returns a set containing all of the builtin metadata fields
     */
    public static Set<String> getBuiltInMetadataFields() {
        return builtInMetadataFields;
    }

    private static Function<String, Predicate<String>> getFieldFilter(List<MapperPlugin> mapperPlugins) {
        Function<String, Predicate<String>> fieldFilter = MapperPlugin.NOOP_FIELD_FILTER;
        for (MapperPlugin mapperPlugin : mapperPlugins) {
            fieldFilter = and(fieldFilter, mapperPlugin.getFieldFilter());
        }
        return fieldFilter;
    }

    private static Function<String, Predicate<String>> and(Function<String, Predicate<String>> first,
                                                           Function<String, Predicate<String>> second) {
        //the purpose of this method is to not chain no-op field predicates, so that we can easily find out when no plugins plug in
        //a field filter, hence skip the mappings filtering part as a whole, as it requires parsing mappings into a map.
        if (first == MapperPlugin.NOOP_FIELD_FILTER) {
            return second;
        }
        if (second == MapperPlugin.NOOP_FIELD_FILTER) {
            return first;
        }
        return index -> {
            Predicate<String> firstPredicate = first.apply(index);
            Predicate<String> secondPredicate = second.apply(index);
            if (firstPredicate == MapperPlugin.NOOP_FIELD_PREDICATE) {
                return secondPredicate;
            }
            if (secondPredicate == MapperPlugin.NOOP_FIELD_PREDICATE) {
                return firstPredicate;
            }
            return firstPredicate.and(secondPredicate);
        };
    }

    @Override
    protected void configure() {
        bind(IndicesStore.class).asEagerSingleton();
        bind(IndicesClusterStateService.class).asEagerSingleton();
        bind(TransportResyncReplicationAction.class).asEagerSingleton();
        bind(PrimaryReplicaSyncer.class).asEagerSingleton();
        bind(RetentionLeaseSyncAction.class).asEagerSingleton();
        bind(RetentionLeaseBackgroundSyncAction.class).asEagerSingleton();
        bind(RetentionLeaseSyncer.class).asEagerSingleton();
    }

    /**
     * A registry for all field mappers.
     */
    public MapperRegistry getMapperRegistry() {
        return mapperRegistry;
    }

}


text:
from django_db_sanitizer.updaters.base import BaseUpdater

from django_db_sanitizer.updaters.batch import BatchMultiValuePostgresUpdater
from django_db_sanitizer.updaters.simple import (
    SingleValuePerFieldUpdater, SingleValuePerFieldRowUpdater
)


text:
require 'spec_helper'

describe Storey::Duplicator do

  describe '#perform!' do
    context "when the dump is a failure" do
      it 'raises an error' do
        duplicator = described_class.new('non-existent-will-fail-dump', 'new')
        expected_msg = [
          "Problem dumping `non-existent-will-fail-dump` to make a copy of it",
          "into `new`: pg_dump: no matching schemas were found",
        ].join(" ")
        expect { duplicator.perform! }.
          to raise_error(Storey::StoreyError).
          with_message(/#{expected_msg}/)
      end
    end

    it 'removes the target and source sql files after work' do
      Storey.create 'boo'
      duplicator = described_class.new('boo', 'ya')
      duplicator.perform!
      source_dump_dir =
        File.join(Rails.root, 'tmp', 'schema_dumps', 'source', '*.*')
      target_dump_dir =
        File.join(Rails.root, 'tmp', 'schema_dumps', 'target', '*.*')
      expect(Dir[source_dump_dir]).to be_empty
      expect(Dir[target_dump_dir]).to be_empty
    end

    it "does not used cached schema migration versions when copying" do
      s1_versions_count = nil
      Storey.create("s1") do
        s1_versions_count = ActiveRecord::SchemaMigration.count
      end

      duplicator = described_class.new('s1', 's2')
      duplicator.perform!

      Storey.switch("s2") do
        expect(ActiveRecord::SchemaMigration.count).to eq s1_versions_count
      end
    end
  end

end


text:
from calendarserver.version import version

from twext.internet.gaiendpoint import GAIEndpoint
from twext.python.log import Logger

from txweb2 import responsecode
from txweb2.client.http import HTTPClientProtocol, ClientRequest
from txweb2.dav.util import allDataFromStream
from txweb2.http_headers import Headers, MimeType
from txweb2.stream import MemoryStream

from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.protocol import Factory

from twistedcaldav.accounting import accountingEnabledForCategory, \
    emitAccounting
from twistedcaldav.client.pool import _configuredClientContextFactory
from twistedcaldav.config import config
from twistedcaldav.util import utf8String

from cStringIO import StringIO
import base64
import json

log = Logger()

class ConduitRequest(object):
    """
    An HTTP request between pods. This is typically used to send and receive JSON data. However,
    for attachments, we need to send the actual attachment data as the request body, so in that
    case the JSON data is sent in an HTTP header.
    """

    def __init__(self, server, data, stream=None, stream_type=None):
        self.server = server
        self.data = json.dumps(data)
        self.stream = stream
        self.streamType = stream_type

    @inlineCallbacks
    def doRequest(self, txn):

        # Generate an HTTP client request
        try:
            if "xpod" not in txn.logItems:
                txn.logItems["xpod"] = 0
            txn.logItems["xpod"] += 1

            response = (yield self._processRequest())

            if accountingEnabledForCategory("xPod"):
                self.loggedResponse = yield self.logResponse(response)
                emitAccounting("xPod", "", self.loggedRequest + "\n" + self.loggedResponse, "POST")

            if response.code in (responsecode.OK,):
                data = (yield allDataFromStream(response.stream))
                data = json.loads(data)
            else:
                raise ValueError("Incorrect cross-pod response status code: {}".format(response.code))

        except Exception as e:
            # Request failed
            log.error("Could not do cross-pod request : {request} {ex}", request=self, ex=e)
            raise ValueError("Failed cross-pod request: {}".format(e))

        returnValue(data)

    @inlineCallbacks
    def logRequest(self, request):
        """
        Log an HTTP request.
        """

        iostr = StringIO()
        iostr.write(">>>> Request start\n\n")
        if hasattr(request, "clientproto"):
            protocol = "HTTP/{:d}.{:d}".format(request.clientproto[0], request.clientproto[1])
        else:
            protocol = "HTTP/1.1"
        iostr.write("{} {} {}\n".format(request.method, request.uri, protocol))
        for name, valuelist in request.headers.getAllRawHeaders():
            for value in valuelist:
                # Do not log authorization details
                if name not in ("Authorization",):
                    iostr.write("{}: {}\n".format(name, value))
                else:
                    iostr.write("{}: xxxxxxxxx\n".format(name))
        iostr.write("\n")

        # We need to play a trick with the request stream as we can only read it once. So we
        # read it, store the value in a MemoryStream, and replace the request's stream with that,
        # so the data can be read again. Note if we are sending an attachment, we won't log
        # the attachment data as we do not want to read it all into memory.
        if self.stream is None:
            data = (yield allDataFromStream(request.stream))
            iostr.write(data)
            request.stream = MemoryStream(data if data is not None else "")
            request.stream.doStartReading = None
        else:
            iostr.write("<<Stream Type: {}>>\n".format(self.streamType))

        iostr.write("\n\n>>>> Request end\n")
        returnValue(iostr.getvalue())

    @inlineCallbacks
    def logResponse(self, response):
        """
        Log an HTTP request.
        """
        iostr = StringIO()
        iostr.write(">>>> Response start\n\n")
        code_message = responsecode.RESPONSES.get(response.code, "Unknown Status")
        iostr.write("HTTP/1.1 {:d} {}\n".format(response.code, code_message))
        for name, valuelist in response.headers.getAllRawHeaders():
            for value in valuelist:
                # Do not log authorization details
                if name not in ("WWW-Authenticate",):
                    iostr.write("{}: {}\n".format(name, value))
                else:
                    iostr.write("{}: xxxxxxxxx\n".format(name))
        iostr.write("\n")

        # We need to play a trick with the response stream to ensure we don't mess it up. So we
        # read it, store the value in a MemoryStream, and replace the response's stream with that,
        # so the data can be read again.
        data = (yield allDataFromStream(response.stream))
        iostr.write(data)
        response.stream = MemoryStream(data if data is not None else "")
        response.stream.doStartReading = None

        iostr.write("\n\n>>>> Response end\n")
        returnValue(iostr.getvalue())

    @inlineCallbacks
    def _processRequest(self):
        """
        Process the request by sending it to the relevant server.

        @return: the HTTP response.
        @rtype: L{Response}
        """
        ssl, host, port, _ignore_path = self.server.details()
        path = "/" + config.Servers.ConduitName

        headers = Headers()
        headers.setHeader("Host", utf8String(host + ":{}".format(port)))
        if self.streamType:
            # For attachments we put the base64-encoded JSON data into a header
            headers.setHeader("Content-Type", self.streamType)
            headers.addRawHeader("XPOD", base64.b64encode(self.data))
        else:
            headers.setHeader("Content-Type", MimeType("application", "json", params={"charset": "utf-8", }))
        headers.setHeader("User-Agent", "CalendarServer/{}".format(version))
        headers.addRawHeader(*self.server.secretHeader())

        from twisted.internet import reactor
        f = Factory()
        f.protocol = HTTPClientProtocol
        ep = GAIEndpoint(reactor, host, port, _configuredClientContextFactory() if ssl else None)
        proto = (yield ep.connect(f))

        request = ClientRequest("POST", path, headers, self.stream if self.stream is not None else self.data)

        if accountingEnabledForCategory("xPod"):
            self.loggedRequest = yield self.logRequest(request)

        response = (yield proto.submitRequest(request))

        returnValue(response)


text:
package com.sfsu.investickation.fragments;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.appcompat.BuildConfig;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;

import com.sfsu.controllers.DatabaseDataController;
import com.sfsu.db.UsersDao;
import com.sfsu.entities.Account;
import com.sfsu.investickation.R;
import com.sfsu.network.auth.AuthPreferences;
import com.sfsu.network.bus.BusProvider;
import com.sfsu.network.events.UserEvent;
import com.sfsu.network.handler.ApiRequestHandler;
import com.sfsu.utils.Preconditions;
import com.squareup.otto.Subscribe;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Displays the {@link Account} data. Allows users to edit the data.
 */
public class ProfileFragment extends Fragment {

    private final String TAG = "~!@#ProfileFragment";
    @Bind(R.id.edittext_full_name)
    EditText et_fullName;
    @Bind(R.id.edittext_email)
    EditText et_email;
    @Bind(R.id.edittext_address)
    EditText et_address;
    @Bind(R.id.edittext_city)
    EditText et_city;
    @Bind(R.id.edittext_state)
    EditText et_state;
    @Bind(R.id.edittext_zipcode)
    EditText et_zip;
    @Bind(R.id.button_save_user)
    Button btn_Save;
    private AuthPreferences mAuthPreferences;
    private DatabaseDataController dbController;
    private Context mContext;
    private Account mUser;
    private MenuItem cancelMenuItem, editMenuItem;
    private ProgressDialog mProgressDialog;

    public ProfileFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
        mAuthPreferences = new AuthPreferences(mContext);
        dbController = new DatabaseDataController(mContext, new UsersDao());
        setHasOptionsMenu(true);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_profile, container, false);
        ButterKnife.bind(this, rootView);

        mUser = (Account) dbController.get(mAuthPreferences.getUser_id());
        populateViews();

        return rootView;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        try {
            mContext = context;
        } catch (Exception e) {

        }
    }

    @Override
    public void onPause() {
        super.onPause();
        BusProvider.bus().unregister(this);
    }

    @Override
    public void onResume() {
        super.onResume();
        getActivity().setTitle(R.string.title_fragment_profile);
        BusProvider.bus().register(this);
        mProgressDialog = new ProgressDialog(mContext);
    }

    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
        inflater.inflate(R.menu.menu_personal_info, menu);
        cancelMenuItem = menu.findItem(R.id.action_cancel);
        editMenuItem = menu.findItem(R.id.action_edit);
        // initially set to hidden
        cancelMenuItem.setVisible(false);

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.action_edit:
                showEditableView();
                break;
            case R.id.action_cancel:
                clearEditMode();
                break;
        }
        return super.onOptionsItemSelected(item);
    }

    /**
     * Save the Edits made by the user - call Server and update the local DB details
     */
    private void saveProfileEdits() {

    }

    /**
     * Toggles back to the default mode - view
     */
    private void clearEditMode() {
        btn_Save.setVisibility(View.INVISIBLE);
        // change the menu items
        cancelMenuItem.setVisible(false);
        editMenuItem.setVisible(true);
    }

    /**
     * Toggles editable mode - view
     */
    private void showEditableView() {
        btn_Save.setVisibility(View.VISIBLE);
        // change the menu items
        cancelMenuItem.setVisible(true);
        editMenuItem.setVisible(false);
    }

    /**
     * Update User details on server and once the update is successful, update in the local DB
     */
    private void editUserInformation() {
        BusProvider.bus().post(new UserEvent.OnLoadingInitialized(mUser, mUser.getId(), ApiRequestHandler.UPDATE));
        mProgressDialog.setIndeterminate(true);
        mProgressDialog.setMessage(getString(R.string.progressDialog_updating_user_details));
        mProgressDialog.show();
    }

    @Subscribe
    public void onUserDetailsUpdatedSuccess(UserEvent.OnLoaded onLoaded) {
        mProgressDialog = Preconditions.checkNotNull(mProgressDialog);
        mProgressDialog.dismiss();

        // retrieve the user and update the same user in the database
        mUser = onLoaded.getResponse();

        Thread updateUserThread = new Thread(new Runnable() {
            private final Handler myHandler = new Handler() {
                @Override
                public void handleMessage(Message msg) {
                    super.handleMessage(msg);

                }
            };

            private void passMessageToHandler() {

            }

            @Override
            public void run() {

            }
        });

        populateViews();
    }

    private void populateViews() {
        try {
            et_fullName.setText(mUser.getFull_name());
            et_address.setText(mUser.getAddress());
            et_email.setText(mUser.getEmail());
            et_city.setText(mUser.getCity());
            et_state.setText(mUser.getState());
            et_zip.setText(mUser.getZipCode());
        } catch (NullPointerException ne) {
            if (BuildConfig.DEBUG)
                Log.e(TAG, "populateViews ", ne);
        }
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putParcelable("savedUser", mUser);

    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        if (savedInstanceState != null) {
            mUser = savedInstanceState.getParcelable("savedUser");
        }
    }
}


text:
define(["Sprite", "Box2DW"], function(Sprite, Box2D) // Locals having the same name as globals don't change them
{
var exports = {};

exports.Scene = function(spriteConstructorManager, name, type, typeArgs, data) // Feel free to change these (except spriteConstructorManager)
{
	var scene = {};

	var mName = name;
	var mSprites = []; // 2d. Its index represents the render order. Make sure to check for undefined in the first array because of padding!
	var mSpriteConstructorManager = spriteConstructorManager;
	var mType = typeof type !== "undefined" ? type : "basic";
	var mData = data;

	// Physics
	var mWorld = false; // Only defined if the scene is a physics type

	// Interface
	var mSpriteIndex = [0, 0]; // For getSprite(); The first number represents the render order, and the second, the index of that order

	typeArgs = typeof typeArgs !== "undefined" ? typeArgs : {};

	if(mType=="physics")
	{
		// Defaults
		var gravity = typeof typeArgs.gravity !== "undefined" ? typeArgs.gravity : new Box2D.b2Vec2(0, -10);
		var sleep = typeof typeArgs.sleep !== "undefined" ? typeArgs.sleep : true;

		mWorld = new Box2D.b2World(gravity, sleep);
	}

	scene.delete = function()
	{
		mSpriteConstructorManager.deleteScene(this);
	};

	scene.getName = function()
	{
		return mName;
	};

	scene.getSprites = function()
	{
		return mSprites;
	};

	scene.getType = function()
	{
		return mType;
	};

	scene.getData = function()
	{
		return mData;
	};

	scene.getWorld = function()
	{
		return mWorld;
	};

	scene.resetSpriteIndex = function()
	{
		mSpriteIndex = [0, 0];
	};

	scene.getSprite = function() // Gets the current sprite, call this in a loop, returns false when the loop is over (array[array.length])
	{
		var renderOrderSprites;
		var sprite;

		for(length=mSprites.length; mSpriteIndex[0]<length; mSpriteIndex[0]++)
		{
			renderOrderSprites = mSprites[mSpriteIndex[0]];

			if(typeof renderOrderSprites!=="undefined") // Check if it is NOT padding!!
			{
				for(jLength=renderOrderSprites.length; mSpriteIndex[1]<jLength; mSpriteIndex[1]++)
				{
					sprite = renderOrderSprites[mSpriteIndex[1]];

					if(mSpriteIndex[1]<renderOrderSprites.length-1)
					{
						mSpriteIndex[1]++;
					} else
					{
						mSpriteIndex[1] = 0;
						mSpriteIndex[0]++;
					}

					return sprite;
				}
			}
		}

		return false;
	};

	// Creates new sprite using a constructor, or a constructor name.
	scene.createSprite = function(constructor)
	{
		var spriteConstructor = constructor; // Make sure we are out of this weird arguments object

		// Find constructor
		if(typeof constructor==="string")
		{
			spriteConstructor = mSpriteConstructorManager.findConstructor(constructor);
		}

		// Add this scene as the first argument of the new sprite
		var args = Array.prototype.slice.call(arguments); // Turn into array
		args.splice(0, 1, this, spriteConstructor); // Remove first argument, and add others

		var sprite = spriteConstructor.createSprite.apply(this, args); // Apply args

		this.addSpriteToArray(sprite);
		return sprite;
	};

	// Very lengthy, needs work?
	scene.findSprites = function(spriteName) // Sprite name = type
	{
		var sprites = [];

		var renderOrderSprites;
		var currentSprite;

		for(var i=0, length=mSprites.length; i<length; i++)
		{
			renderOrderSprites = mSprites[i];

			if(typeof renderOrderSprites!=="undefined")
			{
				for(var j=0, jLength=renderOrderSprites.length; j<jLength; j++)
				{
					currentSprite = renderOrderSprites[j];

					if(currentSprite.getName()===spriteName)
					{
						sprites.push(currentSprite);
					}
				}
			}
		}

		return sprites;
	};

	scene.clear = function() // Deletes all sprites
	{
		mSprites = [];
	};

	scene.deleteSprite = function(sprite)
	{
		var renderOrderSprites;
		var currentSprite;

		for(var i=0, length=mSprites.length; i<length; i++)
		{
			renderOrderSprites = mSprites[i];

			if(typeof renderOrderSprites!=="undefined")
			{
				for(var j=0, jLength=renderOrderSprites.length; j<jLength; j++)
				{
					currentSprite = renderOrderSprites[j];

					if(currentSprite===sprite)
					{
						this.removeSpriteFromArray(i, j);

						return true;
					}
				}
			}
		}

		return false;
	};

	scene.deleteSprites = function(spriteName)
	{
		var renderOrderSprites;
		var currentSprite;

		for(var i=0, length=mSprites.length; i<length; i++)
		{
			renderOrderSprites = mSprites[i];

			if(typeof renderOrderSprites!="undefined")
			{
				for(var j=0, jLength=renderOrderSprites.length; j<jLength; j++)
				{
					currentSprite = renderOrderSprites[j];

					if(currentSprite.getName()===spriteName)
					{
						this.removeSpriteFromArray(i, j);
					}
				}
			}
		}
	};

	// Helper functions
	scene.addSpriteToArray = function(sprite, index) // This will add the sprite to the array. mSprites[renderOrder][spriteIndex]
	{
		var array = mSprites;
		var renderOrder = sprite.getRenderOrder();
		var arrayLength =  array.length;
		index = typeof index !== "undefined" ? index : array.length; // Default is top-most. This index represents the index in the same render order

		if(renderOrder>=arrayLength) // Padding, like this we can iterate through this easily
		{
			for(var i=arrayLength; i<renderOrder; i++)
			{
				array[i] = undefined;
			}
		}

		if(typeof array[renderOrder]==="undefined")
		{
			array[renderOrder] = []; // Create a new array
		}

		if(index>=array[renderOrder].length)
		{
			array[renderOrder].push(sprite); // If it's out of range, just add it to the end (faster!)
		} else
		{
			array[renderOrder].splice(index, 0, sprite);
		}
	}

	scene.removeSpriteFromArray = function(renderOrder, index) // Remove the sprite from mSprites
	{
		var array = mSprites;
		if(renderOrder>=0 && renderOrder<array.length)
		{
			var renderOrderSprites = array[renderOrder]; // Get array

			if(typeof renderOrderSprites!=="undefined" && index>=0 && index<renderOrderSprites.length) // Validation + in range
			{
				if(renderOrderSprites.length===1) // Only one here
				{
					if(renderOrder===array.length-1)
					{
						var lastGoodIndex = -1;

						for(var i=0; i<renderOrder; i++)
						{
							if(typeof array[i]!=="undefined")
							{
								lastGoodIndex = i;
							}
						}

						array.splice(lastGoodIndex+1, renderOrder-lastGoodIndex);
					} else
					{
						array[renderOrder] = undefined; // Cannot use any variable for this and setting it to undefined!!
					}
				} else
				{
					renderOrderSprites.splice(index, 1);
				}

				return true;
			}
		}

		return false;
	}

	return scene;
};

return exports;
});


text:
package config

import (
	"flag"
	"fmt"
	"os"
	"os/user"
	"path/filepath"

	"k8s.io/client-go/rest"
	"k8s.io/client-go/tools/clientcmd"
	clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
	logf "sigs.k8s.io/controller-runtime/pkg/internal/log"
)

var (
	kubeconfig string
	log        = logf.RuntimeLog.WithName("client").WithName("config")
)

func init() {
	// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
	flag.StringVar(&kubeconfig, "kubeconfig", "",
		"Paths to a kubeconfig. Only required if out-of-cluster.")
}

// GetConfig creates a *rest.Config for talking to a Kubernetes API server.
// If --kubeconfig is set, will use the kubeconfig file at that location.  Otherwise will assume running
// in cluster and use the cluster provided kubeconfig.
//
// It also applies saner defaults for QPS and burst based on the Kubernetes
// controller manager defaults (20 QPS, 30 burst)
//
// Config precedence
//
// * --kubeconfig flag pointing at a file
//
// * KUBECONFIG environment variable pointing at a file
//
// * In-cluster config if running in cluster
//
// * $HOME/.kube/config if exists.
func GetConfig() (*rest.Config, error) {
	return GetConfigWithContext("")
}

// GetConfigWithContext creates a *rest.Config for talking to a Kubernetes API server with a specific context.
// If --kubeconfig is set, will use the kubeconfig file at that location.  Otherwise will assume running
// in cluster and use the cluster provided kubeconfig.
//
// It also applies saner defaults for QPS and burst based on the Kubernetes
// controller manager defaults (20 QPS, 30 burst)
//
// Config precedence
//
// * --kubeconfig flag pointing at a file
//
// * KUBECONFIG environment variable pointing at a file
//
// * In-cluster config if running in cluster
//
// * $HOME/.kube/config if exists.
func GetConfigWithContext(context string) (*rest.Config, error) {
	cfg, err := loadConfig(context)
	if err != nil {
		return nil, err
	}

	if cfg.QPS == 0.0 {
		cfg.QPS = 20.0
		cfg.Burst = 30.0
	}

	return cfg, nil
}

// loadInClusterConfig is a function used to load the in-cluster
// Kubernetes client config. This variable makes is possible to
// test the precedence of loading the config.
var loadInClusterConfig = rest.InClusterConfig

// loadConfig loads a REST Config as per the rules specified in GetConfig.
func loadConfig(context string) (*rest.Config, error) {
	// If a flag is specified with the config location, use that
	if len(kubeconfig) > 0 {
		return loadConfigWithContext("", &clientcmd.ClientConfigLoadingRules{ExplicitPath: kubeconfig}, context)
	}

	// If the recommended kubeconfig env variable is not specified,
	// try the in-cluster config.
	kubeconfigPath := os.Getenv(clientcmd.RecommendedConfigPathEnvVar)
	if len(kubeconfigPath) == 0 {
		if c, err := loadInClusterConfig(); err == nil {
			return c, nil
		}
	}

	// If the recommended kubeconfig env variable is set, or there
	// is no in-cluster config, try the default recommended locations.
	//
	// NOTE: For default config file locations, upstream only checks
	// $HOME for the user's home directory, but we can also try
	// os/user.HomeDir when $HOME is unset.
	//
	// TODO(jlanford): could this be done upstream?
	loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
	if _, ok := os.LookupEnv("HOME"); !ok {
		u, err := user.Current()
		if err != nil {
			return nil, fmt.Errorf("could not get current user: %w", err)
		}
		loadingRules.Precedence = append(loadingRules.Precedence, filepath.Join(u.HomeDir, clientcmd.RecommendedHomeDir, clientcmd.RecommendedFileName))
	}

	return loadConfigWithContext("", loadingRules, context)
}

func loadConfigWithContext(apiServerURL string, loader clientcmd.ClientConfigLoader, context string) (*rest.Config, error) {
	return clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
		loader,
		&clientcmd.ConfigOverrides{
			ClusterInfo: clientcmdapi.Cluster{
				Server: apiServerURL,
			},
			CurrentContext: context,
		}).ClientConfig()
}

// GetConfigOrDie creates a *rest.Config for talking to a Kubernetes apiserver.
// If --kubeconfig is set, will use the kubeconfig file at that location.  Otherwise will assume running
// in cluster and use the cluster provided kubeconfig.
//
// Will log an error and exit if there is an error creating the rest.Config.
func GetConfigOrDie() *rest.Config {
	config, err := GetConfig()
	if err != nil {
		log.Error(err, "unable to get kubeconfig")
		os.Exit(1)
	}
	return config
}


text:
package jsettlers.main.android.gameplay.gamemenu;

import jsettlers.main.android.R;

import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;

/**
 * Created by tompr on 23/11/2016.
 */
public class PausedDialog extends DialogFragment {
	public interface Listener {
		void onGameUnPause();
	}

	public static PausedDialog newInstance() {
		return new PausedDialog();
	}

	@NonNull
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		return new AlertDialog.Builder(getActivity())
				.setTitle(R.string.game_menu_paused)
				.setPositiveButton(R.string.game_menu_unpause, (dialogInterface, i) -> getDialog().cancel())
				.setCancelable(true)
				.create();
	}

	@Override
	public void onCancel(DialogInterface dialog) {
		super.onCancel(dialog);
		Listener listener = (Listener) getParentFragment();
		listener.onGameUnPause();
	}
}


text:
        The Logos project is a sure tested formula that was created purely for those who are looking to begin their road on maximizing potential. Although some of the tasks may be difficult, you can find solace in your coaches expansive knowledge in the program. In short this is your journey to a fitter, stronger, and better you!

 The Team

 Chase Comrie

 Founder

 Matt Guenther

 Front End

 Brian Ng

 UX + Front End

 Brian D'Amore

 Back End

 Mike Buckley

 Back End

 Justin Calder

 Mentor


text:
<?php

namespace ProjectRena\Model\EVEApi\Character;

use ProjectRena\RenaApp;

/**
 * Class PlanetaryPins.
 */
class PlanetaryPins
{
    /**
     * @var int
     */
    public $accessMask = 2;

    /**
     * @var
     */
    private $app;

    /**
     * @param \ProjectRena\RenaApp $app
     */
    function __construct(RenaApp $app)
    {
        $this->app = $app;
    }

    /**
     * @param $apiKey
     * @param $vCode
     * @param $characterID
     * @param $planetID
     *
     * @return mixed
     */
    public function getData($apiKey, $vCode, $characterID, $planetID)
    {
        try {
            $pheal = $this->app->Pheal->Pheal($apiKey, $vCode);
            $pheal->scope = 'Char';
            $result = $pheal->PlanetaryPins(array('characterID' => $characterID, 'planetID' => $planetID))->toArray();

            return $result;
        } catch (\Exception $exception) {
            $this->app->Pheal->handleApiException($apiKey, null, $exception);
        }
    }
}


text:
<resources>
    <string name="app_name">ScreenshotsNannyDemo</string>

    <!-- MainActivity -->
    <string name="welcome">Willkommen</string>
    <string name="button_second">Gehen</string>
    <string name="button_network">Netzwerk Activity</string>
    <string name="button_maps">Karten Activity</string>
    <string name="type_hint">Geben Sie hier Ihren Text ein</string>
    <string name="menu_action_account">Konto</string>

    <!-- SecondActivity -->
    <string name="title_activity_second">ZweiteActivity</string>
    <string name="intro_phrase">Es war einmal, </string>

    <!-- NetworkActivity -->
    <string name="title_activity_network">NetzwerkActivity</string>
    <string name="content_description_avatar">Avatar</string>

    <!-- MapsActivity -->
    <string name="title_activity_maps">Karte</string>
    <string name="text_map">Karte</string>
    <string name="map_marker_title">Ich bin ein Berliner</string>
    <string name="edit_text_lat_hint">Breitengrad</string>
    <string name="edit_text_lng_hint">Längengrad</string>

    <!-- AccountActivity -->
    <string name="title_activity_account">AccountActivity</string>
    <string name="info_empty_account">Es gibt noch keinen Benutzer</string>
    <string name="message_account_fab_about">Es gibt nichts Besonderes an mich.</string>
    <string name="text_user">Benutzer</string>
    <string name="text_points">Punkte</string>
</resources>