text:
<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/security"
		xmlns:context="http://www.springframework.org/schema/context"
		xmlns:p="http://www.springframework.org/schema/p"
        xmlns:b="http://www.springframework.org/schema/beans"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
        	http://www.springframework.org/schema/context	http://www.springframework.org/schema/context/spring-context.xsd
        	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        	http://www.springframework.org/schema/mvc  	http://www.springframework.org/schema/mvc/spring-mvc.xsd
            http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd">

	<!-- 重要:注意spring-security-x.x.xsd 的版本号 -->
	<!-- 以下都是专用于security的配置 -->

<!-- 20160425 对方法进行安全控制的设置 note that:Security annotations take precedence over pointcuts.-->
	<global-method-security access-decision-manager-ref="methodInvocationAccessDecisionManager"  secured-annotations="enabled" jsr250-annotations="enabled" pre-post-annotations="enabled" >
		<!--
		<protect-pointcut expression="execution(* com.mycompany.*Service.*(..))" access="ROLE_USER"/>
		 -->
	</global-method-security>

   	<!-- 注意:静态资源**代表可以多级目录,即使已经在mvc:resource中设为静态资源的内容也需要再次设置,
   		因为静态资源是不通过filter和interceptor的
   	 -->
	<http pattern="/i18n/**" security="none"/>
    <http pattern="/language/**" security="none"/>
    <http pattern="/static/**" security="none"/>
    <http pattern="/styles/**" security="none"/>
    <http pattern="/fonts/**" security="none"/>
    <http pattern="/images/**" security="none"/>
    <http pattern="/lib/**" security="none"/>
    <http pattern="/js/**" security="none"/>
    <http pattern="/css/**" security="none"/>
    <http pattern="/vender/**" security="none"/>

    <!-- 验证码不校验 -->
    <http pattern="/verify/**" security="none"/>

    <!-- caution:测试、开发时才允许打开匿名可访问,生产环境中必须关闭 -->
    <http pattern="/rest/**" security="none"/>

<!--20170711 spring-security4.2 移除该设置 access-denied-page="/auth/denied" -->
    <!-- auto-config="true" 不推荐使用,其会自动注册一些默认的过滤器 -->
    <!-- 20170711 使用form-login 代替   entry-point-ref="loginEntryPoint" -->
    <http access-decision-manager-ref="webUrlAccessDecisionManager"   use-expressions="true" >  <!--  当访问被拒绝时,403.jsp  -->

    	<!-- caution:测试、开发时才允许打开匿名可访问,生产环境中必须关闭
    	<intercept-url pattern="/rest/**" access="permitAll"/>
    	 -->

    	<intercept-url pattern="${security.invalidSessionUrl}" access="permitAll"/>
    	<!-- 登录页,不需要拦截 -->
        <intercept-url pattern="${security.loginPage}" access="permitAll"/>
        <intercept-url pattern="/user/hello" access="hasRole('ROLE_ADMIN')"/>

        <!-- 20160517 重要:security with default -->
        <intercept-url pattern="/**" access="isAuthenticated()"/>

        <!-- 实现免登陆验证 -->
        <!--
        <remember-me />   -->

        <!-- login-page:需要登陆时 拦截后执行的请求
            default-target-url:身份验证通过后执行的请求
            authentication-failure-url:如果验证失败,则转向URL
            username-parameter:表示登录时用户使用的是哪个参数,即用户名输入框的name
            password-parameter:表示登录时密码使用的是哪个参数,即密码输入框的name
             -->
        <!--  20160517 默认的form-login无法支持用户名和密码之外的登录信息,customLoginFilter完成替换 -->
        <form-login login-page="${security.loginPage}" default-target-url="${security.mainPage}"
        	authentication-failure-url="${security.authenticationFailureUrl}"
        	login-processing-url="${security.loginProcessingUrl}"
            username-parameter="username"
            password-parameter="password"/>

        <!-- 开启了session失效功能.
			20160425 注销时删除JSESSIONID cookie (Unfortunately this can't be guaranteed to work with every servlet container, so you will need to test it in your environment)
			注销URL为:/auth/logout
			注销成功后转向:/auth/login -->
        <logout  delete-cookies="JSESSIONID"
                invalidate-session="true"
                logout-success-url="${security.logoutSuccessUrl}"
                logout-url="${security.logoutUrl}"/>

        <!-- invalid-session-url是配置会话失效转向地址,可以在该地址中加入几秒后自动转入登录页面的功能;
        max-sessions是设置单个用户最大并行会话数;You can set the maximumSession property to -1 to allow unlimited sessions
        error-if-maximum-exceeded是配置当用户登录数达到最大时是否报错,设置为true时会报错且后登录的会话不能登录,默认为false不报错且将前一会话置为失效 -->
        <!-- 2016-01-21 由于调试restful api需要,暂时屏蔽session-manage配置 -->
        <!-- 2017-07-11 如果不希望session失效后就进入invalid-session-url ,删除该配置属性即可 -->

        <session-management session-authentication-strategy-ref="sas" invalid-session-url="${security.invalidSessionUrl}">
            <!-- 重点:设置了custom-filter可能会导致下述简单配置失效,所以直接使用explicit setup : session-authentication-strategy-ref
            	20160517 :<concurrency-control>和session-authentication-strategy-ref两者不能同时使用,conflict!!!
            -->

            <!--    并发控制方式一:防止重复登录,同一用户第二次登录会让第一次登录失效
            <concurrency-control max-sessions="1" />
             -->
            <!--    并发控制方式二:如果第二次登录,阻止,并显示错误信息
            <concurrency-control max-sessions="1"  error-if-maximum-exceeded="true"  />
             -->
        </session-management>

    </http>

    <!--  认证管理器,实现用户认证的入口,主要实现UserDetailsService接口即可  -->
    <!-- 20160425 使用Namespace方式配置Spring Security时会自动创建一个AuthenticationManager(你无法将其替换),这里使用alias attribute设定了其属性名,方便其他bean引用 -->
    <authentication-manager alias="authenticationManager">
    	<!-- 非常重要:Spring Security将会按照顺序,依次从上向下调用所有Provider,只要任何一个Provider校验通过,整个认证将通过  -->
    	<!-- 非常重要:authentication-manager存在bug,如果自定义provider使用了支持更多验证内容的Token时,
    	最后一个provider的结果会覆盖前面provider的结果,切记!!!    	 -->
    	<!--
			测试新PasswordEncoder用,生产环境中一定要屏蔽
			测试用的provider一定要放在最前,防止覆盖后续正式provider的处理结果
		    rod/koala
            dianne/emu
            scott/wombat
            peter/opal
		 -->
		<authentication-provider>
            <password-encoder ref="testPasswordEncoder"/>
            <user-service>
                <user name="rod" password="4efe081594ce25ee4efd9f7067f7f678a347bccf2de201f3adf2a3eb544850b465b4e51cdc3fcdde" authorities="supervisor, user, teller" />
                <user name="dianne" password="957ea522524a41cbfb649a3e293d56268f840fd5b661b499b07858bc020d6d223f912e3ab303b00f" authorities="user,teller" />
                <user name="scott" password="fb1f9e48058d30dc21c35ab4cf895e2a80f2f03fac549b51be637196dfb6b2b7276a89c65e38b7a1" authorities="user" />
                <user name="peter" password="e175750688deee19d7179d444bfaf92129f4eea8b4503d83eb8f92a7dd9cda5fbae73638c913e420" authorities="user" />
            </user-service>
        </authentication-provider>

        <!-- 自定义的认证Provider -->
        <authentication-provider ref="customAuthenticationProvider" />

    </authentication-manager>

    <b:bean id="loginEntryPoint"  class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
		<!-- 默认登录页的url -->
		<b:constructor-arg value="${security.loginPage}" />
	</b:bean>

    <!-- sessionManagementFilter 重要:
        If you are using a customized authentication filter for form-based login,
        then you have to configure concurrent session control support explicitly.
        More details can be found in the Session Management chapter.
        20170711 在v4.2中没有了默认构造函数,且带expiredUrl参数的构造函数已经被标记为deprecated
    -->
	<b:bean id="concurrencyFilter"
	    class="org.springframework.security.web.session.ConcurrentSessionFilter">
	    <b:constructor-arg name="sessionRegistry" ref="sessionRegistry" />
	    <b:constructor-arg name="expiredUrl" value="/session-expired.htm" />
	</b:bean>

	<!--20170711 :ConcurrentSessionControlStrategy 改名为 ConcurrentSessionControlAuthenticationStrategy -->
	<b:bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy">
		<b:constructor-arg name="sessionRegistry" ref="sessionRegistry" />
		<b:property name="maximumSessions" value="1" />
	</b:bean>
	<b:bean id="sessionRegistry"  class="org.springframework.security.core.session.SessionRegistryImpl" />

	<!--  http使用的访问决策器,决定某个用户具有的角色,是否有足够的权限去访问某个资源,默认为AffirmativeBased,RoleVoter+AuthenticatedVoter  -->
    <b:bean name="webUrlAccessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
    	<b:constructor-arg >
    		<b:list>
    		<!--
    			<b:bean class="com.platform.web.security.access.vote.WildcardPermissionVoter" />
    		 -->
    			<b:bean class="org.springframework.security.access.vote.AuthenticatedVoter" />
				<b:bean class="org.springframework.security.access.vote.RoleVoter" />
				<b:bean class="org.springframework.security.web.access.expression.WebExpressionVoter" />

			</b:list>
    	</b:constructor-arg>
    </b:bean>
    <!-- methodinvocation使用的表决器,在这里不能使用WebExpressionVoter,所以分开定义 -->
    <b:bean name="methodInvocationAccessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
    	<b:constructor-arg >
    		<b:list>
    		<!--
    			<b:bean class="com.platform.web.security.access.vote.WildcardPermissionVoter" />
    		-->
    			<b:bean class="org.springframework.security.access.vote.AuthenticatedVoter" />
				<b:bean class="org.springframework.security.access.vote.RoleVoter" />

			</b:list>
    	</b:constructor-arg>
    </b:bean>

</b:beans>


text:
package org.formbuilder.util;

import org.formbuilder.mapping.exception.AccessorNotFoundException;

import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

/**
 * Handles method  invocations as invocations of getters and setters of bean properties
 *
 * @author eav Date: 04.09.2010 Time: 18:58:28
 */
public class BeanLikeHandler
        implements InvocationHandler
{
    private Map<String, Object> propertyValues = new HashMap<String, Object>();

    public Object invoke( final Object proxy,
                          final Method method,
                          final Object[] args )
            throws
            Throwable
    { // todo optimize
        try
        {
            final PropertyDescriptor descriptor = Reflection.getDescriptor( method, true );
            return getValue( descriptor );
        }
        catch ( AccessorNotFoundException e )
        {
            final PropertyDescriptor descriptor = Reflection.getDescriptor( method, false );
            return setValue( descriptor, args );
        }
    }

    private Object getValue( final PropertyDescriptor descriptor )
    {
        final Object propertyValue = propertyValues.get( descriptor.getName() );
        if ( propertyValue != null )
        {
            return propertyValue;
        }
        return Reflection.emptyValue( descriptor.getReadMethod() );
    }

    private Object setValue( final PropertyDescriptor descriptor,
                             final Object[] args )
    {
        propertyValues.put( descriptor.getName(), args[0] );
        return null;
    }
}

redpajama_set_name: RedPajamaGithub


text:
module Colin.Graphic where

import Control.Wire as X
import Colin.Sprite

type Graphic = IO ()

render :: Graphic -> IO ()
render = Prelude.id


text:
@interface LBRecommendedBusinessAuditViewController : UIViewController

@end


text:
[![Build Status](https://travis-ci.org/rlqualls/github-gem.png?branch=master)](https://travis-ci.org/rlqualls/github-gem)
[![Coverage Status](https://coveralls.io/repos/rlqualls/github-gem/badge.png?branch=master)](https://coveralls.io/r/rlqualls/github-gem?branch=master)
[![Code Climate](https://codeclimate.com/github/rlqualls/github-gem.png)](https://codeclimate.com/github/rlqualls/github-gem)

The GitHub gem is back!

The original project can be found at [defunkt/github-gem](https://github.com/defunkt/github-gem).

## Features

  - Syntax highlighting for most things
  - More commands (pulls, log, view, readme)

## Installation (for now)

    $ git clone http://github.com/rlqualls/github-gem
    $ cd github-gem
    $ bundle
    $ rake install

## Usage

### help

List the commands available.

    $ gh
    $ gh help

### search

List repositories matching the keyword.

    $ gh search ruby

![github search screenshot](http://i.imgur.com/YdYfhn1.png)

### view

View the contents of a remote repo root, a repo directory, or a repo file.

    $ gh view rlqualls/github-gem

![github view screenshot](http://i.imgur.com/kgeh0VS.png)

    $ gh view rlqualls/github-gem/lib

![github view directory screenshot](http://i.imgur.com/Mj4TQrL.png)

    $ gh view rlqualls/github-gem/lib/github/ui.rb

![github view file screenshot](http://i.imgur.com/x9lvvJr.png)

### readme

View the README in the current directory or a GitHub repo.

    $ gh readme
    $ gh readme rlqualls/github-gem

### log

View the commit log of a GitHub repo.

    $ gh log rlqualls/github-gem

### Command

View the source code of a github gem command.

    $ gh command view

## Original Usage Instructions

### Pulling Upstream Changes

Let's say you just forked `github-gem` on GitHub from defunkt.

    $ gh clone YOU/github-gem
    $ cd github-gem
    $ gh pull defunkt

This will setup a remote and branch for defunkt's repository at master.
In this case, a 'defunkt/master' branch.

If defunkt makes some changes you want, simply `github pull defunkt`.  This will
leave you in the 'defunkt/master' branch after pulling changes from defunkt's
remote.  After confirming that defunkt's changes were what you wanted, run `git
checkout master` and then `git merge defunkt/master` to merge defunkt's changes
into your own master branch.  In summary:

    $ gh pull defunkt
    $ gh checkout master
    $ gh merge defunkt/master

If you've already reviewed defunkt's changes and just want to merge them into your
master branch, use the `merge` flag:

    $ gh pull --merge defunkt

### Fetching and Evaluating Downstream Changes

If you are the maintainer of a project, you will often need to fetch commits
from other developers, evaluate and/or test them, then merge them into the
project.

Let's say you are 'defunkt' and 'mojombo' has forked your 'github-gem' repo,
made some changes and issues you a pull request for his 'master' branch.

From the root of the project, you can do:

    $ gh fetch mojombo master

This will leave you in the 'mojombo/master' branch after fetching his commits.
Your local 'mojombo/master' branch is now at the exact same place as mojombo's
'master' branch. You can now run tests or evaluate the code for awesomeness.

If mojombo's changes are good, you'll want to merge your 'master' (or another
branch) into those changes so you can retest post-integration:

    $ gh merge master

Test/analyze again and if everything is ok:

    $ gh checkout master
    $ gh merge mojombo/master

The latter command will be a fast-forward merge since you already did the
real merge previously.

### Network Patch Queue

The github gem can also show you all of the commits that exist on any fork of your
project (your network) that you don't have in your branch yet.  In order to see
the list of the projects that have commits you do not, you can run:

    $ gh network list

Which will show you all the forks that have changes.  If you want to see what those
changes are, you can run:

    $ gh network commits

which will show you something like this:

    9582b9 (jchris/gist)             kevin@sb.org          Add gist binary                        4 months ago
    c1a6f9 (jchris/gist~1)           kevin@sb.org          Tweak Rakefile spec tasks to be a bi   4 months ago
    d3c332 (jchris/gist~2)           kevin@sb.org          Pull out two helpers into the shared   4 months ago
    8f65ab (jchris/gist~3)           kevin@sb.org          Extract command/helper spec assistan   4 months ago
    389dbf (jchris/gist~4)           kevin@sb.org          Rename ui_spec to command_spec         4 months ago
    670a1a (jchris/gist~5)           kevin@sb.org          Hoist the specs into a per-binary sp   4 months ago
    6aa18e (jchris/gist~6)           kevin@sb.org          Hoist commands/helpers into a per-co   4 months ago
    ee013a (luislavena/master)       luislavena@gmail.com  Replaced STDOUT by $stdout in specs.   2 weeks ago
    d543c4 (luislavena/master~3)     luislavena@gmail.com  Exclude package folder.                8 weeks ago
    a8c3eb (luislavena/master~5)     luislavena@gmail.com  Fixed specs for open under Windows.    5 months ago
    33d003 (riquedafreak/master)     enrique.osuna@gmail.  Make sure it exists on the remote an   5 weeks ago
    157155 (riquedafreak/master~1)   enrique.osuna@gmail.  Updated specs.                         5 weeks ago
    f44e99 (riquedafreak/master~3)   enrique.osuna@gmail.  Only work with a clean branch.         3 months ago

These are all the commits that you don't have in your current branch that have been
pushed to other forks of your project.  If you want to incorporate them, you can use:

    $ gh cherry-pick ee013a

for example to apply that single patch to your branch.  You can also merge a branch,
if you want all the changes introduced in another branch:

    $ gh merge jchris/gist

The next time you run the 'github network commits' command, you won't see any of the
patches you have cherry-picked or merged (or rebased).  If you want to ignore a
commit, you can simply run:

    $ gh ignore a8c3eb

Then you won't ever see that commit again. Or, if you want to ignore a range of commits,
you can use the normal Git revision selection shorthands - for example, if you want
to ignore all 7 jchris/gist commits there, you can run:

    $ gh ignore ..jchris/gist

You can also filter the output, if you want to see some subset.  You can filter by project,
author and date range, or (one of the cooler things) you can filter by whether the patch
applies cleanly to your branch head or not.  For instance, I can do this:

    $ ./bin/github network commits --applies

    ca15af (jchris/master~1)         jchris@grabb.it       fixed github gemspecs broken referen   8 weeks ago
    ee013a (luislavena/master)       luislavena@gmail.com  Replaced STDOUT by $stdout in specs.   2 weeks ago
    157155 (riquedafreak/master~1)   enrique.osuna@gmail.  Updated specs.                         5 weeks ago
    f44e99 (riquedafreak/master~3)   enrique.osuna@gmail.  Only work with a clean branch.         3 months ago

    $ ./bin/github network commits --applies --project=riq

    157155 (riquedafreak/master~1)   enrique.osuna@gmail.  Updated specs.                         5 weeks ago
    f44e99 (riquedafreak/master~3)   enrique.osuna@gmail.  Only work with a clean branch.         3 months ago

Pretty freaking sweet.  Also, you can supply the --shas option to just get a list of
the shas instead of the pretty printout here, so you can pipe that into other
scripts (like 'github ignore' for instance).

### Issues

If you'd like to see a summary of the open issues on your project:

    $ gh issues open

    -----
    Issue #135 (2 votes): Remove Node#collect_namespaces
    *  URL: http://github.com/tenderlove/nokogiri/issues/#issue/135
    *  Opened 3 days ago by tenderlove
    *  Last updated about 1 hour ago

    I think we should remove Node#collect_namespaces.  Since namespace names are not unique, I don't know that this method is very useful.
    -----
    Issue #51 (0 votes): FFI: support varargs in error/exception callbacks
    *  URL: http://github.com/tenderlove/nokogiri/issues/#issue/51
    *  Opened 4 months ago by flavorjones
    *  Last updated about 1 month ago
    *  Labels: ffi, mdalessio

    we should open JIRA tickets for vararg support in FFI callbacks

    then we should format the libxml error messages properly in the error/exception callbacks
    -----

If you want to additionally filter by time:

    $ gh issues open --after=2009-09-14

Or filter by label:

    $ gh issues open --label=ffi

## Contributors

* defunkt
* maddox
* halorgium
* kballard
* mojombo
* schacon
* drnic


text:
package main

import (
	"bufio"
	"flag"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/akhenakh/regionagogo"
	"github.com/akhenakh/regionagogo/db/boltdb"
)

// fieldFlag reusable parse Value to create import command
type fieldFlag struct {
	Fields []string
}

func (ff *fieldFlag) String() string {
	return fmt.Sprint(ff.Fields)
}

func (ff *fieldFlag) Set(value string) error {
	if len(ff.Fields) > 0 {
		return fmt.Errorf("The field flag is already set")
	}

	ff.Fields = strings.Split(value, ",")
	return nil
}

func main() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	// fields name we want to import as metadata
	var importFields fieldFlag
	flag.Var(&importFields, "importFields", "List of fields to fetch inside GeoJSON properties")

	// add a property to each entries imported
	var forceFields fieldFlag
	flag.Var(&forceFields, "forceFields", "List of fields to enforce as a property, eg level=country")

	// rename a field on the fly
	var renameFields fieldFlag
	flag.Var(&renameFields, "renameFields", "List of fields to be renamed on the fly as a property, eg NAME_EN=name\n\tnote NAME_EN needs to be in importFields even if it will be renamed")

	filename := flag.String("filename", "", "A geojson file")
	dbpath := flag.String("dbpath", "", "Database path")
	debug := flag.Bool("debug", false, "Enable debug")
	featureImport := flag.Bool("featureImport", false, "the GeoJSON is a feature not a featureCollection")

	flag.Parse()

	if len(*filename) == 0 {
		flag.PrintDefaults()
		os.Exit(2)
	}
	if len(importFields.Fields) < 1 {
		flag.PrintDefaults()
		os.Exit(2)
	}

	forceFieldsMap := make(map[string]string)

	if len(forceFields.Fields) > 0 {
		// check the syntax
		for _, field := range forceFields.Fields {
			if len(strings.Split(field, "=")) != 2 {
				fmt.Println("Invalid forceField", field)
				flag.PrintDefaults()
				os.Exit(2)
			}
			split := strings.Split(field, "=")
			forceFieldsMap[split[0]] = split[1]
		}
	}

	renameFieldsMap := make(map[string]string)

	if len(renameFields.Fields) > 0 {
		// check the syntax
		for _, field := range renameFields.Fields {
			if len(strings.Split(field, "=")) != 2 {
				fmt.Println("Invalid forceField", field)
				flag.PrintDefaults()
				os.Exit(2)
			}
			split := strings.Split(field, "=")
			renameFieldsMap[split[0]] = split[1]
		}
	}

	opts := boltdb.WithDebug(*debug)

	gs, err := boltdb.NewGeoFenceBoltDB(*dbpath, opts)
	if err != nil {
		log.Fatal(err)
	}

	fi, err := os.Open(*filename)
	defer fi.Close()
	if err != nil {
		log.Fatal(err)
	}
	r := bufio.NewReader(fi)

	i := regionagogo.NewGeoJSONImport(gs, r, importFields.Fields, forceFieldsMap, renameFieldsMap)
	i.FeatureImport = *featureImport
	if err := i.Start(); err != nil {
		log.Fatal(err)
	}

}


text:
using System;
using UnityEngine;
using LuaInterface;

public class AnimatorControllerParameterWrap
{
	public static void Register(IntPtr L)
	{
		LuaMethod[] regs = new LuaMethod[]
		{
			new LuaMethod("Equals", Equals),
			new LuaMethod("GetHashCode", GetHashCode),
			new LuaMethod("New", _CreateAnimatorControllerParameter),
			new LuaMethod("GetClassType", GetClassType),
		};

		LuaField[] fields = new LuaField[]
		{
			new LuaField("name", get_name, set_name),
			new LuaField("nameHash", get_nameHash, null),
			new LuaField("type", get_type, set_type),
			new LuaField("defaultFloat", get_defaultFloat, set_defaultFloat),
			new LuaField("defaultInt", get_defaultInt, set_defaultInt),
			new LuaField("defaultBool", get_defaultBool, set_defaultBool),
		};

		LuaScriptMgr.RegisterLib(L, "UnityEngine.AnimatorControllerParameter", typeof(AnimatorControllerParameter), regs, fields, typeof(object));
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int _CreateAnimatorControllerParameter(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

		if (count == 0)
		{
			AnimatorControllerParameter obj = new AnimatorControllerParameter();
			LuaScriptMgr.PushObject(L, obj);
			return 1;
		}
		else
		{
			LuaDLL.luaL_error(L, "invalid arguments to method: AnimatorControllerParameter.New");
		}

		return 0;
	}

	static Type classType = typeof(AnimatorControllerParameter);

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetClassType(IntPtr L)
	{
		LuaScriptMgr.Push(L, classType);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_name(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name name");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index name on a nil value");
			}
		}

		LuaScriptMgr.Push(L, obj.name);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_nameHash(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name nameHash");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index nameHash on a nil value");
			}
		}

		LuaScriptMgr.Push(L, obj.nameHash);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_type(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name type");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index type on a nil value");
			}
		}

		LuaScriptMgr.Push(L, obj.type);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_defaultFloat(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name defaultFloat");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index defaultFloat on a nil value");
			}
		}

		LuaScriptMgr.Push(L, obj.defaultFloat);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_defaultInt(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name defaultInt");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index defaultInt on a nil value");
			}
		}

		LuaScriptMgr.Push(L, obj.defaultInt);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int get_defaultBool(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name defaultBool");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index defaultBool on a nil value");
			}
		}

		LuaScriptMgr.Push(L, obj.defaultBool);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_name(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name name");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index name on a nil value");
			}
		}

        //obj.name = LuaScriptMgr.GetString(L, 3);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_type(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name type");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index type on a nil value");
			}
		}

		obj.type = (AnimatorControllerParameterType)LuaScriptMgr.GetNetObject(L, 3, typeof(AnimatorControllerParameterType));
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_defaultFloat(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name defaultFloat");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index defaultFloat on a nil value");
			}
		}

		obj.defaultFloat = (float)LuaScriptMgr.GetNumber(L, 3);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_defaultInt(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name defaultInt");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index defaultInt on a nil value");
			}
		}

		obj.defaultInt = (int)LuaScriptMgr.GetNumber(L, 3);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int set_defaultBool(IntPtr L)
	{
		object o = LuaScriptMgr.GetLuaObject(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)o;

		if (obj == null)
		{
			LuaTypes types = LuaDLL.lua_type(L, 1);

			if (types == LuaTypes.LUA_TTABLE)
			{
				LuaDLL.luaL_error(L, "unknown member name defaultBool");
			}
			else
			{
				LuaDLL.luaL_error(L, "attempt to index defaultBool on a nil value");
			}
		}

		obj.defaultBool = LuaScriptMgr.GetBoolean(L, 3);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Equals(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		AnimatorControllerParameter obj = LuaScriptMgr.GetVarObject(L, 1) as AnimatorControllerParameter;
		object arg0 = LuaScriptMgr.GetVarObject(L, 2);
		bool o = obj != null ? obj.Equals(arg0) : arg0 == null;
		LuaScriptMgr.Push(L, o);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetHashCode(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 1);
		AnimatorControllerParameter obj = (AnimatorControllerParameter)LuaScriptMgr.GetNetObjectSelf(L, 1, "AnimatorControllerParameter");
		int o = obj.GetHashCode();
		LuaScriptMgr.Push(L, o);
		return 1;
	}
}


text:
package Bread::Board::Declare::Meta::Role::Instance;
BEGIN {
  $Bread::Board::Declare::Meta::Role::Instance::AUTHORITY = 'cpan:DOY';
}
{
  $Bread::Board::Declare::Meta::Role::Instance::VERSION = '0.16';
}
use Moose::Role;

# XXX: ugh, this should be settable at the attr level, fix this in moose
sub inline_get_is_lvalue { 0 }

no Moose::Role;

1;

__END__

=pod

=head1 NAME

Bread::Board::Declare::Meta::Role::Instance

=head1 VERSION

version 0.16

=for Pod::Coverage inline_get_is_lvalue

=head1 AUTHOR

Jesse Luehrs <doy@tozt.net>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by Jesse Luehrs.

This is free software, licensed under:

  The MIT (X11) License

=cut


text:
# Réalisation d'une TODO liste avec ZetaPush #
*~ 15 minutes
Concepts : service, stack, authentification*

## Introduction ##

Le prototype réalisé lors de la partie 1, bien que fonctionnel, ne profite pas à 100%
des macros déployées côté serveur. Par exemple le serveur implémente d'ores et déjà
de pouvoir supprimer en une fois plusieurs notes, alors que le client nous limite à une
note supprimée. Dommage non ?

Mais avant toute chose pour faciliter la maintenabilité et la lisibilité de notre client nous allons créer un service qui permettra d'abstraire les appels au serveur depuis le composant HomePage.
Ce service pourra ainsi être réutilisé à de multiples endroits de notre application, voire même dans un autre projet en modifiant quelque peu certaines parties du code !

## Pré-requis ##

En considérant la partie 1 comme réalisée, pour cette seconde partie il vous suffit juste de reprendre votre projet.
Rien de nouveau à installer ou à configurer.

## Côté Serveur ##

Des modifications minimes sont à effectuer sur nos différentes macros **pushNote** et **deleteNotes**. Celles-ci vont désormais retourner la liste complète des notes de notre stack.
Plutôt que de recopier sauvagement le code de la macro **getNotes()**, il est possible d'utiliser le mot-clé *call* ainsi :
```javascript
...

var macroResult = call getNotes();
var notes = macroResult.result.notes;

} return { notes } on channel __selfName
```
Explicite non ? Une amélioration encore plus simple consiste à changer le *return* par *broadcast*. Ce seul changement va permettre de **broadcaster à tous les périphériques de l'utilisateur l'information** : en l'occurrence les notes. Dans le cadre de l'authentification weak - cf part 1 - l'utilisateur est assimilé au navigateur web et les périphériques ne sont rien d'autres que des onglets.

Mais en optant pour l'authentification simple, plus traditionnelle avec par exemple un couple login/mot de passe, tous les périphériques (smartphone, ordinateur, objet connecté, etc...) d'un même utilisateur (personne, entreprise) seront synchronisés en temps réel !

## Côté Client ##

Voici pour rappel l'arborescence du src de notre client et plus particulièrement les fichiers sur lesquels nous allons travailler :
```
.src/
+-- api/
|   +-- notes-api.service
+-- app/
|   +-- app.component
|   +-- app.module
+-- assets/
+-- pages/
|   +-- home/
|   |   +-- home.html
|   |   +-- home.ts
+-- theme/
```

Utilisons la commande `> ionic generate provider notes-manager` pour inscrire un nouveau service injectable à notre application. Il en résulte un nouveau fichier *src/providers/notes-manager/notes-manager.ts* qu'il vous faudra rendre injectable en l'ajoutant aux providers de *app.module.ts*. *Le chemin peut être différent selon la version d'Ionic utilisée*

Faisons le bilan de l'état actuel du composant *HomePage*.
* À la construction, on subscribe aux différents observables renvoyés par NotesApi.
* À l'initialisation, lorsqu'on réussit à se connecter à ZetaPush, on demande au serveur les notes existantes.
* Enfin suite aux actions de l'utilisateur on effectue des appels à NotesApi.

À présent on va sortir toute cette logique du composant *HomePage*, pour l'attribuer à notre service nouvellement créé : *NotesManagerProvider*.

### NotesManagerProvider, pour un code plus propre ###

Voici le code de *src/providers/notes-manager/notes-manager.ts* que je détaillerai juste après.

```javascript
import { Injectable, OnDestroy } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/merge';
import { Note, NotesApi } from '../../api/notes-api.service';

@Injectable()
export class NotesManagerProvider implements OnDestroy {

    // Using a Subject to subscribe and emit values
    private _notes: BehaviorSubject<Array<Note>> = new BehaviorSubject([]);

    // Showing an Observable instead of giving the Subject (security purpose)
    public readonly notes: Observable<Array<Note>> = this._notes.asObservable();

    subscription: any;

  constructor(private api: NotesApi) {

    // SUBSCRIBING THE DIFFERENT API OBSERVABLES
    // AND ACT AS A PROXY

    this.subscription = Observable.merge(
        this.api.onGetNotes,
        this.api.onPushNote,
        this.api.onDeleteNotes
    ).subscribe(
        serverResponse => {
            console.log('Proxy received a server response ', serverResponse);
            this._notes.next(serverResponse['notes']);
        },
        error => { console.log(error); }
    );

  }

  // CRUD OPERATIONS - these will be the functions called from HomePage

  pushNote(text: string): void {
      this.api.pushNote({content: text});
  }

  getNotes(): void {
      this.api.getNotes({});
  }

  deleteNotes(ids : Array<string>): void {
      this.api.deleteNotes({ids: ids});
  }

  resetNotes(): void {
      this.api.reset({});
  }

  ngOnDestroy(): void {
      this.subscription.unsubscribe();
  }

}
```

*NotesApi* permet d'interagir avec le serveur à un niveau très bas. Jusqu'à présent c'est ce service dont se servait *HomePage*, à présent *HomePage* devra utiliser le service *NotesManagerProvider*, qui se chargera à son tour de recourir à *NotesApi*.

Pour ce faire on modifie le fichier *src/pages/home/home.ts*.
```javascript

import { Component, OnInit } from '@angular/core';
import { NavController, AlertController, Platform } from 'ionic-angular';
import { ZetaPushConnection } from 'zetapush-angular';
import { NotesManagerProvider } from '../../providers/notes-manager/notes-manager';
import { Note } from '../../api/notes-api.service';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
  providers: [NotesManagerProvider]
})
export class HomePage implements OnInit {

    notes: Array<Note>;

    constructor(
        public navCtrl: NavController,
        public alertCtrl: AlertController,
        private platform: Platform,
        private zpConnection: ZetaPushConnection,
        private notesManager: NotesManagerProvider) {

            this.notesManager.notes.subscribe(
                notes => {
                    console.log('The proxy sent us something : ', notes);
                    this.notes = notes;
                },
                error => { console.log(error) }
            );

        }

        ngOnInit(): void {
            this.platform.ready().then(() => {
                this.zpConnection.connect().then(() => {
                    // getting notes from server after connection
                    this.notesManager.getNotes();
                });
            });
        }

        userAddNote() {
            let form = this.alertCtrl.create({
                title : 'Add a note',
                message : 'Enter the text of the note here',
                inputs: [
                    {
                        name: 'text',
                        placeholder: ''
                    }
                ],
                buttons: [
                    {
                        text: 'Cancel',
                        handler: data => {
                            // nothing
                        }
                    },
                    {
                        text: 'Add',
                        handler: data => {
                            this.notesManager.pushNote(data.text);
                        }
                    }
                ]
            });
            form.present();
        }

        userClear() {
            this.notesManager.resetNotes();
            // The reset macro doesn't send us anything, that's why
            // we "manually" reset the notes array
            this.notes = [];
        }

        userRefresh() {
            this.notesManager.getNotes();
        }

        userDelete(deleted : Note) {
            var ids = [];
            ids.push(deleted.id);
            this.notesManager.deleteNotes(ids);
        }

}

```

Beaucoup plus clair non ? Un seul Observable à gérer et des fonctions encore plus simples qui ne nécessitent pas la connaissance de l'API.
Par exemple `this.notesApi.pushNote({content:data.text});` devient `this.notesManager.pushNote(data.text);`.
Les *console.log* permettent de retracer dans la console du navigateur le fonctionnement de l'application et aident à la compréhension.

### Ajout de fonctionnalité ###

Ajoutons un attribut `selection: Array<Note> = [];` au composant *HomePage* juste à côté de l'attribut notes existant déjà, et créons deux fonctions pour respectivement sélectionner une note et savoir si une note est sélectionnée.

```javascript
userSelect(note: Note){

    if(this.isSelected(note)){
        this.selection.splice(this.selection.indexOf(note), 1);
    } else {
        this.selection.push(note);
    }

}

isSelected(note: Note): boolean {
    return (this.selection.indexOf(note) !== -1);
}
```

Puis modifions la fonction existante *userClear()* pour changer son comportement : réinitialisation de la todo liste seulement si aucune note sélectionnée, sinon suppression de toutes les notes sélectionnées.

```javascript
userClear() {
    if(this.selection.length > 0){
        var ids = this.selection.map(note => note.id);
        this.notesManager.deleteNotes(ids);
    } else {
        this.notesManager.resetNotes();
        this.notes = [];
    }
}
```

Côté javascript c'est fini, il ne reste plus qu'à modifier le HTML/CSS pour pouvoir en profiter :)
```html
<!-- fichier home.html -->
...
<ion-card *ngFor="let note of notes" (click)="userSelect(note)" [ngClass]="{faded: isSelected(note)}">
    <ion-card-content>
        <ion-list>
            <ion-item>
                <p>{{note.text}}</p>
                <ion-icon item-end [ngClass]="{notSelected: !isSelected(note)}" name="trash"></ion-icon>
            </ion-item>
        </ion-list>
    </ion-card-content>
</ion-card>
...
```

```css
/* fichier home.scss */

...

.notSelected {
    visibility: hidden;
}

.faded {
    opacity: 0.2;
    transition: 0.3s;
}

```

Et voilà ! Désormais il est possible de sélectionner des notes et de supprimer la sélection. On pourra réutiliser ce principe de sélection pour d'autres fin, qui feront l'objet des prochaines parties de ce tutoriel.


text:
package com.example.stitcher;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNotNull;

import com.google.api.gax.rpc.NotFoundException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class GetLiveSessionTest {

  private static final String LOCATION = "us-central1";
  private static final String LIVE_URI =
      "https://storage.googleapis.com/cloud-samples-data/media/hls-live/manifest.m3u8";
  // Single Inline Linear
  // (https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/tags)
  private static final String LIVE_AD_TAG_URI =
      "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=";
  private static final String SLATE_ID = TestUtils.getSlateId();
  private static final String SLATE_URI =
      "https://storage.googleapis.com/cloud-samples-data/media/ForBiggerEscapes.mp4";
  private static String PROJECT_ID;
  private static String SESSION_ID;
  private static String SESSION_NAME;
  private static PrintStream originalOut;
  private ByteArrayOutputStream bout;

  private static String requireEnvVar(String varName) {
    String varValue = System.getenv(varName);
    assertNotNull(
        String.format("Environment variable '%s' is required to perform these tests.", varName));
    return varValue;
  }

  @BeforeClass
  public static void checkRequirements() {
    requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS");
    PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT");
  }

  @Before
  public void beforeTest() throws IOException {
    TestUtils.cleanStaleSlates(PROJECT_ID, LOCATION);
    originalOut = System.out;
    bout = new ByteArrayOutputStream();
    System.setOut(new PrintStream(bout));

    try {
      DeleteSlate.deleteSlate(PROJECT_ID, LOCATION, SLATE_ID);
    } catch (NotFoundException e) {
      // Don't worry if the slate doesn't already exist.
    }
    CreateSlate.createSlate(PROJECT_ID, LOCATION, SLATE_ID, SLATE_URI);
    bout.reset();

    CreateLiveSession.createLiveSession(PROJECT_ID, LOCATION, LIVE_URI, LIVE_AD_TAG_URI, SLATE_ID);
    Matcher idMatcher =
        Pattern.compile(
                String.format(
                    "Created live session: projects/.*/locations/%s/liveSessions/(.*)", LOCATION))
            .matcher(bout.toString());
    if (idMatcher.find()) {
      SESSION_ID = idMatcher.group(1);
    }
    // Project number is always returned in the live session name
    SESSION_NAME = String.format("locations/%s/liveSessions/%s", LOCATION, SESSION_ID);
    bout.reset();
  }

  @Test
  public void test_GetLiveSession() throws IOException {
    GetLiveSession.getLiveSession(PROJECT_ID, LOCATION, SESSION_ID);
    String output = bout.toString();
    assertThat(output, containsString(SESSION_NAME));
    bout.reset();
  }

  @After
  public void tearDown() throws IOException {
    DeleteSlate.deleteSlate(PROJECT_ID, LOCATION, SLATE_ID);
    // No delete method for a live session
    System.setOut(originalOut);
    bout.reset();
  }
}


text:
<!doctype html>

  <title>ComboBox</title>
  <meta charset="utf-8">
  <link rel="canonical" href="<%host%>/advanced/combobox/">

  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

      <amp-state id="cities">
        </amp-state>

        <amp-bind-macro id="filterCities"
                        arguments="query"
                        expression="cities.filter( city => city.toLowerCase().indexOf(query.toLowerCase()) >= 0 )">
        </amp-bind-macro>

          Enter city:

          <input id="input-city"
               class="combo-input"
               [value]="city"
                on="input-debounced: AMP.setState({
                        input: event.value,
                        filteredCities: event.value.length > 0 ? filterCities(event.value) : []
                     });
                     change: AMP.setState( { state: event.value  })">

        <button class="combo-trigger"
                 on="tap:AMP.setState({
                   filteredCities: filteredCities.length > 0 ? [] : filterCities(input || '')
                 })">
           0 ? 'arrow-up' : 'arrow-down'">
        </button>

        <amp-selector on="select:AMP.setState({
                            city: event.targetOption,
                            filteredCities: []
                         })"
                         keyboard-select-mode="focus">
          <amp-list id="suggestions"
                    items="."
                    layout="fixed-height"
                    height="0"
                   [src]="filteredCities"
                   [height]="filteredCities.length * 34">
            <template type="amp-mustache">

{{.}}

            </template>
          </amp-list>
        </amp-selector>


text:
package cs3773.com.eventplanner.model;

import java.io.Serializable;
import java.sql.Time;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * This class will hold all information about the schedule for an event.
 * <p/>
 * Created by Rodney on 4/28/2015.
 */
public class TimeSlot implements Comparable<Time>, Serializable {

    private Time time;
    private String description;

    public TimeSlot(String time, String description) throws Exception {
        Date date = null;
        try {
            date = new SimpleDateFormat("hh:mm", Locale.US).parse(time);
        } catch (ParseException e) {
            throw new Exception("Invalid time format. Must be in the format 'hh:mm'");
        }

        if (date != null) {
            this.time = new Time(date.getTime());
        } else {
            this.time = new Time(0);
        }

    }

    public TimeSlot(Time time, String description) {
        this.time = time;
        this.description = description;
    }

    public Time getTime() {
        return time;
    }

    public String getDescription() {
        return description;
    }

    @Override
    public int compareTo(Time other) {
        return time.compareTo(other);
    }

    @Override
    public String toString() {
        return new SimpleDateFormat("h:mm a", Locale.US).format(new Date(time.getTime()));
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0" name="${project.artifactId}">

    <feature name="ipojo" version="${project.version}"
             description="Apache Felix iPOJO Core Runtime">
        <bundle>mvn:${project.groupId}/org.apache.felix.ipojo/${project.version}</bundle>
    </feature>

    <feature name="ipojo-command" version="${project.version}"
             description="Apache Felix iPOJO Shell Command">
        <feature version="${project.version}">ipojo</feature>
        <bundle>mvn:${project.groupId}/org.apache.felix.ipojo.gogo/${project.version}</bundle>
    </feature>

    <feature name="ipojo-all" version="${project.version}"
             description="Apache Felix iPOJO All Runtime Bundles">
        <feature version="${project.version}">ipojo-command</feature>
        <bundle>mvn:${project.groupId}/org.apache.felix.ipojo.composite/${project.version}</bundle>
        <bundle>mvn:${project.groupId}/org.apache.felix.ipojo.api/${project.version}</bundle>
    </feature>

    <feature name="ipojo-webconsole" version="${project.version}"
             description="Apache Felix iPOJO Web Console Plugin">
        <feature version="${project.version}">ipojo</feature>
        <feature>webconsole</feature>
        <bundle>mvn:${project.groupId}/org.apache.felix.ipojo.webconsole/${ipojo.webconsole.version}</bundle>
    </feature>
</features>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.google.cloud.tools.eclipse</groupId>
    <artifactId>plugins</artifactId>
    <version>0.1.0-SNAPSHOT</version>
  </parent>
  <artifactId>com.google.cloud.tools.eclipse.googleapis</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <packaging>eclipse-plugin</packaging>

  <!--
    This project provides versions of Google APIs in a form that
    can be consumed by Eclipse/OSGi projects as many of these APIs
    are not distributed as OSGi bundles.

    This approach requires use of Ian Brandt's "Maven Dependency
    Plugin" for m2e, which causes the `dependency:copy-dependencies`
    to be performed during the _process-sources_ phase on a full
    build.
   -->

  <dependencies>
    <dependency>
      <groupId>com.google.api-client</groupId>
      <artifactId>google-api-client</artifactId>
      <version>1.25.0</version>
    </dependency>

    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-appengine</artifactId>
      <version>v1-rev80-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-cloudresourcemanager</artifactId>
      <version>v1-rev507-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-servicemanagement</artifactId>
      <version>v1-rev412-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-storage</artifactId>
      <version>v1-rev138-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-compute</artifactId>
      <version>v1-rev198-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-dataflow</artifactId>
      <version>v1b3-rev259-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-bigquery</artifactId>
      <version>v2-rev405-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-pubsub</artifactId>
      <version>v1-rev403-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-datastore</artifactId>
      <version>v1-rev63-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-iam</artifactId>
      <version>v1-rev261-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-oauth2</artifactId>
      <version>v2-rev141-1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.http-client</groupId>
      <artifactId>google-http-client</artifactId>
      <version>1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.http-client</groupId>
      <artifactId>google-http-client-jackson</artifactId>
      <version>1.25.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.http-client</groupId>
      <artifactId>google-http-client-jackson2</artifactId>
      <version>1.25.0</version>
    </dependency>

    <dependency>
      <groupId>com.google.oauth-client</groupId>
      <artifactId>google-oauth-client</artifactId>
      <version>1.33.3</version>
    </dependency>
    <dependency>
      <groupId>com.google.oauth-client</groupId>
      <artifactId>google-oauth-client-jetty</artifactId>
      <version>1.33.3</version>
    </dependency>
    <dependency>
      <groupId>com.google.oauth-client</groupId>
      <artifactId>google-oauth-client-java6</artifactId>
      <version>1.33.3</version>
    </dependency>
    <dependency>
      <groupId>com.google.cloud.tools.login</groupId>
      <artifactId>plugins-login-common</artifactId>
      <version>0.2.2</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- Copy listed dependencies to lib/ -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>assemble-bundle-lib</id>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeScope>runtime</includeScope>
              <!-- the groupIds of the dependencies above -->
              <includeGroupIds>
                com.google.api-client,
                com.google.apis,
                com.google.oauth-client,
                com.google.http-client,
                com.google.cloud.tools.login,
              </includeGroupIds>
              <outputDirectory>lib</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--
        This plugin's configuration is used to store Eclipse m2e
        settings only. It has no influence on the Maven build itself.
        -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[2.8,)</versionRange>
                    <goals>
                      <goal>copy-dependencies</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <!-- cause copy-dependencies to run on any full workspace change -->
                    <execute>
                      <runOnIncremental>true</runOnIncremental>
                      <runOnConfiguration>true</runOnConfiguration>
                    </execute>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>


text:
const jwtTokenWrapper = token => (delegate, url, config = {}) => {
  const headers = config.headers || {}

  const modifiedConfig = {
    ...config,
    headers: { ...headers, Authorization: `Bearer ${token}` }
  }

  delegate(url, modifiedConfig)
}

export default jwtTokenWrapper


text:
class PlayerManager {
    /**
     * Returns random player from room, other than specified in ignorePlayers parameter
     * @param {Room} room
     * @param {Player[]} ignorePlayers
     * @return {Player}
     */
    static getRandomPlayer(room, ignorePlayers) {

    }
}

module.exports = PlayerManager;


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

#include "UnrealEd.h"
#include "AutomationEditorPromotionCommon.h"
#include "AssetRegistryModule.h"
#include "ScopedTransaction.h"

#define LOCTEXT_NAMESPACE "EditorPromotionTestCommon"

/**
* Finds a visible widget by type.     SLOW!!!!!
*
* @param InParent - We search this widget and its children for a matching widget (recursive)
* @param InWidgetType - The widget type we are searching for
*/
TSharedPtr<SWidget> FEditorPromotionTestUtilities::FindFirstWidgetByClass(TSharedRef<SWidget> InParent, const FName& InWidgetType)
{
	if (InParent->GetType() == InWidgetType)
	{
		return InParent;
	}
	FChildren* Children = InParent->GetChildren();
	for (int32 i = 0; i < Children->Num(); ++i)
	{
		TSharedRef<SWidget> ChildWidget = Children->GetChildAt(i);
		TSharedPtr<SWidget> FoundWidget = FindFirstWidgetByClass(ChildWidget, InWidgetType);
		if (FoundWidget.IsValid())
		{
			return FoundWidget;
		}
	}
	return NULL;
}

/**
* Gets the base path for this asset
*/
FString FEditorPromotionTestUtilities::GetGamePath()
{
	return TEXT("/Game/BuildPromotionTest");
}

/**
* Creates a material from an existing texture
*
* @param InTexture - The texture to use as the diffuse for the new material
*/
UMaterial* FEditorPromotionTestUtilities::CreateMaterialFromTexture(UTexture* InTexture)
{
	// Create the factory used to generate the asset
	UMaterialFactoryNew* Factory = NewObject<UMaterialFactoryNew>();
	Factory->InitialTexture = InTexture;

	const FString AssetName = FString::Printf(TEXT("%s_Mat"), *InTexture->GetName());
	const FString PackageName = FEditorPromotionTestUtilities::GetGamePath() + TEXT("/") + AssetName;
	UPackage* AssetPackage = CreatePackage(NULL, *PackageName);
	EObjectFlags Flags = RF_Public | RF_Standalone;

	UObject* CreatedAsset = Factory->FactoryCreateNew(UMaterial::StaticClass(), AssetPackage, FName(*AssetName), Flags, NULL, GWarn);

	if (CreatedAsset)
	{
		// Notify the asset registry
		FAssetRegistryModule::AssetCreated(CreatedAsset);

		// Mark the package dirty...
		AssetPackage->MarkPackageDirty();
	}

	return Cast<UMaterial>(CreatedAsset);
}

/**
* Sets an editor keyboard shortcut
*
* @param CommandContext - The context of the command
* @param Command - The command name to set
* @param NewChord - The new input chord to assign
*/
bool FEditorPromotionTestUtilities::SetEditorKeybinding(const FString& CommandContext, const FString& Command, const FInputChord& NewChord)
{
	TSharedPtr<FUICommandInfo> UICommand = FInputBindingManager::Get().FindCommandInContext(*CommandContext, *Command);
	if (UICommand.IsValid())
	{
		UICommand->SetActiveChord(NewChord);
		FInputBindingManager::Get().NotifyActiveChordChanged(*UICommand.Get());
		FInputBindingManager::Get().SaveInputBindings();
		return true;
	}
	else
	{
		return false;
	}
}

/**
* Gets an editor keyboard shortcut
*
* @param CommandContext - The context of the command
* @param Command - The command name to get
*/
FInputChord FEditorPromotionTestUtilities::GetEditorKeybinding(const FString& CommandContext, const FString& Command)
{
	FInputChord Keybinding;
	TSharedPtr<FUICommandInfo> UICommand = FInputBindingManager::Get().FindCommandInContext(*CommandContext, *Command);
	if (UICommand.IsValid())
	{
		TSharedRef<const FInputChord> ActiveChord = UICommand->GetActiveChord();
		Keybinding = ActiveChord.Get();
	}
	return Keybinding;
}

/**
* Gets the current input chord or sets a new one if it doesn't exist
*
* @param Context - The context of the UI Command
* @param Command - The name of the UI command
*/
FInputChord FEditorPromotionTestUtilities::GetOrSetUICommand(const FString& Context, const FString& Command)
{
	FInputChord CurrentChord = GetEditorKeybinding(Context, Command);

	//If there is no current keybinding, set one
	if (!CurrentChord.Key.IsValid())
	{
		FInputChord NewChord(EKeys::J, EModifierKey::Control);
		SetEditorKeybinding(Context, Command, NewChord);
		CurrentChord = NewChord;
	}

	return CurrentChord;
}

/**
* Sends a UI command to the active top level window after focusing on a widget of a given type
*
* @param InChord - The chord to send to the window
* @param WidgetTypeToFocus - The widget type to find and focus on
*/
void FEditorPromotionTestUtilities::SendCommandToCurrentEditor(const FInputChord& InChord, const FName& WidgetTypeToFocus)
{
	//Focus the asset Editor / Graph
	TSharedRef<SWindow> EditorWindow = FSlateApplication::Get().GetActiveTopLevelWindow().ToSharedRef();
	FSlateApplication::Get().ProcessWindowActivatedEvent(FWindowActivateEvent(FWindowActivateEvent::EA_Activate, EditorWindow));
	TSharedPtr<SWidget> FocusWidget = FindFirstWidgetByClass(EditorWindow, WidgetTypeToFocus);
	if (FocusWidget.IsValid())
	{
		FSlateApplication::Get().SetKeyboardFocus(FocusWidget.ToSharedRef(), EFocusCause::SetDirectly);

		//Send the command
		FModifierKeysState ModifierKeys(InChord.NeedsShift(), false, InChord.NeedsControl(), false, InChord.NeedsAlt(), false, InChord.NeedsCommand(), false, false);
		FKeyEvent KeyEvent(InChord.Key, ModifierKeys, 0/*UserIndex*/, false, 0, 0);
		FSlateApplication::Get().ProcessKeyDownEvent(KeyEvent);
		FSlateApplication::Get().ProcessKeyUpEvent(KeyEvent);
	}
	else
	{
		//UE_LOG(LogParticleEditorPromotionTests, Error, TEXT("Could not find widget %s to send UI command"), *WidgetTypeToFocus.ToString());
	}
}

/**
* Sets an object property value by name
*
* @param TargetObject - The object to modify
* @param InVariableName - The name of the property
*/
void FEditorPromotionTestUtilities::SetPropertyByName(UObject* TargetObject, const FString& InVariableName, const FString& NewValueString)
{
	UProperty* FoundProperty = FindField<UProperty>(TargetObject->GetClass(), *InVariableName);
	if (FoundProperty)
	{
		const FScopedTransaction PropertyChanged(LOCTEXT("PropertyChanged", "Object Property Change"));

		TargetObject->Modify();

		TargetObject->PreEditChange(FoundProperty);
		FoundProperty->ImportText(*NewValueString, FoundProperty->ContainerPtrToValuePtr<uint8>(TargetObject), 0, TargetObject);
		FPropertyChangedEvent PropertyChangedEvent(FoundProperty, EPropertyChangeType::ValueSet);
		TargetObject->PostEditChangeProperty(PropertyChangedEvent);
	}
}

#undef LOCTEXT_NAMESPACE


text:
package com.newtranx.util.monitoring;

public abstract class MonitorContext {

	private boolean async = false;

	public abstract void doReport();

	public boolean isAsync() {
		return async;
	}

	public void setAsync(boolean async) {
		this.async = async;
	}

}


text:
package org.srcdeps.quickstarts.mvn.git.interdep;

import org.l2x6.maven.srcdeps.itest.service.AppService;

public class Interdep {
    private final AppService service = new AppService();

    public AppService getService() {
        return service;
    }
}


text:
class CompilerEngine : public ICompilerEngine{
public:
  // ------------------------------------------
  static CompilerEngine* inst;
  CompilerEngine();

  DataLayout*       GetDatLayout();

  Type*             TypeOf(const std::string&);

  Function*         CurrentFunction();
  // -----------------------
  void              PushFunction(Function*);
  void              PopFunction();
  // -------------------
  BasicBlock*       CurrentBBlock();
  Module*           CurrentModule();
  ValueSymbolTable* CurrentValSymTable();

  GenericValue Test();
  void StartGen(NBlock* root);
  void PushBlock(BasicBlock* bb);
  void PopBlock();
  // -----------------------
  Ctxt CurrentCtxtTy() const;
  void PushContext(Ctxt);
  void PopContext();
  // ------------------------------------
  IClass* CurrentClass();
  // ---------------------------------
  void PushClass(IClass*);
  void PopClass();
  // --------------------
  void AddType(const std::string&, llvm::Type*);
  // ---------------------
  void PrintStacks();
  // Returns size in bytes
  size_t SizeOfType(const std::string&);
private:
  std::stack<IClass*> class_stak;
  std::stack<Function*> function_stak;
  std::map<std::string, Type*> type_table;
  std::stack<BasicBlock*> block_stack;
  std::stack<Ctxt> ctxt_stak;
  // ---------------------------------
  //Function*               current_function;
  Module*               main_module;
  Module*               current_module;
  ValueSymbolTable*     current_lookup;
  Function*             main_function;
  DataLayout            dat_layout;
private:
    void add_c_std_fnct();
};
#endif // _COMPILER_ENGINE_CONTEXT_HPP_


text:
FOUNDATION_EXPORT double Pods_soca_iOSVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_soca_iOSVersionString[];


text:
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var carservice_1 = require("../../service/carservice");
var DataScrollerInfiniteDemo = (function () {
    function DataScrollerInfiniteDemo(carService) {
        this.carService = carService;
        this.msgs = [];
    }
    DataScrollerInfiniteDemo.prototype.loadData = function (event) {
        var _this = this;
        //initialize
        if (!this.cars) {
            this.carService.getCarsSmall().then(function (cars) { return _this.cars = cars; });
        }
        else {
            var newArray = this.cars.slice(0);
            for (var i = 0; i < newArray.length; i++) {
                this.cars.push(newArray[i]);
            }
            this.msgs = [];
            this.msgs.push({ severity: 'info', summary: 'Data Loaded', detail: 'Between ' + event.first + ' and ' + (event.first + event.rows) });
        }
    };
    return DataScrollerInfiniteDemo;
}());
DataScrollerInfiniteDemo = __decorate([
    core_1.Component({
        templateUrl: './datascrollerinfinitedemo.html',
        styles: ["\n        .ui-grid-row > div {\n            padding: 4px 10px;\n            font-size: 20px;\n        }\n        \n        .ui-grid-row .ui-grid-row > div:last-child {\n            font-weight: bold;\n        }\n    "]
    }),
    __metadata("design:paramtypes", [carservice_1.CarService])
], DataScrollerInfiniteDemo);
exports.DataScrollerInfiniteDemo = DataScrollerInfiniteDemo;
//# sourceMappingURL=datascrollerinfinitedemo.js.map


text:
// C++ General Utility Library (mailto:cgul@zethes.com)
// Copyright (C) 2012-2014, Joshua Brookover and Amber Thrall
// All rights reserved.

/** @file Memory.hpp
 */

#pragma once
#include <CGUL/Config.hpp>
#include "../Utility/String.hpp"
#include "../External/Defines.hpp"

namespace CGUL
{
    /** @brief A simple memory utility.
     */
    namespace Memory
    {
        template< typename T >
        _CGUL_INLINE_DEFINE T* AllocateBulk(Size count);
        template< typename T >
        _CGUL_INLINE_DEFINE void FreeBulk(T* data);

        _CGUL_INLINE_DEFINE void ZeroData(void* data, Size count);
        template< typename T >
        _CGUL_INLINE_DEFINE void ZeroArray(T* data, Size count);

        _CGUL_INLINE_DEFINE void Copy(void* destination, const void* source, Size count);
    }
}

#include "../External/Undefines.hpp"
#include "Memory_Implement.hpp"