text:
Manual de Desarmamento de Bombas
=======================

Tradução ao português do Brasil do manual de «Keep Talking And Nobody Explodes»
-------------------------------------------------------------------------

Esta tradução foi encontrada em Agosto de 2016 na pagina [Link para Comunidade do Steam de tradução do manual para PT-BR](http://steamcommunity.com/app/341800/discussions/0/481115363862555843). Apenas subi o PDF disponibilizado no link e criei um botão de acesso.

Todo o crédito aos tradutores e criadores do jogo.


text:
<?php

namespace App\Events\User;

use App\Models\User;

class UserRegistered
{
    /** @var User $user */
    private $user;

    public function __construct(User $user)
    {
        $this->user = $user;
    }

    /**
     * @return User
     */
    public function getUser()
    {
        return $this->user;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.opticaline.framework.core;

import org.opticaline.framework.core.format.Transaction;
import org.opticaline.framework.core.route.RouteBean;
import org.opticaline.framework.utils.BeanUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

/**
 * Created by Nathan on 2014/9/12.
 */
public class Controller {
    private static final Logger logger = LoggerFactory.getLogger(Controller.class);

    public static Object handler(RouteBean routeBean, Map<String, String[]> parameterMap) throws RuntimeException {
        Object result;
        try {
            result = routeBean.getMethod().invoke(routeBean.getClazz(), argumentsHandler(routeBean, parameterMap));
            logger.debug("Execute - {}", routeBean.getMethod());
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new RuntimeException();
        }
        return result;
    }

    private static Object[] argumentsHandler(RouteBean routeBean, Map<String, String[]> parameterMap) {
        String[] paramNames = routeBean.getParamNames();
        Object[] arguments = new Object[paramNames.length];
        //获取url路径中截取的参数
        Map<String, Object> urlParams = ContextFactory.getApplicationContext().getUriParameters();
        for (int i = 0; i < paramNames.length; i++) {
            Class clazz = routeBean.getParamType(i);
            //分别从url和request中获取参数并封装
            if (isJDKType(clazz)) {
                arguments[i] = getParam(routeBean.getParamNames(i), clazz, urlParams, parameterMap);
                //url路径参数的注入优先级高
                //TODO 下一步解决url参数的数组形式问题
                if (arguments[i] != null) {
                    Transaction transaction = ContextFactory.getApplicationContext()
                            .getTransaction(clazz);
                    if (transaction != null) {
                        arguments[i] = transaction.format(urlParams,
                                parameterMap, routeBean.getParamNames(i), arguments[i]);
                    } else {
                        logger.debug("Not found Transaction for type {}.", clazz);
                    }
                } else if (routeBean.getParamNotNull(i)) {
                    if (!clazz.isPrimitive()) {
                        try {
                            arguments[i] = clazz.newInstance();
                        } catch (InstantiationException | IllegalAccessException e) {
                            logger.error("Can't init parameter type {}.", clazz);
                        }
                    }
                }
            } else {
                Object bean = null;
                try {
                    //获取Bean的类型之后制造Bean实例
                    bean = clazz.newInstance();
                    //封装成javabean
                    BeanUtils.request2Bean(parameterMap, bean);
                } catch (InstantiationException | IllegalAccessException e) {
                    e.printStackTrace();
                }
                arguments[i] = bean;
                //java bean
            }

        }
        return arguments;
    }

    private static Object getParam(String name, Class type, Map<String, Object> url, Map<String, String[]> req) {
        Object param = req.get(name);
        Object uriParam = url.get(name);
        Object result = null;
        if (uriParam != null) {
            result = uriParam;
        } else {
            if (type.isArray()) {
                result = type.cast(param);
            } else {
                String[] params = (String[]) param;
                if (params.length > 0) {
                    result = params[0];
                }
            }
        }
        return result;
    }

    private static boolean isJDKType(Class clazz) {
        String className = clazz.toString();
        return !className.startsWith("class") || className.startsWith("class java.lang.") || className.startsWith("class [Ljava.lang.");
    }
}


text:
from lib.common import helpers

class Module:

    def __init__(self, mainMenu, params=[]):

        # metadata info about the module, not modified during runtime
        self.info = {
            # name for the module that will appear in module menus
            'Name': 'Invoke-EgressCheck',

            # list of one or more authors for the module
            'Author': ['Stuart Morgan <stuart.morgan@mwrinfosecurity.com>'],

            # more verbose multi-line description of the module
            'Description': ('This module will generate traffic on a provided range of ports '
                            'and supports both TCP and UDP. Useful to identify direct egress channels.'),

            # True if the module needs to run in the background
            'Background' : False,

            # File extension to save the file as
            'OutputExtension' : None,

            # True if the module needs admin rights to run
            'NeedsAdmin' : False,

            # True if the method doesn't touch disk/is reasonably opsec safe
            # Disabled - this can be a relatively noisy module but sometimes useful
            'OpsecSafe' : False,

            'Language' : 'powershell',

            'MinLanguageVersion' : '2',

            # list of any references/other comments
            'Comments': [
                'https://github.com/stufus/egresscheck-framework'
            ]
        }

        # any options needed by the module, settable during runtime
        self.options = {
            # format:
            #   value_name : {description, required, default_value}
            'Agent' : {
                # The 'Agent' option is the only one that MUST be in a module
                'Description'   :   'Agent to generate the source traffic on',
                'Required'      :   True,
                'Value'         :   ''
            },
            'ip' : {
                'Description'   :   'Target IP Address',
                'Required'      :   True,
                'Value'         :   ''
            },
            'protocol' : {
                'Description'   :   'The protocol to use. This can be TCP or UDP',
                'Required'      :   True,
                'Value'         :   'TCP'
            },
            'portrange' : {
                'Description'   :   'The range of ports to connect on. This can be a comma separated list or dash-separated ranges.',
                'Required'      :   True,
                'Value'         :   '22-25,53,80,443,445,3306,3389'
            },
            'delay' : {
                'Description'   :   'Delay, in milliseconds, between ports being tested',
                'Required'      :   True,
                'Value'         :   '50'
            }
        }

        # save off a copy of the mainMenu object to access external functionality
        #   like listeners/agent handlers/etc.
        self.mainMenu = mainMenu

        # During instantiation, any settable option parameters
        #   are passed as an object set to the module and the
        #   options dictionary is automatically set. This is mostly
        #   in case options are passed on the command line
        if params:
            for param in params:
                # parameter format is [Name, Value]
                option, value = param
                if option in self.options:
                    self.options[option]['Value'] = value

    def generate(self):
        # if you're reading in a large, external script that might be updates,
        #   use the pattern below
        # read in the common module source code
        moduleSource = self.mainMenu.installPath + "/data/module_source/exfil/Invoke-EgressCheck.ps1"
        try:
            f = open(moduleSource, 'r')
        except:
            print helpers.color("[!] Could not read module source path at: " + str(moduleSource))
            return ""

        moduleCode = f.read()
        f.close()

        script = moduleCode

        # Need to actually run the module that has been loaded
        script += 'Invoke-EgressCheck'

        # add any arguments to the end execution of the script
        for option,values in self.options.iteritems():
            if option.lower() != "agent":
                if values['Value'] and values['Value'] != '':
                    if values['Value'].lower() == "true":
                        # if we're just adding a switch
                        script += " -" + str(option)
                    else:
                        script += " -" + str(option) + " \"" + str(values['Value']) + "\""

        return script


text:
/**
 * @license HTTP Auth Interceptor Module for AngularJS
 * (c) 2012 Witold Szczerba
 * License: MIT
 */
'use strict';

angular.module('mw.resourceGuard')

/**
 * @ngdoc service
 * @name UnauthInterceptor
 *
 * @description
 *
 *
 * @todo
 * Incorporate:
 * https://github.com/it-crowd/angular-http-auth/blob/a713fe40a60db1ddc84d22b95495bdb1c7a63e8a/src/http-auth-interceptor.js
 * https://github.com/christianrondeau/angular-http-auth/blob/61ba732dbc20313a96ed0fe5a5cdd219228d8c39/src/http-auth-interceptor.js
 *
 * Perhaps we should also ignore 401 invalid_grant responses when logins fail. When resources require login the response
 * is 401 Forbidden which would then be handled here.
 */
.factory('UnauthInterceptor', ['$rootScope', '$q', 'HttpBuffer', function($rootScope, $q, HttpBuffer) {
    return {
        responseError: function(rejection) {
            if (rejection.status === 401 && !rejection.config.ignoreResourceGuard) {
                var deferred = $q.defer();
                HttpBuffer.append(rejection.config, deferred);
                $rootScope.$broadcast('auth:loginRequired', rejection);
                return deferred.promise;
            }
            if (rejection.status === 403) {
                $rootScope.$broadcast('auth:resourceUnauthorized', rejection);
            }
            // otherwise, default behaviour
            return $q.reject(rejection);
        }
    };
}]);


text:
package de.fuberlin.wiwiss.d2rs;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import javax.servlet.ServletContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joseki.RDFServer;
import org.joseki.Registry;
import org.joseki.Service;
import org.joseki.ServiceRegistry;
import org.joseki.processors.SPARQL;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.shared.PrefixMapping;
import com.hp.hpl.jena.sparql.core.describe.DescribeHandler;
import com.hp.hpl.jena.sparql.core.describe.DescribeHandlerFactory;
import com.hp.hpl.jena.sparql.core.describe.DescribeHandlerRegistry;

import de.fuberlin.wiwiss.d2rq.GraphD2RQ;

/**
 * A D2R Server instance. Sets up a service, loads the D2RQ model, and starts Joseki.
 *
 * @author Richard Cyganiak (richard@cyganiak.de)
 * @version $Id: D2RServer.java,v 1.26 2009/08/02 09:12:06 fatorange Exp $
 */
public class D2RServer {
	private final static String SPARQL_SERVICE_NAME = "sparql";

	/* These service names should match the mappings in web.xml */
	private final static String RESOURCE_SERVICE_NAME = "resource";
	private final static String DATA_SERVICE_NAME = "data";
	private final static String PAGE_SERVICE_NAME = "page";
	private final static String VOCABULARY_STEM = "vocab/";

	private final static String DEFAULT_BASE_URI = "http://localhost";
	private final static String DEFAULT_SERVER_NAME = "D2R Server";
	private final static String SERVER_INSTANCE = "D2RServer.SERVER_INSTANCE";
	private static final Log log = LogFactory.getLog(D2RServer.class);

	/** d2rq mapping file */
	private String configFile;

	/** config file parser and Java representation */
	private ConfigLoader config = null;

	/** server port from command line, overrides port in config file */
	private int overridePort = -1;

	/** base URI from command line */
	private String overrideBaseURI = null;

	/** base URI from command line */
	private boolean overrideUseAllOptimizations = false;

	/** the dataset, auto-reloadable in case of local mapping files */
	private AutoReloadableDataset dataset;

	public void putIntoServletContext(ServletContext context) {
		context.setAttribute(SERVER_INSTANCE, this);
	}

	public static D2RServer fromServletContext(ServletContext context) {
		return (D2RServer) context.getAttribute(SERVER_INSTANCE);
	}

	public void overridePort(int port) {
		log.info("using port " + port);
		this.overridePort = port;
	}

	public void overrideBaseURI(String baseURI) {

		// This is a hack to allow hash URIs to be used at least in the
		// SPARQL endpoint. It will not work in the Web interface.
		if (!baseURI.endsWith("/") && !baseURI.endsWith("#")) {
			baseURI += "/";
		}
		if (baseURI.indexOf('#') != -1) {
			log.warn("Base URIs containing '#' may not work correctly!");
		}

		log.info("using custom base URI: " + baseURI);
		this.overrideBaseURI = baseURI;
	}

	public void overrideUseAllOptimizations(boolean overrideAllOptimizations) {
		this.overrideUseAllOptimizations = overrideAllOptimizations;
	}

	public void setConfigFile(String configFileURL) {
		configFile = configFileURL;
	}

	public String baseURI() {
		if (this.overrideBaseURI != null) {
			return this.overrideBaseURI;
		}
		if (this.config.baseURI() != null) {
			return this.config.baseURI();
		}
		if (this.port() == 80) {
			return D2RServer.DEFAULT_BASE_URI + "/";
		}
		return D2RServer.DEFAULT_BASE_URI + ":" + this.port() + "/";
	}

	public int port() {
		if (this.overridePort != -1) {
			return this.overridePort;
		}
		if (this.config.port() != -1) {
			return this.config.port();
		}
		return JettyLauncher.DEFAULT_PORT;
	}

	public String serverName() {
		if (this.config.serverName() != null) {
			return this.config.serverName();
		}
		return D2RServer.DEFAULT_SERVER_NAME;
	}

	public boolean hasTruncatedResults() {
		return dataset.hasTruncatedResults();
	}

	public String resourceBaseURI(String serviceStem) {
		// This is a hack to allow hash URIs to be used at least in the
		// SPARQL endpoint. It will not work in the Web interface.
		if (this.baseURI().endsWith("#")) {
			return this.baseURI();
		}
		return this.baseURI() + serviceStem + D2RServer.RESOURCE_SERVICE_NAME + "/";
	}

	public String resourceBaseURI() {
		return resourceBaseURI("");
	}

	public String graphURLDescribingResource(String resourceURI) {
		if (resourceURI.indexOf(":") == -1) {
			resourceURI = resourceBaseURI() + resourceURI;
		}
		String query = "DESCRIBE <" + resourceURI + ">";
		try {
			return this.baseURI() + D2RServer.SPARQL_SERVICE_NAME + "?query=" + URLEncoder.encode(query, "utf-8");
		} catch (UnsupportedEncodingException ex) {
			throw new RuntimeException(ex);
		}
	}

	public static String getResourceServiceName() {
		return RESOURCE_SERVICE_NAME;
	}

	public static String getDataServiceName() {
		return DATA_SERVICE_NAME;
	}

	public static String getPageServiceName() {
		return PAGE_SERVICE_NAME;
	}

	public String dataURL(String serviceStem, String relativeResourceURI) {
		return this.baseURI() + serviceStem + DATA_SERVICE_NAME + "/" + relativeResourceURI;
	}

	public String pageURL(String serviceStem, String relativeResourceURI) {
		return this.baseURI() + serviceStem + PAGE_SERVICE_NAME + "/" + relativeResourceURI;
	}

	public boolean isVocabularyResource(Resource r) {
		return r.getURI().startsWith(resourceBaseURI(VOCABULARY_STEM));
	}

	public void addDocumentMetadata(Model document, Resource documentResource) {
		this.config.addDocumentMetadata(document, documentResource);
	}

	/**
	 * @return the auto-reloadable dataset which contains a GraphD2RQ as its default graph, no named graphs
	 */
	public AutoReloadableDataset dataset() {
		return this.dataset;
	}

	/**
	 * @return The graph currently in use; will change to a new instance on auto-reload
	 */
	public GraphD2RQ currentGraph() {
		return (GraphD2RQ) this.dataset.asDatasetGraph().getDefaultGraph();
	}

	/**
	 * delegate to auto-reloadable dataset, will reload if necessary
	 */
	public void checkMappingFileChanged() {
		dataset.checkMappingFileChanged();
	}

	/**
	 * delegate to auto-reloadable dataset	 *
	 * @return prefix mappings for the d2rq base graph
	 */
	public PrefixMapping getPrefixes() {
		return dataset.getPrefixMapping();
	}

	public void start() {
		log.info("using config file: " + configFile);
		this.config = new ConfigLoader(configFile);
		this.config.load();

		if (config.isLocalMappingFile())
			this.dataset = new AutoReloadableDataset(config.getLocalMappingFilename(), true, this);
		else
			this.dataset = new AutoReloadableDataset(config.getMappingURL(), false, this);
		this.dataset.forceReload();

		if (this.overrideUseAllOptimizations)
			currentGraph().getConfiguration().setUseAllOptimizations(true);

		if (currentGraph().getConfiguration().getUseAllOptimizations()) {
			log.info("Fast mode (all optimizations)");
		} else {
			log.info("Safe mode (launch using --fast to use all optimizations)");
		}

		DescribeHandlerRegistry.get().clear();
		DescribeHandlerRegistry.get().add(new FindDescribeHandlerFactory());

		Registry.add(RDFServer.ServiceRegistryName,
				createJosekiServiceRegistry());
	}

	protected ServiceRegistry createJosekiServiceRegistry() {
		ServiceRegistry services = new ServiceRegistry();
		Service service = new Service(new SPARQL(),
				D2RServer.SPARQL_SERVICE_NAME,
				new D2RQDatasetDesc(this.dataset));
		services.add(D2RServer.SPARQL_SERVICE_NAME, service);
		return services;
	}

	private class FindDescribeHandlerFactory implements DescribeHandlerFactory {

		public DescribeHandler create() {
			return new FindDescribeHandler(D2RServer.this);
		}
	}

	public ConfigLoader getConfig() {
		return config;
	}
}


text:
package com.amazonaws.services.opsworks.model.transform;

import java.util.Map;
import java.util.Map.Entry;

import com.amazonaws.services.opsworks.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * Stack JSON Unmarshaller
 */
public class StackJsonUnmarshaller implements
        Unmarshaller<Stack, JsonUnmarshallerContext> {

    public Stack unmarshall(JsonUnmarshallerContext context) throws Exception {
        Stack stack = new Stack();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL)
            return null;

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("StackId", targetDepth)) {
                    context.nextToken();
                    stack.setStackId(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("Name", targetDepth)) {
                    context.nextToken();
                    stack.setName(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("Arn", targetDepth)) {
                    context.nextToken();
                    stack.setArn(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("Region", targetDepth)) {
                    context.nextToken();
                    stack.setRegion(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("VpcId", targetDepth)) {
                    context.nextToken();
                    stack.setVpcId(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("Attributes", targetDepth)) {
                    context.nextToken();
                    stack.setAttributes(new MapUnmarshaller<String, String>(
                            StringJsonUnmarshaller.getInstance(),
                            StringJsonUnmarshaller.getInstance())
                            .unmarshall(context));
                }
                if (context.testExpression("ServiceRoleArn", targetDepth)) {
                    context.nextToken();
                    stack.setServiceRoleArn(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("DefaultInstanceProfileArn",
                        targetDepth)) {
                    context.nextToken();
                    stack.setDefaultInstanceProfileArn(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("DefaultOs", targetDepth)) {
                    context.nextToken();
                    stack.setDefaultOs(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("HostnameTheme", targetDepth)) {
                    context.nextToken();
                    stack.setHostnameTheme(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("DefaultAvailabilityZone",
                        targetDepth)) {
                    context.nextToken();
                    stack.setDefaultAvailabilityZone(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("DefaultSubnetId", targetDepth)) {
                    context.nextToken();
                    stack.setDefaultSubnetId(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("CustomJson", targetDepth)) {
                    context.nextToken();
                    stack.setCustomJson(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context.testExpression("ConfigurationManager", targetDepth)) {
                    context.nextToken();
                    stack.setConfigurationManager(StackConfigurationManagerJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("ChefConfiguration", targetDepth)) {
                    context.nextToken();
                    stack.setChefConfiguration(ChefConfigurationJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("UseCustomCookbooks", targetDepth)) {
                    context.nextToken();
                    stack.setUseCustomCookbooks(BooleanJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("UseOpsworksSecurityGroups",
                        targetDepth)) {
                    context.nextToken();
                    stack.setUseOpsworksSecurityGroups(BooleanJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context
                        .testExpression("CustomCookbooksSource", targetDepth)) {
                    context.nextToken();
                    stack.setCustomCookbooksSource(SourceJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("DefaultSshKeyName", targetDepth)) {
                    context.nextToken();
                    stack.setDefaultSshKeyName(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("CreatedAt", targetDepth)) {
                    context.nextToken();
                    stack.setCreatedAt(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
                if (context
                        .testExpression("DefaultRootDeviceType", targetDepth)) {
                    context.nextToken();
                    stack.setDefaultRootDeviceType(StringJsonUnmarshaller
                            .getInstance().unmarshall(context));
                }
                if (context.testExpression("AgentVersion", targetDepth)) {
                    context.nextToken();
                    stack.setAgentVersion(StringJsonUnmarshaller.getInstance()
                            .unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null
                        || context.getLastParsedParentElement().equals(
                                currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return stack;
    }

    private static StackJsonUnmarshaller instance;

    public static StackJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new StackJsonUnmarshaller();
        return instance;
    }
}


text:
$(document).ready(function () {
    'use strict';
    $('.HeaderLogo').html('Demo');
    $('.loginLink').qtip('enable');
});


text:
package com.markmao.pullscrollview.ui;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;

import com.markmao.pullscrollview.R;

/**
 * Stretch ScrollView demo.
 *
 * @author markmjw
 * @date 2014-04-30
 */
public class StretchViewActivity extends Activity {
    private TableLayout mMainLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_stretch);

        mMainLayout = (TableLayout) findViewById(R.id.table_layout);
        showTable();
    }

    public void showTable() {
        TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(
                TableRow.LayoutParams.MATCH_PARENT,
                TableRow.LayoutParams.WRAP_CONTENT);
        layoutParams.gravity = Gravity.CENTER;
        layoutParams.leftMargin = 30;
        layoutParams.bottomMargin = 10;
        layoutParams.topMargin = 10;

        for (int i = 0; i < 40; i++) {
            TableRow tableRow = new TableRow(this);
            TextView textView = new TextView(this);
            textView.setText("Test stretch scroll view " + i);
            textView.setTextSize(20);
            textView.setPadding(15, 15, 15, 15);

            tableRow.addView(textView, layoutParams);
            if (i % 2 != 0) {
                tableRow.setBackgroundColor(Color.LTGRAY);
            } else {
                tableRow.setBackgroundColor(Color.WHITE);
            }

            final int n = i;
            tableRow.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(StretchViewActivity.this, "Click item " + n, Toast.LENGTH_SHORT).show();
                }
            });

            mMainLayout.addView(tableRow);
        }
    }
}


text:
class KindlePreviewer < Cask
  version :latest
  sha256 :no_check

  url 'https://kindlepreviewer.s3.amazonaws.com/KindlePreviewer.zip'
  homepage 'http://www.amazon.com/gp/feature.html/?docId=1000765261'
  license :unknown

  app 'Kindle Previewer.app'
end


text:
package io.tals.flux4j.shared;

/**
 * @author Tal Shani
 */
public interface StoreChangeSubscription {
    void unbind();
    void enabled();
    void disable();
    boolean isEnabled();
}


text:
<!DOCTYPE html>

	<title> NUSProgressBar - A Module Planning Tool </title>
	<link rel="stylesheet" href="main.css">

						<input type='text' class='form-control' id='module-search-bar-box' placeholder='Enter module code or module name'>

							<button class='btn btn-default' id='module-search-bar-select' type='button'>Select</button>

									Module Code:

								MCs

							Module Title:

								Description:

							show more

Close

							        x

							Pre-requisites:

							Preclusions:

							<button class="btn" id="add-module-button" type="button">Add</button>

							There might be a pre-requisite tree.

						<progress class="progress progress-striped progress-info" id="the-progress-bar" value="0" max="100"></progress>

						    Lvl 1000

						      	Chosen Modules:

						      	Avaliable Modules:

						    Lvl 2000

						      	Chosen Modules:

						      	Avaliable Modules:

						    Lvl 3000

						      	Chosen Modules:

						      	Avaliable Modules:

						    Lvl 4000

						      	Chosen Modules:

						      	Avaliable Modules:

						    FLR

						      	Chosen Modules:

						      	Avaliable Modules:

						    ULR

						      	Chosen Modules:

						      	Avaliable Modules:

UE

 Here is the message area. (coming soon...)

								Year 1 Sem 1

								Year 1  Sem 2

								Year 2 Sem 1

								Year 2 Sem 2

								Year 3 Sem 1

								Year 3 Sem 2

								Year 4 Sem 1

								Year 4 Sem 2


text:
[![Build
Status](https://travis-ci.org/parse-server-modules/parse-server-push-adapter.svg?branch=master)](https://travis-ci.org/parse-server-modules/parse-server-push-adapter)
[![codecov.io](https://codecov.io/github/parse-server-modules/parse-server-push-adapter/coverage.svg?branch=master)](https://codecov.io/github/parse-server-modules/parse-server-push-adapter?branch=master)
[![NPM Version](https://img.shields.io/npm/v/parse-server-push-adapter.svg?style=flat-square)](https://www.npmjs.com/package/parse-server-push-adapter)

Official Push adapter for parse-server

See [parse-server push configuration](https://github.com/ParsePlatform/parse-server/wiki/Push)

## Silent Notifications

If you have migrated from parse.com and you are seeing situations where silent (newsstand-like presentless) notifications are failing to deliver please ensure that your payload is setting the content-available attribute to Int(1) and not "1" This value will be explicitly checked.

### see more logs

You can enable verbose logging with environment variables:

```
VERBOSE=1

or

VERBOSE_PARSE_SERVER_PUSH_ADAPTER=1
```

This will produce a more verbose output for all the push sending attempts


text:
'use babel';

import helper from './helper';

export function provide(indexer) {
  return (tipeString, projectDirectory, filePath) => {
    return new Promise(resolve => {
      const functionsMatchingTypeReceived = indexer.onFunctionsMatchingTypeReceived(
        hints => {
          functionsMatchingTypeReceived.dispose();
          return resolve(hints);
        }
      );
      indexer.getFunctionsMatchingType([
        tipeString,
        projectDirectory,
        filePath,
      ]);
    });
  };
}


text:
var termkit = {
  version: 1,
};

//require.paths.unshift(__dirname + '/../Shared/');

// Load requirements.
var http = require('http'),
	path = require('path'),
    io = require('socket.io'),
	paperboy = require('paperboy')
    router = require('./router'),

	PORT = 2222,
	WEBROOT = path.join(path.dirname(__filename), '..', 'HTML');

// Load config file.
var config = require('./config.js').getConfig();

// Set up http server.
var server = http.createServer(function (request, result) {
  paperboy.deliver(WEBROOT, request, result);
}).listen(PORT);

// Set up WebSocket and handlers.
var ioServer = io.listen(server);
ioServer.sockets.on('connection', function (client) {
  var p = new router.router(client);
});


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Fl. Pl. Africa 29: t. 1155. 1953

#### Original name
null

### Remarks
null


text:
/**
 * @file	IExceptiongit ta.h
 * @brief	Projekt IPK 2 - Client
 *
 * @date	2013/03/02
 * @author	Frantisek Kolacek, xkolac12@stud.fit.vutbr.cz
 */

#ifndef IEXCEPTION_H
#define IEXCEPTION_H

#include <string>

using namespace std;

enum IErrorCodes{
    PARAM_INVALID_SOURCE_PORT,
    PARAM_INVALID_DESTINATION_PORT,
    PARAM_INVALID,

    SOCK_INVALID_SOCKET_STATE,
    SOCK_CANNOT_CREATE,
    SOCK_CANNOT_RESOLVE_ADDRESS,
    SOCK_CANNOT_CONNECT_TO_REMOTE_HOST,
    SOCK_CANNOT_READ,
    SOCK_CANNOT_WRITE,
    SOCK_CANNOT_BIND,

    RESPONSE_INVALID,

    SYSTEM_CANNOT_COMPILE_REGEX,
    SYSTEM_CANNOT_OPEN_FILE,
    SYSTEM_UNDEFINED_EXCEPTION
};

class IException
{
    public:
        IException(int, string = "Undefined", int = 0);
        IException(string, int = 0, string = "Undefined", int = 0);
        virtual ~IException();

        string getMessage();
        int getCode();
        string getFile();
        int getLine();

    protected:
        string message;
        int code;
        string file;
        int line;
};

#endif // IEXCEPTION_H


text:
import json
from resources import *
from exceptions import *

class Base(object):

    def __init__(self, gapi):
        self.gapi = gapi

    def __repr__(self):
        return '<%s: I\'m a red-headed endpoint, please use one of my functions >' % self.__class__.__name__

    """
    HTTP functions
    """

    def get(self, endpoint_id=None):
        if endpoint_id:
            # get single resource
            result = self.gapi.call_api('GET', self.path + '/' + endpoint_id, None, None)
            return self.resource(result)

        else:
            # get all resources
            result = self.gapi.call_api('GET', self.path, None, None)
            for i, r in enumerate(result):
                result[i] = self.resource(r)
            return result

    def post(self, data):
        try:
            data = json.dumps(data)
        except Exception as e:
            raise GingerAPIError('Error encoding parameters into JSON: "%s"' % e.message)
        result = self.gapi.call_api('POST', self.path, data, None)

        return self.resource(result)

    def put(self, endpoint_id, resource):
        # strip endpoints on resource
        attr_to_delete = list()
        for key, value in resource.iteritems():
            if isinstance(value, Base):
                attr_to_delete.append(key)
        for key in attr_to_delete:
            delattr(resource, key)

        # perform request
        try:
            data = json.dumps(resource)
        except Exception as e:
            raise GingerAPIError('Error encoding parameters into JSON: "%s"' % e.message)
        result = self.gapi.call_api('PUT', self.path + '/' + endpoint_id, data, None)

        return self.resource(result)

    def delete(self, endpoint_id):
        result = self.gapi.call_api('DELETE', self.path + '/' + endpoint_id, None, None)

        return self.resource(result)

    def options(self):
        pass

    """
    Endpoint functions
    """

    def resource(self, result=None):
        raise NotImplementedError()

    def create(self, data):
        return self.post(data)

    def all(self):
        return self.get(None)

class Merchants(Base):
    def __init__(self, gapi):
        self.gapi = gapi
        self.path = 'merchants'

    def resource(self, result):
        return Merchant(self.gapi, result)

class Orders(Base):
    def __init__(self, gapi):
        self.gapi = gapi
        self.path = 'orders'

    def create(self, data):
        # filter amount
        if isinstance(data['amount'], decimal.Decimal):
            data['amount'] = int(round(data['amount'] * 100))

        return self.post(data)

    def resource(self, result):
        return Order(self.gapi, result)

class IdealIssuers(Base):
    def __init__(self, gapi):
        self.gapi = gapi
        self.path = 'ideal/issuers'

    def resource(self, result):
        return IdealIssuer(result)

class Partners(Base):
    def __init__(self, gapi):
        self.gapi = gapi
        self.path = 'partners'

    def resource(self, result):
        return Partner(self.gapi, result)

class PartnerMerchants(Base):
    def __init__(self, gapi, partner_id):
        self.gapi = gapi
        self.path = 'partners/%s/merchants' % partner_id

    def resource(self, result):
        return Merchant(self.gapi, result)

class Users(Base):
    def __init__(self, gapi, merchant_id):
        self.gapi = gapi
        self.path = 'merchants/%s/users' % merchant_id

    def resource(self, result):
        return User(result)

class Projects(Base):
    def __init__(self, gapi, merchant_id):
        self.gapi = gapi
        self.path = 'merchants/%s/projects' % merchant_id

    def resource(self, result):
        return Project(result)

class Transactions(Base):
    def __init__(self, gapi, order_id):
        self.gapi = gapi
        self.path = 'orders/%s/transactions' % order_id

    def resource(self, result):
        return Transaction(result)

class Refunds(Base):
    pass

class Balances(Base):
    def __init__(self, gapi, merchant_id):
        self.gapi = gapi
        self.path = 'reports/balance/merchants/%s' % merchant_id

    def get(self, endpoint_id=None):
        # response is not a list, but a dict in a dict. Lets transform
        result = self.gapi.call_api('GET', self.path, None, None)
        result_new = dict()
        for i, r in enumerate(result):
            if 'EUR' in result[r]:
                result_new[r] = float(result[r]['EUR']) / 100
            else:
                result_new[r] = 0
        return self.resource(result_new)

    def resource(self, result):
        return Balance(result)


text:
require "fastlane_core"
require "credentials_manager"

module Gym
  class Options
    def self.available_options
      return @options if @options

      @options = plain_options
    end

    # rubocop:disable Metrics/MethodLength
    def self.plain_options
      [
        FastlaneCore::ConfigItem.new(key: :workspace,
                                     short_option: "-w",
                                     env_name: "GYM_WORKSPACE",
                                     optional: true,
                                     description: "Path the workspace file",
                                     verify_block: proc do |value|
                                       raise "Workspace file not found at path '#{File.expand_path(value)}'".red unless File.exist?(value.to_s)
                                       raise "Workspace file invalid".red unless File.directory?(value.to_s)
                                       raise "Workspace file is not a workspace, must end with .xcworkspace".red unless value.include?(".xcworkspace")
                                     end),
        FastlaneCore::ConfigItem.new(key: :project,
                                     short_option: "-p",
                                     optional: true,
                                     env_name: "GYM_PROJECT",
                                     description: "Path the project file",
                                     verify_block: proc do |value|
                                       raise "Project file not found at path '#{File.expand_path(value)}'".red unless File.exist?(value.to_s)
                                       raise "Project file invalid".red unless File.directory?(value.to_s)
                                       raise "Project file is not a project file, must end with .xcodeproj".red unless value.include?(".xcodeproj")
                                     end),
        FastlaneCore::ConfigItem.new(key: :provisioning_profile_path,
                                     short_option: "-e",
                                     env_name: "GYM_PROVISIONING_PROFILE_PATH",
                                     description: "The path to the provisioning profile (found automatically when located in current folder)",
                                     optional: true,
                                     verify_block: proc do |value|
                                       raise "Provisioning profile not found at path '#{File.expand_path(value)}'".red unless File.exist?(value)
                                     end),
        FastlaneCore::ConfigItem.new(key: :scheme,
                                     short_option: "-s",
                                     optional: true,
                                     env_name: "GYM_SCHEME",
                                     description: "The project's scheme. Make sure it's marked as `Shared`"),
        FastlaneCore::ConfigItem.new(key: :clean,
                                     short_option: "-c",
                                     env_name: "GYM_CLEAN",
                                     description: "Should the project be cleaned before building it?",
                                     is_string: false,
                                     default_value: false),
        FastlaneCore::ConfigItem.new(key: :output_directory,
                                     short_option: "-o",
                                     env_name: "GYM_OUTPUT_DIRECTORY",
                                     description: "The directory in which the ipa file should be stored in",
                                     default_value: ".",
                                     verify_block: proc do |value|
                                       raise "Directory not found at path '#{File.expand_path(value)}'".red unless File.directory?(value)
                                     end),
        FastlaneCore::ConfigItem.new(key: :output_name,
                                     short_option: "-n",
                                     env_name: "GYM_OUTPUT_NAME",
                                     description: "The name of the resulting ipa file",
                                     optional: true,
                                     verify_block: proc do |value|
                                       value.gsub!(".ipa", "")
                                     end),
        FastlaneCore::ConfigItem.new(key: :sdk,
                                     short_option: "-k",
                                     env_name: "GYM_SDK",
                                     description: "The SDK that should be used for building the application",
                                     optional: true),
        FastlaneCore::ConfigItem.new(key: :configuration,
                                     short_option: "-q",
                                     env_name: "GYM_CONFIGURATION",
                                     description: "The configuration to use when building the app. Defaults to 'Release'",
                                     default_value: "Release"),
        FastlaneCore::ConfigItem.new(key: :silent,
                                     short_option: "-t",
                                     env_name: "GYM_SILENT",
                                     description: "Hide all information that's not necessary while building",
                                     default_value: false,
                                     is_string: false),
        FastlaneCore::ConfigItem.new(key: :provisioning_profile_name,
                                     short_option: "-l",
                                     env_name: "GYM_PROVISIONING_PROFILE_NAME",
                                     description: "The name of the provisioning profile to use. It has to match the name exactly",
                                     optional: true),
        FastlaneCore::ConfigItem.new(key: :codesigning_identity,
                                     short_option: "-i",
                                     env_name: "GYM_CODE_SIGNING_IDENTITY",
                                     description: "The name of the code signing identity to use. It has to match the name exactly. You usually don't need this! e.g. 'iPhone Distribution: SunApps GmbH'",
                                     optional: true),
        FastlaneCore::ConfigItem.new(key: :destination,
                                     short_option: "-d",
                                     env_name: "GYM_DESTINATION",
                                     description: "Use a custom destination for building the app",
                                     default_value: "generic/platform=iOS"),
        FastlaneCore::ConfigItem.new(key: :xcargs,
                                     short_option: "-x",
                                     env_name: "GYM_XCARGS",
                                     description: "Pass additional arguments to xcodebuild when building the app. Be sure to quote multiple args",
                                     optional: true)

      ]
    end
    # rubocop:enable Metrics/MethodLength
  end
end


text:
class ArraySet < Array
	def include?(obj)
		# On first invocation create a HASH (yeah, yeah) to act as our set given the array values
		if !defined? @array_values
			@array_values = {}
			self.each {|x| @array_values[x] = 1}
		end
		@array_values.has_key? obj
	end
end


text:
/*
 * Created on Sep 3, 2015
 */
package org.griphyn.vdl.compiler.intermediate;

import org.antlr.stringtemplate.StringTemplate;

public class IArrayReference extends IAbstractExpression implements ILValue {
    private IExpression array;
    private IExpression key;

    public IArrayReference() {
        super();
    }

    public IExpression getArray() {
        return array;
    }

    public void setArray(IExpression array) {
        this.array = array;
    }

    public IExpression getKey() {
        return key;
    }

    public void setKey(IExpression key) {
        this.key = key;
    }

    @Override
    protected void setTemplateAttributes(OutputContext oc, StringTemplate st) {
        super.setTemplateAttributes(oc, st);
        st.setAttribute("arraychild", key.getTemplate(oc));
        st.setAttribute("parent", array.getTemplate(oc));
    }

    @Override
    protected String getTemplateName() {
        return "extractarrayelement";
    }
}


text:
ActiveRecord::Schema.define(version: 20140821054935) do

  create_table "comments", force: true do |t|
    t.integer  "user_id"
    t.string   "content"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "users", force: true do |t|
    t.string   "username"
    t.string   "email"
    t.string   "password"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

end


text:
namespace CK.Glouton.Model.Server.Handlers
{
    public interface IGloutonHandlerConfiguration
    {
        IGloutonHandlerConfiguration Clone();
    }
}


text:
var Gifffer = function() {
    var images, d = document, ga = 'getAttribute', sa = 'setAttribute';
    images = d && d.querySelectorAll ? d.querySelectorAll('[data-gifffer]') : [];
    var createContainer = function(w, h, el) {
       // top container reacts to changes in width
        var reactWidth = d.createElement('DIV'), cls = el[ga]('class'), id = el[ga]('id');
        cls ? reactWidth[sa]('class', el[ga]('class')) : null;
        id ? reactWidth[sa]('id', el[ga]('id')) : null;
        reactWidth[sa]('style', 'position:relative;cursor:pointer;width:' + w + 'px;max-width:100%;');
        // next container maintains aspect ratio
        var aspectRatio = d.createElement('DIV');
        aspectRatio[sa]('style', 'width:100%;padding-bottom:' + (100 * h / w) + '%;');
        // next container is for holding content
        var con = d.createElement('DIV');
        con[sa]('style', 'position:absolute;top:0;bottom:0;left:0;right:0;');
        // creating play button
        var play = d.createElement('DIV');
        play[sa]('class','gifffer-play-button');
        play[sa]('style', 'width:60px;height:60px;border-radius:30px;background:rgba(0, 0, 0, 0.3);position:absolute;left: calc(50% - 30px);top: calc(50% - 40px);z-index:100;');
        var trngl = d.createElement('DIV');
        trngl[sa]('style', 'width:0;height: 0;border-top:14px solid transparent;border-bottom:14px solid transparent;border-left:14px solid rgba(0, 0, 0, 0.5);position:absolute;left:26px;top:16px;')
        // dom placement
        reactWidth.appendChild(aspectRatio);
        aspectRatio.appendChild(con);
        con.appendChild(play);
        play.appendChild(trngl);
        el.parentNode.replaceChild(reactWidth, el);
        return {c: con, p: play };
    },
    i = 0,
    imglen = images.length,
    process = function(el) {
        var url, con, c, w, h, duration,play, gif, playing = false, cc, isC, durationTimeout;
        url = el[ga]('data-gifffer');
        w = el[ga]('data-gifffer-width');
        h = el[ga]('data-gifffer-height');
        duration = el[ga]('data-gifffer-duration');
        el.style.display = 'block';
        c = document.createElement('canvas');
        isC = !!(c.getContext && c.getContext('2d'));
        if(w && h && isC) cc = createContainer(w, h, el);
        el.onload = function() {
            if(isC) {
                w = w || el.width;
                h = h || el.height;
                // creating the container
                if(!cc) cc = createContainer(w, h, el);
                con = cc.c;
                play = cc.p;
                con.addEventListener('click', function() {
                    clearTimeout(durationTimeout);
                    if(!playing) {
                        playing = true;
                        gif = d.createElement('IMG');
                        gif[sa]('style', 'width:100%;');
                        gif[sa]('data-uri', Math.floor(Math.random()*100000) + 1);
                        setTimeout(function() {
                            gif.src = url;
                        }, 0);
                        con.removeChild(play);
                        con.removeChild(c);
                        con.appendChild(gif);
                        if(parseInt(duration) > 0) {
                            durationTimeout = setTimeout(function() {
                                playing = false;
                                con.appendChild(play);
                                con.removeChild(gif);
                                con.appendChild(c);
                                gif = null;
                            }, duration);
                        }
                    } else {
                        playing = false;
                        con.appendChild(play);
                        con.removeChild(gif);
                        con.appendChild(c);
                        gif = null;
                    }
                });
                // canvas
                c.width = w;
                c.height = h;
                c[sa]('style', 'width:100%;');
                c.getContext('2d').drawImage(el, 0, 0, w, h);
                con.appendChild(c);
            }
        }
        el.src = url;
    }
    for(i; i<imglen; ++i) process(images[i]);
}


text:
"""
==========================================
Author:             Tyler Brockett
Username:           /u/tylerbrockett
Description:        Alert Bot
==========================================
"""

from utils.env import env, BOT_USERNAME, DEV_USERNAME, SUBREDDIT

GITHUB_HOME = 'https://github.com/tylerbrockett/Alert-Bot-Reddit'
GITHUB_README = 'https://github.com/tylerbrockett/Alert-Bot-Reddit/blob/master/README.md'

def format_subject(s):
    while len(s) >= 3 and s[:3].lower() == 're:':
        s = s[3:]
    while len(s) > 0 and s[0] == ' ':
        s = s[1:]
    return s

def format_subscription_list(subs, title):
    result = '##' + title + '\n'
    i = 0
    if len(subs) == 0:
        result += 'No Subscriptions'
    for sub in subs:
        i += 1
        result += sub.to_table('Subscription #' + str(i)) + '\n \n'
    return result

def compose_greeting(username):
    return 'Hi /u/' + username + ',\n\n'

def compose_salutation():
    result = '\n\t \n\t \n-/u/' + env(BOT_USERNAME) + '\n\t \n\t \n' + \
             env(SUBREDDIT) + ' | ' + \
             '/u/' + env(DEV_USERNAME) + ' | ' + \
             '[Bot Code](' + GITHUB_HOME + ')\n'
    return result

DEFAULT_SUB_MESSAGE = '\t \n**Note:** No subreddit was specified, so /r/buildapcsales will be used by default\t \n'

def compose_subscribe_message(username, new_sub, subs, subreddit_not_specified):
    result = compose_greeting(username) + \
             'Thanks for your subscription. ' + \
             'You will continue to receive updates for posts that match your new subscription. ' + \
             'To unsubscribe, send me a message with the body "unsubscribe #" (without quotes) where "#" is the ' + \
             'actual subscription number.\t \nAlternatively, you can reply to this message or any replies from ' + \
             'the bot in regards to this subscription and reply with "unsubscribe" as the body.\t \n' + \
             (DEFAULT_SUB_MESSAGE if subreddit_not_specified else '') + \
             new_sub.to_table('New Subscription') + '\t \n\t \n' + \
             format_subscription_list(subs, 'Your Subscriptions') + \
             compose_salutation()
    return result

def compose_all_subscriptions_message(username, all_subscriptions):
    result = compose_greeting(username) + \
             format_subscription_list(all_subscriptions, 'Your Subscriptions') + \
             compose_salutation()
    return result

def compose_duplicate_subscription_message(username, existing_sub, new_sub):
    result = compose_greeting(username) + \
             'We think you already have an existing subscription matching the criteria specified. Below ' + \
             'both subscriptions are listed. If you believe there has been a mistake, please visit ' + \
             env(SUBREDDIT) + ' or message /u/' + env(DEV_USERNAME) + '.\n\n' + \
             existing_sub.to_table('Existing Subscription') + '\n\n' + \
             new_sub.to_table('New Subscription') + '\n' + \
             compose_salutation()
    return result

def compose_help_message(username, subs):
    result = compose_greeting(username) + \
             'Please visit the bot\'s [Github Readme](' + GITHUB_README + ') for ' + \
             'detailed information on how the bot works. If you still have questions, please visit ' + \
             env(SUBREDDIT) + ' or message /u/' + env(DEV_USERNAME) + '. Thanks!\t \n\t \n' + \
             format_subscription_list(subs, 'Your Subscriptions') + \
             compose_salutation()
    return result

def compose_unsubscribe_invalid_sub_message(username, subs):
    result = compose_greeting(username) + \
        'I\'m sorry, but it looks like the subscription you\'re trying to unsubscribe from is invalid. Please ' + \
        'make sure you are replying to a message that was in regards to a valid and active subscription. If you ' + \
        'think you are receiving this message in error, please visit ' + env(SUBREDDIT) + ' or message ' + \
        '/u/' + env(DEV_USERNAME) + ' to get this sorted out.\n\n' + \
        format_subscription_list(subs, 'Your Subscriptions') + \
        compose_salutation()
    return result

def compose_unsubscribe_message(username, removed_subs, subs):
    result = compose_greeting(username) + \
             'You have unsubscribed from the following item. Thanks for using the bot!\n\n' + \
             removed_subs[0].to_table('Unsubscribed From') + \
             '\n' + \
             format_subscription_list(subs, 'Your Subscriptions') + \
             compose_salutation()
    return result

def compose_unsubscribe_all_message(username):
    result = compose_greeting(username) + \
             'You have successfully unsubscribed from all subscriptions.' + \
             compose_salutation()
    return result

def compose_unsubscribe_from_num_message(username, removed_sub, subs):
    result = compose_greeting(username) + \
        'You have successfully unsubscribed from the following item.\t \n\t \n' + \
        removed_sub.to_table('Unsubscribed From') + '\t \n\t \n' + \
        format_subscription_list(subs, 'Your Subscriptions') + \
        compose_salutation()
    return result

def compose_edit_message(username):
    result = compose_greeting(username) + \
        'Unfortunately, the bot has only partially implemented this feature, so it is not available quite ' + \
        'yet. Please try again at a later date. Sorry for the inconvenience! ' + \
        compose_salutation()
    return result

def compose_feedback_message(username):
    result = compose_greeting(username) + \
             'Thank you very much for your feedback! \t \n' + \
             'I am open to whatever requests the community makes. If your message is urgent, please feel free to ' + \
             'PM me at /u/' + env(DEV_USERNAME) + '. Thanks again!' + \
             compose_salutation()
    return result

def compose_reject_message(username, subject, body, error):
    result = compose_greeting(username) + \
             '**There was an error processing your request.** Please review your message and ' + \
             'make sure it follows [the guidelines](' + GITHUB_README + ') that have been set. ' + \
             'You can also visit ' + env(SUBREDDIT) + ' or message /u/' + env(DEV_USERNAME) + \
             '. Thank you for your patience! \n\t \n\t \n' + \
             '**Error:** \t \n' + \
             error + '\t \n\t \n' + \
             '**Your request:** \t \n' + \
             'Subject:\t' + subject + '\t \n' + \
             'Body:   \t' + body + \
             compose_salutation()
    return result

def format_subreddit_list(subreddits, title):
    i = 0
    result = '###' + title + '\n' + \
             '\#|Subreddit' + '\n' + \
             ':--|:--' + '\n'
    for subreddit in subreddits:
        i += 1
        result += str(i) + '|' + str(subreddit) + '\n'
    return result

def compose_invalid_subreddit_message(username, invalid_subreddits, message):
    result = compose_greeting(username) + \
        'Unfortunately, it appears that the following subreddit(s) you tried to subscribe to were invalid. If you ' + \
        'believe this is a mistake please visit ' + env(SUBREDDIT) + ' or message ' + \
        '/u/' + env(DEV_USERNAME) + '. Sorry for the inconvenience!\t \n\t \n' + \
        '**Subject:**\t' + message.subject + '\t \n' + \
        '**Body:**\t\t' + message.body + '\t \n' + \
        format_subreddit_list(invalid_subreddits, 'Invalid Subreddits') + \
        compose_salutation()
    return result

def format_submission_body_summary(submission):
    if submission.is_self:
        return '**Body Text:**\t \n' + submission.selftext[:500] + (submission.selftext[500:] and '...')
    else:
        return '**Post Content Link:**\t \n[Content Link](' + submission.url + ')'

def compose_match_message(sub, submission, subs):
    result = compose_greeting(sub.username) + \
        '**Post Title:**\t \n' + \
        '[' + submission.title + '](' + submission.permalink + ')\t \n\t \n' + \
        format_submission_body_summary(submission) + '\t \n\t \n' + \
        sub.to_table('Matched Subscription') + '\t \n\t \n' + \
        'Reply to the bot with "subs" or "subscriptions" to view your subscriptions. Reply with "unsub", ' + \
        '"unsubscribe", or "stop" to remove this subscription.' + \
        compose_salutation()
    return result

def compose_too_generic_message(username):
    result = compose_greeting(username) + \
        'Unfortunately, your subscription request is too generic. Allowing such a subscription would probably hog ' + \
        'the bot\'s resources. Try constraining the subscription a bit. Sorry, and thanks for your understanding.' + \
        compose_salutation()
    return result

def format_subreddits(subreddits):
    result = '###Subreddits\n'
    if len(subreddits) == 0:
        result += 'No Results'
        return result
    result += \
        '\#|Subreddit|# of Subscriptions\n' + \
        ':--|:--:|:--\n'
    i = 0
    for sub in subreddits:
        i += 1
        result += \
            str(i) + '|' + '/r/' + sub[0] + '|' + str(sub[1]) + '\n'
    return result

def compose_statistics(username, current_users, all_users, unique_subs, all_subs, unique_subreddits, all_matches, subreddits):
    result = compose_greeting(username) + \
        '###Statistics\n' + \
        'Statistic|Value\n' + \
        ':--|:--:' + '\n' + \
        'Current Users Subscribed|' + str(current_users) + '\n' + \
        'Total Users|' + str(all_users) + '\n' + \
        'Unique Subscriptions|' + str(unique_subs) + '\n' + \
        'Active Subscriptions|' + str(all_subs) + '\n' + \
        'Unique Subreddits|' + str(unique_subreddits) + '\n' + \
        'Total Matches to Date|' + str(all_matches) + '\n\n\n' + \
        format_subreddits(subreddits) + '\n\n\n' + \
        'Thank ***YOU*** for being a part of that!\n' + \
        compose_salutation()
    return result

def compose_feedback_forward(developer_username, username, body):
    result = compose_greeting(developer_username) + \
             'You have received feedback from /u/' + username + '. The feedback is quoted below:\n\n"' + \
             body + '"' + compose_salutation()
    return result

def compose_username_mention_forward(developer_username, username, body):
    result = compose_greeting(developer_username) + \
             'The bot has been mentioned in a post! the body of the message is quoted below:\n\n' + \
             'USERNAME: ' + username + '\t \nBODY:\n' + body
    return result

def compose_username_mention_reply(username):
    result = 'Hi /u/' + username + ', thanks for the mention!\t \n ' + \
             'For those of you that don\'t know about this bot, it\'s purpose is to peruse Reddit for you, and ' + \
             'alert you when it finds a match based on what you tell it to look for. You can filter by subreddit, ' + \
             'words/phrases in the title or selftext/link of the post, the Redditor that created the post, etc. ' + \
             'It is great for finding things you want in subreddits with sales or giveaways! ' + \
             'For more information, please visit [the Github README](' + GITHUB_README + ').' + \
             compose_salutation()
    return result

def compose_post_reply_forward(developer_username, username, body):
    result = compose_greeting(developer_username) + \
             'Someone has responded to a post by the bot! the comment is quoted below:\n\n' + \
             'USERNAME: ' + username + '\nBODY:\n' + body
    return result


text:
#include <sstream>
#include "client_win.h"
#include "include/wrapper/cef_helpers.h"
#include "humblelogging/api.h"
#include <Winuser.h>

HUMBLE_LOGGER(logger, "client");

Client_Win::Client_Win()
  : Client()
{

}

Client_Win::~Client_Win()
{

}

bool Client_Win::OnKeyEvent( CefRefPtr<CefBrowser> browser, const CefKeyEvent &event, CefEventHandle os_event )
{
  // see chrome shortcuts: https://support.google.com/chrome/topic/25799?hl=en
  // see windows key codes: http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
  CEF_REQUIRE_UI_THREAD();

  if(HL_IF_TRACE(logger))
  {
    std::stringstream sstream;
    sstream << "OnKeyEvent, type=" << event.type
            << " modifiers=" << event.modifiers
            << " windows_key_code=" << event.windows_key_code
            << " unmodified_character=" << event.unmodified_character;

    HL_TRACE(logger, sstream.str());
  }

  if(!event.focus_on_editable_field && event.type == KEYEVENT_RAWKEYDOWN) // shortcut only on non edit field
  {
    if(event.modifiers == EVENTFLAG_NONE) // modifiers: none
    {
      switch (event.windows_key_code)
      {
        case VK_F5:
        {
          browser->Reload();
          return true;
        }
        case VK_F11:
        {
          toggleFullScreen(browser->GetHost()->GetWindowHandle());
          return true;
        }
        case VK_F12:
        {
          showDevTools(browser);
          return true;
        }
        default:
          break;
      }
    }
    if(event.modifiers & EVENTFLAG_CONTROL_DOWN) // modifiers: CTRL
    {
      switch (event.windows_key_code)
      {
        case VK_F5:
        case 0x52: // R - Key
        {
          browser->ReloadIgnoreCache();
          return true;
        }
        default:
          break;
      }
    }
    if(event.modifiers & EVENTFLAG_SHIFT_DOWN) // modifiers: SHIFT
    {
      switch (event.windows_key_code)
      {
        case VK_F5:
        {
          browser->ReloadIgnoreCache();
          return true;
        }
        default:
          break;
      }
    }
    if( (event.modifiers & EVENTFLAG_SHIFT_DOWN) && (event.modifiers & EVENTFLAG_CONTROL_DOWN) ) // modifiers: SHIFT + CTRL
    {
      switch (event.windows_key_code)
      {
        case 0x49: // I - Key
        {
          showDevTools(browser);
          return true;
        }
        default:
          break;
      }
    }
  }

  return false;
}

void Client_Win::toggleFullScreen(CefWindowHandle window)
{
  window = GetParent(window);
  // Save current window state if not already fullscreen.
  if(!_bIsFullScreen)
  {
    _savedWindowInfo.maximized = ::IsZoomed(window);
    if(_savedWindowInfo.maximized)
      ::SendMessage(window, WM_SYSCOMMAND, SC_RESTORE, 0);
    _savedWindowInfo.style = GetWindowLong(window, GWL_STYLE);
    _savedWindowInfo.ex_style = GetWindowLong(window, GWL_EXSTYLE);
    GetWindowRect(window, &_savedWindowInfo.rect);
  }

  _bIsFullScreen = ! _bIsFullScreen; // toggle
  if(_bIsFullScreen)
  {
    SetWindowLong(window, GWL_STYLE,
                  _savedWindowInfo.style & ~(WS_CAPTION | WS_THICKFRAME));
    SetWindowLong(window, GWL_EXSTYLE,
                  _savedWindowInfo.ex_style & ~(WS_EX_DLGMODALFRAME |
                      WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));

    MONITORINFO monitor_info;
    monitor_info.cbSize = sizeof(monitor_info);
    GetMonitorInfo(MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST),
                   &monitor_info);
    SetWindowPos(window, NULL,
                 monitor_info.rcMonitor.left,
                 monitor_info.rcMonitor.top,
                 monitor_info.rcMonitor.right - monitor_info.rcMonitor.left,
                 monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top,
                 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
  }
  else
  {
    SetWindowLong(window, GWL_STYLE, _savedWindowInfo.style);
    SetWindowLong(window, GWL_EXSTYLE, _savedWindowInfo.ex_style);

    SetWindowPos(window, NULL,
                 _savedWindowInfo.rect.left,
                 _savedWindowInfo.rect.top,
                 _savedWindowInfo.rect.right - _savedWindowInfo.rect.left,
                 _savedWindowInfo.rect.bottom - _savedWindowInfo.rect.top,
                 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);

    if (_savedWindowInfo.maximized)
      ::SendMessage(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
  }
}