text:
<?php

namespace app\modules\manut_transporte\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\modules\manut_transporte\models\TransporteAdmin;

/**
 * TransporteAdminSearch represents the model behind the search form about `app\modules\manut_transporte\models\TransporteAdmin`.
 */
class TransporteAdminEncerradasSearch extends TransporteAdminEncerradas
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'tipo_solic_id', 'tipocarga_id', 'situacao_id', 'motorista_id', 'idusuario_solic', 'idusuario_suport'], 'integer'],
            [['data_solicitacao', 'bairro_id','descricao_transporte', 'local', 'data_prevista', 'hora_prevista', 'data_confirmacao', 'hora_confirmacao', 'usuario_solic_nome', 'usuario_suport_nome', 'tipo_carga_label', 'motorista_label'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = TransporteAdmin::find()
        ->orderBy(['id' => SORT_DESC]);

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $dataProvider->sort->attributes['tipo_carga_label'] = [
        'asc' => ['tipo_carga.descricao' => SORT_ASC],
        'desc' => ['tipo_carga.descricao' => SORT_DESC],
        ];

        $dataProvider->sort->attributes['motorista_label'] = [
        'asc' => ['motorista.descricao' => SORT_ASC],
        'desc' => ['motorista.descricao' => SORT_DESC],
        ];

        // $dataProvider->sort->attributes['bairro_label'] = [
        // 'asc' => ['bairro.descricao' => SORT_ASC],
        // 'desc' => ['bairro.descricao' => SORT_DESC],
        // ];

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->joinWith('tipoCarga');
        $query->joinWith('motorista');
        $query->joinWith('bairro');
        $query->joinWith('situacao');

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'data_solicitacao' => $this->data_solicitacao,
            'data_prevista' => $this->data_prevista,
            'hora_prevista' => $this->hora_prevista,
            'data_confirmacao' => $this->data_confirmacao,
            'hora_confirmacao' => $this->hora_confirmacao,
            'tipo_solic_id' => $this->tipo_solic_id,
            'tipocarga_id' => $this->tipocarga_id,
            'motorista_id' => $this->motorista_id,
            'idusuario_solic' => $this->idusuario_solic,
            'idusuario_suport' => $this->idusuario_suport,
            'situacao_id' => 3, //SOLICITAÇÕES ENCERRADAS
        ]);

        $query->andFilterWhere(['like', 'descricao_transporte', $this->descricao_transporte])
            ->andFilterWhere(['like', 'local', $this->local])
            ->andFilterWhere(['=', 'tipo_carga.descricao', $this->tipo_carga_label])
            ->andFilterWhere(['=', 'motorista.descricao', $this->motorista_label])
            ->andFilterWhere(['like', 'bairro.descricao', $this->bairro_id])
            ->andFilterWhere(['like', 'usuario_solic_nome', $this->usuario_solic_nome])
            ->andFilterWhere(['like', 'usuario_suport_nome', $this->usuario_suport_nome]);

        return $dataProvider;
    }
}


text:
namespace TradeAndTravel
{
    public class Iron : Item
    {
        private const int InitialIronValue = 3;

        public Iron(string name, Location location = null)
            : base(name, Iron.InitialIronValue, ItemType.Iron, location)
        {
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace SPV\ProveedorBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ProveedorBundle extends Bundle
{
}


text:
package org.apache.creadur.tentacles;

import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public enum LicenseType {

    ASL_2_0("asl-2.0"), CPL_1_0("cpl-1.0"), CDDL_1_0("cddl-1.0");

    public static Licenses loadLicensesFrom(final Platform platform)
            throws IOException {
        final Map<String, String> licenses =
                new ConcurrentHashMap<String, String>();
        for (final LicenseType type : LicenseType.values()) {
            type.putTextInto(licenses, platform.getTentaclesResources());
        }
        return new Licenses(licenses, platform);
    }

    private final String resourceName;
    private final String resourcePath;

    private LicenseType(final String resourceName) {
        this.resourceName = resourceName;
        this.resourcePath = "licenses/" + getResourceName() + ".txt";
    }

    public String getResourceName() {
        return this.resourceName;
    }

    public String getResourcePath() {
        return this.resourcePath;
    }

    public String readText(final TentaclesResources tentaclesResources)
            throws IOException {
        return tentaclesResources.readText(getResourcePath()).trim();
    }

    public void putTextInto(final Map<String, String> licenseTextByName,
            final TentaclesResources tentaclesResources) throws IOException {
        licenseTextByName.put(getResourceName(), readText(tentaclesResources));
    }
}


text:
namespace GAME {

    Collection Screen::screens;

    Screen::Screen() :
        Body(nullptr) {
        init(nullptr, screens);

        _isVisible = false;

    }
    Screen::~Screen() {

        deinit(screens);
    }

    Status Screen::update( const float dt, const float t ) {

        if(LIB::checkIfQuit()) return Status::Cancel;
        return Status::Run;

    }

    void Screen::draw( const double delta) {
        glClearColor(0.01, 0.04, 0.1, 1.0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        Body::draw(delta);
        get_console()->draw(delta);
    }

}


text:
import os

import emport

from ..exceptions import BadMountpoint
from ..utils.url import Mountpoint

_SUBSYSTEM_BY_NAME = {}

class SubsystemMeta(type):

    def __new__(mcs, classname, bases, classdict):
        returned = type.__new__(mcs, classname, bases, classdict)
        if 'NAME' in classdict:
            _SUBSYSTEM_BY_NAME[classdict['NAME']] = returned
        return returned

class SubsystemBase(metaclass=SubsystemMeta):

    SUBSYSTEM_BY_NAME = _SUBSYSTEM_BY_NAME
    SUPPORTS_OVERLAYS = False

    def __init__(self, manager):
        super(SubsystemBase, self).__init__()
        self.manager = manager
        self.project = self.manager.project
        self.grains = []

    def add_grain(self, path, config):
        self.grains.append(LoadedGrain(self, path, config))

    def get_docker_preamble_steps(self):
        return ()

    def get_docker_install_steps(self):
        return ()

    def activate(self, flask_app):
        pass

    def configure_app(self, flask_app):
        for grain in self.grains:
            self.configure_grain(grain, flask_app)

    def configure_grain(self, grain, flask_app):
        raise NotImplementedError() # pragma: no cover

    def configure_tmux_window(self, windows):
        pass

    def iter_locations(self):
        raise NotImplementedError() # pragma: no cover

class LoadedGrain(object):

    def __init__(self, subsystem, path, config):
        super(LoadedGrain, self).__init__()
        self.subsystem = subsystem
        self.path = path
        self.relpath = os.path.relpath(self.path, self.subsystem.project.root)
        self.config = config
        self.mountpoint = self.config.get('mountpoint', None)
        if self.mountpoint is not None:
            if self.mountpoint != '/' and self.mountpoint.endswith('/'):
                raise BadMountpoint(f'Mountpoint for grain {self.path} should not end with /')
            self.mountpoint = Mountpoint(self.mountpoint)

    def get_path_from(self, project_root):
        return os.path.abspath(os.path.join(project_root, self.relpath))

    def load(self):
        if os.path.isfile(self.path):
            return emport.import_file(self.path)
        main = self.config.get('main', 'main')
        if not main.endswith('.py'):
            main += '.py'
        return emport.import_file(os.path.join(self.path, main))

    def load_python_symbol_by_name(self, symbol):
        filename, symbol = symbol.rsplit(':', 1)
        grain = self.load_python_module_by_name(filename)
        return getattr(grain, symbol)

    def load_python_module_by_name(self, rel_filename):
        assert not os.path.isabs(rel_filename)
        rel_filename = os.path.join(self.path, rel_filename)
        if not os.path.isfile(rel_filename) and not rel_filename.endswith('.py'):
            rel_filename += '.py'
        if not os.path.isfile(rel_filename):
            raise RuntimeError(f'File does not exist: {rel_filename!r}')
        module = emport.import_file(rel_filename)
        return module

    def __repr__(self):
        return self.path


text:
import tornado
from tornado.websocket import WebSocketHandler
from tornado.web import RequestHandler, Application, url
import tornadis

clients = []

class GetHandler(RequestHandler):

    @tornado.gen.coroutine
    def get(self):
        self.render("websocket.html")

class WSHandler(WebSocketHandler):

    @tornado.gen.coroutine
    def initialize(self):
        self.redis = tornadis.Client()
        loop = tornado.ioloop.IOLoop.current()
        loop.add_callback(self.watch_redis)

    @tornado.gen.coroutine
    def watch_redis(self):
        while True:
            response = yield self.redis.call('BLPOP', 'ws-queue', 0)
            for client in clients:
                client.write_message(response[1])

    def open(self, *args):
        clients.append(self)

    @tornado.gen.coroutine
    def on_message(self, message):
        yield self.redis.call('LPUSH', 'ws-queue', message)

    def on_close(self):
        clients.remove(self)

app = Application([
    url(r"/", GetHandler),
    url(r"/ws", WSHandler)
])

if __name__ == '__main__':
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()


text:
package org.axonframework.axonserver.connector;

import io.axoniq.axonserver.grpc.control.NodeInfo;
import org.axonframework.axonserver.connector.event.util.EventCipher;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.lang.management.ManagementFactory;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Configuration class provided configurable fields and defaults for anything Axon Server related.
 *
 * @author Marc Gathier
 * @since 4.0
 */
@ConfigurationProperties(prefix = "axon.axonserver")
public class AxonServerConfiguration {

    private static final int DEFAULT_GRPC_PORT = 8124;
    private static final String DEFAULT_SERVERS = "localhost";
    private static final String DEFAULT_CONTEXT = "default";

    /**
     * Whether (automatic) configuration of the AxonServer Connector is enabled. When {@code false}, the connector will
     * not be implicitly be configured. Defaults to {@code true}.
     *

     * Note that this setting will only affect automatic configuration by Application Containers (such as Spring).
     */
    private boolean enabled = true;

    /**
     * Comma separated list of AxonServer servers. Each element is hostname or hostname:grpcPort. When no grpcPort is
     * specified, default port 8123 is used.
     */
    private String servers = DEFAULT_SERVERS;

    /**
     * Client identifier as it registers itself to AxonServer, must be unique.
     */
    private String clientId = ManagementFactory.getRuntimeMXBean().getName();

    /**
     * Application name, defaults to spring.application.name multiple instances of the same application share the same
     * application name, but each must have a different clientId.
     */
    private String componentName;

    /**
     * Token for access control
     */
    private String token;

    /**
     * Bounded context that this application operates in. Defaults to {@code "default"}.
     */
    private String context = DEFAULT_CONTEXT;

    /**
     * Certificate file for SSL.
     */
    private String certFile;

    /**
     * Use TLS for connection to AxonServer.
     */
    private boolean sslEnabled;

    /**
     * Initial number of permits send for message streams (events, commands, queries).
     */
    private Integer initialNrOfPermits = 5000;

    /**
     * Additional number of permits send for message streams (events, commands, queries) when application is ready for
     * more messages.
     *

     * A value of {@code null}, 0, and negative values will have the client request the number of permits required to
     * get from the "new-permits-threshold" to "initial-nr-of-permits".
     */
    private Integer nrOfNewPermits = null;

    /**
     * Threshold at which application sends new permits to server.
     *

     * A value of {@code null}, 0, and negative values will have the threshold set to 50% of "initial-nr-of-permits".
     */
    private Integer newPermitsThreshold = null;

    /**
     * Specific flow control settings for the event message stream.
     *

     * When not specified (null) the default flow control properties initialNrOfPermits, nrOfNewPermits en
     * newPermitsThreshold will be used.
     */
    private FlowControlConfiguration eventFlowControl;

    /**
     * Specific flow control settings for the queue message stream.
     */
    private FlowControlConfiguration queryFlowControl;

    /**
     * Specific flow control settings for the command message stream.
     */
    private FlowControlConfiguration commandFlowControl;

    /**
     * Number of threads executing commands.
     */
    private int commandThreads = 10;

    /**
     * Number of threads executing queries.
     */
    private int queryThreads = 10;

    /**
     * Interval (in ms.) application sends status updates on event processors to AxonServer.
     */
    private int processorsNotificationRate = 500;

    /**
     * Initial delay (in ms.) before application sends first status update on event processors to AxonServer.
     */
    private int processorsNotificationInitialDelay = 5000;

    /**
     * An {@link EventCipher} which is used to encrypt and decrypt events and snapshots. Defaults to {@link
     * EventCipher#EventCipher()}.
     *
     * @deprecated in through use of the AxonServer java
     * connector
     */
    @Deprecated
    private EventCipher eventCipher = new EventCipher();

    /**
     * Timeout (in ms) for keep alive requests.
     */
    private long keepAliveTimeout = 5000;

    /**
     * Interval (in ms) for keep alive requests, 0 is keep-alive disabled. Defaults to {@code 1000}.
     */
    private long keepAliveTime = 1_000;

    /**
     * An {@code int} indicating the maximum number of Aggregate snapshots which will be retrieved. Defaults to {@code
     * 1}.
     */
    private int snapshotPrefetch = 1;

    /**
     * Indicates whether the download advice message should be suppressed, even when default connection properties
     * (which are generally only used in DEV mode) are used. Defaults to false.
     */
    private boolean suppressDownloadMessage = false;

    /**
     * GRPC max inbound message size, 0 keeps default value.
     */
    private int maxMessageSize = 0;

    /**
     * Timeout (in milliseconds) to wait for response on commit.
     */
    private int commitTimeout = 10000;

    /**
     * Flag that allows blacklisting of Event types to be disabled. Disabling this may have serious performance impact,
     * as it requires all messages from AxonServer to be sent to clients, even if a Client is unable to process the
     * message.
     *

     * Default is to have blacklisting enabled.
     */
    private boolean disableEventBlacklisting = false;

    /**
     * The number of messages that may be in-transit on the network/grpc level when streaming data from the server.
     * Setting this to 0 (or a negative value) will disable buffering, and requires each message sent by the server to
     * be acknowledged before the next message may be sent. Defaults to 500.
     */
    private int maxGrpcBufferedMessages = 500;

    /**
     * It represents the fixed value of load factor sent to Axon Server for any command's subscription if no specific
     * implementation of CommandLoadFactorProvider is configured. The default value is 100.
     */
    private int commandLoadFactor = 100;

    /**
     * Represents the maximum time in milliseconds a request for the initial Axon Server connection may last. Defaults
     * to 5000 (5 seconds).
     */
    private long connectTimeout = 5000;

    /**
     * Indicates whether it is OK to query events from the local Axon Server node - the node the client is currently
     * connected to. This means that the client will probably get stale events since all events my not be replicated to
     * this node yet. Can be used when the criteria for eventual consistency is less strict. It will spread the load for
     * querying events - not all requests will go to the leader of the cluster anymore.
     *

     * If Axon Server SE is used, this property has no effect.
     *

     */
    private boolean forceReadFromLeader = false;

    /**
     * Instantiate a {@link Builder} to create an {@link AxonServerConfiguration}.
     *
     * @return a {@link Builder} to be able to create an {@link AxonServerConfiguration}.
     */
    public static Builder builder() {
        Builder builder = new Builder();
        if (Boolean.getBoolean("axon.axonserver.suppressDownloadMessage")) {
            builder.suppressDownloadMessage();
        }

        return builder;
    }

    /**
     * Instantiate a default {@link AxonServerConfiguration}.
     */
    public AxonServerConfiguration() {
    }

    public boolean isEnabled() {
        return enabled;
    }

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

    public String getServers() {
        return servers;
    }

    public void setServers(String routingServers) {
        this.servers = routingServers;
        suppressDownloadMessage = true;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getComponentName() {
        return componentName == null
                ? System.getProperty("axon.application.name", "Unnamed-" + clientId)
                : componentName;
    }

    public void setComponentName(String componentName) {
        this.componentName = componentName;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getCertFile() {
        return certFile;
    }

    public void setCertFile(String certFile) {
        this.certFile = certFile;
    }

    public boolean isSslEnabled() {
        return sslEnabled;
    }

    public void setSslEnabled(boolean sslEnabled) {
        this.sslEnabled = sslEnabled;
    }

    public Integer getInitialNrOfPermits() {
        return initialNrOfPermits;
    }

    public void setInitialNrOfPermits(Integer initialNrOfPermits) {
        this.initialNrOfPermits = initialNrOfPermits;
    }

    public Integer getNrOfNewPermits() {
        if (nrOfNewPermits == null || nrOfNewPermits <= 0) {
            return getInitialNrOfPermits() - getNewPermitsThreshold();
        }
        return nrOfNewPermits;
    }

    public void setNrOfNewPermits(Integer nrOfNewPermits) {
        this.nrOfNewPermits = nrOfNewPermits;
    }

    public Integer getNewPermitsThreshold() {
        if (newPermitsThreshold == null || newPermitsThreshold <= 0) {
            return initialNrOfPermits / 2;
        }
        return newPermitsThreshold;
    }

    public void setNewPermitsThreshold(Integer newPermitsThreshold) {
        this.newPermitsThreshold = newPermitsThreshold;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public List<NodeInfo> routingServers() {
        String[] serverArr = servers.split(",");
        return Arrays.stream(serverArr).map(server -> {
            String[] s = server.trim().split(":");
            if (s.length > 1) {
                return NodeInfo.newBuilder().setHostName(s[0]).setGrpcPort(Integer.parseInt(s[1])).build();
            }
            return NodeInfo.newBuilder().setHostName(s[0]).setGrpcPort(DEFAULT_GRPC_PORT).build();
        }).collect(Collectors.toList());
    }

    public EventCipher getEventCipher() {
        return eventCipher;
    }

    private void setEventSecretKey(String key) {
        if (key != null && key.length() > 0) {
            eventCipher = new EventCipher(key.getBytes(StandardCharsets.US_ASCII));
        }
    }

    public Integer getCommandThreads() {
        return commandThreads;
    }

    public void setCommandThreads(Integer commandThreads) {
        this.commandThreads = commandThreads;
    }

    public void setCommandThreads(int commandThreads) {
        this.commandThreads = commandThreads;
    }

    public int getQueryThreads() {
        return queryThreads;
    }

    public void setQueryThreads(int queryThreads) {
        this.queryThreads = queryThreads;
    }

    public int getProcessorsNotificationRate() {
        return processorsNotificationRate;
    }

    public void setProcessorsNotificationRate(int processorsNotificationRate) {
        this.processorsNotificationRate = processorsNotificationRate;
    }

    public int getProcessorsNotificationInitialDelay() {
        return processorsNotificationInitialDelay;
    }

    public void setProcessorsNotificationInitialDelay(int processorsNotificationInitialDelay) {
        this.processorsNotificationInitialDelay = processorsNotificationInitialDelay;
    }

    public long getKeepAliveTimeout() {
        return this.keepAliveTimeout;
    }

    public void setKeepAliveTimeout(long keepAliveTimeout) {
        this.keepAliveTimeout = keepAliveTimeout;
    }

    public long getKeepAliveTime() {
        return keepAliveTime;
    }

    public void setKeepAliveTime(long keepAliveTime) {
        this.keepAliveTime = keepAliveTime;
    }

    public boolean getSuppressDownloadMessage() {
        return suppressDownloadMessage;
    }

    public void setSuppressDownloadMessage(boolean suppressDownloadMessage) {
        this.suppressDownloadMessage = suppressDownloadMessage;
    }

    public int getMaxMessageSize() {
        return maxMessageSize;
    }

    public void setMaxMessageSize(int maxMessageSize) {
        this.maxMessageSize = maxMessageSize;
    }

    public int getSnapshotPrefetch() {
        return snapshotPrefetch;
    }

    public void setSnapshotPrefetch(int snapshotPrefetch) {
        this.snapshotPrefetch = snapshotPrefetch;
    }

    public boolean isDisableEventBlacklisting() {
        return disableEventBlacklisting;
    }

    public void setDisableEventBlacklisting(boolean disableEventBlacklisting) {
        this.disableEventBlacklisting = disableEventBlacklisting;
    }

    public int getCommitTimeout() {
        return commitTimeout;
    }

    public void setCommitTimeout(int commitTimeout) {
        this.commitTimeout = commitTimeout;
    }

    public int getMaxGrpcBufferedMessages() {
        return maxGrpcBufferedMessages;
    }

    public void setMaxGrpcBufferedMessages(int maxGrpcBufferedMessages) {
        this.maxGrpcBufferedMessages = maxGrpcBufferedMessages;
    }

    public int getCommandLoadFactor() {
        return commandLoadFactor;
    }

    public void setCommandLoadFactor(int commandLoadFactor) {
        this.commandLoadFactor = commandLoadFactor;
    }

    public long getConnectTimeout() {
        return connectTimeout;
    }

    public void setConnectTimeout(long connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public boolean isForceReadFromLeader() {
        return forceReadFromLeader;
    }

    public void setForceReadFromLeader(boolean forceReadFromLeader) {
        this.forceReadFromLeader = forceReadFromLeader;
    }

    public FlowControlConfiguration getEventFlowControl() {
        if (eventFlowControl == null) {
            return new FlowControlConfiguration(getInitialNrOfPermits(), getNrOfNewPermits(), getNewPermitsThreshold());
        }
        return eventFlowControl;
    }

    public void setEventFlowControl(FlowControlConfiguration eventFlowControl) {
        this.eventFlowControl = eventFlowControl;
    }

    public FlowControlConfiguration getQueryFlowControl() {
        if (queryFlowControl == null) {
            return new FlowControlConfiguration(getInitialNrOfPermits(), getNrOfNewPermits(), getNewPermitsThreshold());
        }
        return queryFlowControl;
    }

    public void setQueryFlowControl(FlowControlConfiguration queryFlowControl) {
        this.queryFlowControl = queryFlowControl;
    }

    public FlowControlConfiguration getCommandFlowControl() {
        if (commandFlowControl == null) {
            return new FlowControlConfiguration(getInitialNrOfPermits(), getNrOfNewPermits(), getNewPermitsThreshold());
        }
        return commandFlowControl;
    }

    public void setCommandFlowControl(FlowControlConfiguration commandFlowControl) {
        this.commandFlowControl = commandFlowControl;
    }

    public FlowControlConfiguration getDefaultFlowControlConfiguration() {
        return new FlowControlConfiguration(initialNrOfPermits, nrOfNewPermits, newPermitsThreshold);
    }

    /**
     * Configuration class for Flow Control of specific message types.
     *
     * @author Gerlo Hesselink
     * @since 4.3
     */
    public static class FlowControlConfiguration {

        /**
         * Initial number of permits send for message streams (events, commands, queries).
         */
        private Integer initialNrOfPermits = 5000;

        /**
         * Additional number of permits send for message streams (events, commands, queries) when application is ready
         * for more messages.
         *

         * A value of {@code null}, 0, and negative values will have the client request the number of permits required
         * to get from the "new-permits-threshold" to "initial-nr-of-permits".
         */
        private Integer nrOfNewPermits = null;

        /**
         * Threshold at which application sends new permits to server.
         *

         * A value of {@code null}, 0, and negative values will have the threshold set to 50% of
         * "initial-nr-of-permits".
         */
        private Integer newPermitsThreshold = null;

        public FlowControlConfiguration() {
        }

        /**
         * Construct a {@link FlowControlConfiguration}.
         *
         * @param initialNrOfPermits  initial nr of new permits
         * @param nrOfNewPermits      additional number of permits when application is ready for message
         * @param newPermitsThreshold threshold at which application sends new permits to server
         */
        public FlowControlConfiguration(Integer initialNrOfPermits, Integer nrOfNewPermits,
                                        Integer newPermitsThreshold) {
            this.initialNrOfPermits = initialNrOfPermits;
            this.nrOfNewPermits = nrOfNewPermits;
            this.newPermitsThreshold = newPermitsThreshold;
        }

        public Integer getInitialNrOfPermits() {
            return this.initialNrOfPermits;
        }

        public void setInitialNrOfPermits(Integer initialNrOfPermits) {
            this.initialNrOfPermits = initialNrOfPermits;
        }

        public Integer getNrOfNewPermits() {
            if (this.nrOfNewPermits == null || this.nrOfNewPermits <= 0) {
                return getInitialNrOfPermits() - getNewPermitsThreshold();
            }
            return this.nrOfNewPermits;
        }

        public void setNrOfNewPermits(Integer nrOfNewPermits) {
            this.nrOfNewPermits = nrOfNewPermits;
        }

        public Integer getNewPermitsThreshold() {
            if (this.newPermitsThreshold == null || this.newPermitsThreshold <= 0) {
                return this.initialNrOfPermits / 2;
            }
            return this.newPermitsThreshold;
        }

        public void setNewPermitsThreshold(Integer newPermitsThreshold) {
            this.newPermitsThreshold = newPermitsThreshold;
        }
    }

    @SuppressWarnings("unused")
    public static class Builder {

        private final AxonServerConfiguration instance;

        public Builder() {
            instance = new AxonServerConfiguration();
            instance.initialNrOfPermits = 1000;
            instance.nrOfNewPermits = 500;
            instance.newPermitsThreshold = 500;
        }

        public Builder ssl(String certFile) {
            instance.certFile = certFile;
            instance.sslEnabled = true;
            return this;
        }

        public Builder token(String token) {
            instance.token = token;
            return this;
        }

        public Builder context(String context) {
            instance.context = context;
            return this;
        }

        public Builder forceReadFromLeader(boolean forceReadFromLeader) {
            instance.forceReadFromLeader = forceReadFromLeader;
            return this;
        }

        public Builder flowControl(int initialNrOfPermits, int nrOfNewPermits, int newPermitsThreshold) {
            instance.initialNrOfPermits = initialNrOfPermits;
            instance.nrOfNewPermits = nrOfNewPermits;
            instance.newPermitsThreshold = newPermitsThreshold;
            return this;
        }

        public Builder commandFlowControl(int initialNrOfPermits, int nrOfNewPermits, int newPermitsThreshold) {
            instance.setCommandFlowControl(new FlowControlConfiguration(initialNrOfPermits,
                                                                        nrOfNewPermits,
                                                                        newPermitsThreshold));
            return this;
        }

        public Builder queryFlowControl(int initialNrOfPermits, int nrOfNewPermits, int newPermitsThreshold) {
            instance.setQueryFlowControl(new FlowControlConfiguration(initialNrOfPermits,
                                                                      nrOfNewPermits,
                                                                      newPermitsThreshold));
            return this;
        }

        public Builder eventFlowControl(int initialNrOfPermits, int nrOfNewPermits, int newPermitsThreshold) {
            instance.setEventFlowControl(new FlowControlConfiguration(initialNrOfPermits,
                                                                      nrOfNewPermits,
                                                                      newPermitsThreshold));
            return this;
        }

        public Builder setEventSecretKey(String key) {
            instance.setEventSecretKey(key);
            return this;
        }

        public Builder eventCipher(EventCipher eventCipher) {
            instance.eventCipher = eventCipher;
            return this;
        }

        public Builder maxMessageSize(int maxMessageSize) {
            instance.maxMessageSize = maxMessageSize;
            return this;
        }

        public Builder snapshotPrefetch(int snapshotPrefetch) {
            instance.snapshotPrefetch = snapshotPrefetch;
            return this;
        }

        public Builder commandLoadFactor(int commandLoadFactor) {
            instance.commandLoadFactor = commandLoadFactor;
            return this;
        }

        /**
         * Initializes a {@link AxonServerConfiguration} as specified through this Builder.
         *
         * @return a {@link AxonServerConfiguration} as specified through this Builder
         */
        public AxonServerConfiguration build() {
            return instance;
        }

        public Builder servers(String servers) {
            instance.setServers(servers);
            return this;
        }

        public Builder suppressDownloadMessage() {
            instance.setSuppressDownloadMessage(true);
            return this;
        }

        public Builder componentName(String componentName) {
            instance.setComponentName(componentName);
            return this;
        }

        public Builder clientId(String clientId) {
            instance.setClientId(clientId);
            return this;
        }

        public Builder connectTimeout(long timeout) {
            instance.setConnectTimeout(timeout);
            return this;
        }
    }
}


text:
function showStudents() {

}


text:
<?php

/**
 * ======================================================================
 * LICENSE: This file is subject to the terms and conditions defined in *
 * file 'license.txt', which is part of this source code package.       *
 * ======================================================================
 */

/**
 * AAM Plugin Update Hook
 *
 * @package AAM
 * @author Vasyl Martyniuk <support@wpaam.com>
 * @copyright Copyright C Vasyl Martyniuk
 * @license GNU General Public License {@link http://www.gnu.org/licenses/}
 */
final class aam_Core_Update {

    /**
     * Reference to AAM
     *
     * @var aam
     *
     * @access private
     */

    private $_parent = null;
    /**
     * List of stages
     *
     * @var array
     *
     * @access private
     */
    private $_stages = array();

    /**
     * Constructoor
     *
     * @return void
     *
     * @access public
     */
    public function __construct($parent) {
        $this->_parent = $parent;
        //register update stages
        $this->_stages = apply_filters('aam_update_stages', array(
            array($this, 'downloadRepository'),
            array($this, 'flashCache'),
            array($this, 'updateFlag')
        ));
    }

    /**
     * Run the update if necessary
     *
     * @return void
     *
     * @access public
     */
    public function run() {
        foreach ($this->_stages as $stage) {
            //break the change if any stage failed
            if (call_user_func($stage) === false) {
                break;
            }
        }
    }

    /**
     * Download the Extension Repository
     *
     * This forces the system to retrieve the new set of extensions based on
     * license key
     *
     * @return boolean
     *
     * @access public
     */
    public function downloadRepository() {
        $response = true;
        if ($extensions = aam_Core_API::getBlogOption('aam_extensions')) {
            if (is_array($extensions)){
                $repo = aam_Core_Repository::getInstance($this->_parent);
                $repo->download();
            }
        }

        return $response;
    }

    /**
     * Flash all cache
     *
     * @return boolean
     *
     * @access public
     */
    public function flashCache(){
        global $wpdb;

        //clear visitor's cache first
        if (is_multisite()) {
            //get all sites first and iterate through each
            $query = 'SELECT blog_id FROM ' . $wpdb->blogs;
            $blog_list = $wpdb->get_results($query);
            if (is_array($blog_list)) {
                $query = 'DELETE FROM %s WHERE `option_name` = "aam_%s_cache"';
                foreach ($blog_list as $blog) {
                    $wpdb->query(
                        sprintf(
                            $query,
                            $wpdb->get_blog_prefix($blog->blog_id) . 'options',
                            aam_Control_Subject_Visitor::UID
                        )
                    );
                }
            }
        } else {
            $query = 'DELETE FROM ' . $wpdb->options . ' ';
            $query .= 'WHERE `option_name` = "aam_' . aam_Control_Subject_Visitor::UID . '_cache"';
            $wpdb->query($query);
        }

        //clear users cache
        $query = 'DELETE FROM ' . $wpdb->usermeta . ' ';
        $query .= 'WHERE `meta_key` = "aam_cache"';
        $wpdb->query($query);

        return true;
    }

    /**
     * Change the Update flag
     *
     * This will stop to run the update again
     *
     * @return boolean
     *
     * @access public
     */
    public function updateFlag() {
        return aam_Core_API::updateBlogOption('aam_updated', AAM_VERSION, 1);
    }

}


text:
<?php

/**
 * @file
 * Definition of Drupal\user\Tests\UserRegistrationTest.
 */

namespace Drupal\user\Tests;

use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\simpletest\WebTestBase;

/**
 * Tests registration of user under different configurations.
 *
 * @group user
 */
class UserRegistrationTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('field_test');

  function testRegistrationWithEmailVerification() {
    $config = \Drupal::config('user.settings');
    // Require email verification.
    $config->set('verify_mail', TRUE)->save();

    // Set registration to administrator only.
    $config->set('register', USER_REGISTER_ADMINISTRATORS_ONLY)->save();
    $this->drupalGet('user/register');
    $this->assertResponse(403, 'Registration page is inaccessible when only administrators can create accounts.');

    // Allow registration by site visitors without administrator approval.
    $config->set('register', USER_REGISTER_VISITORS)->save();
    $edit = array();
    $edit['name'] = $name = $this->randomMachineName();
    $edit['mail'] = $mail = $edit['name'] . '@example.com';
    $this->drupalPostForm('user/register', $edit, t('Create new account'));
    $this->assertText(t('A welcome message with further instructions has been sent to your email address.'), 'User registered successfully.');
    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
    $new_user = reset($accounts);
    $this->assertTrue($new_user->isActive(), 'New account is active after registration.');

    // Allow registration by site visitors, but require administrator approval.
    $config->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
    $edit = array();
    $edit['name'] = $name = $this->randomMachineName();
    $edit['mail'] = $mail = $edit['name'] . '@example.com';
    $this->drupalPostForm('user/register', $edit, t('Create new account'));
    $this->container->get('entity.manager')->getStorage('user')->resetCache();
    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
    $new_user = reset($accounts);
    $this->assertFalse($new_user->isActive(), 'New account is blocked until approved by an administrator.');
  }

  function testRegistrationWithoutEmailVerification() {
    $config = \Drupal::config('user.settings');
    // Don't require email verification and allow registration by site visitors
    // without administrator approval.
    $config
      ->set('verify_mail', FALSE)
      ->set('register', USER_REGISTER_VISITORS)
      ->save();

    $edit = array();
    $edit['name'] = $name = $this->randomMachineName();
    $edit['mail'] = $mail = $edit['name'] . '@example.com';

    // Try entering a mismatching password.
    $edit['pass[pass1]'] = '99999.0';
    $edit['pass[pass2]'] = '99999';
    $this->drupalPostForm('user/register', $edit, t('Create new account'));
    $this->assertText(t('The specified passwords do not match.'), 'Typing mismatched passwords displays an error message.');

    // Enter a correct password.
    $edit['pass[pass1]'] = $new_pass = $this->randomMachineName();
    $edit['pass[pass2]'] = $new_pass;
    $this->drupalPostForm('user/register', $edit, t('Create new account'));
    $this->container->get('entity.manager')->getStorage('user')->resetCache();
    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
    $new_user = reset($accounts);
    $this->assertNotNull($new_user, 'New account successfully created with matching passwords.');
    $this->assertText(t('Registration successful. You are now logged in.'), 'Users are logged in after registering.');
    $this->drupalLogout();

    // Allow registration by site visitors, but require administrator approval.
    $config->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
    $edit = array();
    $edit['name'] = $name = $this->randomMachineName();
    $edit['mail'] = $mail = $edit['name'] . '@example.com';
    $edit['pass[pass1]'] = $pass = $this->randomMachineName();
    $edit['pass[pass2]'] = $pass;
    $this->drupalPostForm('user/register', $edit, t('Create new account'));
    $this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval');

    // Try to login before administrator approval.
    $auth = array(
      'name' => $name,
      'pass' => $pass,
    );
    $this->drupalPostForm('user/login', $auth, t('Log in'));
    $this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), 'User cannot login yet.');

    // Activate the new account.
    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
    $new_user = reset($accounts);
    $admin_user = $this->drupalCreateUser(array('administer users'));
    $this->drupalLogin($admin_user);
    $edit = array(
      'status' => 1,
    );
    $this->drupalPostForm('user/' . $new_user->id() . '/edit', $edit, t('Save'));
    $this->drupalLogout();

    // Login after administrator approval.
    $this->drupalPostForm('user/login', $auth, t('Log in'));
    $this->assertText(t('Member for'), 'User can log in after administrator approval.');
  }

  function testRegistrationEmailDuplicates() {
    // Don't require email verification and allow registration by site visitors
    // without administrator approval.
    \Drupal::config('user.settings')
      ->set('verify_mail', FALSE)
      ->set('register', USER_REGISTER_VISITORS)
      ->save();

    // Set up a user to check for duplicates.
    $duplicate_user = $this->drupalCreateUser();

    $edit = array();
    $edit['name'] = $this->randomMachineName();
    $edit['mail'] = $duplicate_user->getEmail();

    // Attempt to create a new account using an existing email address.
    $this->drupalPostForm('user/register', $edit, t('Create new account'));
    $this->assertText(t('The email address @email is already registered.', array('@email' => $duplicate_user->getEmail())), 'Supplying an exact duplicate email address displays an error message');

    // Attempt to bypass duplicate email registration validation by adding spaces.
    $edit['mail'] = '   ' . $duplicate_user->getEmail() . '   ';

    $this->drupalPostForm('user/register', $edit, t('Create new account'));
    $this->assertText(t('The email address @email is already registered.', array('@email' => $duplicate_user->getEmail())), 'Supplying a duplicate email address with added whitespace displays an error message');
  }

  function testRegistrationDefaultValues() {
    // Don't require email verification and allow registration by site visitors
    // without administrator approval.
    $config_user_settings = \Drupal::config('user.settings')
      ->set('verify_mail', FALSE)
      ->set('register', USER_REGISTER_VISITORS)
      ->save();

    // Set the default timezone to Brussels.
    $config_system_date = \Drupal::config('system.date')
      ->set('timezone.user.configurable', 1)
      ->set('timezone.default', 'Europe/Brussels')
      ->save();

    // Check that the account information options are not displayed
    // as a details element if there is not more than one details in the form.
    $this->drupalGet('user/register');
    $this->assertNoRaw('<details id="edit-account"><summary>Account information</summary>');

    $edit = array();
    $edit['name'] = $name = $this->randomMachineName();
    $edit['mail'] = $mail = $edit['name'] . '@example.com';
    $edit['pass[pass1]'] = $new_pass = $this->randomMachineName();
    $edit['pass[pass2]'] = $new_pass;
    $this->drupalPostForm(NULL, $edit, t('Create new account'));

    // Check user fields.
    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
    $new_user = reset($accounts);
    $this->assertEqual($new_user->getUsername(), $name, 'Username matches.');
    $this->assertEqual($new_user->getEmail(), $mail, 'Email address matches.');
    $this->assertEqual($new_user->getSignature(), '', 'Correct signature field.');
    $this->assertTrue(($new_user->getCreatedTime() > REQUEST_TIME - 20 ), 'Correct creation time.');
    $this->assertEqual($new_user->isActive(), $config_user_settings->get('register') == USER_REGISTER_VISITORS ? 1 : 0, 'Correct status field.');
    $this->assertEqual($new_user->getTimezone(), $config_system_date->get('timezone.default'), 'Correct time zone field.');
    $this->assertEqual($new_user->langcode->value, \Drupal::languageManager()->getDefaultLanguage()->getId(), 'Correct language field.');
    $this->assertEqual($new_user->preferred_langcode->value, \Drupal::languageManager()->getDefaultLanguage()->getId(), 'Correct preferred language field.');
    $this->assertEqual($new_user->init->value, $mail, 'Correct init field.');
  }

  /**
   * Tests Field API fields on user registration forms.
   */
  function testRegistrationWithUserFields() {
    // Create a field on 'user' entity type.
    $field_storage = entity_create('field_storage_config', array(
      'field_name' => 'test_user_field',
      'entity_type' => 'user',
      'type' => 'test_field',
      'cardinality' => 1,
    ));
    $field_storage->save();
    $field = entity_create('field_config', array(
      'field_storage' => $field_storage,
      'label' => 'Some user field',
      'bundle' => 'user',
      'required' => TRUE,
    ));
    $field->save();
    entity_get_form_display('user', 'user', 'default')
      ->setComponent('test_user_field', array('type' => 'test_field_widget'))
      ->save();
    entity_get_form_display('user', 'user', 'register')
      ->save();

    // Check that the field does not appear on the registration form.
    $this->drupalGet('user/register');
    $this->assertNoText($field->label(), 'The field does not appear on user registration form');

    // Have the field appear on the registration form.
    entity_get_form_display('user', 'user', 'register')
      ->setComponent('test_user_field', array('type' => 'test_field_widget'))
      ->save();

    $this->drupalGet('user/register');
    $this->assertText($field->label(), 'The field appears on user registration form');

    // Check that validation errors are correctly reported.
    $edit = array();
    $edit['name'] = $name = $this->randomMachineName();
    $edit['mail'] = $mail = $edit['name'] . '@example.com';
    // Missing input in required field.
    $edit['test_user_field[0][value]'] = '';
    $this->drupalPostForm(NULL, $edit, t('Create new account'));
    $this->assertRaw(t('@name field is required.', array('@name' => $field->label())), 'Field validation error was correctly reported.');
    // Invalid input.
    $edit['test_user_field[0][value]'] = '-1';
    $this->drupalPostForm(NULL, $edit, t('Create new account'));
    $this->assertRaw(t('%name does not accept the value -1.', array('%name' => $field->label())), 'Field validation error was correctly reported.');

    // Submit with valid data.
    $value = rand(1, 255);
    $edit['test_user_field[0][value]'] = $value;
    $this->drupalPostForm(NULL, $edit, t('Create new account'));
    // Check user fields.
    $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
    $new_user = reset($accounts);
    $this->assertEqual($new_user->test_user_field->value, $value, 'The field value was correclty saved.');

    // Check that the 'add more' button works.
    $field_storage->cardinality = FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED;
    $field_storage->save();
    foreach (array('js', 'nojs') as $js) {
      $this->drupalGet('user/register');
      // Add two inputs.
      $value = rand(1, 255);
      $edit = array();
      $edit['test_user_field[0][value]'] = $value;
      if ($js == 'js') {
        $this->drupalPostAjaxForm(NULL, $edit, 'test_user_field_add_more');
        $this->drupalPostAjaxForm(NULL, $edit, 'test_user_field_add_more');
      }
      else {
        $this->drupalPostForm(NULL, $edit, t('Add another item'));
        $this->drupalPostForm(NULL, $edit, t('Add another item'));
      }
      // Submit with three values.
      $edit['test_user_field[1][value]'] = $value + 1;
      $edit['test_user_field[2][value]'] = $value + 2;
      $edit['name'] = $name = $this->randomMachineName();
      $edit['mail'] = $mail = $edit['name'] . '@example.com';
      $this->drupalPostForm(NULL, $edit, t('Create new account'));
      // Check user fields.
      $accounts = entity_load_multiple_by_properties('user', array('name' => $name, 'mail' => $mail));
      $new_user = reset($accounts);
      $this->assertEqual($new_user->test_user_field[0]->value, $value, format_string('@js : The field value was correclty saved.', array('@js' => $js)));
      $this->assertEqual($new_user->test_user_field[1]->value, $value + 1, format_string('@js : The field value was correclty saved.', array('@js' => $js)));
      $this->assertEqual($new_user->test_user_field[2]->value, $value + 2, format_string('@js : The field value was correclty saved.', array('@js' => $js)));
    }
  }

}


text:
(function(global, factory) {
	if (!global.JSON) {
		return;
	}

	if (typeof define === 'function' && define.amd) {
		define(function() {
			return factory(global);
		});
	} else if (typeof module === 'object' && typeof module.exports === 'object') {
		module.exports = factory(global);
	} else {
		var init = !global.Nette || !global.Nette.noInit;
		global.Nette = factory(global);
		if (init) {
			global.Nette.initOnLoad();
		}
	}

}(typeof window !== 'undefined' ? window : this, function(window) {

	'use strict';

	var Nette = {};
	var preventFiltering = {};
	var formToggles = {};
	var toggleListeners = new window.WeakMap();

	Nette.formErrors = [];
	Nette.version = '3.0';
	Nette.invalidNumberMessage = 'Please enter a valid value.';

	/**
	 * Function to execute when the DOM is fully loaded.
	 * @private
	 */
	Nette.onDocumentReady = function(callback) {
		if (document.readyState !== 'loading') {
			callback.call(this);
		} else {
			document.addEventListener('DOMContentLoaded', callback);
		}
	};

	/**
	 * Returns the value of form element.
	 */
	Nette.getValue = function(elem) {
		var i;
		if (!elem) {
			return null;

		} else if (!elem.tagName) { // RadioNodeList, HTMLCollection, array
			return elem[0] ? Nette.getValue(elem[0]) : null;

		} else if (elem.type === 'radio') {
			var elements = elem.form.elements; // prevents problem with name 'item' or 'namedItem'
			for (i = 0; i < elements.length; i++) {
				if (elements[i].name === elem.name && elements[i].checked) {
					return elements[i].value;
				}
			}
			return null;

		} else if (elem.type === 'file') {
			return elem.files || elem.value;

		} else if (elem.tagName.toLowerCase() === 'select') {
			var index = elem.selectedIndex,
				options = elem.options,
				values = [];

			if (elem.type === 'select-one') {
				return index < 0 ? null : options[index].value;
			}

			for (i = 0; i < options.length; i++) {
				if (options[i].selected) {
					values.push(options[i].value);
				}
			}
			return values;

		} else if (elem.name && elem.name.substr(-2) === '[]') { // multiple elements []
			elements = elem.form.elements[elem.name].tagName ? [elem] : elem.form.elements[elem.name];
			values = [];

			for (i = 0; i < elements.length; i++) {
				if (elements[i].type !== 'checkbox' || elements[i].checked) {
					values.push(elements[i].value);
				}
			}
			return values;

		} else if (elem.type === 'checkbox') {
			return elem.checked;

		} else if (elem.tagName.toLowerCase() === 'textarea') {
			return elem.value.replace('\r', '');

		} else {
			return elem.value.replace('\r', '').replace(/^\s+|\s+$/g, '');
		}
	};

	/**
	 * Returns the effective value of form element.
	 */
	Nette.getEffectiveValue = function(elem, filter) {
		var val = Nette.getValue(elem);
		if (elem.getAttribute) {
			if (val === elem.getAttribute('data-nette-empty-value')) {
				val = '';
			}
		}
		if (filter && preventFiltering[elem.name] === undefined) {
			preventFiltering[elem.name] = true;
			var ref = {value: val};
			Nette.validateControl(elem, null, true, ref);
			val = ref.value;
			delete preventFiltering[elem.name];
		}
		return val;
	};

	/**
	 * Validates form element against given rules.
	 */
	Nette.validateControl = function(elem, rules, onlyCheck, value, emptyOptional) {
		var top = !rules;
		elem = elem.tagName ? elem : elem[0]; // RadioNodeList
		rules = rules || JSON.parse(elem.getAttribute('data-nette-rules') || '[]');
		value = value === undefined ? {value: Nette.getEffectiveValue(elem)} : value;
		emptyOptional = emptyOptional === undefined ? !Nette.validateRule(elem, ':filled', null, value) : emptyOptional;

		for (var id = 0, len = rules.length; id < len; id++) {
			var rule = rules[id],
				op = rule.op.match(/(~)?([^?]+)/),
				curElem = rule.control ? elem.form.elements.namedItem(rule.control) : elem;

			rule.neg = op[1];
			rule.op = op[2];
			rule.condition = !!rule.rules;

			if (!curElem) {
				continue;
			} else if (emptyOptional && !rule.condition && rule.op !== ':filled') {
				continue;
			}

			curElem = curElem.tagName ? curElem : curElem[0]; // RadioNodeList
			var success = Nette.validateRule(curElem, rule.op, rule.arg, elem === curElem ? value : undefined);

			if (success === null) {
				continue;
			} else if (rule.neg) {
				success = !success;
			}

			if (rule.condition && success) {
				if (!Nette.validateControl(elem, rule.rules, onlyCheck, value, rule.op === ':blank' ? false : emptyOptional)) {
					return false;
				}
			} else if (!rule.condition && !success) {
				if (Nette.isDisabled(curElem)) {
					continue;
				}
				if (!onlyCheck) {
					var arr = Array.isArray(rule.arg) ? rule.arg : [rule.arg],
						message = rule.msg.replace(/%(value|\d+)/g, function(foo, m) {
							return Nette.getValue(m === 'value' ? curElem : elem.form.elements.namedItem(arr[m].control));
						});
					Nette.addError(curElem, message);
				}
				return false;
			}
		}

		if (elem.type === 'number' && !elem.validity.valid) {
			if (top && !onlyCheck) {
				Nette.addError(elem, Nette.invalidNumberMessage);
			}
			return false;
		}

		return true;
	};

	/**
	 * Validates whole form.
	 */
	Nette.validateForm = function(sender, onlyCheck) {
		var form = sender.form || sender,
			scope = false;

		Nette.formErrors = [];

		if (form['nette-submittedBy'] && form['nette-submittedBy'].getAttribute('formnovalidate') !== null) {
			var scopeArr = JSON.parse(form['nette-submittedBy'].getAttribute('data-nette-validation-scope') || '[]');
			if (scopeArr.length) {
				scope = new RegExp('^(' + scopeArr.join('-|') + '-)');
			} else {
				Nette.showFormErrors(form, []);
				return true;
			}
		}

		var radios = {}, i, elem;

		for (i = 0; i < form.elements.length; i++) {
			elem = form.elements[i];

			if (elem.tagName && !(elem.tagName.toLowerCase() in {input: 1, select: 1, textarea: 1, button: 1})) {
				continue;

			} else if (elem.type === 'radio') {
				if (radios[elem.name]) {
					continue;
				}
				radios[elem.name] = true;
			}

			if ((scope && !elem.name.replace(/]\[|\[|]|$/g, '-').match(scope)) || Nette.isDisabled(elem)) {
				continue;
			}

			if (!Nette.validateControl(elem, null, onlyCheck) && !Nette.formErrors.length) {
				return false;
			}
		}
		var success = !Nette.formErrors.length;
		Nette.showFormErrors(form, Nette.formErrors);
		return success;
	};

	/**
	 * Check if input is disabled.
	 */
	Nette.isDisabled = function(elem) {
		if (elem.type === 'radio') {
			for (var i = 0, elements = elem.form.elements; i < elements.length; i++) {
				if (elements[i].name === elem.name && !elements[i].disabled) {
					return false;
				}
			}
			return true;
		}
		return elem.disabled;
	};

	/**
	 * Adds error message to the queue.
	 */
	Nette.addError = function(elem, message) {
		Nette.formErrors.push({
			element: elem,
			message: message
		});
	};

	/**
	 * Display error messages.
	 */
	Nette.showFormErrors = function(form, errors) {
		var messages = [],
			focusElem;

		for (var i = 0; i < errors.length; i++) {
			var elem = errors[i].element,
				message = errors[i].message;

			if (messages.indexOf(message) < 0) {
				messages.push(message);

				if (!focusElem && elem.focus) {
					focusElem = elem;
				}
			}
		}

		if (messages.length) {
			alert(messages.join('\n'));

			if (focusElem) {
				focusElem.focus();
			}
		}
	};

	/**
	 * Validates single rule.
	 */
	Nette.validateRule = function(elem, op, arg, value) {
		value = value === undefined ? {value: Nette.getEffectiveValue(elem, true)} : value;

		if (op.charAt(0) === ':') {
			op = op.substr(1);
		}
		op = op.replace('::', '_');
		op = op.replace(/\\/g, '');

		var arr = Array.isArray(arg) ? arg.slice(0) : [arg];
		for (var i = 0, len = arr.length; i < len; i++) {
			if (arr[i] && arr[i].control) {
				var control = elem.form.elements.namedItem(arr[i].control);
				arr[i] = control === elem ? value.value : Nette.getEffectiveValue(control, true);
			}
		}

		return Nette.validators[op]
			? Nette.validators[op](elem, Array.isArray(arg) ? arr : arr[0], value.value, value)
			: null;
	};

	Nette.validators = {
		filled: function(elem, arg, val) {
			if (elem.type === 'number' && elem.validity.badInput) {
				return true;
			}
			return val !== '' && val !== false && val !== null
				&& (!Array.isArray(val) || !!val.length)
				&& (!window.FileList || !(val instanceof window.FileList) || val.length);
		},

		blank: function(elem, arg, val) {
			return !Nette.validators.filled(elem, arg, val);
		},

		valid: function(elem) {
			return Nette.validateControl(elem, null, true);
		},

		equal: function(elem, arg, val) {
			if (arg === undefined) {
				return null;
			}

			function toString(val) {
				if (typeof val === 'number' || typeof val === 'string') {
					return '' + val;
				} else {
					return val === true ? '1' : '';
				}
			}

			val = Array.isArray(val) ? val : [val];
			arg = Array.isArray(arg) ? arg : [arg];
			loop:
				for (var i1 = 0, len1 = val.length; i1 < len1; i1++) {
					for (var i2 = 0, len2 = arg.length; i2 < len2; i2++) {
						if (toString(val[i1]) === toString(arg[i2])) {
							continue loop;
						}
					}
					return false;
				}
			return true;
		},

		notEqual: function(elem, arg, val) {
			return arg === undefined ? null : !Nette.validators.equal(elem, arg, val);
		},

		minLength: function(elem, arg, val) {
			if (elem.type === 'number') {
				if (elem.validity.tooShort) {
					return false;
				} else if (elem.validity.badInput) {
					return null;
				}
			}
			return val.length >= arg;
		},

		maxLength: function(elem, arg, val) {
			if (elem.type === 'number') {
				if (elem.validity.tooLong) {
					return false;
				} else if (elem.validity.badInput) {
					return null;
				}
			}
			return val.length <= arg;
		},

		length: function(elem, arg, val) {
			if (elem.type === 'number') {
				if (elem.validity.tooShort || elem.validity.tooLong) {
					return false;
				} else if (elem.validity.badInput) {
					return null;
				}
			}
			arg = Array.isArray(arg) ? arg : [arg, arg];
			return (arg[0] === null || val.length >= arg[0]) && (arg[1] === null || val.length <= arg[1]);
		},

		email: function(elem, arg, val) {
			return (/^("([ !#-[\]-~]|\\[ -~])+"|[-a-z0-9!#$%&'*+/=?^_`{|}~]+(\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*)@([0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)+[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?$/i).test(val);
		},

		url: function(elem, arg, val, value) {
			if (!(/^[a-z\d+.-]+:/).test(val)) {
				val = 'http://' + val;
			}
			if ((/^https?:\/\/((([-_0-9a-z\u00C0-\u02FF\u0370-\u1EFF]+\.)*[0-9a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,61}[0-9a-z\u00C0-\u02FF\u0370-\u1EFF])?\.)?[a-z\u00C0-\u02FF\u0370-\u1EFF]([-0-9a-z\u00C0-\u02FF\u0370-\u1EFF]{0,17}[a-z\u00C0-\u02FF\u0370-\u1EFF])?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[[0-9a-f:]{3,39}\])(:\d{1,5})?(\/\S*)?$/i).test(val)) {
				value.value = val;
				return true;
			}
			return false;
		},

		regexp: function(elem, arg, val) {
			var parts = typeof arg === 'string' ? arg.match(/^\/(.*)\/([imu]*)$/) : false;
			try {
				return parts && (new RegExp(parts[1], parts[2].replace('u', ''))).test(val);
			} catch (e) {} // eslint-disable-line no-empty
		},

		pattern: function(elem, arg, val, value, caseInsensitive) {
			if (typeof arg !== 'string') {
				return null;
			}

			try {
				try {
					var regExp = new RegExp('^(?:' + arg + ')$', caseInsensitive ? 'ui' : 'u');
				} catch (e) {
					regExp = new RegExp('^(?:' + arg + ')$', caseInsensitive ? 'i' : '');
				}

				if (window.FileList && val instanceof FileList) {
					for (var i = 0; i < val.length; i++) {
						if (!regExp.test(val[i].name)) {
							return false;
						}
					}

					return true;
				}

				return regExp.test(val);
			} catch (e) {} // eslint-disable-line no-empty
		},

		patternCaseInsensitive: function(elem, arg, val) {
			return Nette.validators.pattern(elem, arg, val, null, true);
		},

		numeric: function(elem, arg, val) {
			if (elem.type === 'number' && elem.validity.badInput) {
				return false;
			}
			return (/^[0-9]+$/).test(val);
		},

		integer: function(elem, arg, val) {
			if (elem.type === 'number' && elem.validity.badInput) {
				return false;
			}
			return (/^-?[0-9]+$/).test(val);
		},

		'float': function(elem, arg, val, value) {
			if (elem.type === 'number' && elem.validity.badInput) {
				return false;
			}
			val = val.replace(/ +/g, '').replace(/,/g, '.');
			if ((/^-?[0-9]*\.?[0-9]+$/).test(val)) {
				value.value = val;
				return true;
			}
			return false;
		},

		min: function(elem, arg, val) {
			if (elem.type === 'number') {
				if (elem.validity.rangeUnderflow) {
					return false;
				} else if (elem.validity.badInput) {
					return null;
				}
			}
			return arg === null || parseFloat(val) >= arg;
		},

		max: function(elem, arg, val) {
			if (elem.type === 'number') {
				if (elem.validity.rangeOverflow) {
					return false;
				} else if (elem.validity.badInput) {
					return null;
				}
			}
			return arg === null || parseFloat(val) <= arg;
		},

		range: function(elem, arg, val) {
			if (elem.type === 'number') {
				if (elem.validity.rangeUnderflow || elem.validity.rangeOverflow) {
					return false;
				} else if (elem.validity.badInput) {
					return null;
				}
			}
			return Array.isArray(arg) ?
				((arg[0] === null || parseFloat(val) >= arg[0]) && (arg[1] === null || parseFloat(val) <= arg[1])) : null;
		},

		submitted: function(elem) {
			return elem.form['nette-submittedBy'] === elem;
		},

		fileSize: function(elem, arg, val) {
			if (window.FileList) {
				for (var i = 0; i < val.length; i++) {
					if (val[i].size > arg) {
						return false;
					}
				}
			}
			return true;
		},

		mimeType: function (elem, arg, val) {
			arg = Array.isArray(arg) ? arg : [arg];
			for (var i = 0, len = arg.length, re = []; i < len; i++) {
				re.push('^' + arg[i].replace(/([^\w])/g, '\\$1').replace('\\*', '.*') + '$');
			}
			re = new RegExp(re.join('|'));

			if (window.FileList && val instanceof FileList) {
				for (i = 0; i < val.length; i++) {
					if (val[i].type && !re.test(val[i].type)) {
						return false;
					} else if (elem.validity.badInput) {
						return null;
					}
				}
			}
			return true;
		},

		image: function (elem, arg, val) {
			return Nette.validators.mimeType(elem, ['image/gif', 'image/png', 'image/jpeg', 'image/webp'], val);
		},

		'static': function (elem, arg) {
			return arg;
		}
	};

	/**
	 * Process all toggles in form.
	 */
	Nette.toggleForm = function(form, event) {
		var i;
		formToggles = {};
		for (i = 0; i < form.elements.length; i++) {
			if (form.elements[i].tagName.toLowerCase() in {input: 1, select: 1, textarea: 1, button: 1}) {
				Nette.toggleControl(form.elements[i], null, null, !event);
			}
		}

		for (i in formToggles) {
			Nette.toggle(i, formToggles[i].state, formToggles[i].elem, event);
		}
	};

	/**
	 * Process toggles on form element.
	 */
	Nette.toggleControl = function(elem, rules, success, firsttime, value, emptyOptional) {
		rules = rules || JSON.parse(elem.getAttribute('data-nette-rules') || '[]');
		value = value === undefined ? {value: Nette.getEffectiveValue(elem)} : value;
		emptyOptional = emptyOptional === undefined ? !Nette.validateRule(elem, ':filled', null, value) : emptyOptional;

		var has = false,
			handler = function (e) {
				Nette.toggleForm(elem.form, e);
			},
			curSuccess;

		for (var id = 0, len = rules.length; id < len; id++) {
			var rule = rules[id],
				op = rule.op.match(/(~)?([^?]+)/),
				curElem = rule.control ? elem.form.elements.namedItem(rule.control) : elem;

			rule.neg = op[1];
			rule.op = op[2];
			rule.condition = !!rule.rules;

			if (!curElem) {
				continue;
			} else if (emptyOptional && !rule.condition && rule.op !== ':filled') {
				continue;
			}

			curSuccess = success;
			if (success !== false) {
				curSuccess = Nette.validateRule(curElem, rule.op, rule.arg, elem === curElem ? value : undefined);
				if (curSuccess === null) {
					continue;

				} else if (rule.neg) {
					curSuccess = !curSuccess;
				}
				if (!rule.condition) {
					success = curSuccess;
				}
			}

			if ((rule.condition && Nette.toggleControl(elem, rule.rules, curSuccess, firsttime, value, rule.op === ':blank' ? false : emptyOptional)) || rule.toggle) {
				has = true;
				if (firsttime) {
					var name = curElem.tagName ? curElem.name : curElem[0].name,
						els = curElem.tagName ? curElem.form.elements : curElem;

					for (var i = 0; i < els.length; i++) {
						if (els[i].name === name && !toggleListeners.has(els[i])) {
							els[i].addEventListener('change', handler);
							toggleListeners.set(els[i], null);
						}
					}
				}
				for (var toggleId in rule.toggle || []) {
					formToggles[toggleId] = formToggles[toggleId] || {elem: elem};
					formToggles[toggleId].state = formToggles[toggleId].state || (rule.toggle[toggleId] ? curSuccess : !curSuccess);
				}
			}
		}
		return has;
	};

	/**
	 * Displays or hides HTML element.
	 */
	Nette.toggle = function(selector, visible, srcElement, event) { // eslint-disable-line no-unused-vars
		if (/^\w[\w.:-]*$/.test(selector)) { // id
			selector = '#' + selector;
		}
		var elems = document.querySelectorAll(selector);
		for (var i = 0; i < elems.length; i++) {
			elems[i].hidden = !visible;
		}
	};

	/**
	 * Compact checkboxes
	 */
	Nette.compactCheckboxes = function(form) {
		var name, i, elem, values = {};

		for (i = 0; i < form.elements.length; i++) {
			elem = form.elements[i];
			if (elem.tagName
				&& elem.tagName.toLowerCase() === 'input'
				&& elem.type === 'checkbox'
			) {
				if (elem.name
					&& elem.name.substr(-2) === '[]'
				) {
					name = elem.name.substr(0, elem.name.length - 2);
					elem.removeAttribute('name');
					elem.setAttribute('data-nette-name', name);
				}

				if (name = elem.getAttribute('data-nette-name')) { // eslint-disable-line no-cond-assign
					values[name] = values[name] || [];
					if (elem.checked && !elem.disabled) {
						values[name].push(elem.value);
					}
				}
			}
		}

		for (name in values) {
			if (form.elements[name] === undefined) {
				elem = document.createElement('input');
				elem.setAttribute('name', name);
				elem.setAttribute('type', 'hidden');
				form.appendChild(elem);
			}
			form.elements[name].value = values[name].join(',');
			form.elements[name].disabled = values[name].length === 0;
		}
	};

	/**
	 * Setup handlers.
	 */
	Nette.initForm = function(form) {
		if (form.method === 'get' && form.hasAttribute('data-nette-compact')) {
			form.addEventListener('submit', function() {
				Nette.compactCheckboxes(form);
			});
		}

		check: {
			for (var i = 0; i < form.elements.length; i++) {
				if (form.elements[i].getAttribute('data-nette-rules')) {
					break check;
				}
			}
			return;
		}

		Nette.toggleForm(form);

		if (form.noValidate) {
			return;
		}
		form.noValidate = true;

		form.addEventListener('submit', function(e) {
			if (!Nette.validateForm(form)) {
				e.stopPropagation();
				e.preventDefault();
			}
		});
	};

	/**
	 * @private
	 */
	Nette.initOnLoad = function() {
		Nette.onDocumentReady(function() {
			for (var i = 0; i < document.forms.length; i++) {
				Nette.initForm(document.forms[i]);
			}

			document.body.addEventListener('click', function(e) {
				var target = e.target;
				while (target) {
					if (target.form && target.type in {submit: 1, image: 1}) {
						target.form['nette-submittedBy'] = target;
						break;
					}
					target = target.parentNode;
				}
			});
		});
	};

	/**
	 * Converts string to web safe characters [a-z0-9-] text.
	 */
	Nette.webalize = function(s) {
		s = s.toLowerCase();
		var res = '', i, ch;
		for (i = 0; i < s.length; i++) {
			ch = Nette.webalizeTable[s.charAt(i)];
			res += ch ? ch : s.charAt(i);
		}
		return res.replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
	};

	Nette.webalizeTable = {\u00e1: 'a', \u00e4: 'a', \u010d: 'c', \u010f: 'd', \u00e9: 'e', \u011b: 'e', \u00ed: 'i', \u013e: 'l', \u0148: 'n', \u00f3: 'o', \u00f4: 'o', \u0159: 'r', \u0161: 's', \u0165: 't', \u00fa: 'u', \u016f: 'u', \u00fd: 'y', \u017e: 'z'};

	return Nette;
}));


text:
require 'test/unit'

require_relative '../bin/tokens'

class TestBooleanConstantToken < Test::Unit::TestCase

  def test_simple
    token = BooleanConstantToken.new('ON')

    assert_equal('ON', token.to_s)

    assert(!token.keyword?)
    assert(!token.operator?)
    assert(!token.separator?)
    assert(!token.function?)
    assert(!token.text_constant?)
    assert(!token.numeric_constant?)
    assert(token.boolean_constant?)
    assert(!token.user_function?)
    assert(!token.variable?)
    assert(!token.groupstart?)
    assert(!token.groupend?)
    assert(!token.whitespace?)
    assert(token.operand?)
    assert(!token.statement_separator?)
  end

end


text:
@implementation RCTOrientationController

@synthesize bridge = _bridge;

- (instancetype)init
{
    if ((self = [super init])) {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];

    }
    return self;

}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (NSString*) getOrientationStr: (int) orientationNumber
{
    NSString *orientationStr;
    switch (orientationNumber) {
        case 0:
            orientationStr = @"PORTRAIT";
            break;
        case 1:
            orientationStr = @"LANDSCAPE LEFT";
            break;
        case 2:
            orientationStr = @"PORTRAIT UPSIDE DOWN";
            break;
        case 3:
            orientationStr = @"LANDSCAPE RIGHT";
            break;
        default:
            orientationStr = @"UNKNOWN";
            break;
    }
    return orientationStr;
}

- (void)orientationDidChange:(NSNotification *)notification
{
    [_bridge.eventDispatcher sendDeviceEventWithName:@"orientationDidChange" body:[self getData]];
}

RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(getOrientation:(RCTResponseSenderBlock)callback)
{
    callback([self getData]);
}

-(NSArray*)getData{
    int deviceOrientation = [self getDeviceOrientationAsNumber];
    int applicationOrientation = [self getApplicationOrientationAsNumber];

    UIDevice *currentDevice = [UIDevice currentDevice];
    NSString *deviceStr = [currentDevice model];

    NSArray *orientationArray = @[[self getOrientationStr : deviceOrientation], [self getOrientationStr : applicationOrientation], deviceStr, [self getDimensions]];
    return orientationArray;
}

-(NSDictionary*) getDimensions {
    CGRect sizeRect = [[UIScreen mainScreen] bounds];
    NSArray *keys = [NSArray arrayWithObjects:@"width", @"height", nil];
    NSArray *objects = [NSArray arrayWithObjects:[NSNumber numberWithFloat:sizeRect.size.width], [NSNumber numberWithFloat:sizeRect.size.height], nil];
    NSDictionary *size = [NSDictionary dictionaryWithObjects:objects
                                                     forKeys:keys];
    return size;
}

-(int)getDeviceOrientationAsNumber{
    UIDevice *currentDevice = [UIDevice currentDevice];
    UIDeviceOrientation orientation = [currentDevice orientation];

    switch (orientation) {
        case UIDeviceOrientationPortrait:
            return 0;
            break;
        case UIDeviceOrientationPortraitUpsideDown:
            return 2;
            break;
        case UIDeviceOrientationLandscapeLeft:
            return 1;
            break;
        case UIDeviceOrientationLandscapeRight:
            return 3;
            break;
        default:
            return 0;
            break;
    }

}

-(int)getApplicationOrientationAsNumber{
    UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;

    switch (orientation) {
        case UIInterfaceOrientationPortrait:
            return 0;
            break;
        case UIInterfaceOrientationLandscapeLeft:
            return 3;
            break;
        case UIInterfaceOrientationPortraitUpsideDown:
            return 2;
            break;
        case UIInterfaceOrientationLandscapeRight:
            return 1;
            break;
        default:
            return 0;
            break;
    }

}

RCT_EXPORT_METHOD(rotate:(int)rotation)
{
    if(rotation>3||rotation<1)rotation = 0;
    NSNumber *value;
    int orientation = ([self getApplicationOrientationAsNumber] + rotation)%4;

    switch (orientation) {
        case 1:
            value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];
            break;
        case 2:
            value = [NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown];
            break;
        case 3:
            value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
            break;
        case 0:
            value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
            break;

        default:
            break;
    }

    dispatch_async(dispatch_get_main_queue(), ^{
        [[UIDevice currentDevice] setValue:value forKey:@"orientation"];
        [UIViewController attemptRotationToDeviceOrientation];

    });
}

@end


text:
@protocol JCClubEditViewControllerDelegate <NSObject>

-(void)doneClubEditing:(PFObject*)clubObject;

@end

@interface JCClubEditViewController : UIViewController<UITextFieldDelegate, UITextViewDelegate, UIAlertViewDelegate, UIImagePickerControllerDelegate,UINavigationControllerDelegate>

@property (strong, nonatomic) PFObject *currentClub;
@property (strong, nonatomic) IBOutlet UITextField *nameField;
@property (strong, nonatomic) IBOutlet UIButton *imageBtn;
@property (strong, nonatomic) IBOutlet UITextView *descriptionView;

@property (strong, nonatomic) IBOutlet UISwitch *sororitySwitch;
@property (strong, nonatomic) IBOutlet UISwitch *fraternitySwitch;
@property (strong, nonatomic) IBOutlet UISwitch *academicSwitch;
@property (strong, nonatomic) IBOutlet UISwitch *sportsSwitch;
@property (strong, nonatomic) IBOutlet UISwitch *culturalSwitch;
@property (strong, nonatomic) IBOutlet UISwitch *religiousSwitch;

@property (assign, nonatomic) id <JCClubEditViewControllerDelegate> delegate;

-(IBAction)saveBtn:(id)sender;
-(IBAction)imageBtn:(id)sender;

@end


text:
  {% include components/infobar.html %}

        {% include components/brandpanel.html %}

        {% include components/nav-bar.html %}

            Navigation
            <button type="button" class="app-nav-bar__toggle app-nav-bar__toggle--burger js-nav-toggle">
                Toggle navigation
                ☰
            </button>

        {% include components/banner.html %}


text:
package keygo

import (
	"log"
	"os/exec"
	"bytes"
)

func Keygo_set(service, username, password string) {
	del := exec.Command("security", "delete-internet-password", "-s", service, "-a", username)
	_ = del.Run()
	cmd := exec.Command("security", "add-internet-password", "-s", service, "-a", username, "-r", "http", "-w", password)
	var err bytes.Buffer
	cmd.Stderr = &err
	var out bytes.Buffer
	cmd.Stdout = &out
	error := cmd.Run()
	if err.String() != "" {
		log.Fatal(err.String())
	}
	if out.String() != "" {
		log.Print(out.String())
	}
	if error != nil {
		log.Fatal(error)
	}
}


text:
package com.tikitoo.diigo.app2.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.Html;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import com.tikitoo.diigo.app2.R;

/**
 * "title":"简图 | 写字,配图,分享到微信和微博",
 * "url":"http:\/\/jiantuapp.com","comments":[]*
 * "tags":"no_tag",
 * "desc":"",
 * "annotations":[],
 * "created_at":"2015\/01\/13 04:37:57 +0000",
 * "updated_at":"2015\/01\/13 04:37:57 +0000",
 * "shared":"no",
 * "readlater":"no",
 * 显示书签详细界面
 * 设置Url 可以点击分享
 * Created by tikitoo on 1/7/15.
 */
public class DetailActivity extends ActionBarActivity {

    TextView tvUrl, tvTitle, tvTags, tvDesc, tvComments, tvShared, tvReadLater, tvCreateAt, tvUpdateAt;
    Intent shareIntent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);

        tvUrl = (TextView) findViewById(R.id.detail_url_text_view);
        tvTitle = (TextView) findViewById(R.id.detail_title_text_view);
        tvTags = (TextView) findViewById(R.id.detail_tags_text_view);

        Intent intent = getIntent();
        Bundle bundle = intent.getExtras();

        String url = bundle.getString("url");
        String title = bundle.getString("title");
        String tags = bundle.getString("tags");

        StringBuffer tagSb = new StringBuffer();
        String[] tagss = tags.split(",");
        for (String tag : tagss) {
            tagSb.append(tag + " ");
        }

        tvUrl.setText(url);
        tvTitle.setText(Html.fromHtml("<b>Title: </b>" + title));
        tvTags.setText(Html.fromHtml("<b>Tags: </b>" + tagSb));

        tvUrl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()) {
                    case R.id.detail_url_text_view:
                        // 设置为Url 打开
                        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(tvUrl.getText().toString()));
                        // shareIntent = new Intent(Intent.ACTION_SEND, Uri.parse(tvUrl.getText().toString()));
                        startActivity(Intent.createChooser(intent, "Share Url"));

                }

            }
        });

    }

    public void otherInitData() {
        /*tvDesc = (TextView) findViewById(R.id.detail_desc_text_view);
        tvComments = (TextView) findViewById(R.id.detail_comments_text_view);
        tvCreateAt = (TextView) findViewById(R.id.detail_create_at_text_view);
        tvUpdateAt = (TextView) findViewById(R.id.detail_update_at_text_view);
        */
        /*String desc = bundle.getString("desc");
        String comments = bundle.getString("comments");
        String create_at = bundle.getString("create_at");
        String update_at = bundle.getString("update_at");
        */
        // Url 显示为点击
        /*tvDesc.setText(Html.fromHtml("<b>Description: </b>" + desc));
        tvComments.setText(Html.fromHtml("<b>Comments: </b>" + comments));
        tvCreateAt.setText(Html.fromHtml("<b>Create Time: </b>" + create_at));
        tvUpdateAt.setText(Html.fromHtml("<b>Update Time: </b>" + update_at));
        */

    }

    /**
     * 设置Menu
     * @param menu
     * @return
     */
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.menu_detail_marks, menu);
        return super.onCreateOptionsMenu(menu);
    }

    /**
     * Menu 操作
     * @param item
     * @return
     */
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        switch (id) {
            case R.id.action_share_detail:
                shareMarkData();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    /**
     * 将书签Url 分享
     */
    public void shareMarkData() {

        shareIntent = new Intent();
        shareIntent.setAction(Intent.ACTION_SEND);
        shareIntent.putExtra(Intent.EXTRA_TEXT, tvUrl.getText().toString());
        shareIntent.setType("text/plain");
        startActivity(shareIntent);
    }

}