text:
from __future__ import absolute_import

import os

from proton import *

from . import common
from . import engine
from .common import pump, Skipped

def _sslCertpath(file):
    """ Return the full path to the certificate, keyfile, etc.
    """
    if os.name=="nt":
        if file.find("private-key")!=-1:
            # The private key is not in a separate store
            return None
        # Substitute pkcs#12 equivalent for the CA/key store
        if file.endswith(".pem"):
            file = file[:-4] + ".p12"
    return os.path.join(os.path.dirname(__file__),
                        "ssl_db/%s" % file)

def _testSaslMech(self, mech, clientUser='user@proton', authUser='user@proton', encrypted=False, authenticated=True):
  self.s1.allowed_mechs(mech)
  self.c1.open()
  self.c2.open()

  pump(self.t1, self.t2, 1024)

  if encrypted is not None:
    assert self.t2.encrypted == encrypted, encrypted
    assert self.t1.encrypted == encrypted, encrypted

  assert self.t2.authenticated == authenticated, authenticated
  assert self.t1.authenticated == authenticated, authenticated
  if authenticated:
    # Server
    assert self.t2.user == authUser
    assert self.s2.user == authUser
    assert self.s2.mech == mech.strip()
    assert self.s2.outcome == SASL.OK, self.s2.outcome
    assert self.c2.state & Endpoint.LOCAL_ACTIVE and self.c2.state & Endpoint.REMOTE_ACTIVE,\
      "local_active=%s, remote_active=%s" % (self.c1.state & Endpoint.LOCAL_ACTIVE, self.c1.state & Endpoint.REMOTE_ACTIVE)
    # Client
    assert self.t1.user == clientUser
    assert self.s1.user == clientUser
    assert self.s1.mech == mech.strip()
    assert self.s1.outcome == SASL.OK, self.s1.outcome
    assert self.c1.state & Endpoint.LOCAL_ACTIVE and self.c1.state & Endpoint.REMOTE_ACTIVE,\
      "local_active=%s, remote_active=%s" % (self.c1.state & Endpoint.LOCAL_ACTIVE, self.c1.state & Endpoint.REMOTE_ACTIVE)
  else:
    # Server
    assert self.t2.user == None
    assert self.s2.user == None
    assert self.s2.outcome != SASL.OK, self.s2.outcome
    # Client
    assert self.t1.user == clientUser
    assert self.s1.user == clientUser
    assert self.s1.outcome != SASL.OK, self.s1.outcome

class Test(common.Test):
  pass

def consumeAllOuput(t):
  stops = 0
  while stops<1:
    out = t.peek(1024)
    l = len(out) if out else 0
    t.pop(l)
    if l <= 0:
      stops += 1

class SaslTest(Test):

  def setUp(self):
    self.t1 = Transport()
    self.s1 = SASL(self.t1)
    self.t2 = Transport(Transport.SERVER)
    self.t2.max_frame_size = 65536
    self.s2 = SASL(self.t2)

  def pump(self):
    pump(self.t1, self.t2, 1024)

  # We have to generate the client frames manually because proton does not
  # generate pipelined SASL and AMQP frames together
  def testIllegalProtocolLayering(self):
    # Server
    self.s2.allowed_mechs('ANONYMOUS')

    c2 = Connection()
    self.t2.bind(c2)

    assert self.s2.outcome is None

    # Push client bytes into server
    self.t2.push(
        # SASL
        b'AMQP\x03\x01\x00\x00'
        # @sasl-init(65) [mechanism=:ANONYMOUS, initial-response=b"anonymous@fuschia"]
        b'\x00\x00\x002\x02\x01\x00\x00\x00SA\xd0\x00\x00\x00"\x00\x00\x00\x02\xa3\x09ANONYMOUS\xa0\x11anonymous@fuschia'
        # SASL (again illegally)
        b'AMQP\x03\x01\x00\x00'
        # @sasl-init(65) [mechanism=:ANONYMOUS, initial-response=b"anonymous@fuschia"]
        b'\x00\x00\x002\x02\x01\x00\x00\x00SA\xd0\x00\x00\x00"\x00\x00\x00\x02\xa3\x09ANONYMOUS\xa0\x11anonymous@fuschia'
        # AMQP
        b'AMQP\x00\x01\x00\x00'
        # @open(16) [container-id="", channel-max=1234]
        b'\x00\x00\x00!\x02\x00\x00\x00\x00S\x10\xd0\x00\x00\x00\x11\x00\x00\x00\x0a\xa1\x00@@`\x04\xd2@@@@@@'
        )

    consumeAllOuput(self.t2)

    assert self.t2.condition
    assert self.t2.closed
    assert not c2.state & Endpoint.REMOTE_ACTIVE

  def testPipelinedClient(self):
    # Server
    self.s2.allowed_mechs('ANONYMOUS')

    c2 = Connection()
    self.t2.bind(c2)

    assert self.s2.outcome is None

    # Push client bytes into server
    self.t2.push(
        # SASL
        b'AMQP\x03\x01\x00\x00'
        # @sasl-init(65) [mechanism=:ANONYMOUS, initial-response=b"anonymous@fuschia"]
        b'\x00\x00\x002\x02\x01\x00\x00\x00SA\xd0\x00\x00\x00"\x00\x00\x00\x02\xa3\x09ANONYMOUS\xa0\x11anonymous@fuschia'
        # AMQP
        b'AMQP\x00\x01\x00\x00'
        # @open(16) [container-id="", channel-max=1234]
        b'\x00\x00\x00!\x02\x00\x00\x00\x00S\x10\xd0\x00\x00\x00\x11\x00\x00\x00\x0a\xa1\x00@@`\x04\xd2@@@@@@'
        )

    consumeAllOuput(self.t2)

    assert not self.t2.condition
    assert self.s2.outcome == SASL.OK
    assert c2.state & Endpoint.REMOTE_ACTIVE

  def testPipelinedServer(self):
    # Client
    self.s1.allowed_mechs('ANONYMOUS')

    c1 = Connection()
    self.t1.bind(c1)

    assert self.s1.outcome is None

    # Push server bytes into client
    # Commented out lines in this test are where the client input processing doesn't
    # run after output processing even though there is input waiting
    self.t1.push(
        # SASL
        b'AMQP\x03\x01\x00\x00'
        # @sasl-mechanisms(64) [sasl-server-mechanisms=@PN_SYMBOL[:ANONYMOUS]]
        b'\x00\x00\x00\x1c\x02\x01\x00\x00\x00S@\xc0\x0f\x01\xe0\x0c\x01\xa3\tANONYMOUS'
        # @sasl-outcome(68) [code=0]
        b'\x00\x00\x00\x10\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00'
        # AMQP
        b'AMQP\x00\x01\x00\x00'
        # @open(16) [container-id="", channel-max=1234]
        b'\x00\x00\x00!\x02\x00\x00\x00\x00S\x10\xd0\x00\x00\x00\x11\x00\x00\x00\x0a\xa1\x00@@`\x04\xd2@@@@@@'
        )

    consumeAllOuput(self.t1)

    assert self.s1.outcome == SASL.OK
    assert c1.state & Endpoint.REMOTE_ACTIVE

  def testPipelined2(self):
    out1 = self.t1.peek(1024)
    self.t1.pop(len(out1))
    self.t2.push(out1)

    self.s2.allowed_mechs('ANONYMOUS')
    c2 = Connection()
    c2.open()
    self.t2.bind(c2)

    out2 = self.t2.peek(1024)
    self.t2.pop(len(out2))
    self.t1.push(out2)

    out1 = self.t1.peek(1024)
    assert len(out1) > 0

  def testFracturedSASL(self):
    """ PROTON-235
    """
    assert self.s1.outcome is None

    # self.t1.trace(Transport.TRACE_FRM)

    out = self.t1.peek(1024)
    self.t1.pop(len(out))
    self.t1.push(b"AMQP\x03\x01\x00\x00")
    out = self.t1.peek(1024)
    self.t1.pop(len(out))
    self.t1.push(b"\x00\x00\x00")
    out = self.t1.peek(1024)
    self.t1.pop(len(out))

    self.t1.push(b"6\x02\x01\x00\x00\x00S@\xc0\x29\x01\xe0\x26\x04\xa3\x05PLAIN\x0aDIGEST-MD5\x09ANONYMOUS\x08CRAM-MD5")
    out = self.t1.peek(1024)
    self.t1.pop(len(out))
    self.t1.push(b"\x00\x00\x00\x10\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00")
    out = self.t1.peek(1024)
    self.t1.pop(len(out))
    while out:
      out = self.t1.peek(1024)
      self.t1.pop(len(out))

    assert self.s1.outcome == SASL.OK, self.s1.outcome

  def test_singleton(self):
      """Verify that only a single instance of SASL can exist per Transport"""
      transport = Transport()
      attr = object()
      sasl1 = SASL(transport)
      sasl1.my_attribute = attr
      sasl2 = transport.sasl()
      sasl3 = SASL(transport)
      assert sasl1 == sasl2
      assert sasl1 == sasl3
      assert sasl1.my_attribute == attr
      assert sasl2.my_attribute == attr
      assert sasl3.my_attribute == attr
      transport = Transport()
      sasl1 = transport.sasl()
      sasl1.my_attribute = attr
      sasl2 = SASL(transport)
      assert sasl1 == sasl2
      assert sasl1.my_attribute == attr
      assert sasl2.my_attribute == attr

  def testSaslSkipped(self):
    """Verify that the server (with SASL) correctly handles a client without SASL"""
    self.t1 = Transport()
    self.t2.require_auth(False)
    self.pump()
    assert self.s2.outcome == None
    assert self.t2.condition == None
    assert self.t2.authenticated == False
    assert self.s1.outcome == None
    assert self.t1.condition == None
    assert self.t1.authenticated == False

  def testSaslSkippedFail(self):
    """Verify that the server (with SASL) correctly handles a client without SASL"""
    self.t1 = Transport()
    self.t2.require_auth(True)
    self.pump()
    assert self.s2.outcome == None
    assert self.t2.condition != None
    assert self.s1.outcome == None
    assert self.t1.condition != None

  def testMechNotFound(self):
    self.c1 = Connection()
    self.c1.open()
    self.t1.bind(self.c1)
    self.s1.allowed_mechs('IMPOSSIBLE')

    self.pump()

    assert self.t2.authenticated == False
    assert self.t1.authenticated == False
    assert self.s1.outcome != SASL.OK
    assert self.s2.outcome != SASL.OK

class SASLMechTest(Test):
  def setUp(self):
    self.t1 = Transport()
    self.s1 = SASL(self.t1)
    self.t2 = Transport(Transport.SERVER)
    self.s2 = SASL(self.t2)

    self.c1 = Connection()
    self.c1.user = 'user@proton'
    self.c1.password = 'password'
    self.c1.hostname = 'localhost'

    self.c2 = Connection()

  def testANON(self):
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'ANONYMOUS', authUser='anonymous')

  def testCRAMMD5(self):
    common.ensureCanTestExtendedSASL()

    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'CRAM-MD5')

  def testDIGESTMD5(self):
    common.ensureCanTestExtendedSASL()

    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'DIGEST-MD5')

  # PLAIN shouldn't work without encryption without special setting
  def testPLAINfail(self):
    common.ensureCanTestExtendedSASL()

    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'PLAIN', authenticated=False)

  # Client won't accept PLAIN even if offered by server without special setting
  def testPLAINClientFail(self):
    common.ensureCanTestExtendedSASL()

    self.s2.allow_insecure_mechs = True
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'PLAIN', authenticated=False)

  # PLAIN will only work if both ends are specially set up
  def testPLAIN(self):
    common.ensureCanTestExtendedSASL()

    self.s1.allow_insecure_mechs = True
    self.s2.allow_insecure_mechs = True
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'PLAIN')

# SCRAM not supported before Cyrus SASL 2.1.26
# so not universal and hence need a test for support
# to keep it in tests.
#  def testSCRAMSHA1(self):
#    common.ensureCanTestExtendedSASL()
#
#    self.t1.bind(self.c1)
#    self.t2.bind(self.c2)
#    _testSaslMech(self, 'SCRAM-SHA-1')

def _sslConnection(domain, transport, connection):
  transport.bind(connection)
  ssl = SSL(transport, domain, None )
  return connection

class SSLSASLTest(Test):
  def setUp(self):
    if not common.isSSLPresent():
      raise Skipped("No SSL libraries found.")

    self.server_domain = SSLDomain(SSLDomain.MODE_SERVER)
    self.client_domain = SSLDomain(SSLDomain.MODE_CLIENT)

    self.t1 = Transport()
    self.s1 = SASL(self.t1)
    self.t2 = Transport(Transport.SERVER)
    self.s2 = SASL(self.t2)

    self.c1 = Connection()
    self.c2 = Connection()

  def testSSLPlainSimple(self):
    if not SASL.extended():
      raise Skipped("Simple SASL server does not support PLAIN")
    common.ensureCanTestExtendedSASL()

    clientUser = 'user@proton'
    mech = 'PLAIN'

    self.c1.user = clientUser
    self.c1.password = 'password'
    self.c1.hostname = 'localhost'

    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
    ssl2 = _sslConnection(self.server_domain, self.t2, self.c2)

    _testSaslMech(self, mech, encrypted=True)

  def testSSLPlainSimpleFail(self):
    if not SASL.extended():
      raise Skipped("Simple SASL server does not support PLAIN")
    common.ensureCanTestExtendedSASL()

    clientUser = 'usr@proton'
    mech = 'PLAIN'

    self.c1.user = clientUser
    self.c1.password = 'password'
    self.c1.hostname = 'localhost'

    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
    ssl2 = _sslConnection(self.server_domain, self.t2, self.c2)

    _testSaslMech(self, mech, clientUser='usr@proton', encrypted=True, authenticated=False)

  def testSSLExternalSimple(self):
    if os.name=="nt":
      extUser = 'O=Client, CN=127.0.0.1'
    else:
      extUser = 'O=Client,CN=127.0.0.1'
    mech = 'EXTERNAL'

    self.server_domain.set_credentials(_sslCertpath("server-certificate.pem"),
                                       _sslCertpath("server-private-key.pem"),
                                       "server-password")
    self.server_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
    self.server_domain.set_peer_authentication(SSLDomain.VERIFY_PEER,
                                               _sslCertpath("ca-certificate.pem") )
    self.client_domain.set_credentials(_sslCertpath("client-certificate.pem"),
                                       _sslCertpath("client-private-key.pem"),
                                       "client-password")
    self.client_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
    self.client_domain.set_peer_authentication(SSLDomain.VERIFY_PEER)

    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
    ssl2 = _sslConnection(self.server_domain, self.t2, self.c2)

    _testSaslMech(self, mech, clientUser=None, authUser=extUser, encrypted=True)

  def testSSLExternalSimpleFail(self):
    mech = 'EXTERNAL'

    self.server_domain.set_credentials(_sslCertpath("server-certificate.pem"),
                                       _sslCertpath("server-private-key.pem"),
                                       "server-password")
    self.server_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
    self.server_domain.set_peer_authentication(SSLDomain.VERIFY_PEER,
                                               _sslCertpath("ca-certificate.pem") )
    self.client_domain.set_trusted_ca_db(_sslCertpath("ca-certificate.pem"))
    self.client_domain.set_peer_authentication(SSLDomain.VERIFY_PEER)

    ssl1 = _sslConnection(self.client_domain, self.t1, self.c1)
    ssl2 = _sslConnection(self.server_domain, self.t2, self.c2)

    _testSaslMech(self, mech, clientUser=None, authUser=None, encrypted=None, authenticated=False)

class SASLEventTest(engine.CollectorTest):
  def setUp(self):
    engine.CollectorTest.setUp(self)
    self.t1 = Transport()
    self.s1 = SASL(self.t1)
    self.t2 = Transport(Transport.SERVER)
    self.s2 = SASL(self.t2)

    self.c1 = Connection()
    self.c1.user = 'user@proton'
    self.c1.password = 'password'
    self.c1.hostname = 'localhost'

    self.c2 = Connection()

    self.collector = Collector()

  def testNormalAuthenticationClient(self):
    common.ensureCanTestExtendedSASL()
    self.c1.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'DIGEST-MD5')
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.CONNECTION_REMOTE_OPEN)

  def testNormalAuthenticationServer(self):
    common.ensureCanTestExtendedSASL()
    self.c2.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'DIGEST-MD5')
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.CONNECTION_REMOTE_OPEN)

  def testFailedAuthenticationClient(self):
    common.ensureCanTestExtendedSASL()
    clientUser = "usr@proton"
    self.c1.user = clientUser
    self.c1.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'DIGEST-MD5', clientUser=clientUser, authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_ERROR,
                Event.TRANSPORT_TAIL_CLOSED,
                Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)

  def testFailedAuthenticationServer(self):
    common.ensureCanTestExtendedSASL()
    clientUser = "usr@proton"
    self.c1.user = clientUser
    self.c2.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'DIGEST-MD5', clientUser=clientUser, authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_ERROR,
                Event.TRANSPORT_TAIL_CLOSED,
                Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)

  def testNoMechClient(self):
    common.ensureCanTestExtendedSASL()
    self.c1.collect(self.collector)
    self.s2.allowed_mechs('IMPOSSIBLE')
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'DIGEST-MD5', authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_ERROR,
                Event.TRANSPORT_TAIL_CLOSED, Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)

  def testNoMechServer(self):
    common.ensureCanTestExtendedSASL()
    self.c2.collect(self.collector)
    self.s2.allowed_mechs('IMPOSSIBLE')
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'DIGEST-MD5', authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_TAIL_CLOSED,
                Event.TRANSPORT_ERROR, Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)

  def testDisallowedMechClient(self):
    self.c1.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'IMPOSSIBLE', authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_ERROR,
                Event.TRANSPORT_TAIL_CLOSED, Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)

  def testDisallowedMechServer(self):
    self.c2.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'IMPOSSIBLE', authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_TAIL_CLOSED,
                Event.TRANSPORT_ERROR, Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)

  def testDisallowedPlainClient(self):
    self.c1.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'PLAIN', authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_ERROR,
                Event.TRANSPORT_TAIL_CLOSED, Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)

  def testDisallowedPlainServer(self):
    self.c2.collect(self.collector)
    self.t1.bind(self.c1)
    self.t2.bind(self.c2)
    _testSaslMech(self, 'PLAIN', authenticated=False)
    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND,
                Event.CONNECTION_LOCAL_OPEN, Event.TRANSPORT,
                Event.TRANSPORT_TAIL_CLOSED,
                Event.TRANSPORT_ERROR, Event.TRANSPORT_HEAD_CLOSED, Event.TRANSPORT_CLOSED)


text:
package net.java.sip.communicator.service.replacement;

/**
 * Property for Replacement Service
 *
 * @author Purvesh Sahoo
 */
public final class ReplacementProperty
{
    /**
     * The replacement proposal property.
     */
    public static final String REPLACEMENT_PROPOSAL =
        "plugin.chatconfig.replacement.proposal.enable";

    /**
     *  The replacement property.
     */
    public static final String REPLACEMENT_ENABLE =
        "net.java.sip.communicator.service.replacement.enable";

    /**
     * Returns the property name of individual replacement sources
     *
     * @param source the replacement source name.
     * @return the property name of the specified source as will be stored in
     *         the properties file.
     */
    public static String getPropertyName(String source)
    {
        return "net.java.sip.communicator.service.replacement."
                + source
                + ".enable";
    }
}

redpajama_set_name: RedPajamaGithub


text:
This is an implementation of the Simple and Modular Architecture for CSS conventions and a SASS Architecture for my own Curriculum.

This is mostly inspired by <http://thesassway.com/beginner/how-to-structure-a-sass-project>

## Why SMACSS ?

So tired of having Ctrl+F adventures in my css' hundreds of lines ...

## Why SASS ?

Sass comes with a lot of features allowing SMACSS to be even more powerful

And also because it's cool

# Try it

-   Copy this repo : `git clone https://github.com/Zacaria/SMASASS`
-   Install the dependencies : `npm install`
-   Launch the server : `grunt serve`
-   Edit files : reload and recompilation are automatic

## Demo features

-   Watchers on scss, view folder, and server file
-   Create build dist by running : `grunt build`

__Demo__ [here](http://cv-chtatarz.rhcloud.com/)

# Get started

- Grab the \_blank folder
- Copy it into your own project
- Add this line into your html :

    `<link type="text/css" rel="stylesheet" href="link/to/css/main.css">`

# Architecture explanation

Head to the core of the project : /public/styles/scss

        |-- scss
            |-- partials
            |   |-- layout
            |   |   |-- _layout.scss
            |   |-- modules
            |   |   |-- _modules.scss
            |   |-- themes
            |   |-- _base.scss
            |   |-- _reset.scss
            |   |-- _state.scss
            |   |-- _typo.scss
            |-- vars
            |   |-- _all.scss
            |   |-- ...
            |-- _shame.scss
            |-- main.scss

## partials
The partials folder contains code that output css

In this folder, we say 'rule = var'

## layout

All layouts are centralized by `_layouts.scss`

Layouts are major sections of the page (header, footer, sidebar)

Id's use is tolerable here.

## modules

All modules are centralized by `_modules.scss`

Modules are autonomous sections in a page.

Modules have to be modular and reusable :

    header .block-list { ... }  Bad idea =(
    .block-list-fit { ... }     Good idea =)

Rules for same modules have to share same base name :

    .btn {}
    .btn-search {}
    .btn-small {}
    .btn-large {}

## themes

Redefines base, layout, module and state rules to switch between themes

This way :

      //Default rules
      body {
          font-family: "Roboto", sans-serif;
      }

      header {
          background-color: #33F;
          color: #A66105;
      }

      .block-list > li{
          border: 0 dashed #00D;
      }

      //Overwritten rules
      .theme-ocean {
        font-family: "Roboto", sans-serif;

        .theme-ocean header {
            background-color: #33F;
            color: #A66105;
        }

        .theme-ocean .block-list > li{
            border: 0 dashed #00D;
        }
      }

This way, you can import all themes at the same time.

You just have to add the theme root class to apply it dynamically, using javascript for example.

## base

Base file imports vars and defines rules for html tags

## reset

Reset is a way of cleaning the styling differences between browsers in order to have a consistent baseline

Feel free to choose your own <http://cssreset.com/>

## state

This file defines the states of elements (like inputs, divs)

This is the only place where `!important`  is good to use

It defines a final state of an element, therefore, there should not be two states for an element

States can be :
- class names
- pseudo-class
- media queries

Primarily used by JavaScript

Class names have to say what is the intention of the rule :

    .is-loading {}
    .is-collapsed {}

When the state relates to a module

    .is-btn-active {}
    .is-btn-disabled {}

## typo

This is the only place where we should define typos

Be careful, the given path must be relative to main.scss

## vars

Vars are centralized by `_all.scss`

This is also the place for mixins

## shame

In the rush of development project we should allow some shameful non SMASASS code

It has to be documented !!

- What does it refer ?
- Why (so much hate) ?
- How does it work ?
- How would it be cleanable later ?

Of course this needs to be cleaned regularly

## main

The main file imports everything in this order :

- Third-party styles
- Reset
- Base
- Layouts
- Modules
- States
- Themes
- Shame

This is the only file that compass compiles.

# Suggestions ?


text:
package net.xpece.android.widget;

import android.content.Context;
import android.support.annotation.Keep;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.ViewGroup;

/**
 * @author Eugen on 15.03.2017.
 */

public class FixedItemSizeLinearLayoutManager extends LinearLayoutManager {

    private int mItemWidth = 0;
    private int mItemHeight = 0;

    public FixedItemSizeLinearLayoutManager(final Context context) {
        super(context);
    }

    public FixedItemSizeLinearLayoutManager(final Context context, final int orientation, final boolean reverseLayout) {
        super(context, orientation, reverseLayout);
    }

    @Keep
    public FixedItemSizeLinearLayoutManager(final Context context, final AttributeSet attrs, final int defStyleAttr, final int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public FixedItemSizeLinearLayoutManager setItemHeight(final int itemHeight) {
        if (mItemHeight != itemHeight) {
            mItemHeight = itemHeight;
            if (isAttachedToWindow()) {
                requestLayout();
            }
        }
        return this;
    }

    public FixedItemSizeLinearLayoutManager setItemWidth(final int itemWidth) {
        if (mItemWidth != itemWidth) {
            mItemWidth = itemWidth;
            if (isAttachedToWindow()) {
                requestLayout();
            }
        }
        return this;
    }

    @Override
    public RecyclerView.LayoutParams generateDefaultLayoutParams() {
        final RecyclerView.LayoutParams out = super.generateDefaultLayoutParams();
        if (mItemWidth > 0) out.width = mItemWidth;
        if (mItemHeight > 0) out.height = mItemHeight;
        return out;
    }

    @Override
    public RecyclerView.LayoutParams generateLayoutParams(final Context c, final AttributeSet attrs) {
        final RecyclerView.LayoutParams out = super.generateLayoutParams(c, attrs);
        if (mItemWidth > 0) out.width = mItemWidth;
        if (mItemHeight > 0) out.height = mItemHeight;
        return out;
    }

    @Override
    public RecyclerView.LayoutParams generateLayoutParams(final ViewGroup.LayoutParams lp) {
        final RecyclerView.LayoutParams out = super.generateLayoutParams(lp);
        if (mItemWidth > 0) out.width = mItemWidth;
        if (mItemHeight > 0) out.height = mItemHeight;
        return out;
    }
}


text:
function Test(lower, upper) {
  var lx = lower + "x";
  var ux = upper + "x";
  var lp = lower + "|";
  var uxp = upper + "x|";
  assertEquals(lx, new RegExp(uxp + lp + lower + "cat", "i").exec(lx) + "");
  assertEquals(ux, new RegExp(uxp + lp + lower + "cat", "i").exec(ux) + "");
  assertEquals(lower, new RegExp(lp + uxp + lower + "cat", "i").exec(lx) + "");
  assertEquals(upper, new RegExp(lp + uxp + lower + "cat", "i").exec(ux) + "");
}

function TestFail(lower, upper) {
  var lx = lower + "x";
  var ux = upper + "x";
  var lp = lower + "|";
  var uxp = upper + "x|";
  assertEquals(lower, new RegExp(uxp + lp + lower + "cat", "i").exec(lx) + "");
  assertEquals(ux, new RegExp(uxp + lp + lower + "cat", "i").exec(ux) + "");
  assertEquals(lower, new RegExp(lp + uxp + lower + "cat", "i").exec(lx) + "");
  assertEquals(ux, new RegExp(lp + uxp + lower + "cat", "i").exec(ux) + "");
}

Test("a", "A");
Test("0", "0");
TestFail("a", "b");
// Small and capital o-umlaut
Test(String.fromCharCode(0xf6), String.fromCharCode(0xd6));
// Small and capital kha.
Test(String.fromCharCode(0x445), String.fromCharCode(0x425));
// Small and capital y-umlaut.
Test(String.fromCharCode(0xff), String.fromCharCode(0x178));
// Small and large Greek mu.
Test(String.fromCharCode(0x3bc), String.fromCharCode(0x39c));
// Micron and large Greek mu.
Test(String.fromCharCode(0xb5), String.fromCharCode(0x39c));
// Micron and small Greek mu.
Test(String.fromCharCode(0xb5), String.fromCharCode(0x3bc));
// German double s and capital S. These are not equivalent since one is double.
TestFail(String.fromCharCode(0xdf), "S");
// Small i and Turkish capital dotted I. These are not equivalent due to
// 21.2.2.8.2 section 3g.  One is below 128 and the other is above 127.
TestFail("i", String.fromCharCode(0x130));
// Small dotless i and I. These are not equivalent either.
TestFail(String.fromCharCode(0x131), "I");


text:
/**
 * {@link org.apache.lucene.analysis.TokenFilter} and {@link
 * org.apache.lucene.analysis.Analyzer} implementations that use Snowball
 * stemmers.
 *

 * This project provides pre-compiled version of the Snowball stemmers
 * based on revision 500 of the Tartarus Snowball repository,
 * together with classes integrating them with the Lucene search engine.
 *

 *

 * A few changes has been made to the static Snowball code and compiled stemmers:
 *

 *

 *
Class SnowballProgram is made abstract and contains new abstract method stem() to avoid reflection in Lucene filter class SnowballFilter.

 *
All use of StringBuffers has been refactored to StringBuilder for speed.

 *
Snowball BSD license header has been added to the Java classes to avoid having RAT adding ASL headers.

 *

 *

 * See the Snowball home page for more information about the algorithms.
 *

 *
 *

 * IMPORTANT NOTICE ON BACKWARDS COMPATIBILITY!
 *

 *

 * An index created using the Snowball module in Lucene 2.3.2 and below
 * might not be compatible with the Snowball module in Lucene 2.4 or greater.
 *

 *

 * For more information about this issue see:
 * https://issues.apache.org/jira/browse/LUCENE-1142
 *

 */
package org.apache.lucene.analysis.snowball;


text:
package example.turlir.com.templater.base;

import example.turlir.com.templater.WidgetHolder;

public interface EmptyHandler {
    void process(WidgetHolder holder);
}


text:
<?php

namespace Custom\GreenBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Custom\GreenBundle\Entity\Page;
use Custom\GreenBundle\Form\PageType;

/**
 * Page controller.
 *
 */
class PageController extends Controller
{

    /**
     * Lists all Page entities.
     *
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('CustomGreenBundle:Page')->findAll();

        return $this->render('CustomGreenBundle:Page:index.html.twig', array(
            'entities' => $entities,
        ));
    }
    /**
     * Creates a new Page entity.
     *
     */
    public function createAction(Request $request)
    {
        $entity = new Page();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('cms_page_show', array('id' => $entity->getId())));
        }

        return $this->render('CustomGreenBundle:Page:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }

    /**
     * Creates a form to create a Page entity.
     *
     * @param Page $entity The entity
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createCreateForm(Page $entity)
    {
        $form = $this->createForm(new PageType(), $entity, array(
            'action' => $this->generateUrl('cms_page_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }

    /**
     * Displays a form to create a new Page entity.
     *
     */
    public function newAction()
    {
        $entity = new Page();
        $form   = $this->createCreateForm($entity);

        return $this->render('CustomGreenBundle:Page:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }

    /**
     * Finds and displays a Page entity.
     *
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CustomGreenBundle:Page')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Page entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return $this->render('CustomGreenBundle:Page:show.html.twig', array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Displays a form to edit an existing Page entity.
     *
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CustomGreenBundle:Page')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Page entity.');
        }

        $editForm = $this->createEditForm($entity);
        $deleteForm = $this->createDeleteForm($id);

        return $this->render('CustomGreenBundle:Page:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
    * Creates a form to edit a Page entity.
    *
    * @param Page $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm(Page $entity)
    {
        $form = $this->createForm(new PageType(), $entity, array(
            'action' => $this->generateUrl('cms_page_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
    /**
     * Edits an existing Page entity.
     *
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('CustomGreenBundle:Page')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Page entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('cms_page_edit', array('id' => $id)));
        }

        return $this->render('CustomGreenBundle:Page:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }
    /**
     * Deletes a Page entity.
     *
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('CustomGreenBundle:Page')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Page entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('cms_page'));
    }

    /**
     * Creates a form to delete a Page entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('cms_page_delete', array('id' => $id)))
            ->setMethod('DELETE')
            ->add('submit', 'submit', array('label' => 'Delete'))
            ->getForm()
        ;
    }
}


text:
namespace bookbot {

namespace {

enum class VelocitySearchLatticePrimitiveType {
  kConstantAcceleration,
  kTurnInPlace,
  kStandStill
};

struct VelocitySearchNode {
  VelocitySearchNode(
      int time_index_in, int velocity_index_in, double distance_traveled_in,
      double yaw_in, double x_position_in, double y_position_in,
      double curvature_in, double previous_acceleration_in,
      VelocitySearchLatticePrimitiveType previous_primitive_type_in,
      double cost_to_come_in, double cost_to_go_in, int parent_index_in)
      : time_index(time_index_in),
        velocity_index(velocity_index_in),
        distance_traveled(distance_traveled_in),
        yaw(yaw_in),
        x_position(x_position_in),
        y_position(y_position_in),
        curvature(curvature_in),
        previous_acceleration(previous_acceleration_in),
        previous_primitive_type(previous_primitive_type_in),
        cost_to_come(cost_to_come_in),
        cost_to_go(cost_to_go_in),
        parent_index(parent_index_in) {}

  Eigen::Vector2d Position() const { return {x_position, y_position}; }

  // Search state
  int time_index;
  int velocity_index;
  double distance_traveled;
  double yaw;

  // Cached path information
  double x_position;
  double y_position;
  double curvature;

  // Acceleration used in previous primitive and previous primitive type
  double previous_acceleration;
  VelocitySearchLatticePrimitiveType previous_primitive_type;

  // Search node values
  double cost_to_come;
  double cost_to_go;
  int parent_index;
};

std::ostream& operator<<(std::ostream& stream,
                         const VelocitySearchLatticePrimitiveType& type);

std::ostream& operator<<(std::ostream& stream, const VelocitySearchNode& node);

std::vector<VelocitySearchNode> EnumerateNeighbors(
    const VelocitySearchNode& current_node, const VelocityPlannerParams& params,
    const VelocitySearchVisitedGrid& visited_set, double velocity_resolution,
    int zero_velocity_index, double time_resolution, const Path& desired_path,
    int current_node_index);

}  // namespace

Trajectory PerformVelocityProfileSearch(
    const Path& desired_path, const Trajectory1DPoint& initial_state,
    const VelocityPlannerParams& params, const Trajectory& previous_trajectory,
    const SignedDistanceField& distance_field) {
  // v1   v2  v3  v4
  //  |   |   |   |
  // [0 1 2 3 4 5 6]  velocity_resolution = (max - min) / (vel_bins - 1)
  //   \_/ \_/ \_/                        = (6 - 0) / (4 - 1) = 2
  // velocity_resolution
  const double velocity_resolution =
      (params.velocity_bounds.constraint_interval.max_value -
       params.velocity_bounds.constraint_interval.min_value) /
      static_cast<double>(params.velocity_bins - 1);

  const double time_resolution =
      params.planning_time_horizon / static_cast<double>(params.time_bins);

  auto min_time_to_end = [&desired_path,
                          &params](const VelocitySearchNode& node) -> double {
    const double distance =
        desired_path.back().distance_along_path - node.distance_traveled;
    return distance / params.velocity_bounds.constraint_interval.max_value;
  };

  auto search_node_comparator = [](const VelocitySearchNode& a,
                                   const VelocitySearchNode& b) -> bool {
    return (a.cost_to_come + a.cost_to_go) > (b.cost_to_come + b.cost_to_go);
  };

  auto bin_velocity = [&params, velocity_resolution](double velocity) -> int {
    return std::round(
        (velocity - params.velocity_bounds.constraint_interval.min_value) /
        velocity_resolution);
  };

  const int zero_velocity_index = bin_velocity(0);

  auto visited_set =
      VelocitySearchVisitedGrid(params.visited_grid_distance_resolution);
  std::vector<VelocitySearchNode> closed_list;
  std::deque<VelocitySearchNode> velocity_profile;
  std::priority_queue<VelocitySearchNode, std::vector<VelocitySearchNode>,
                      decltype(search_node_comparator)>
      open_list(search_node_comparator);

  PathPoint initial_path_point = InterpolateCubicSpiralPathByDistanceAlongPath(
      initial_state.distance, std::begin(desired_path), std::end(desired_path));
  int initial_v_index = bin_velocity(initial_state.velocity);
  auto initial_node = VelocitySearchNode(
      0, initial_v_index, initial_state.distance, initial_path_point.yaw,
      initial_path_point.x, initial_path_point.y, initial_path_point.curvature,
      initial_state.acceleration,
      VelocitySearchLatticePrimitiveType::kConstantAcceleration, 0, 0, -1);
  initial_node.cost_to_go =
      min_time_to_end(initial_node) * params.travel_time_weight;
  open_list.push(initial_node);
  while (!open_list.empty()) {
    ScopedTimer timer("VelocitySearchTreeNodeEvaluation");
    VelocitySearchNode current_node = open_list.top();
    open_list.pop();

    // Check and insert into visited set
    if (!visited_set.Insert(current_node.time_index,
                            current_node.velocity_index,
                            current_node.distance_traveled)) {
      // Insert returns false if node already in visited set
      continue;
    }
    closed_list.push_back(current_node);

    // Check for goal
    double current_min_time_to_end = min_time_to_end(current_node);
    if ((current_min_time_to_end < 0.5 * time_resolution &&
         current_node.velocity_index == zero_velocity_index) ||
        current_node.time_index >= params.time_bins) {
      // At goal or horizon -> return best velocity_profile
      int parent_index = current_node.parent_index;
      velocity_profile.push_back(current_node);
      while (parent_index != -1) {
        VelocitySearchNode& out_node = closed_list[parent_index];
        parent_index = out_node.parent_index;
        velocity_profile.push_front(out_node);
      }
      break;
    }

    // Generate neighbor candidate set (no costs are computed yet)
    std::vector<VelocitySearchNode> candidate_neighbor_nodes =
        EnumerateNeighbors(current_node, params, visited_set,
                           velocity_resolution, zero_velocity_index,
                           time_resolution, desired_path,
                           closed_list.size() - 1);

    // Evaluate neighbors and add them to the open list
    for (VelocitySearchNode& neighbor_node : candidate_neighbor_nodes) {
      const double neighbor_velocity =
          params.velocity_bounds.constraint_interval.min_value +
          static_cast<double>(neighbor_node.velocity_index) *
              velocity_resolution;

      neighbor_node.cost_to_go =
          min_time_to_end(neighbor_node) * params.travel_time_weight;

      double obstacle_cost = 0;
      double dist_to_obstacles = 0;

      // Check constraints
      // Lateral acceleration constraints
      const double lateral_acceleration =
          neighbor_velocity * neighbor_velocity * neighbor_node.curvature;
      if (!params.lateral_acceleration_bounds.IsSatisfied(
              lateral_acceleration)) {
        continue;
      }

      // Max yaw change
      if (AngleDifference(neighbor_node.yaw, current_node.yaw) >
              params.max_yaw_change_for_nonzero_velocity &&
          neighbor_node.velocity_index != zero_velocity_index) {
        continue;
      }

      // Obstacle constraints
      // The occupancy_grid is already bloated by half the robot width so we
      // want to check two points to get a two circle coverage of the robot
      // shape.
      //   __________________
      //  |                  |
      //  |   _|_ ____ _|_   |
      //  |    | offset |    |
      //  |__________________|
      //       ^       ^
      //   base_link   base_link + offset
      //
      const Eigen::Vector2d neighbor_position = neighbor_node.Position();
      const Eigen::Vector2d neighbor_front_position =
          neighbor_position +
          Eigen::Rotation2D<double>(neighbor_node.yaw) *
              Eigen::Vector2d(params.obstacle_check_front_offset, 0);
      if (!params.override_obstacles) {
        double distance_to_obstacles =
            distance_field.Evaluate(neighbor_position);
        if (distance_to_obstacles <= params.robot_radius) {
          continue;
        }
        double front_distance_to_obstacles =
            distance_field.Evaluate(neighbor_front_position);
        if (front_distance_to_obstacles <= params.robot_radius) {
          continue;
        }
      }

      // Compute costs
      const double longitudinal_acceleration_cost =
          neighbor_node.previous_acceleration *
          neighbor_node.previous_acceleration *
          params.longitudinal_acceleration_weight;
      const double lateral_acceleration_cost =
          lateral_acceleration * lateral_acceleration *
          params.lateral_acceleration_weight;
      const double elapsed_time_cost = time_resolution * time_resolution;
      const double desired_velocity_deviation =
          params.desired_velocity_bounds.constraint_interval.max_value -
          neighbor_velocity;
      const double desired_velocity_deviation_cost =
          desired_velocity_deviation * desired_velocity_deviation *
          params.desired_velocity_weight;
      double incremental_node_cost =
          longitudinal_acceleration_cost + lateral_acceleration_cost +
          elapsed_time_cost + desired_velocity_deviation_cost;
      neighbor_node.cost_to_come =
          current_node.cost_to_come + incremental_node_cost;
      open_list.push(neighbor_node);
    }
  }

  auto search_node_to_trajectory_point =
      [&initial_state, &time_resolution, &velocity_resolution,
       &params](const VelocitySearchNode& node) -> TrajectoryPoint {
    TrajectoryPoint point;
    point.time = initial_state.time + node.time_index * time_resolution;
    point.x = node.x_position;
    point.y = node.y_position;
    point.distance_along_path = node.distance_traveled;
    point.yaw = node.yaw;
    point.curvature = node.curvature;
    point.velocity =
        params.velocity_bounds.constraint_interval.min_value +
        static_cast<double>(node.velocity_index) * velocity_resolution;
    return point;
  };

  // Visualize expanded Tree
  std::vector<std::pair<TrajectoryPoint, TrajectoryPoint>> expanded_tree;
  for (const auto& node : closed_list) {
    if (node.parent_index == -1) {
      continue;
    }
    expanded_tree.emplace_back(
        search_node_to_trajectory_point(closed_list[node.parent_index]),
        search_node_to_trajectory_point(node));
  }
  PublishIntrospection("expanded_velocity_tree", "odom", expanded_tree);

  // Convert optimal node sequence to trajectory
  Trajectory trajectory;
  for (const auto& node : velocity_profile) {
    trajectory.push_back(search_node_to_trajectory_point(node));
  }
  return trajectory;
}

namespace {

std::ostream& operator<<(std::ostream& stream,
                         const VelocitySearchLatticePrimitiveType& type) {
  switch (type) {
    case VelocitySearchLatticePrimitiveType::kConstantAcceleration:
      return stream << "<ConstantAccel>";
    case VelocitySearchLatticePrimitiveType::kTurnInPlace:
      return stream << "<TurnInPlace>";
    case VelocitySearchLatticePrimitiveType::kStandStill:
      return stream << "<StandStill>";
  }
  return stream;
}

std::ostream& operator<<(std::ostream& stream, const VelocitySearchNode& node) {
  stream << "[t:" << node.time_index << " v:" << node.velocity_index
         << " d:" << node.distance_traveled << " yaw:" << node.yaw
         << " type:" << node.previous_primitive_type
         << " c2c:" << node.cost_to_come << " ctg:" << node.cost_to_go << "]";
  return stream;
}

std::vector<VelocitySearchNode> EnumerateNeighbors(
    const VelocitySearchNode& current_node, const VelocityPlannerParams& params,
    const VelocitySearchVisitedGrid& visited_set, double velocity_resolution,
    int zero_velocity_index, double time_resolution, const Path& desired_path,
    int current_node_index) {
  std::vector<VelocitySearchNode> candidate_neighbor_nodes;
  // Add constant acceleration_options
  for (int neighbor_velocity_index = 0;
       neighbor_velocity_index < params.velocity_bins;
       ++neighbor_velocity_index) {
    const double acceleration =
        static_cast<double>(neighbor_velocity_index -
                            current_node.velocity_index) *
        velocity_resolution / time_resolution;
    if (!params.acceleration_bounds.IsSatisfied(acceleration)) {
      continue;
    }

    const double current_velocity =
        params.velocity_bounds.constraint_interval.min_value +
        static_cast<double>(current_node.velocity_index) * velocity_resolution;
    const double neighbor_distance_traveled =
        current_node.distance_traveled + current_velocity * time_resolution +
        0.5 * acceleration * time_resolution * time_resolution;

    // Check if its past the end of the path
    if (neighbor_distance_traveled > desired_path.back().distance_along_path -
                                         params.path_end_buffer_distance) {
      continue;
    }

    // Check visited
    if (visited_set.Contains(current_node.time_index + 1,
                             neighbor_velocity_index,
                             neighbor_distance_traveled)) {
      continue;
    }

    auto neighbor_path_point = InterpolateCubicSpiralPathByDistanceAlongPath(
        neighbor_distance_traveled, std::begin(desired_path),
        std::end(desired_path));

    candidate_neighbor_nodes.emplace_back(
        current_node.time_index + 1, neighbor_velocity_index,
        neighbor_distance_traveled, neighbor_path_point.yaw,
        neighbor_path_point.x, neighbor_path_point.y,
        neighbor_path_point.curvature, acceleration,
        VelocitySearchLatticePrimitiveType::kConstantAcceleration, 0, 0,
        current_node_index);
  }

  // Define turn in place options (equivalent to turning M_PI/2 in 1 second)
  const std::array<double, 2> turn_in_place_yaw_change_options = {
      -M_PI_2 * time_resolution, M_PI_2 * time_resolution};

  if (current_node.velocity_index == zero_velocity_index) {
    // Add turn-in-place options
    for (double yaw_change : turn_in_place_yaw_change_options) {
      // Skip visited list check for turn-in-place options
      candidate_neighbor_nodes.emplace_back(
          current_node.time_index + 1, zero_velocity_index,
          current_node.distance_traveled, current_node.yaw + yaw_change,
          current_node.x_position, current_node.y_position,
          current_node.curvature, 0,
          VelocitySearchLatticePrimitiveType::kTurnInPlace, 0, 0,
          current_node_index);
    }

    // Add standstill option
    // Skip visited list check for standstill options
    candidate_neighbor_nodes.emplace_back(
        current_node.time_index + 1, zero_velocity_index,
        current_node.distance_traveled, current_node.yaw,
        current_node.x_position, current_node.y_position,
        current_node.curvature, 0,
        VelocitySearchLatticePrimitiveType::kStandStill, 0, 0,
        current_node_index);
  }

  return candidate_neighbor_nodes;
}

}  // namespace

}  // namespace bookbot


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/nav_header_height"
    android:background="@drawable/side_nav_bar"
    android:gravity="bottom"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:theme="@style/ThemeOverlay.AppCompat.Dark">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/nav_header_vertical_spacing"
        android:src="@drawable/ic_live_tv_48pt" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/nav_header_vertical_spacing"
        android:text="远程视频监控系统"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Developed by Pwrliang" />

</LinearLayout>


text:
class SubmissionsController < ApplicationController
  before_action :all_submissions, only: [:index]
  def new
    @submission = Submission.new
  end

  def create
    current_challenge = Challenge.find(submission_params[:challenge_id])
    @challenge = current_challenge.next
    @submission = Submission.new(submission_params)
    @submission.user_id = current_user.id
    if @submission.save! && @challenge
      redirect_to user_challenge_path(current_user, @challenge)
    else
      redirect_to user_path(current_user)
    end
  end

  def update
    submission = Submission.find(params[:id])
    if submission.update(submission_params)
      redirect_to admin_hunt_path
    end
  end

  private

  def submission_params
    params.require(:submission).permit(:user_id, :challenge_id, :text, :photo, :lat, :lon, :photo_approved)
  end
end


text:
declare var $;

import {Component} from 'angular2/core';
import {NgForm}    from 'angular2/common';
import {ExpenseModel} from '../models/expense';
import {FlexibleLogService} from '../services/FlexibleLogService';
import { Daddy } from './daddy';

@Component({
	selector: 'flexibleLog-form',
	templateUrl: '/angular/views/flexibleLog/flexibleLog.html'
})

export class FlexibleLog extends Daddy {
	constructor(public flexibleLogService: FlexibleLogService) {
		super();
		this.flexibleLogsInit();
	}

	selectedMonth: string = '';
	selectedYear: string = '';
	selectedMonthNumber: number = 0;
	displayDays: any[] = [];
	mL = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
	year = ['2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025', '2026', '2027'];
	flexibleLogsInit() {
		let d = new Date();
		let n = d.getMonth();
		this.selectedMonth = this.mL[n];
		this.selectedMonthNumber = n;
		this.selectedYear = d.getFullYear();

		for (let i = 1; i <= this.getDaysFromMonth(this.selectedYear, this.selectedMonthNumber); i++){
			this.displayDays.push(i);
		}

		this.fetchPrimaryData();
	}

	getDaysFromMonth(year, month) {
		return new Date(year, month+ 1, 0).getDate();
	}

	changeMonthlyWorkReportSelection(month, year) {
		let d = new Date(month + '/01/' + year);
		let n = d.getMonth();
		this.selectedMonth = month;
		this.selectedMonthNumber = n;
		this.selectedYear = year;
	}

	goForWorkCatalog(month, year) {
		let d = new Date(month + '/01/' + year);
		let n = d.getMonth();
		this.selectedMonth = month;
		this.selectedMonthNumber = n;
		this.selectedYear = year;
		this.displayDays = [];

		for (let i = 1; i <= this.getDaysFromMonth(this.selectedYear, this.selectedMonthNumber); i++) {
			this.displayDays.push(i);
		}

		this.fetchPrimaryData();
	}

	finalData: any[] = [];
	fetchPrimaryData() {
		this.finalData = [];
		this.flexibleLogService.getFlexibleReport({
			month: this.selectedMonthNumber,
			year: this.selectedYear,
			day: this.displayDays
		}).subscribe(
			(data) => {
				for(let sogo of data) {
					this.finalData.push(sogo);
				}
			}
		);
	}
}


text:
mongo_server = 'ds254236.mlab.com' # Find this in your deployment settings
mongo_id     =  54236              # Find this in your deployment settings
mongo_client = 'stocktalk'         # The name of your deployment
mongo_user   = 'username'          # The username you added as a user to your deployment
mongo_pass   = 'password'          # The password you made for that user

# Twitter
api_key             = ''
api_secret          = ''
access_token        = ''
access_token_secret = ''
credentials = [api_key, api_secret, access_token, access_token_secret]


text:
describe("Match", function() {

  var mock;

  beforeEach(function(){
		mock = new Mock();
  });

  afterEach(function(){
    mock = null;
  });

  describe("string matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.a_string);
  		mock.a_method('a string');
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.a_string);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("array matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.an_array);
  		mock.a_method([1,2,3]);
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.an_array);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("function matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.a_function);
  		mock.a_method(function(){});
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.a_function);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("object matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.an_object);
  		mock.a_method({});
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.an_object);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("number matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.a_number);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.a_number);
  		mock.a_method("1234");
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("null matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.is_null);
  		mock.a_method(null);
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.is_null);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("date matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.a_date);
  		mock.a_method(new Date());
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.a_date);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("boolean matcher", function() {

    it("should pass validation with true", function(){
  		mock.expects('a_method').passing(Match.a_boolean);
  		mock.a_method(true);
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should pass validation with false", function(){
  		mock.expects('a_method').passing(Match.a_boolean);
  		mock.a_method(false);
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.a_boolean);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

  describe("undefined matcher", function() {

    it("should pass validation", function(){
  		mock.expects('a_method').passing(Match.is_undefined);
  		mock.a_method(undefined);
  		expect(mock.jsmocha.verify()).toBeTruthy();
    }); // end it

    it("should fail validation", function(){
  		mock.expects('a_method').passing(Match.is_undefined);
  		mock.a_method(1234);
  		expect(mock.jsmocha.verify()).toBeFalsy();
    }); // end it

  }); // end describe

}); // end describe


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W30121_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans18.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">30m

    <p class="styleSans660.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Whiting Oil and Gas Bartleson #11-19-2H
Section 19 T153N R92W Mountrail County, North Dakota
Wellsite Muflogger
NESET  CONSULTING —.
' SERVICE
6844 Highway 40, Tioga ND, 58852 701-664-1492

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">


text:
package eu.lunisolar.magma.func.predicate;

import eu.lunisolar.magma.func.*; // NOSONAR
import javax.annotation.Nonnull; // NOSONAR
import javax.annotation.Nullable; // NOSONAR
import java.util.Objects;// NOSONAR
import eu.lunisolar.magma.basics.meta.*; // NOSONAR
import eu.lunisolar.magma.basics.meta.functional.*; // NOSONAR
import eu.lunisolar.magma.basics.meta.functional.type.*; // NOSONAR
import eu.lunisolar.magma.basics.meta.functional.domain.*; // NOSONAR

import eu.lunisolar.magma.func.action.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.bi.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.obj.*; // NOSONAR
import eu.lunisolar.magma.func.consumer.primitives.tri.*; // NOSONAR
import eu.lunisolar.magma.func.function.*; // NOSONAR
import eu.lunisolar.magma.func.function.conversion.*; // NOSONAR
import eu.lunisolar.magma.func.function.from.*; // NOSONAR
import eu.lunisolar.magma.func.function.to.*; // NOSONAR
import eu.lunisolar.magma.func.operator.binary.*; // NOSONAR
import eu.lunisolar.magma.func.operator.ternary.*; // NOSONAR
import eu.lunisolar.magma.func.operator.unary.*; // NOSONAR
import eu.lunisolar.magma.func.predicate.*; // NOSONAR
import eu.lunisolar.magma.func.supplier.*; // NOSONAR

import org.testng.Assert;
import org.testng.annotations.*;      //NOSONAR
import java.util.regex.Pattern;          //NOSONAR
import java.text.ParseException;         //NOSONAR
import eu.lunisolar.magma.basics.*; //NOSONAR
import eu.lunisolar.magma.basics.exceptions.*; //NOSONAR
import java.util.concurrent.atomic.AtomicInteger; //NOSONAR
import eu.lunisolar.magma.func.tuple.*; // NOSONAR
import java.util.function.*; // NOSONAR

/** The test obviously concentrate on the interface methods the function it self is very simple.  */
public class LBiObjDblPredicateTest<T1,T2> {
    private static final String ORIGINAL_MESSAGE = "Original message";
    private static final String EXCEPTION_WAS_WRAPPED = "Exception was wrapped.";
    private static final String NO_EXCEPTION_WERE_THROWN = "No exception were thrown.";

    private boolean testValue = true;

    private LBiObjDblPredicate<Integer,Integer> sut = new LBiObjDblPredicate<Integer,Integer>(){
        public  boolean testX(Integer a1,Integer a2,double a3)  {
            return testValue;
        }
    };

    private LBiObjDblPredicate<Integer,Integer> sutAlwaysThrowing = LBiObjDblPredicate.biObjDblPred((a1,a2,a3) -> {
            throw new ParseException(ORIGINAL_MESSAGE, 0);
    });

    private LBiObjDblPredicate<Integer,Integer> sutAlwaysThrowingUnchecked = LBiObjDblPredicate.biObjDblPred((a1,a2,a3) -> {
            throw new IndexOutOfBoundsException(ORIGINAL_MESSAGE);
    });

    @Test
    public void testTheResult() throws Throwable {
         Assert.assertEquals(sut.test(100,100,100d), testValue);
    }

    @Test
    public void testTupleCall() throws Throwable {

        LBiObjDblTriple<Integer,Integer> domainObject = Tuple4U.biObjDblTriple(100,100,100d);

        Object result = sut.tupleTest(domainObject);

            Assert.assertEquals(result, testValue);
    }

    @Test
    public void testNonNullTest() throws Throwable {
            Assert.assertEquals(sut.nonNullTest(100,100,100d), testValue);
    }

    @Test
    public void testNestingTestUnchecked() throws Throwable {

        // then
        try {
            sutAlwaysThrowingUnchecked.nestingTest(100,100,100d);
            Assert.fail(NO_EXCEPTION_WERE_THROWN);
        } catch (Exception e) {
            Assert.assertEquals(e.getClass(), IndexOutOfBoundsException.class);
            Assert.assertNull(e.getCause());
            Assert.assertEquals(e.getMessage(), ORIGINAL_MESSAGE);
        }
    }

    @Test
    public void testShovingTestUnchecked() throws Throwable {

        // then
        try {
            sutAlwaysThrowingUnchecked.shovingTest(100,100,100d);
            Assert.fail(NO_EXCEPTION_WERE_THROWN);
        } catch (Exception e) {
            Assert.assertEquals(e.getClass(), IndexOutOfBoundsException.class);
            Assert.assertNull(e.getCause());
            Assert.assertEquals(e.getMessage(), ORIGINAL_MESSAGE);
        }
    }

    @Test
    public void testApplyAsBooleanShouldNotModifyValue() throws Throwable {
        Assert.assertEquals(sut.doApplyAsBoolean(100,100,100d), testValue);
    }

    @Test
    public void testFunctionalInterfaceDescription() throws Throwable {
        Assert.assertEquals(sut.functionalInterfaceDescription(), "LBiObjDblPredicate: boolean test(T1 a1,T2 a2,double a3)");
    }

    @Test
    public void testBiObjDblPredMethod() throws Throwable {
        Assert.assertTrue(LBiObjDblPredicate.biObjDblPred((a1,a2,a3) -> testValue ) instanceof LBiObjDblPredicate);

    }

    @Test
    public void testnegate() throws Throwable {
        Assert.assertEquals(sut.negate().test(100,100,100d), !testValue);
    }

    @DataProvider(name="boolean permutations")
    public Object[][] permuations() {
       return new Object[][] {
            // b1 , b2   , AND  , OR   , XOR
            {false, false, false, false, false },
            {true , false, false, true , true },
            {false, true , false, true , true },
            {true , true , true , true , false },
       };
    }

    @Test(dataProvider="boolean permutations")
    public void testAndOrXor(final boolean f1Result, final boolean f2Result, final boolean andResult, final boolean orResult, final boolean xorResult) throws Throwable {

        //given
        LBiObjDblPredicate<Integer,Integer> fun1 = LBiObjDblPredicate.biObjDblPred((a1,a2,a3) -> f1Result);
        LBiObjDblPredicate<Integer,Integer> fun2 = LBiObjDblPredicate.biObjDblPred((a1,a2,a3) -> f2Result);

        //when
        LBiObjDblPredicate<Integer,Integer> andFunction = fun1.and(fun2);
        LBiObjDblPredicate<Integer,Integer> orFunction = fun1.or(fun2);
        LBiObjDblPredicate<Integer,Integer> xorFunction = fun1.xor(fun2);

        //then
        Assert.assertEquals(andFunction.test(100,100,100d), andResult);

        Assert.assertEquals(orFunction.test(100,100,100d), orResult);

        Assert.assertEquals(xorFunction.test(100,100,100d), xorResult);
    }

    @Test
    public void testIsEqual() throws Throwable  {
        //when
        LBiObjDblPredicate<Integer,Integer> equals = LBiObjDblPredicate.isEqual(1,1,1d);

        //then
        Assert.assertTrue(equals.test(1,1,1d));

        Assert.assertFalse(equals.test(0,0,0d));
    }

    // <editor-fold desc="compose (functional)">

    @Test
    public void testCompose() throws Throwable {

        final ThreadLocal<Boolean> mainFunctionCalled = ThreadLocal.withInitial(()-> false);
        final AtomicInteger beforeCalls = new AtomicInteger(0);

        //given (+ some assertions)
        LBiObjDblPredicate<Integer,Integer> sutO = (a1,a2,a3) -> {
                mainFunctionCalled.set(true);
                Assert.assertEquals(a1, (Object) 90);
                Assert.assertEquals(a2, (Object) 91);
                Assert.assertEquals(a3, (Object) 92d);
                return true;
        };

        LFunction<Integer,Integer> before1 = p0 -> {
            Assert.assertEquals(p0, (Object) 80);
            beforeCalls.incrementAndGet();
            return 90;
        };
        LFunction<Integer,Integer> before2 = p1 -> {
            Assert.assertEquals(p1, (Object) 81);
            beforeCalls.incrementAndGet();
            return 91;
        };
        LDblUnaryOperator before3 = p2 -> {
            Assert.assertEquals(p2, (Object) 82d);
            beforeCalls.incrementAndGet();
            return 92d;
        };

        //when
        LBiObjDblPredicate<Integer,Integer> function = sutO.compose(before1,before2,before3);
        function.test(80,81,82d);

        //then - finals
        Assert.assertTrue(mainFunctionCalled.get());
        Assert.assertEquals(beforeCalls.get(), 3);
    }

    @Test
    public void testUnboxingCompose() throws Throwable {

        final ThreadLocal<Boolean> mainFunctionCalled = ThreadLocal.withInitial(()-> false);
        final AtomicInteger beforeCalls = new AtomicInteger(0);

        //given (+ some assertions)
        LBiObjDblPredicate<Integer,Integer> sutO = (a1,a2,a3) -> {
                mainFunctionCalled.set(true);
                Assert.assertEquals(a1, (Object) 90);
                Assert.assertEquals(a2, (Object) 91);
                Assert.assertEquals(a3, (Object) 92d);
                return true;
        };

        LFunction<Integer,Integer> before1 = p0 -> {
            Assert.assertEquals(p0, (Object) 80);
            beforeCalls.incrementAndGet();
            return 90;
        };
        LFunction<Integer,Integer> before2 = p1 -> {
            Assert.assertEquals(p1, (Object) 81);
            beforeCalls.incrementAndGet();
            return 91;
        };
        LToDblFunction<Integer> before3 = p2 -> {
            Assert.assertEquals(p2, (Object) 82);
            beforeCalls.incrementAndGet();
            return 92d;
        };

        //when
        LTriPredicate<Integer,Integer,Integer> function = sutO.unboxingCompose(before1,before2,before3);
        function.test(80,81,82);

        //then - finals
        Assert.assertTrue(mainFunctionCalled.get());
        Assert.assertEquals(beforeCalls.get(), 3);
    }

    // </editor-fold>

    // <editor-fold desc="then (functional)">

    @Test
    public void testBoolToBiObjDblFunc0() throws Throwable  {

        final ThreadLocal<Boolean> mainFunctionCalled = ThreadLocal.withInitial(()-> false);
        final ThreadLocal<Boolean> thenFunctionCalled = ThreadLocal.withInitial(()-> false);

        //given (+ some assertions)
        LBiObjDblPredicate<Integer,Integer> sutO = (a1,a2,a3) -> {
                mainFunctionCalled.set(true);
                Assert.assertEquals(a1, (Object) 80);
                Assert.assertEquals(a2, (Object) 81);
                Assert.assertEquals(a3, (Object) 82d);
                return true;
        };

        LBoolFunction<Integer> thenFunction = p -> {
                thenFunctionCalled.set(true);
                // boolean
                Assert.assertEquals(p, (Object) true);
                // Integer
                return 100;
        };

        //when
        LBiObjDblFunction<Integer,Integer,Integer> function = sutO.boolToBiObjDblFunc(thenFunction);
        Integer finalValue = function.apply(80,81,82d);

        //then - finals
        Assert.assertEquals(finalValue, (Object) 100);
        Assert.assertTrue(mainFunctionCalled.get());
        Assert.assertTrue(thenFunctionCalled.get());

    }

    @Test
    public void testBoolToBiObjDblPred1() throws Throwable  {

        final ThreadLocal<Boolean> mainFunctionCalled = ThreadLocal.withInitial(()-> false);
        final ThreadLocal<Boolean> thenFunctionCalled = ThreadLocal.withInitial(()-> false);

        //given (+ some assertions)
        LBiObjDblPredicate<Integer,Integer> sutO = (a1,a2,a3) -> {
                mainFunctionCalled.set(true);
                Assert.assertEquals(a1, (Object) 80);
                Assert.assertEquals(a2, (Object) 81);
                Assert.assertEquals(a3, (Object) 82d);
                return true;
        };

        LLogicalOperator thenFunction = p -> {
                thenFunctionCalled.set(true);
                // boolean
                Assert.assertEquals(p, (Object) true);
                // boolean
                return true;
        };

        //when
        LBiObjDblPredicate<Integer,Integer> function = sutO.boolToBiObjDblPred(thenFunction);
        boolean finalValue = function.test(80,81,82d);

        //then - finals
        Assert.assertEquals(finalValue, (Object) true);
        Assert.assertTrue(mainFunctionCalled.get());
        Assert.assertTrue(thenFunctionCalled.get());

    }

    // </editor-fold>

    @Test(expectedExceptions = RuntimeException.class)
    public void testShove() {

        // given
        LBiObjDblPredicate<Integer,Integer> sutThrowing = LBiObjDblPredicate.biObjDblPred((a1,a2,a3) -> {
            throw new UnsupportedOperationException();
        });

        // when
        sutThrowing.shovingTest(100,100,100d);
    }

    @Test
    public void testToString() throws Throwable {

        Assert.assertTrue(sut.toString().startsWith(this.getClass().getName()+"$"));

        Assert.assertTrue(String.format("%s", sut).contains("LBiObjDblPredicate: boolean test(T1 a1,T2 a2,double a3)"));

    }

    @Test
    public void isThrowing() {

        Assert.assertFalse(sut.isThrowing());
    }

}


text:
<component name="libraryTable">
  <library name="SBT: com.fasterxml.jackson.core:jackson-annotations:2.4.4">
    <CLASSES>
      <root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/jars/jackson-annotations-2.4.4.jar!/"/>
      <root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.4.4.jar!/"/>
    </CLASSES>
    <JAVADOC>
      <root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/docs/jackson-annotations-2.4.4-javadoc.jar!/"/>
    </JAVADOC>
    <SOURCES>
      <root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/srcs/jackson-annotations-2.4.4-sources.jar!/"/>
    </SOURCES>
  </library>
</component>


text:
<?php

namespace Encase;

use Encase\Container;
use Encase\ContainerItem;

class FactoryItem extends ContainerItem {

  function fetch() {
    return new $this->reifiedValue;
  }

}

?>


text:
import { ActionConst } from 'react-native-router-flux';
import { createReducer } from 'redux-immutablejs'
import Immutable from 'immutable'
const initialState = Immutable.fromJS({
  scene: {},
});

export default createReducer(initialState,{
  [ActionConst.FOCUS](state,{scene}) {
    return state.merge({
      scene,
    });
  },

});


text:
from confduino import exampallcreate
from confduino.libinstall import install_lib
from entrypoint2 import entrypoint

@entrypoint
def upgrade_many(upgrade=True, create_examples_all=True):
    """upgrade many libs.

    source: http://arduino.cc/playground/Main/LibraryList

    you can set your arduino path if it is not default
    os.environ['ARDUINO_HOME'] = '/home/...'

    """
    urls = set()

    def inst(url):
        print('upgrading %s' % url)
        assert url not in urls
        urls.add(url)
        try:
            lib = install_lib(url, upgrade)
            print(' -> %s' % lib)
        except Exception as e:
            print(e)

    ############################
    # github.com
    ############################
    inst('https://github.com/sensorium/Mozzi/zipball/master')
    inst('https://github.com/madsci1016/Arduino-EasyTransfer/zipball/master')
    inst('https://github.com/sparkfun/SevSeg/zipball/master')
    inst(
        'https://github.com/madsci1016/Arduino-SoftEasyTransfer/zipball/master')
    inst('https://github.com/madsci1016/Arduino-PS2X/zipball/master')
# inst('http://github.com/wimleers/flexitimer2/zipball/v1.0')# can't install
    inst('https://github.com/kerinin/arduino-splines/zipball/master')
    inst('https://github.com/asynclabs/WiShield/zipball/master')
    inst('https://github.com/asynclabs/dataflash/zipball/master')
    inst('https://github.com/slugmobile/AtTouch/zipball/master')
    inst(
        'https://github.com/carlynorama/Arduino-Library-Button/zipball/master')
    inst(
        'https://github.com/carlynorama/Arduino-Library-FancyLED/zipball/master')
    inst('https://github.com/markfickett/arduinomorse/zipball/master')
    inst('https://github.com/rocketscream/Low-Power/zipball/master')
    inst(
        'https://github.com/arduino-libraries/CapacitiveSensor/zipball/master')

    ############################
    # arduiniana.org
    ############################
    # TODO: how to get latest version??
    inst('http://arduiniana.org/PString/PString2.zip')
    inst('http://arduiniana.org/Flash/Flash3.zip')
    inst('http://arduiniana.org/NewSoftSerial/NewSoftSerial10c.zip')
    inst('http://arduiniana.org/Streaming/Streaming4.zip')
    inst('http://arduiniana.org/PWMServo/PWMServo.zip')
    inst('http://arduiniana.org/TinyGPS/TinyGPS10.zip')

    ############################
    # google
    ############################
    # TODO: how to get latest version??
    # parse http://code.google.com/p/arduino-pinchangeint/downloads/list

    # simplified version in core
    inst('http://rogue-code.googlecode.com/files/Arduino-Library-Tone.zip')

    inst('http://arduino-playground.googlecode.com/files/LedDisplay03.zip')
    inst('http://sserial2mobile.googlecode.com/files/SSerial2Mobile-1.1.0.zip')
    inst('http://webduino.googlecode.com/files/webduino-1.4.1.zip')
    inst('http://arduino-pid-library.googlecode.com/files/PID_v1.0.1.zip')
    inst('http://ideoarduinolibraries.googlecode.com/files/Qtouch1Wire.zip')
    inst('http://arduino-timerone.googlecode.com/files/TimerOne-v8.zip')
    inst('http://arduinounit.googlecode.com/files/arduinounit-1.4.2.zip')
    inst('http://arduinode.googlecode.com/files/arduinode_0.1.zip')
    inst('http://arduino-edb.googlecode.com/files/EDB_r7.zip')
    inst('http://arduino-dblib.googlecode.com/files/DB.zip')
    inst(
        'http://morse-endecoder.googlecode.com/files/Morse_EnDecoder_2010.12.06.tar.gz')
    inst('http://arduino-pinchangeint.googlecode.com/files/PinChangeInt.zip')
    inst('http://arduino-tvout.googlecode.com/files/TVout_R5.91.zip')
    inst('http://narcoleptic.googlecode.com/files/Narcoleptic_v1a.zip')

    ############################
    # teensy
    ############################
    inst('http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip')
    inst('http://www.pjrc.com/teensy/arduino_libraries/VirtualWire.zip')
    inst('http://www.pjrc.com/teensy/arduino_libraries/FrequencyTimer2.zip')
    inst('http://www.pjrc.com/teensy/arduino_libraries/FreqCount.zip')
    inst('http://www.pjrc.com/teensy/arduino_libraries/FreqMeasure.zip')

    ############################
    # others
    ############################

# too big
#    inst('http://www.state-machine.com/arduino/qp_arduino.zip')

# The owner of this website (download.milesburton.com) has banned your access based on your browser's signature
#     inst('http://download.milesburton.com/Arduino/MaximTemperature/DallasTemperature_370Beta.zip')

    inst('http://www.shikadi.net/files/arduino/SerialIP-1.0.zip')
    inst(
        'http://siggiorn.com/wp-content/uploads/libraries/ArduinoByteBuffer.zip')
    inst(
        'http://siggiorn.com/wp-content/uploads/libraries/ArduinoSerialManager.zip')
    inst('http://arduino-tweet.appspot.com/Library-Twitter-1.2.2.zip')

# can't install
# inst('http://gkaindl.com/php/download.php?key=ArduinoEthernet')

    inst(
        'http://sebastian.setz.name/wp-content/uploads/2011/01/multiCameraIrControl_1-5.zip')
    inst('http://alexandre.quessy.net/static/avr/Tween_01.zip')
    inst(
        'http://www.lpelettronica.it/images/stories/LPM11162_images/Arduino/LPM11162_ArduinoLib_v1.zip')
    # inst('http://nootropicdesign.com/hackvision/downloads/Controllers.zip')
    inst(
        'http://interface.khm.de/wp-content/uploads/2009/01/FreqCounter_1_12.zip')
    inst(
        'http://interface.khm.de/wp-content/uploads/2010/06/FreqPeriod_1_12.zip')

    ############################
    # arduino.cc
    ############################
    inst('http://arduino.cc/playground/uploads/Main/PS2Keyboard002.zip')
    inst('http://arduino.cc/playground/uploads/Code/Metro.zip')
    inst('http://www.arduino.cc/playground/uploads/Main/MsTimer2.zip')

# can't install
# inst('http://www.arduino.cc/playground/uploads/Code/Time.zip')

    inst('http://arduino.cc/playground/uploads/Main/LedControl.zip')

# can't install
# inst('http://www.arduino.cc/playground/uploads/Code/ks0108GLCD.zip')#

    inst('http://arduino.cc/playground/uploads/Code/Bounce.zip')
    inst('http://arduino.cc/playground/uploads/Main/CapacitiveSense003.zip')
    inst('http://arduino.cc/playground/uploads/Main/PinChangeInt.zip')

# can't install
# inst('http://arduino.cc/playground/uploads/Code/TimerThree.zip')

    inst('http://arduino.cc/playground/uploads/Code/TimedAction-1_6.zip')

# can't install
# inst('http://www.arduino.cc/playground/uploads/Code/Time.zip')

    inst('http://arduino.cc/playground/uploads/Code/EventFuse.zip')
    inst('http://arduino.cc/playground/uploads/Code/Charlieplex.zip')
    inst('http://arduino.cc/playground/uploads/Code/DigitalToggle.zip')
    inst('http://arduino.cc/playground/uploads/Code/Enerlib.zip')

    inst('http://arduino.cc/playground/uploads/Code/AdvButton_11.zip')

    # old version
    # inst('http://arduino.cc/playground/uploads/Code/AdvButton.zip')

# can't install
# inst('http://arduino.cc/playground/uploads/Code/SerialDebugger.zip') #

    inst('http://arduino.cc/playground/uploads/Code/MatrixMath.zip')
    inst('http://arduino.cc/playground/uploads/Code/StackArray.zip')
    inst('http://arduino.cc/playground/uploads/Code/StackList.zip')
    inst('http://arduino.cc/playground/uploads/Code/QueueArray.zip')
    inst('http://arduino.cc/playground/uploads/Code/QueueList.zip')
    inst('http://arduino.cc/playground/uploads/Code/Ping-1_3.zip')
    inst('http://www.arduino.cc/playground/uploads/Code/LED.zip')

#    inst('')

    if create_examples_all:
        print('create "all" menu item')
        exampallcreate.create_examples_all()
    print('install finished')


text:
{% extends "account/base.html" %}

{% load django_bootstrap_breadcrumbs %}
{% load i18n %}

{% block head_title %}{% trans "Change Password" %}{% endblock %}

{% block breadcrumbs %}
    {{ block.super }}
    {% breadcrumb "Password Recovery" "" %}
{% endblock %}

{% block content %}

{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}

                    {% if token_fail %}
                        {% url 'account_reset_password' as passwd_reset_url %}

{% blocktrans %}The password reset link was invalid, possibly because it has already been used.  Please request a new password reset.{% endblocktrans %}

                    {% else %}
                        {% if form %}
                            <form method="POST" action=".">
                                {% csrf_token %}
                                {{ form.as_p }}
                                <input type="submit" name="action" class="btn btn-primary" value="{% trans "change password" %}"/>
                            </form>
                        {% else %}

{% trans 'Your password is now changed.' %}

                        {% endif %}
                    {% endif %}

{% endblock %}


text:
<form method="post" id="captcha_form" name="captcha_form" action="/mailform.php">

Email address

			<input type="text" class="soloinput twelve" name="email" id="email" value="" />

Subject

			<input type="text" class="soloinput twelve" name="subject" id="subject" />

			<input name="submit" id="submit" type="submit" value="Send" />

Message

			<textarea class="soloinput twelve" name="message" id="message" ></textarea>

</form>

Thanks for getting in touch!


text: <!DOCTYPE html>


text:
<ion-view title="Vardyger">

  <ion-content class="padding">

Tap the <icon ios="ion-navicon" android="ion-navicon" default="ion-navicon" class="energized"></icon>
      nav-icon to view the side menu.

Choose "{{ 'CONTENT' | translate }}" to view a list of posts.

The "{{ 'LOGOUT' | translate }}" menu item will be displayed when you are logged in.

  </ion-content>

</ion-view>


text:
/**
 *    @file
 *          Platform-specific configuration overrides for CHIP on
 *          the PSoC6 platform.
 */

#pragma once

#include "cy_result.h"

// ==================== General Platform Adaptations ====================

#define CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID "enc-msg-counter"
// The ESP NVS implementation limits key names to 15 characters.
#define CHIP_CONFIG_PERSISTED_STORAGE_MAX_KEY_LENGTH 15

#define CHIP_CONFIG_ERROR_TYPE cy_rslt_t
#define CHIP_CONFIG_NO_ERROR CY_RSLT_SUCCESS
#define CHIP_CONFIG_ERROR_MIN 4000000
#define CHIP_CONFIG_ERROR_MAX 4000999
#define CHIP_CONFIG_ERROR_FORMAT PRId32

#define ASN1_CONFIG_ERROR_TYPE cy_rslt_t
#define ASN1_CONFIG_NO_ERROR CY_RSLT_SUCCESS
#define ASN1_CONFIG_ERROR_MIN 5000000
#define ASN1_CONFIG_ERROR_MAX 5000999

#define CHIP_LOG_FILTERING 0

#define CHIP_CONFIG_ABORT() abort()

// ==================== Security Adaptations ====================


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace StageBitz.AdminWeb.Company {

    public partial class PricingPlanHistory {

        /// <summary>
        /// A1 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlAnchor A1;

        /// <summary>
        /// A2 control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlAnchor A2;

        /// <summary>
        /// btnSendToExcel control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button btnSendToExcel;

        /// <summary>
        /// upnlPricingHistory control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.UpdatePanel upnlPricingHistory;

        /// <summary>
        /// GroupBox control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::StageBitz.AdminWeb.Controls.Common.GroupBox GroupBox;

        /// <summary>
        /// ddlDisplayPricingPlans control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.DropDownList ddlDisplayPricingPlans;

        /// <summary>
        /// gvPricingPlans control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::StageBitz.AdminWeb.Controls.Common.SBRadGrid gvPricingPlans;
    }
}


text:
[API docs](http://apidocs.persistiq.com/)

## Installation
### PyPi (recommended)
`pip install persistiq`

### Git
`pip install git+git://github.com/tizz98/persistiq.git@master`

## Usage
### Setup
- Add `PERSIST_IQ_API_KEY='xxxxxxxx'` to your environment variables
    - bash: `echo export PERSIST_IQ_API_KEY='xxxxxxxx' >> ~/.bashrc`
    - zsh: `echo export PERSIST_IQ_API_KEY='xxxxxxxx' >> ~/.zshrc`
    - windows: ???
- Open up a new terminal or:
    - bash: `. ~/.bashrc`
    - zsh: `. ~/.zshrc`
    - windows: ???

### Resources
#### User
```python
from persistiq import User

for user in User.list():
    print user.id, user.name
```

#### Lead
```python
from persistiq import Lead

# NOTE:
# Leads will automatically be paginated
# to only get the first 100 without pagination set:
# >>> Lead.paginate = False

for lead in Lead.list():
    print lead.id, lead.data
```

#### Campaign
```python
from persistiq import Campaign

# NOTE:
# Campaigns will automatically be paginated
# to only get the first 100 without pagination set:
# >>> Campaign.paginate = False

for campaign in Campaign.list():
    print campaign.id, campaign.name
```


text:
            {{-- Collapsed Hamburger --}}
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
                {!! trans('titles.toggleNav') !!}

            </button>

            {{-- Branding Image --}}

                {!! trans('titles.app') !!}

            {{-- Left Side Of Navbar --}}

                @role('admin')

                            Admin

id, 'users/' . Auth::user()->id . '/edit') ? 'class=active' : null }}>{!! HTML::link(url('/users'), Lang::get('titles.adminUserList')) !!}

{!! HTML::link(url('/users/create'), Lang::get('titles.adminNewUser')) !!}

{!! HTML::link(url('/themes'), Lang::get('titles.adminThemesList')) !!}

{!! HTML::link(url('/logs'), Lang::get('titles.adminLogs')) !!}

{!! HTML::link(url('/php'), Lang::get('titles.adminPHP')) !!}

{!! HTML::link(url('/routes'), Lang::get('titles.adminRoutes')) !!}

                @endrole

            {{-- Right Side Of Navbar --}}

                {{-- Authentication Links --}}
                @if (Auth::guest())

{!! trans('titles.login') !!}

{!! trans('titles.register') !!}

                @else

                            @if ((Auth::User()->profile) && Auth::user()->profile->avatar_status == 1)
                                profile->avatar }}" alt="{{ Auth::user()->name }}" class="user-avatar-nav">
                            @else

                            @endif

                            {{ Auth::user()->name }}

name, 'profile/'.Auth::user()->name . '/edit') ? 'class=active' : null }}>
                                {!! HTML::link(url('/profile/'.Auth::user()->name), trans('titles.profile')) !!}

                                    {!! trans('titles.logout') !!}

                                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                    {{ csrf_field() }}
                                </form>

                @endif


text:
app.dependencies = ['store-common'];
app.server = function (ctx) {
    return {
        endpoints: {
            pages: [{
                title: 'Store | Analytics',
                url: 'analytics',
                path: 'analytics.jag',
                secured: true
            }, {
                title: 'Store | Devices',
                url: 'devices',
                path: 'device_listing.jag',
                secured: true
            }, {
                title: 'Store | Device Details',
                url: 'device',
                path: 'device_details.jag',
                secured: true
            }, {
                title: 'Store | Device Events',
                url: 'events',
                path: 'events.jag',
                secured: true
            }, {
                title: 'Store | Groups',
                url: 'groups',
                path: 'groups.jag',
                secured: true
            }, {
                title: 'Store | Policies',
                url: 'policies',
                path: 'policies.jag',
                secured: true
            }, {
                title: 'Store | Users',
                url: 'users',
                path: 'users.jag',
                secured: true
            }, {
                title:'Store | Advance Search',
                url:'advanced-search',
                path:'advanced-search.jag'
            },{
                url:'sso-login',
                path:'sso-auth-login-controller.jag'
            }],
            apis: [{
                url: 'stats',
                path: 'stats-api.jag',
                secured: true
            }, {
                url: 'operations',
                path: 'operation-api.jag',
                secured: true
            }, {
                url: 'devices',
                path: 'device-api.jag',
                secured: true
            },{
                url: 'group',
                path: 'group-api.jag',
                secured: true
            }, {
                url: 'policies',
                path: 'policy-api.jag',
                secured: true
            }, {
                url: 'users',
                path: 'user-api.jag',
                secured: true
            }]
        },
        configs: {
            landingPage: '/pages/devices',
            disabledAssets: ['ebook', 'api', 'wsdl', 'servicex', 'policy', 'proxy', 'schema', 'sequence', 'uri', 'wadl', 'endpoint', 'swagger', 'restservice', 'comments', 'soapservice', 'service', 'license', 'gadget', 'site', 'server']
        }
    }
};

app.pageHandlers = function (ctx) {
    return {
        onPageLoad: function () {
            if ((ctx.isAnonContext) && (ctx.endpoint.secured)) {
                var redirectUrl;
                if (ctx.endpoint.url == 'devices'){
                    redirectUrl = ctx.appContext + '/assets/deviceType/list';
                }else{
                    redirectUrl = ctx.appContext + '/login?requestedPage=' + encodeURIComponent(ctx.appContext + '/pages/' + ctx.endpoint.url) + '&ignoreReferer=true';
                }
                ctx.res.sendRedirect(redirectUrl);
                return false;
            }
            return true;
        }
    }
};

app.apiHandlers = function (ctx) {
    return {
        onApiLoad: function () {
            if ((ctx.isAnonContext) && (ctx.endpoint.secured)) {
                var redirectUrl = ctx.appContext + '/login?requestedPage=' + encodeURIComponent(ctx.appContext + '/pages/devices') + '&ignoreReferer=true';
                ctx.res.sendRedirect(redirectUrl);
                return false;
            }
            return true;
        }
    }
};

app.renderer = function (ctx) {
    var decoratorApi = require('/modules/page-decorators.js').pageDecorators;
    var customDecoratorApi = require('../modules/custom-page-decorators.js').pageDecorators;
    return {
        pageDecorators: {
            navigationBar: function (page) {
                return customDecoratorApi.navigationBar(ctx, page, this);
            },
            searchBar: function (page) {
                return decoratorApi.searchBar(ctx, page, this);
            },
            authenticationDetails: function (page) {
                return decoratorApi.authenticationDetails(ctx, page, this);
            },
            recentAssetsOfActivatedTypes: function (page) {
                return decoratorApi.recentAssetsOfActivatedTypes(ctx, page, this);
            },
            popularAssets: function (page) {
                return decoratorApi.popularAssets(ctx, page, this);
            }
        }
    }
};


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

    function MediaAppContentController($scope) {

        var vm = this;

    }

    angular.module("umbraco").controller("Umbraco.Editors.Media.Apps.ContentController", MediaAppContentController);
})();


text:
package com.ibm.g11n.pipeline.client.impl;

import java.util.Collections;
import java.util.Map;

import com.ibm.g11n.pipeline.client.TranslationConfigData;

/**
 * TranslationConfigData implementation class.
 *
 * @author Yoshito Umaoka
 */
class TranslationConfigDataImpl extends TranslationConfigData {

    static class MTServiceDataImpl extends MTServiceData {
        private final Map<String, Object> params;

        MTServiceDataImpl(RestMTServiceData restMTService) {
            super(restMTService.getServiceInstanceId(),
                    restMTService.getUpdatedBy(), restMTService.getUpdatedAt());
            this.params = restMTService.getParams();
        }

        @Override
        public Map<String, Object> getParams() {
            if (params == null) {
                return null;
            }
            return Collections.unmodifiableMap(params);
        }
    }

    MTServiceDataImpl mtService;

    TranslationConfigDataImpl(RestTranslationConfigData restTransConfig) {
        super(restTransConfig.getUpdatedBy(), restTransConfig.getUpdatedAt());
        this.mtService = new MTServiceDataImpl(restTransConfig.getMTService());
    }

    @Override
    public MTServiceData getMTServiceData() {
        return mtService;
    }

    /**
     * Data object used for deserializing translation config data in JSON.
     *
     * @author Yoshito Umaoka
     */
    static class RestTranslationConfigData extends RestObject {
        private RestMTServiceData mtService;

        /**
         * No-args constructor used by JSON unmarshaller
         */
        RestTranslationConfigData() {
        }

        public RestMTServiceData getMTService() {
            return mtService;
        }
    }

    /**
     * Data object used for deserializing MT service data in translation
     * config data in JSON.
     *
     * @author Yoshito Umaoka
     */
    static class RestMTServiceData extends RestObject {
        private String serviceInstanceId;
        private Map<String, Object> params;

        /**
         * No-args constructor used by JSON unmarshaller
         */
        RestMTServiceData() {
        }

        public String getServiceInstanceId() {
            return serviceInstanceId;
        }

        public Map<String, Object> getParams() {
            return params;
        }
    }
}