text:
import test from 'ava';
import {
  IocContext,
  inject,
  NotfoundTypeError,
  injectable,
  MultiImplementError,
  classInfo,
  postConstruct,
  preDestroy,
} from '../lib';

class TestService {}

test('default instance.', t => {
  t.true(IocContext.DefaultInstance instanceof IocContext);
});

test('register component error case.', t => {
  enum INJECTTYPE {
    test,
  }

  const context = new IocContext();
  t.throws(() => context.register(undefined));
  t.throws(() => context.register(123123));
  t.throws(() => context.register({}));
  t.throws(() => context.register({}, 123123 as any));
  t.throws(() => context.register({}, INJECTTYPE.test as any));
  t.throws(() => context.get('TEST'), { instanceOf: NotfoundTypeError });
});

test('register component by class.', t => {
  const context = new IocContext();
  context.register(TestService);
  t.true(context.get(TestService) instanceof TestService);

  // test for tip of type.
  class A {}
  context.register(A);
  abstract class B {}
  context.register(B);
  t.true(context.get(A) instanceof A);
  t.true(context.get(B) instanceof B);
  t.false(context.get<A>(B) instanceof A);
});

test('register component by create function.', t => {
  const context = new IocContext();
  context.register(
    () => {
      t.fail();
    },
    'test',
    { autoNew: false }
  );
  context.register(() => {
    return { a: 5 };
  }, 'test2');
  t.true(context.get<{ a: number }>('test2').a === 5);
});

test('register component mutli-instance.', t => {
  const context = new IocContext();
  context.register(TestService, undefined, { singleton: false });
  const dataA = context.get(TestService);
  t.true(dataA instanceof TestService);
  const dataB = context.get(TestService);
  t.true(dataB instanceof TestService);
  t.false(dataA === dataB);
});

test('register component no autonew.', t => {
  const context = new IocContext();
  context.register(TestService, undefined, { autoNew: false });
  const dataA = context.get(TestService);
  t.false(dataA instanceof TestService);
  t.true(dataA === TestService);
});

test('register 2nd with same key.', t => {
  const context = new IocContext();
  context.register(TestService);
  t.throws(() => context.register(TestService));
});

test('register component by string.', t => {
  const context = new IocContext();
  context.register(TestService, 'string_key');
  t.true(context.get('string_key') instanceof TestService);

  const data = { x: 'test' };
  context.register(data, 'string_key_value');
  t.true(context.get('string_key_value') === data);

  const data2 = 'test_str';
  context.register(data2, 'string_key_value2');
  t.true(context.get('string_key_value2') === data2);
});

test('register not allowed.', t => {
  const context = new IocContext();
  t.throws(() => context.register(new TestService()));
});

test('auto register component by class.', t => {
  class A {}
  class B {
    @inject()
    a: A;
  }
  const context = new IocContext({ autoRegisterSelf: true });
  t.true(context.get(B) instanceof B);
  t.true(context.get(B).a instanceof A);
});

test('has component.', t => {
  const context = new IocContext();
  context.register(TestService);
  t.true(context.has(TestService));

  class BTest {}
  t.false(context.has(BTest));
});

test('remove component.', t => {
  const context = new IocContext();
  context.register(TestService);
  t.true(context.get(TestService) instanceof TestService);
  t.deepEqual(context.remove(TestService), true);
  t.deepEqual(context.remove(TestService), false);
  t.throws(() => context.get(TestService), { instanceOf: NotfoundTypeError });
});

test('replace component.', t => {
  class BClass {}
  const context = new IocContext();
  context.register(TestService);
  t.true(context.get(TestService) instanceof TestService);

  context.replace(TestService, BClass);
  t.true(context.get(TestService) instanceof BClass);

  t.throws(() => context.replace(BClass, TestService));

  context.replace(BClass, '123', undefined, true);
  t.true(context.get(BClass) === '123');
});

import { TestService as TS2 } from './base';
import { classLoader, ClassLoader } from '../lib/class/ClassLoader';
test('difference class with same class name.', t => {
  const context = new IocContext();
  context.register(TestService);
  context.register(TS2);
  t.true(context.get(TestService) instanceof TestService);
  t.true(context.get(TS2) instanceof TS2);
});

test('subComponent.', t => {
  class SubClass extends TestService {}

  const context = new IocContext();
  context.register(SubClass, TestService);
  t.true(context.get(TestService) instanceof SubClass);
  t.true(context.get(TestService) instanceof TestService);
  t.throws(() => context.get(SubClass), { instanceOf: NotfoundTypeError });
});

test('getSubClasses, with classLoader.', t => {
  class AClass {}
  class BClass extends AClass {}
  class CClass extends AClass {}

  const context = new IocContext();
  t.true(!context.getImports(AClass).length);

  classLoader.registerClass(BClass);
  classLoader.registerClass(CClass);

  const cls = context.getImports(AClass);
  t.true(cls.length === 2);
  t.true(cls[0] instanceof BClass);
  t.true(cls[1] instanceof CClass);

  const cls2 = context.getImports(AClass);
  t.true(cls !== cls2);
  t.true(cls[0] === cls2[0]);

  const cls3 = context.getImports(AClass, { cache: true });
  const cls4 = context.getImports(AClass, { cache: true });
  t.true(cls3 === cls4);
  t.true(cls3[0] === cls4[0]);
});

test('new constructor.', t => {
  let count = 0;
  class OtherClass {}
  class AClass {
    @inject()
    other: OtherClass;

    constructor() {
      count++;
    }
  }
  const context = new IocContext();
  context.register(AClass);
  context.register(OtherClass);
  const a = new AClass();
  context.inject(a);
  t.true(a.other instanceof OtherClass);
  t.true(count === 1);
});

test('inject instance.', t => {
  const context = new IocContext();

  class AClass {}

  class BClass {
    @inject({ lazy: false })
    aclass: AClass;
    @inject()
    injectclass: AClass;
  }

  context.register(AClass);

  const bclass = new BClass();
  context.inject(bclass);
  t.true(bclass.aclass instanceof AClass);
  t.true(bclass.injectclass instanceof AClass);
});

test('inject instance, notfound.', t => {
  const context = new IocContext();

  class AClass {}

  class BClass {
    @inject()
    aclass: AClass;
  }

  const bclass = new BClass();
  context.inject(bclass);
  t.throws(() => bclass.aclass, { instanceOf: NotfoundTypeError });
});

test('inject instance, notfoundHandler.', t => {
  class AClass {}
  class A2Class {}

  class BClass {
    @inject()
    aclass: AClass;
    @inject()
    a2class: A2Class;
  }

  const context = new IocContext({
    notFoundHandler: type => {
      return type === AClass ? new AClass() : undefined;
    },
  });
  const bclass = new BClass();
  context.inject(bclass);
  t.true(bclass.aclass instanceof AClass);
  t.throws(() => bclass.a2class);
});

test('inject instance, string.', t => {
  const context = new IocContext();

  context.register({ a: 123 }, 'TEST_A');

  class BClass {
    @inject({ type: 'TEST_A' })
    aclass: { a: number };
  }

  const bclass = new BClass();
  context.inject(bclass);
  t.true(bclass.aclass.a === 123);
});

test('lazyInject redefined.', t => {
  const context = new IocContext();

  class TestClass {
    a() {
      return 1;
    }
  }

  class AClass {
    @inject()
    tClass: TestClass;
  }

  class BClass extends AClass {
    @inject()
    tClass: TestClass;
  }

  context.register(TestClass);
  context.register(AClass);
  context.register(BClass);

  t.true(context.get(BClass).tClass.a() === 1);
});

test('clear.', t => {
  const context = new IocContext();

  class TestClass {
    a() {
      return 1;
    }
  }
  context.register(TestClass);
  t.true(context.get(TestClass).a() === 1);

  context.clear();
  t.throws(() => context.get(TestClass), { instanceOf: NotfoundTypeError });
});

test('multi implement, use classLoader.', t => {
  const context = new IocContext();

  abstract class IService {}

  t.throws(() => context.get(IService), { instanceOf: NotfoundTypeError });

  @injectable()
  class A extends IService {}

  t.true(context.get(IService) instanceof IService);
  t.true(context.get(IService) instanceof A);
  context.remove(A);

  @injectable()
  class B extends IService {}

  t.throws(() => context.get(IService), { instanceOf: MultiImplementError });
});

test('multi implement, conflictHandler.', t => {
  abstract class IService {}
  @injectable()
  class A extends IService {}
  @injectable()
  class B extends IService {}
  @injectable()
  class C {
    @inject({ lazy: false })
    b1: IService;
    @inject()
    b2: IService;
  }

  const context = new IocContext({
    conflictHandler: (type, implCls, sourceCls) => {
      if (type === IService) {
        return sourceCls?.type === C
          ? implCls.find(info => info.type === B).type
          : implCls.find(info => info.info.name === 'A').type;
      }
    },
  });

  t.true(context.get(IService) instanceof A);
  context.remove(A);
  t.true(context.get(C).b1 instanceof B);
  context.remove(B);
  t.true(context.get(C).b2 instanceof B);
});

test('multi implement, conflictHandler, err.', t => {
  abstract class IService {}
  @injectable()
  class A extends IService {}
  @injectable()
  class B extends IService {}

  const context = new IocContext({
    conflictHandler: (type, implCls, sourceCls) => {
      return undefined;
    },
  });

  t.throws(() => context.get(IService), { instanceOf: MultiImplementError });
});

test('multi implement, no err.', t => {
  @injectable()
  class BaseService {}
  @injectable()
  class A extends BaseService {}
  @injectable()
  class B extends BaseService {}

  const context = new IocContext();

  t.true(context.get(BaseService) instanceof BaseService);

  const childContext = context.createChildContext({
    conflictHandler: (type, implCls, sourceCls) => {
      return implCls.find(s => s.type === A).type;
    },
  });
  t.true(childContext.get(BaseService) instanceof A);
});

test('constructor inject', t => {
  @injectable()
  class A {}
  @injectable()
  class B {
    constructor(public a: A, public count: Number) {}
  }

  const context = new IocContext();
  t.true(context.get(B).a instanceof A);
});

test('no constructor inject', t => {
  @injectable()
  class A {}
  @injectable()
  class B {
    constructor(public a: A, public count: Number) {}
  }

  const context = new IocContext({ constructorInject: false });
  t.deepEqual(context.get(B).a, undefined);
});

test('no singleton inject', t => {
  let count = 0;
  @injectable()
  class A {
    id = count++;
  }
  @injectable()
  class B {
    @inject()
    a1: A;
    @inject()
    a2: A;
    @inject({ singleton: false })
    a3: A;
    @inject({ singleton: false, lazy: false })
    a4: A;
  }

  const context = new IocContext();
  const b = context.get(B);
  t.true(b.a1 === b.a1);
  t.true(b.a1 === b.a2);
  t.true(b.a1 !== b.a3);
  t.true(b.a3 === b.a3);
  t.true(b.a1 !== b.a4);
});

test('custom classLoader.', t => {
  const context = new IocContext({
    useClassLoader: new ClassLoader(),
  });

  abstract class IA {}
  @classInfo()
  class A extends IA {}
  t.throws(() => context.get(IA));

  context.classLoader.registerClass(A);
  t.true(context.get(IA) instanceof A);
});

test('without classLoader', t => {
  const context = new IocContext({
    useClassLoader: false,
  });

  abstract class IA {}
  @classInfo()
  class A extends IA {}
  t.throws(() => context.get(IA), { instanceOf: NotfoundTypeError });
});

test('createInstanceHook.', t => {
  class AClass {
    test: string;
  }
  const context = new IocContext();
  context.register(AClass);

  context.setConfig({
    createInstanceHook: inst => {
      t.true(inst instanceof AClass);
      if (inst instanceof AClass) {
        inst.test = 'xxx';
      }
      return inst;
    },
  });

  const a = context.get(AClass);
  t.true(a.test === 'xxx');
});

test('use the same instance between interface and impl when get.', t => {
  abstract class Base {}
  @injectable()
  class A extends Base {}

  @injectable()
  class Test {
    @inject()
    a: A;
    @inject()
    base: Base;
  }

  const context = new IocContext();
  const test = context.get(Test);

  t.deepEqual(test.a, test.base);
});

test('cannot serialize.', t => {
  t.true(
    JSON.stringify(IocContext.DefaultInstance) ===
      JSON.stringify({ type: 'power-di.IocContext', message: 'NoSerializable' })
  );
});

test('subclass override props.', t => {
  @injectable()
  class X {
    name = 'x';
  }
  @injectable()
  class Y {
    name = 'y';
  }

  @injectable()
  class Base {
    @inject()
    service: X;
  }
  @injectable()
  class Test extends Base {
    @inject()
    service: Y;
  }

  const context = new IocContext();
  context.register(Base);
  t.deepEqual('x', context.get(Base).service.name, 'Base');
  t.deepEqual('y', context.get(Test).service.name, 'Test');
});

test('autoRun postConstruct', t => {
  const ioc = new IocContext();
  class A {
    x: number;
    @postConstruct()
    init() {
      this.x = 1;
    }
  }

  const a = new A();
  ioc.inject(a);
  t.deepEqual(a.x, 1);

  const a2 = new A();
  ioc.inject(a2, { autoRunPostConstruct: false });
  t.deepEqual(a2.x, undefined);
});

test('run preDestroy', t => {
  const ioc = new IocContext();
  class A {
    x: number;
    @preDestroy()
    destroy() {
      this.x = 1;
    }
  }

  const a = new A();
  ioc.inject(a);
  ioc.runPreDestroy(a);

  t.deepEqual(a.x, 1);
});

test('select strategy of multiple', t => {
  abstract class IService {}

  @injectable()
  class A extends IService {}
  @injectable()
  class B extends IService {}

  const ioc = new IocContext();
  t.throws(() => ioc.get(IService), { instanceOf: MultiImplementError });

  ioc.register(B);
  t.true(ioc.get(IService) instanceof B);

  ioc.register(A);
  t.throws(() => ioc.get(IService), { instanceOf: MultiImplementError });
});

test('select strategy of multiple, childContext', t => {
  abstract class IService {}

  @injectable()
  class A extends IService {}
  @injectable()
  class B extends IService {}

  const ioc = new IocContext();
  const child = ioc.createChildContext();
  t.throws(() => child.get(IService), { instanceOf: MultiImplementError });

  ioc.register(B);
  t.true(child.get(IService) instanceof B);
});


text:
//***ssr服务器端渲染 */
//在 server-entry 文件中服务端会传递一个context对象,
//里面包含当前用户请求的url,vue-router 会跳转到当前请求的url中,
//通过 router.getMatchedComponents( ) 来获得当前匹配组件,则去调用当前匹配到的组件里的 preFetch 钩子,
//并传递store(Vuex下的状态),会返回一个 Promise 对象,
//并在then方法中将现有的vuex state 赋值给context,给服务端渲染使用,
//最后返回vue实例,将虚拟DOM渲染成网页。服务端会将vuex初始状态也生成到页面中。
// 如果 vue-router 没有匹配到请求的url,直接返回 Promise中的reject方法,传入404,
//这时候会走到下方renderStream的error事件,让页面显示错误信息。
//created by MrM
import { createApp } from './app'

const isDev = process.env.NODE_ENV !== 'production'

//  `bundleRenderer`请求的方法
export default context => {
    return new Promise((resolve, reject) => {
        const s = isDev && Date.now()
        const { app, router, store } = createApp()

        router.push(context.url)
        router.onReady(() => {
            const matchedComponents = router.getMatchedComponents()

            if (!matchedComponents.length) { // 无匹配的router执行
                reject({ code: 404 })
            }

            Promise.all(matchedComponents.map(component => {
                return component.asyncData && component.asyncData({
                    store,
                    route: router.currentRoute
                })
            })).then(() => {
                // isDev && console.log(`data pre-fetch: ${Date.now() - s}ms`)
                context.state = store.state
                resolve(app)
            }).catch(reject)
        }, reject)
    })
}

redpajama_set_name: RedPajamaGithub


text:
'''
Created on Dec 5, 2016

@author: Venkatesh
'''

from pyth.cms.model.Entities import BillingProvider, FacilityProvider, RenderingProvider, ReferringProvider, BilledCpt, PaidCpt
from pyth.cms.properties import appProperties as appProp
import csv, random

import logging

module_logger = logging.getLogger('pyth.cms.dao.EntityDAO')

class ProviderDAO(object):

       def getSpecialitys(self):
        specialities=[]
        i=0
        with open(appProp.specialityfilename, 'rU') as special:
            splreader = csv.reader(special,delimiter='|' )
            for line in splreader:
                if appProp.splhdr:
                    if i==0:
                        i+=1
                        continue
                specialities.append(line[0] + '-' + line[1])
            return specialities

class BillingProviderDAO(ProviderDAO):
    def __init__(self):
        self.logger = logging.getLogger('pyth.cms.dao.EntityDAO.BillingProviderDAO')
        pass

        # function to get provider array to be used during the file file building
    def getBillProviders(self):
        billproviders=[]
        specialities = self.getSpecialitys()
        i=0
        with open(appProp.billproviderfilename, 'rU') as csvfile:
            csvread = csv.reader(csvfile, delimiter='|')
            for line in csvread:
                if appProp.billproviderhdr:
                    if i==0:
                        i+=1
                        continue
                billproviders.append(self.parseProviderInfo(line,specialities[random.randint(1,20)]))
            return billproviders

    #function to parse the line to get a provider object
    def parseProviderInfo(self, line, speciality):

        return BillingProvider(line[0], line[1], line[2], line[3], line[4],line[5], line[6], speciality)

class FacilityProviderDAO(ProviderDAO):
    '''
    classdocs
    '''
    def __init__(self):
        pass
    def getProviders(self):
        providers=[]

        i=0
        with open(appProp.providerfilename, 'rU') as csvfile:
            csvread = csv.reader(csvfile, delimiter='|')
            for line in csvread:
                if appProp.providerhdr:
                    if i==0:
                        i+=1
                        continue
                providers.append(self.parseProviderInfo(line))
            return providers

    #function to parse the line to get a provider object
    def parseProviderInfo(self, line):
        return FacilityProvider(line[0], line[1], line[2], line[3], line[4],line[5])

class RenderingProviderDAO(ProviderDAO):

    def __init__(self):
        pass

    def getProviders(self):
        providers=[]
        i=0
        with open(appProp.providerfilename, 'rU') as csvfile:
            csvread = csv.reader(csvfile, delimiter='|')
            for line in csvread:
                if appProp.providerhdr:
                    if i==0:
                        i+=1
                        continue
                providers.append(self.parseProviderInfo(line))
            return providers

    #function to parse the line to get a provider object
    def parseProviderInfo(self, line):
        return RenderingProvider(line[0], line[1], line[2], line[3], line[4],line[5])

class ReferringProviderDAO(ProviderDAO):

    def __init__(self):
        pass

    def getProviders(self):
        providers=[]
        i=0
        with open(appProp.providerfilename, 'rU') as csvfile:
            csvread = csv.reader(csvfile, delimiter='|')
            for line in csvread:
                if appProp.providerhdr:
                    if i==0:
                        i+=1
                        continue
                providers.append(self.parseProviderInfo(line))
            return providers

    #function to parse the line to get a provider object
    def parseProviderInfo(self, line):
        return ReferringProvider(line[0], line[1], line[2], line[3], line[4],line[5])

class CptCodeDAO(object):
    pass

class BilledCptCodeDAO(CptCodeDAO):
    def getCodes(self):
        cptcodes=[]
        i=0
        with open(appProp.cptcodesfilename, 'rU') as csvfile:
            csvread = csv.reader(csvfile, delimiter='|')
            for line in csvread:
                if appProp.cpthdr:
                    if i==0:
                        i+=1
                        continue
                cptcodes.append(self.parsecptFileInfo(line))
            return cptcodes

    def parsecptFileInfo(self, line,hdr=True):
        return BilledCpt(line[0], float(line[1]))

class PaidCptCodeDAO(CptCodeDAO):
    def getCodes(self):
        cptcodes=[]
        i=0
        with open(appProp.cptcodesfilename, 'rU') as csvfile:
            csvread = csv.reader(csvfile, delimiter='|')
            for line in csvread:
                if appProp.cpthdr:
                    if i==0:
                        i+=1
                        continue
                cptcodes.append(self.parsecptFileInfo(line))
            return cptcodes

    def parsecptFileInfo(self, line,hdr=True):
        return PaidCpt(line[0], float(line[1]))


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>eRPC API Reference: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>

eRPC API Reference
    Rev. 1.3.0

NXP Semiconductors

Main Page

API Reference

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

erpc::SimpleServer Member List

This is the complete list of members for erpc::SimpleServer, including all inherited members.

addService(Service *service)	erpc::Server

createBufferAndCodec()	erpc::SimpleServer	protected

disposeBufferAndCodec(Codec *codec)	erpc::SimpleServer	protected

findServiceWithId(uint32_t serviceId)	erpc::Server	protectedvirtual

m_codecFactory	erpc::Server	protected

m_firstService	erpc::Server	protected

m_isServerOn	erpc::SimpleServer	protected

m_messageFactory	erpc::Server	protected

m_transport	erpc::SimpleServer	protected

m_transportFactory	erpc::Server	protected

poll()	erpc::SimpleServer	virtual

processMessage(Codec *inCodec, Codec *outCodec, message_type_t &msgType)	erpc::Server	protectedvirtual

run()	erpc::SimpleServer	virtual

runInternal()	erpc::SimpleServer	protected

Server()	erpc::Server	inline

setCodecFactory(CodecFactory *factory)	erpc::Server	inline

setMessageBufferFactory(MessageBufferFactory *factory)	erpc::Server	inline

setTransport(Transport *transport)	erpc::SimpleServer	inline

setTransportFactory(TransportFactory *factory)	erpc::Server	inline

SimpleServer()	erpc::SimpleServer	inline

stop()	erpc::SimpleServer	virtual

~Server()	erpc::Server	inlinevirtual

~SimpleServer()	erpc::SimpleServer	virtual

Copyright © 2016 Freescale Semiconductor, Inc.


text:
package com.google.cloud.metrics;

import java.io.IOException;

/**
 * An exception raised when there is a problem communicating with the recording service.
 */
public class MetricsCommunicationException extends MetricsException {
  private static final long serialVersionUID = -5099045629448807064L;

  public MetricsCommunicationException(String msg, IOException cause) {
    super(msg, cause);
  }
}


text:
cycleslider
===========

Wordpress slider plugin based on cycle.js


text:
<?php

namespace NNGenie\InfosMatBundle\Controller;

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

class AdresseController extends Controller
{
    public function indexAction()
    {

    }

    public function viewAction(\NNGenie\InfosMatBundle\Entity\Adresse $adresse)
    {
        return $this->render('NNGenieInfosMatBundle:Adresse:view.html.twig', array(
            'adresse' => $adresse
        ));
    }

    public function newAction(Request $request)
    {
        $adresse = new \NNGenie\InfosMatBundle\Entity\Adresse();
        $form = $this->createForm('NNGenie\InfosMatBundle\Form\AdresseType', $adresse);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->getRepository('NNGenieInfosMatBundle:Adresse')->saveAdresse($adresse);
            return $this->redirectToRoute('nn_genie_infos_mat_adresse_view', array('id' => $adresse->getId()));
        }
        return $this->render('NNGenieInfosMatBundle:Adresse:new.html.twig', array(
            'form' => $form->createView()
        ));
    }

    public function editAction(Request $request, \NNGenie\InfosMatBundle\Entity\Adresse $adresse)
    {
        $form = $this->createForm('NNGenie\InfosMatBundle\Form\AdresseType', $adresse);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->getRepository('NNGenieInfosMatBundle:Adresse')->updateAdresse($adresse);
            return $this->redirectToRoute('nn_genie_infos_mat_adresse_view', array('id' => $adresse->getId()));
        }

        return $this->render('NNGenieInfosMatBundle:Adresse:edit.html.twig', array(
            'form' => $form->createView()
        ));
    }

    public function deleteAction(\NNGenie\InfosMatBundle\Entity\Adresse $adresse)
    {
        $em = $this->getDoctrine()->getManager();
        $em->getRepository('NNGenieInfosMatBundle:Adresse')->deleteAdresse($adresse);

        return $this->redirectToRoute('nn_genie_infos_mat_adresse_index');
    }

}


text:
module LoldesignPublisher
  class MailerConfigGenerator < ::Rails::Generators::Base
    DEFAULT_VALUES = {
      smtp:           'smtp.sendgrid.net',
      port:            587,
      user_name:      'loldesign',
      password:       'f8ks256$',
      domain:         'heroku.com',
      authentication: :plain,
      env:            :development,
      asset_host:     'http://www.loldesign.com.br/'
    }

    def create_config
      environment   = get_answer_for(value: :env       , question: "Which environment would you like to set?", ask_options: {limited_to: ["development", "production", "test"]})
      smtp_address  = get_answer_for(value: :smtp      , question: "Whats the STMP addres? ex. smtp.sendgrid.net :")
      port_number   = get_answer_for(value: :port      , question: "What's port number? ex. 587 :")
      user_name     = get_answer_for(value: :user_name , question: "What's your user_name?")
      password      = get_answer_for(value: :password  , question: "What's your password?", ask_options: {echo: false})
      puts ' '
      domain        = get_answer_for(value: :domain    , question: "What's the domain name? ex. heroku.com :")
      asset_host    = get_answer_for(value: :asset_host, question: "Whats's the asset_host?")

      inject_into_file "config/environments/#{environment}.rb", :before => /^end/ do
        "\n  # MAILER CONFIG \n" +
        "  config.action_mailer.asset_host = '#{asset_host}' \n" +
        "  config.action_mailer.delivery_method = :smtp \n"      +
        "  config.action_mailer.smtp_settings = { \n"            +
        "  :address        => '#{smtp_address}',\n"              +
        "  :port           => '#{port_number}', \n"              +
        "  :authentication => :plain, \n"                        +
        "  :user_name      => '#{user_name}', \n"                +
        "  :password       => '#{password}', \n"                 +
        "  :domain         => '#{domain}' \n"                    +
        "  } \n"
      end
    end

    private
    def get_answer_for(options={})
      answer = ask(options[:question], options[:ask_options])

      answer.present? ? answer : DEFAULT_VALUES[options[:value]]
    end
  end
end


text:
package net.formula97.fakegpbase.fragments;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import net.formula97.fakegpbase.Databases.GunplaInfo;
import net.formula97.fakegpbase.R;

import java.util.List;

/**
 * Created by f97one on 14/11/03.
 */
public class GunplaInfoAdapter extends ArrayAdapter<GunplaInfo> {

    private List<GunplaInfo> gunplaInfoList;
    private int resourceId;
    private Context mContext;

    public GunplaInfoAdapter(Context context, int resource, List<GunplaInfo> gunplaInfos) {
        super(context, resource, gunplaInfos);

        this.mContext = context;
        this.resourceId = resource;
        this.gunplaInfoList = gunplaInfos;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(resourceId, null);
        }

        TextView modelName = (TextView) convertView.findViewById(R.id.listview_model_name);
        TextView gunplaName = (TextView) convertView.findViewById(R.id.listview_gunpla_name);
        TextView scale = (TextView) convertView.findViewById(R.id.listview_scale);
        TextView grade = (TextView) convertView.findViewById(R.id.listview_grade);

        modelName.setText(gunplaInfoList.get(position).getModelNo());
        gunplaName.setText(gunplaInfoList.get(position).getGunplaName());
        scale.setText(gunplaInfoList.get(position).getScaleValue());
        grade.setText(gunplaInfoList.get(position).getClassValue());

        return convertView;
    }
}


text:
package edu.osu.ocio.shibboleth.idp.authn.provider;

import javax.security.auth.login.LoginException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import edu.internet2.middleware.shibboleth.idp.authn.AuthenticationException;

/**
 * Implemented by submodules of the {@link StatelessLoginServlet} that process
 * credentials or render a user interface.
 */
public interface StatelessLoginSubmodule {

    /**
     * Performs an authentication or UI function on behalf of the
     * {@link StatelessLoginServlet}.
     *
     * @param servlet
     *            the servlet running the request
     * @param request
     *            the client's request
     * @param response
     *            the response to the client
     * @param info
     *            an object for describing the result of a successful act of
     *              authentication
     * @throws AuthenticationException
     *            raised if a fatal error occurs
     * @throws LoginException
     * 			  raised if a login-related error occurs
     */
    void run(StatelessLoginServlet servlet, HttpServletRequest request,
            HttpServletResponse response, StatelessAuthenticationInfo info)
    	throws AuthenticationException, LoginException;

}


text:
package org.liquibase.maven.plugins;

import liquibase.Liquibase;
import liquibase.command.CommandScope;
import liquibase.command.core.InternalSyncHubCommandStep;
import liquibase.database.Database;
import liquibase.exception.LiquibaseException;
import org.apache.maven.plugin.MojoFailureException;

import java.util.UUID;

/**
 *
Syncs all changes in change log with Hub.

 *
 * @author Wesley Willard
 * @goal syncHub
 */
public class LiquibaseSyncHubMojo extends AbstractLiquibaseChangeLogMojo {

    /**
     * Specifies the Liquibase Hub Connection ID for Liquibase to use.
     *
     * @parameter property="liquibase.hubConnectionId"
     */
    protected String hubConnectionId;

    /**
     * Specifies the Liquibase Hub API key for Liquibase to use.
     *
     * @parameter property="liquibase.hubProjectId"
     */
    protected String hubProjectId;

    @Override
    protected void checkRequiredParametersAreSpecified() throws MojoFailureException {
        //
        // Override because changeLogFile is not required
        //
    }

    @Override
    protected void performLiquibaseTask(Liquibase liquibase)
            throws LiquibaseException {
        super.performLiquibaseTask(liquibase);
        Database database = liquibase.getDatabase();
        CommandScope syncHub = new CommandScope(InternalSyncHubCommandStep.COMMAND_NAME);
        syncHub
                .addArgumentValue(InternalSyncHubCommandStep.CHANGELOG_FILE_ARG, changeLogFile)
                .addArgumentValue(InternalSyncHubCommandStep.URL_ARG, database.getConnection().getURL())
                .addArgumentValue(InternalSyncHubCommandStep.HUB_CONNECTION_ID_ARG, (hubConnectionId != null ? UUID.fromString(hubConnectionId) : null))
                .addArgumentValue(InternalSyncHubCommandStep.HUB_PROJECT_ID_ARG, (hubProjectId != null ? UUID.fromString(hubProjectId) : null))
                .addArgumentValue(InternalSyncHubCommandStep.DATABASE_ARG, database)
                .addArgumentValue(InternalSyncHubCommandStep.FAIL_IF_OFFLINE_ARG, false);

        syncHub.execute();
    }
}


text:
var fs = require('fs');
var path = require('path')

var handlebars = require('handlebars');

module.exports = function () {
    return {
        requireAll: function (files) {
            return files.reduce(function (ns, file) {
                ns[file] = require(file);
                return ns;
            }, {});
        },
        getTemplate: function (config) {

            return config.template;
        },
        getTemplatePath: function (config) {
            // TODO maybe remove this method. move code to getTemplate
            return config.templatePath;
        },
        renderTemplate: function (tpl, data) {
            return handlebars.compile(tpl)(data);
        },
        renderComponent: function (jsonFile) {
            var json = JSON.parse(fs.readFileSync(jsonFile, 'utf8'));
            var tplPath = path.resolve(path.dirname(jsonFile), this.getTemplatePath(json));
            var tpl = fs.readFileSync(tplPath, 'utf8')
            return handlebars.compile(tpl)(json);
        }
    }
};


text:
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
code = File.read("Readme.md")[/<!-- example colors -->\n```Ruby(.*?)```\n<!-- example -->/m, 1]
eval code


text:
require 'spec_helper'

# we use the posts controller as it uses the impressionsist module. any such controller would do.
describe DummyController do

  before do
    @impression_count = Impression.all.size
  end

  describe "impressionist filter uniqueness" do

    it "should ignore uniqueness if not requested" do
      controller.impressionist_subapp_filter
      controller.impressionist_subapp_filter
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize unique session" do
      controller.stub(:session_hash).and_return(request.session_options[:id])
      controller.impressionist_subapp_filter(unique: [:session_hash])
      controller.impressionist_subapp_filter(unique: [:session_hash])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique ip" do
      controller.request.stub(:remote_ip).and_return("1.2.3.4")
      controller.impressionist_subapp_filter(unique: [:ip_address])
      controller.impressionist_subapp_filter(unique: [:ip_address])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique request" do
      controller.impressionist_subapp_filter(unique: [:request_hash])
      controller.impressionist_subapp_filter(unique: [:request_hash])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique action" do
      controller.stub(:action_name).and_return("test_action")
      controller.impressionist_subapp_filter(unique: [:action_name])
      controller.impressionist_subapp_filter(unique: [:action_name])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique controller" do
      controller.stub(:controller_name).and_return("post")
      controller.impressionist_subapp_filter(unique: [:controller_name])
      controller.impressionist_subapp_filter(unique: [:controller_name])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique user" do
      controller.stub(:user_id).and_return(42)
      controller.impressionist_subapp_filter(unique: [:user_id])
      controller.impressionist_subapp_filter(unique: [:user_id])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique referer" do
      controller.request.stub(:referer).and_return("http://foo/bar")
      controller.impressionist_subapp_filter(unique: [:referrer])
      controller.impressionist_subapp_filter(unique: [:referrer])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique id" do
      controller.stub(:params).and_return({:id => "666"}) # for correct impressionable id in filter
      controller.impressionist_subapp_filter(unique: [:impressionable_id])
      controller.impressionist_subapp_filter(unique: [:impressionable_id])
      Impression.should have(@impression_count + 1).records
    end

    # extra redundant test for important controller and action combination.
    it "should recognize different controller and action" do
      controller.stub(:controller_name).and_return("post")
      controller.stub(:action_name).and_return("test_action")
      controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
      controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
      Impression.should have(@impression_count + 1).records
      controller.stub(:action_name).and_return("another_action")
      controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
      controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
      Impression.should have(@impression_count + 2).records
      controller.stub(:controller_name).and_return("article")
      controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
      controller.impressionist_subapp_filter(unique: [:controller_name, :action_name])
      Impression.should have(@impression_count + 3).records
    end

    it "should recognize different action" do
      controller.stub(:action_name).and_return("test_action")
      controller.impressionist_subapp_filter(unique: [:action_name])
      controller.impressionist_subapp_filter(unique: [:action_name])
      Impression.should have(@impression_count + 1).records
      controller.stub(:action_name).and_return("another_action")
      controller.impressionist_subapp_filter(unique: [:action_name])
      controller.impressionist_subapp_filter(unique: [:action_name])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize different controller" do
      controller.stub(:controller_name).and_return("post")
      controller.impressionist_subapp_filter(unique: [:controller_name])
      controller.impressionist_subapp_filter(unique: [:controller_name])
      Impression.should have(@impression_count + 1).records
      controller.stub(:controller_name).and_return("article")
      controller.impressionist_subapp_filter(unique: [:controller_name])
      controller.impressionist_subapp_filter(unique: [:controller_name])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize different session" do
      controller.stub(:session_hash).and_return("foo")
      controller.impressionist_subapp_filter(unique: [:session_hash])
      controller.impressionist_subapp_filter(unique: [:session_hash])
      Impression.should have(@impression_count + 1).records
      controller.stub(:session_hash).and_return("bar")
      controller.impressionist_subapp_filter(unique: [:session_hash])
      controller.impressionist_subapp_filter(unique: [:session_hash])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize different ip" do
      controller.request.stub(:remote_ip).and_return("1.2.3.4")
      controller.impressionist_subapp_filter(unique: [:ip_address])
      controller.impressionist_subapp_filter(unique: [:ip_address])
      Impression.should have(@impression_count + 1).records
      controller.request.stub(:remote_ip).and_return("5.6.7.8")
      controller.impressionist_subapp_filter(unique: [:ip_address])
      controller.impressionist_subapp_filter(unique: [:ip_address])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize different referer" do
      controller.request.stub(:referer).and_return("http://foo/bar")
      controller.impressionist_subapp_filter(unique: [:referrer])
      controller.impressionist_subapp_filter(unique: [:referrer])
      Impression.should have(@impression_count + 1).records
      controller.request.stub(:referer).and_return("http://bar/fo")
      controller.impressionist_subapp_filter(unique: [:referrer])
      controller.impressionist_subapp_filter(unique: [:referrer])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize different id" do
      controller.stub(:params).and_return({:id => "666"}) # for correct impressionable id in filter
      controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
      controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
      controller.stub(:params).and_return({:id => "42"}) # for correct impressionable id in filter
      controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
      controller.impressionist_subapp_filter(unique: [:impressionable_type, :impressionable_id])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize combined uniqueness" do
      controller.stub(:action_name).and_return("test_action")
      controller.impressionist_subapp_filter(unique: [:ip_address, :request_hash, :action_name])
      controller.impressionist_subapp_filter(unique: [:request_hash, :ip_address, :action_name])
      controller.impressionist_subapp_filter(unique: [:request_hash, :action_name])
      controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
      controller.impressionist_subapp_filter(unique: [:ip_address, :request_hash])
      controller.impressionist_subapp_filter(unique: [:action_name])
      controller.impressionist_subapp_filter(unique: [:ip_address])
      controller.impressionist_subapp_filter(unique: [:request_hash])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize combined non-uniqueness" do
      controller.stub(:action_name).and_return(nil)
      controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
      controller.stub(:action_name).and_return("test_action")
      controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
      controller.stub(:action_name).and_return("another_action")
      controller.impressionist_subapp_filter(unique: [:ip_address, :action_name])
      Impression.should have(@impression_count + 3).records
    end

  end

  describe "impressionist method uniqueness for impressionables" do

    # in this test we reuse the post model. might break if model changes.

    it "should ignore uniqueness if not requested" do
      impressionable = Post.create
      controller.impressionist impressionable
      controller.impressionist impressionable
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize unique session" do
      controller.stub(:session_hash).and_return(request.session_options[:id])
      impressionable = Post.create
      controller.impressionist(impressionable, nil, :unique => [:session_hash])
      controller.impressionist(impressionable, nil, :unique => [:session_hash])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique ip" do
      controller.request.stub(:remote_ip).and_return("1.2.3.4")
      impressionable = Post.create
      controller.impressionist(impressionable, nil, :unique => [:ip_address])
      controller.impressionist(impressionable, nil, :unique => [:ip_address])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique request" do
      impressionable = Post.create
      controller.impressionist(impressionable, nil, :unique => [:request_hash])
      controller.impressionist(impressionable, nil, :unique => [:request_hash])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique user" do
      controller.stub(:user_id).and_return(666)
      impressionable = Post.create
      controller.impressionist(impressionable, nil, :unique => [:user_id])
      controller.impressionist(impressionable, nil, :unique => [:user_id])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize unique referer" do
      controller.request.stub(:referer).and_return("http://foo/bar")
      impressionable = Post.create
      controller.impressionist(impressionable, nil, :unique => [:referrer])
      controller.impressionist(impressionable, nil, :unique => [:referrer])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize different session" do
      impressionable = Post.create
      controller.stub(:session_hash).and_return("foo")
      controller.impressionist(impressionable, nil, :unique => [:session_hash])
      controller.impressionist(impressionable, nil, :unique => [:session_hash])
      Impression.should have(@impression_count + 1).records
      controller.stub(:session_hash).and_return("bar")
      controller.impressionist(impressionable, nil, :unique => [:session_hash])
      controller.impressionist(impressionable, nil, :unique => [:session_hash])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize different ip" do
      controller.request.stub(:remote_ip).and_return("1.2.3.4")
      impressionable = Post.create
      controller.impressionist(impressionable, nil, :unique => [:ip_address])
      controller.impressionist(impressionable, nil, :unique => [:ip_address])
      Impression.should have(@impression_count + 1).records
      controller.request.stub(:remote_ip).and_return("5.6.7.8")
      controller.impressionist(impressionable, nil, :unique => [:ip_address])
      controller.impressionist(impressionable, nil, :unique => [:ip_address])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize different user" do
      impressionable = Post.create
      controller.stub(:user_id).and_return(666)
      controller.impressionist(impressionable, nil, :unique => [:user_id])
      controller.impressionist(impressionable, nil, :unique => [:user_id])
      Impression.should have(@impression_count + 1).records
      controller.stub(:user_id).and_return(42)
      controller.impressionist(impressionable, nil, :unique => [:user_id])
      controller.impressionist(impressionable, nil, :unique => [:user_id])
      Impression.should have(@impression_count + 2).records
    end

    it "should recognize combined uniqueness" do
      impressionable = Post.create
      controller.stub(:session_hash).and_return("foo")
      controller.impressionist(impressionable, nil, :unique => [:ip_address, :request_hash, :session_hash])
      controller.impressionist(impressionable, nil, :unique => [:request_hash, :ip_address, :session_hash])
      controller.impressionist(impressionable, nil, :unique => [:request_hash, :session_hash])
      controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash])
      controller.impressionist(impressionable, nil, :unique => [:ip_address, :request_hash])
      controller.impressionist(impressionable, nil, :unique => [:session_hash])
      controller.impressionist(impressionable, nil, :unique => [:ip_address])
      controller.impressionist(impressionable, nil, :unique => [:request_hash])
      Impression.should have(@impression_count + 1).records
    end

    it "should recognize combined non-uniqueness" do
      impressionable = Post.create
      controller.stub(:session_hash).and_return(nil)
      controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash])
      controller.stub(:session_hash).and_return("foo")
      controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash])
      controller.stub(:session_hash).and_return("bar")
      controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash])
      Impression.should have(@impression_count + 3).records
    end

  end

  describe "impressionist filter and method uniqueness" do

    it "should recognize uniqueness" do
      impressionable = Post.create
      controller.stub(:controller_name).and_return("posts") # for correct impressionable type in filter
      controller.stub(:params).and_return({:id => impressionable.id.to_s}) # for correct impressionable id in filter
      controller.stub(:session_hash).and_return("foo")
      controller.request.stub(:remote_ip).and_return("1.2.3.4")
      # order of the following methods is important for the test!
      controller.impressionist_subapp_filter(unique: [:ip_address, :request_hash, :session_hash])
      controller.impressionist(impressionable, nil, :unique => [:ip_address, :request_hash, :session_hash])
      Impression.should have(@impression_count + 1).records
    end

  end

  describe 'impressionist with friendly id' do
    it 'should unique' do
      impressionable = Profile.create({username: 'test_profile', slug: 'test_profile'})

      controller.stub(:controller_name).and_return('profile')
      controller.stub(:action_name).and_return('show')
      controller.stub(:params).and_return({id: impressionable.slug})
      controller.request.stub(:remote_ip).and_return('1.2.3.4')

      controller.impressionist(impressionable, nil, :unique => [:impressionable_type, :impressionable_id])
      controller.impressionist(impressionable, nil, :unique => [:impressionable_type, :impressionable_id])
      Impression.should have(@impression_count + 1).records
    end
  end

  shared_examples_for 'an impressionable action' do
    it 'should record an impression' do
      controller.impressionist_subapp_filter(condition)
      Impression.should have(@impression_count + 1).records
    end
  end

  shared_examples_for 'an unimpressionable action' do
    it 'should record an impression' do
      controller.impressionist_subapp_filter(condition)
      Impression.should have(@impression_count).records
    end
  end

  describe "conditional impressions" do
    describe ":if condition" do
      context "true condition" do
        before do
          controller.stub(:true_condition).and_return(true)
        end
        it_behaves_like 'an impressionable action' do
          let(:condition) {{ if: :true_condition }}
        end

        it_behaves_like 'an impressionable action' do
          let(:condition) {{ if: lambda { true } }}
        end
      end

      context "false condition" do
        before do
          controller.stub(:false_condition).and_return(false)
        end
        it_behaves_like 'an unimpressionable action' do
          let(:condition) {{ if: :false_condition }}
        end

        it_behaves_like 'an unimpressionable action' do
          let(:condition) {{ if: lambda { false } }}
        end
      end
    end

    describe ":unless condition" do
      context "true condition" do
        before do
          controller.stub(:true_condition).and_return(true)
        end
        it_behaves_like 'an unimpressionable action' do
          let(:condition) {{ unless: :true_condition }}
        end

        it_behaves_like 'an unimpressionable action' do
          let(:condition) {{ unless: lambda { true } }}
        end
      end

      context "false condition" do
        before do
          controller.stub(:false_condition).and_return(false)
        end
        it_behaves_like 'an impressionable action' do
          let(:condition) {{ unless: :false_condition }}
        end

        it_behaves_like 'an impressionable action' do
          let(:condition) {{ unless: lambda { false } }}
        end
      end
    end
  end
end


text:
def two_fer(name="you"):
    return "One for {}, one for me.".format(name)


text:
package com.reactnativenavigation.viewcontrollers;

import android.app.Activity;

import com.reactnativenavigation.BaseTest;
import com.reactnativenavigation.TestUtils;
import com.reactnativenavigation.mocks.TestComponentLayout;
import com.reactnativenavigation.mocks.TestReactView;
import com.reactnativenavigation.parse.Options;
import com.reactnativenavigation.parse.params.Bool;
import com.reactnativenavigation.presentation.ComponentPresenter;
import com.reactnativenavigation.presentation.Presenter;
import com.reactnativenavigation.utils.StatusBarUtils;
import com.reactnativenavigation.viewcontrollers.stack.StackController;
import com.reactnativenavigation.views.ComponentLayout;

import org.junit.Test;

import static org.assertj.core.api.Java6Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;

public class ComponentViewControllerTest extends BaseTest {
    private ComponentViewController uut;
    private ComponentLayout view;
    private ComponentPresenter presenter;
    private Options resolvedOptions = new Options();
    private StackController parent;
    private Activity activity;

    @Override
    public void beforeEach() {
        super.beforeEach();
        activity = newActivity();
        StatusBarUtils.saveStatusBarHeight(63);
        view = spy(new TestComponentLayout(activity, new TestReactView(activity)));
        parent = TestUtils.newStackController(activity).build();
        Presenter presenter = new Presenter(activity, new Options());
        this.presenter = spy(new ComponentPresenter(Options.EMPTY));
        uut = spy(new ComponentViewController(activity, new ChildControllersRegistry(), "componentId1", "componentName", (activity1, componentId, componentName) -> view, new Options(), presenter, this.presenter) {
            @Override
            public Options resolveCurrentOptions(Options defaultOptions) {
                return resolvedOptions;
            }
        });
        uut.setParentController(parent);
        parent.ensureViewIsCreated();
    }

    @Test
    public void setDefaultOptions() {
        Options defaultOptions = new Options();
        uut.setDefaultOptions(defaultOptions);
        verify(presenter).setDefaultOptions(defaultOptions);
    }

    @Test
    public void applyOptions() {
        Options options = new Options();
        uut.applyOptions(options);
        verify(view).applyOptions(options);
        verify(presenter).applyOptions(view, resolvedOptions);
    }

    @Test
    public void createsViewFromComponentViewCreator() {
        assertThat(uut.getView()).isSameAs(view);
    }

    @Test
    public void componentViewDestroyedOnDestroy() {
        uut.ensureViewIsCreated();
        verify(view, times(0)).destroy();
        uut.onViewAppeared();
        uut.destroy();
        verify(view, times(1)).destroy();
    }

    @Test
    public void lifecycleMethodsSentToComponentView() {
        uut.ensureViewIsCreated();
        verify(view, times(0)).sendComponentStart();
        verify(view, times(0)).sendComponentStop();
        uut.onViewAppeared();
        verify(view, times(1)).sendComponentStart();
        verify(view, times(0)).sendComponentStop();
        uut.onViewDisappear();
        verify(view, times(1)).sendComponentStart();
        verify(view, times(1)).sendComponentStop();
    }

    @Test
    public void isViewShownOnlyIfComponentViewIsReady() {
        assertThat(uut.isViewShown()).isFalse();
        uut.ensureViewIsCreated();
        when(view.asView().isShown()).thenReturn(true);
        assertThat(uut.isViewShown()).isFalse();
        when(view.isReady()).thenReturn(true);
        assertThat(uut.isViewShown()).isTrue();
    }

    @Test
    public void onNavigationButtonPressInvokedOnReactComponent() {
        uut.ensureViewIsCreated();
        uut.sendOnNavigationButtonPressed("btn1");
        verify(view, times(1)).sendOnNavigationButtonPressed("btn1");
    }

    @Test
    public void mergeOptions_emptyOptionsAreIgnored() {
        ComponentViewController spy = spy(uut);
        spy.mergeOptions(Options.EMPTY);
        verify(spy, times(0)).performOnParentController(any());
    }

    @Test
    public void mergeOptions_delegatesToPresenterIfViewIsNotShown() {
        Options options = new Options();
        assertThat(uut.isViewShown()).isFalse();
        uut.mergeOptions(options);
        verifyZeroInteractions(presenter);

        when(uut.isViewShown()).thenReturn(true);
        uut.mergeOptions(options);
        verify(presenter).mergeOptions(uut.getView(), options);
    }

    @Test
    public void applyTopInset_delegatesToPresenter() {
        addToParent(activity, uut);
        uut.applyTopInset();
        verify(presenter).applyTopInsets(uut.getView(), uut.getTopInset());
    }

    @Test
    public void getTopInset_returnsStatusBarHeight() {
        //noinspection ConstantConditions
        uut.setParentController(null);
        assertThat(uut.getTopInset()).isEqualTo(StatusBarUtils.getStatusBarHeight(activity));
    }

    @Test
    public void getTopInset_resolveWithParent() {
        assertThat(uut.getTopInset()).isEqualTo(StatusBarUtils.getStatusBarHeight(activity) + parent.getTopInset(uut));
    }

    @Test
    public void getTopInset_drawBehind() {
        uut.options.statusBar.drawBehind = new Bool(true);
        uut.options.topBar.drawBehind = new Bool(true);
        assertThat(uut.getTopInset()).isEqualTo(0);
    }

    @Test
    public void applyBottomInset_delegatesToPresenter() {
        addToParent(activity, uut);
        uut.applyBottomInset();
        verify(presenter).applyBottomInset(uut.getView(), uut.getBottomInset());
    }
}


text:
package net.glowstone.generator.ground;

import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome;

import java.util.Random;

public class DirtPatchGroundGenerator extends GroundGenerator {
    @Override
    public void generateTerrainColumn(short[][] buf, World world, Random random, int x, int z, Biome biome, double surfaceNoise) {
        if (surfaceNoise > 1.75D) {
            setTopMaterial(Material.DIRT, 1); // coarse dirt
        } else if (surfaceNoise > -0.95D) {
            setTopMaterial(Material.DIRT, 2); // podzol
        } else {
            setTopMaterial(Material.GRASS);
        }
        setGroundMaterial(Material.DIRT);

        super.generateTerrainColumn(buf, world, random, x, z, biome, surfaceNoise);
    }
}


text:
/****************************************************************************
History

$Log: not supported by cvs2svn $
Revision 1.5  2005/09/29 22:18:16  m_di_benedetto
Added frustum culling methods, renamed some parameters.

Revision 1.4  2005/09/28 21:23:03  m_di_benedetto
Added Import() to box and barycenter functors
to handle tree and objects with different ScalarType.

Revision 1.3  2005/09/28 20:10:41  m_di_benedetto
First Commit.

****************************************************************************/

#ifndef __VCGLIB_AABBBINARYTREEINDEX_H
#define __VCGLIB_AABBBINARYTREEINDEX_H

// vcg headers
#include <vcg/space/index/base.h>
#include <vcg/space/index/aabb_binary_tree/base.h>
#include <vcg/space/index/aabb_binary_tree/closest.h>
#include <vcg/space/index/aabb_binary_tree/frustum_cull.h>
#include <vcg/space/index/aabb_binary_tree/kclosest.h>
#include <vcg/space/index/aabb_binary_tree/ray.h>
#include <wrap/utils.h>

/***************************************************************************/

namespace vcg {

template <class OBJTYPE, class SCALARTYPE, class NODEAUXDATA = EmptyClass>
class AABBBinaryTreeIndex : public SpatialIndex<OBJTYPE, SCALARTYPE> {
public:
	typedef AABBBinaryTreeIndex<OBJTYPE, SCALARTYPE, NODEAUXDATA> ClassType;
	typedef OBJTYPE ObjType;
	typedef SCALARTYPE ScalarType;
	typedef NODEAUXDATA NodeAuxData;
	typedef ObjType * ObjPtr;
	typedef Point3<ScalarType> CoordType;
	typedef AABBBinaryTree<ObjType, ScalarType, NodeAuxData> TreeType;

	inline TreeType & Tree(void) {
		return (this->tree);
	}

	inline const TreeType & Tree(void) const {
		return (this->tree);
	}

	bool Empty()
	{
		return (this->tree.pRoot == 0);
	}

	void Clear(void)
	{
		this->tree.Clear();
	}

	template <class OBJITER>
	inline void Set(const OBJITER & _oBegin, const OBJITER & _oEnd) {
		GetPointerFunctor getPtr;
		GetBox3Functor getBox;
		GetBarycenter3Functor getBarycenter;
		//const unsigned int divs = 100;
		//const unsigned int size = (unsigned int)(std::distance(_oBegin, _oEnd));
		//const unsigned int maxObjectsPerLeaf = (size < divs) ? (size) : ((unsigned int)((float)(std::distance(_oBegin, _oEnd)) / (float)divs));
		const unsigned int maxObjectsPerLeaf = 10;
		const ScalarType leafBoxMaxVolume = ((ScalarType)0);
		const bool useVariance = true;

		(void)(this->tree.Set(_oBegin, _oEnd, getPtr, getBox, getBarycenter, maxObjectsPerLeaf, leafBoxMaxVolume, useVariance));
	}

	template <class OBJITERATOR, class OBJITERATORPTRFUNCT, class OBJBOXFUNCT, class OBJBARYCENTERFUNCT>
	inline bool Set(const OBJITERATOR & _oBegin, const OBJITERATOR & _oEnd, OBJITERATORPTRFUNCT & _objPtr, OBJBOXFUNCT & _objBox, OBJBARYCENTERFUNCT & _objBarycenter, const unsigned int _maxElemsPerLeaf = 1, const ScalarType & _leafBoxMaxVolume = ((ScalarType)0), const bool _useVariance = true) {
		return (this->tree.Set(_oBegin, _oEnd, _objPtr, _objBox, _objBarycenter, _maxElemsPerLeaf, _leafBoxMaxVolume, _useVariance));
	}

	template <class OBJPOINTDISTFUNCTOR, class OBJMARKER>
	inline ObjPtr GetClosest(
		OBJPOINTDISTFUNCTOR & _getPointDistance, OBJMARKER & _marker,
		const typename OBJPOINTDISTFUNCTOR::QueryType & _p, const ScalarType & _maxDist,
		ScalarType & _minDist, CoordType & _closestPt) {
		(void)_marker;
		return (AABBBinaryTreeClosest<TreeType>::Closest(this->tree, _getPointDistance, _p, _maxDist, _minDist, _closestPt));
	}

	template <class OBJPOINTDISTFUNCTOR, class OBJMARKER, class OBJPTRCONTAINER, class DISTCONTAINER, class POINTCONTAINER>
	inline unsigned int GetKClosest(
		OBJPOINTDISTFUNCTOR & _getPointDistance, OBJMARKER & _marker, const unsigned int _k, const CoordType & _p, const ScalarType & _maxDist,
		OBJPTRCONTAINER & _objectPtrs, DISTCONTAINER & _distances, POINTCONTAINER & _points) {
		(void)_marker;
		return (AABBBinaryTreeKClosest<TreeType>::KClosest(this->tree, _getPointDistance, _k, _p, _maxDist, _objectPtrs, _distances, _points));
	}

	template <class OBJRAYISECTFUNCTOR, class OBJMARKER>
	inline ObjPtr DoRay(OBJRAYISECTFUNCTOR & _rayIntersector, OBJMARKER & _marker, const Ray3<ScalarType> & _ray, const ScalarType & _maxDist, ScalarType & _t) {
		(void)_marker;
		return (AABBBinaryTreeRay<TreeType>::Ray(this->tree, _rayIntersector, _ray, _maxDist, _t));
	}

	inline void InitializeFrustumCull(void) {
		(void)(AABBBinaryTreeFrustumCull<TreeType>::Initialize(this->tree));
	}

	inline void FrustumCull(const Plane3<ScalarType> _frustumPlanes[6], const unsigned int _minNodeObjectsCount) {
		(void)(AABBBinaryTreeFrustumCull<TreeType>::FrustumCull(this->tree, _frustumPlanes, _minNodeObjectsCount));
	}

protected:
	TreeType tree;

};

}	// end namespace vcg

#endif // #ifndef __VCGLIB_AABBBINARYTREEINDEX_H


text:
@implementation SMKeyMessage

+ (SMMessageType)type {
    return SMMessageTypeKey;
}

//    gy (MPI)
//    Choose a random value y (at least 320 bits), and calculate g^y.
- (NSData *)g {
    uint8_t yBytes[SM_Y_LENGTH_BYTES];
    // Generate 320 random bits for x
    SecRandomCopyBytes(kSecRandomDefault, SM_Y_LENGTH_BYTES, yBytes);

    // TODO: Calcuate g^y

    // Return the bytes as an NSData
//    return [NSData dataWithBytes:yBytes length:SM_Y_LENGTH_BYTES];
    return nil;
}

@end


text:
package name.ikysil.beanpathdsl.core.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 *
 * @author Illya Kysil <ikysil@ikysil.name>
 */
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface IncludeClass {

    boolean transitive() default true;

    boolean withSubclasses() default false;

}


text:
package uk.ac.ebi.embl.api.validation.check.sequence;

import java.sql.SQLException;

import uk.ac.ebi.embl.api.entry.sequence.Sequence;
import uk.ac.ebi.embl.api.validation.*;
import uk.ac.ebi.embl.api.validation.dao.EntryDAOUtils;
import uk.ac.ebi.embl.api.validation.dao.EntryDAOUtilsImpl;
import uk.ac.ebi.embl.api.validation.dao.EraproDAOUtils;
import uk.ac.ebi.embl.api.validation.plan.EmblEntryValidationPlanProperty;

public abstract class SequenceValidationCheck implements EmblEntryValidationCheck<Sequence> {

	private Origin origin;
    private boolean isPopulated;
    private EmblEntryValidationPlanProperty property;
	private EntryDAOUtils entryDAOUtils;
	private EraproDAOUtils eraproDAOUtils;

//	protected ValidationResult result;

	public SequenceValidationCheck() {
//		result = new ValidationResult();
	}

    public void init() {
        //no implementation - override when needed
    }

    public boolean isPopulated() {
        return isPopulated;
    }

    public void setPopulated() {
        //override to do any processing of data post-population
        isPopulated = true;
    }

    public Origin getOrigin() {
		return origin;
	}

	public void setOrigin(Origin origin) {
		this.origin = origin;
	}

	/**
	 * Creates an error validation message for the sequence and adds it to
	 * the validation result.
	 *
	 * @param messageKey a message key
	 * @param params message parameters
	 */
	protected void reportError(ValidationResult result, String messageKey,
			Object... params) {
		reportMessage(result, Severity.ERROR, messageKey, params);
	}

	/**
	 * Creates a warning validation message for the sequence and adds it to
	 * the validation result.
	 *
	 * @param messageKey a message key
	 * @param params message parameters
	 */
	protected void reportWarning(ValidationResult result, String messageKey,
			Object... params) {
		reportMessage(result, Severity.WARNING, messageKey, params);
	}

	/**
	 * Creates a validation message for the sequence and adds it to
	 * the validation result.
	 *
	 * @param severity message severity
	 * @param messageKey a message key
	 * @param params message parameters
	 */
    protected void reportMessage(ValidationResult result, Severity severity,
                                 String messageKey, Object... params) {
        result.append(EntryValidations.createMessage(origin, severity, messageKey, params));
    }

    @Override
   	public void setEmblEntryValidationPlanProperty(
   			EmblEntryValidationPlanProperty property) throws SQLException
   	{
   		this.property=property;
   	}

   	@Override
   	public EmblEntryValidationPlanProperty getEmblEntryValidationPlanProperty()
   	{
   		return property;
   	}

   	@Override
   	public void setEntryDAOUtils(EntryDAOUtils entryDAOUtils)
   	{
   		this.entryDAOUtils=entryDAOUtils;

   	}

   	@Override
   	public EntryDAOUtils getEntryDAOUtils()
   	{
   		// TODO Auto-generated method stub
   		return entryDAOUtils;
   	}

   	@Override
	public EraproDAOUtils getEraproDAOUtils()
	{
		// TODO Auto-generated method stub
		return eraproDAOUtils;
	}

	@Override
	public void setEraproDAOUtils(EraproDAOUtils eraproDAOUtils)
	{
		this.eraproDAOUtils=eraproDAOUtils;

	}

}


text:
<?php

namespace Ajax\semantic\html\content;

use Ajax\semantic\html\base\HtmlSemDoubleElement;
use Ajax\semantic\html\base\constants\Wide;
use Ajax\semantic\html\base\traits\TextAlignmentTrait;
use Ajax\semantic\html\elements\HtmlDivider;

/**
 * A col in the Semantic Grid component
 * @see http://semantic-ui.com/collections/grid.html
 * @author jc
 * @version 1.001
 */
class HtmlGridCol extends HtmlSemDoubleElement {
	use TextAlignmentTrait;

	public function __construct($identifier, $width=NULL) {
		parent::__construct($identifier, "div");
		$this->setClass("column");
		if (isset($width))
			$this->setWidth($width);
	}

	/**
	 * Defines the col width
	 * @param int $width
	 * @return \Ajax\semantic\html\content\HtmlGridCol
	 */
	public function setWidth($width) {
		if (\is_int($width)) {
			$width=Wide::getConstants()["W" . $width];
		}
		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
		return $this->addToPropertyCtrl("class", "wide", array ("wide" ));
	}

	public function setValue($value) {
		$this->content=$value;
		return $this;
	}

	public function setValues($value) {
		return $this->setValue($value);
	}

	public function addDivider($vertical=true, $content=NULL) {
		$divider=new HtmlDivider("", $content);
		if ($vertical)
			$divider->setVertical();
		else
			$divider->setHorizontal();
		$this->wrap($divider,"");
		return $divider;
	}
}


text:
```
It's very easy to make some words **bold** and other words *italic* with Markdown. You can even [link to Google!](http://google.com)
```
It's very easy to make some words **bold** and other words *italic* with Markdown. You can even [link to Google!](http://google.com)

--------
# Headers
```
# This is an \<h1> tag
## This is an \<h2> tag
###### This is an \<h6> tag
```
# This is an \<h1> tag
## This is an \<h2> tag
###### This is an \<h6> tag

----------
# Emphasis
```
*This text will be italic*

_This will also be italic_

**This text will be bold**

__This will also be bold__

~~This will be strikethrough~~

_You **can** combine ~~them~~_
```
*This text will be italic*

_This will also be italic_

**This text will be bold**

__This will also be bold__

~~This will be strikethrough~~

_You **can** combine ~~them~~_

----------
# Lists
## Unordered
```
* Item 1
* Item 2
  * Item 2a
  * Item 2b
```
* Item 1
* Item 2
  * Item 2a
  * Item 2b

## Ordered
```
1. Item 1
1. Item 2
1. Item 3
   1. Item 3a
   1. Item 3b
```
1. Item 1
1. Item 2
1. Item 3
   1. Item 3a
   1. Item 3b

----------
# Images
```
![Fujion Logo](images/fujion.png)
```
![Fujion Logo](images/fujion.png)

----------
# Links
```
http://github.com - automatic!
[GitHub](http://github.com)
```
http://github.com - automatic!
[GitHub](http://github.com)

----------
# Blockquotes
```
As someone said:

> We're living the future so
> the present is our past.
```
As someone said:

> We're living the future so
> the present is our past.

----------
# Inline code
```
I think you should use an
`<addr>` element here instead.
```
I think you should use an
`<addr>` element here instead.

----------
# Task lists
```
- [x] #refs, [links](), **formatting**, and <del>tags</del> supported
- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete item
```
- [x] #refs, [links](), **formatting**, and <del>tags</del> supported
- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete item

----------
# Tables
```
Left-Aligned Column | Centered Column | Right-Aligned Column
:------------ | :-------------: | -------------:
Row 1, Col 1 | Row 1, Col 2 | Row 1, Col 3
Row 2, Col 1 | Row 2, Col 2 | Row 2, Col 3
```
Left-Aligned Column | Centered Column | Right-Aligned Column
:------------ | :-------------: | -------------:
Row 1, Col 1 | Row 1, Col 2 | Row 1, Col 3
Row 2, Col 1 | Row 2, Col 2 | Row 2, Col 3

----------
# Emoji
```
Happy face: :smile:
```
Happy face: :smile:


text:
describe('Directive:  pfFixedAccordion', function () {
  var $scope;
  var $compile;
  var element;
  var isolateScope;

  // load the controller's module
  beforeEach(function () {
    module('patternfly.utils');
  });

  beforeEach(inject(function (_$compile_, _$rootScope_) {
    $compile = _$compile_;
    $scope = _$rootScope_;
  }));

  var compileHTML = function (markup, scope) {
    element = angular.element(markup);
    $compile(element)(scope);

    scope.$digest();
    isolateScope = element.isolateScope();
  };

  beforeEach(function () {
    var htmlTmp = '<uib-accordion  pf-fixed-accordion group-height="350px" group-class="test-class" close-others="true">' +
      '<uib-accordion-group heading="Lorem ipsum">' +
      '  Praesent sagittis est et arcu fringilla placerat. Cras erat ante, dapibus non mauris ac, volutpat sollicitudin ligula. Morbi gravida nisl vel risus tempor, sit amet luctus erat tempus. Curabitur blandit sem non pretium bibendum. Donec eleifend non turpis vitae vestibulum. Vestibulum ut sem ac nunc posuere blandit sed porta lorem. Cras rutrum velit vel leo iaculis imperdiet.' +
      '</uib-accordion-group>' +
      '<uib-accordion-group heading="Dolor sit amet">' +
      '  Donec consequat dignissim neque, sed suscipit quam egestas in. Fusce bibendum laoreet lectus commodo interdum. Vestibulum odio ipsum, tristique et ante vel, iaculis placerat nulla. Suspendisse iaculis urna feugiat lorem semper, ut iaculis risus tempus.' +
      '</uib-accordion-group>' +
      '<uib-accordion-group heading="Consectetur">' +
      '  Curabitur nisl quam, interdum a venenatis a, consequat a ligula. Nunc nec lorem in erat rhoncus lacinia at ac orci. Sed nec augue congue, vehicula justo quis, venenatis turpis. Nunc quis consectetur purus. Nam vitae viverra lacus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum eu augue felis. Maecenas in dignissim purus, quis pulvinar lectus. Vivamus euismod ultrices diam, in mattis nibh.' +
      '</uib-accordion-group>' +
      '<uib-accordion-group heading="Adipisicing elit">' +
      '  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' +
      '</uib-accordion-group>' +
      '<uib-accordion-group heading="Suspendisse lectus tortor">' +
      '  Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.' +
      '</uib-accordion-group>' +
      '<uib-accordion-group heading="Velit mauris">' +
      '  Ut velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.' +
      '</uib-accordion-group>' +
      '<uib-accordion-group heading="Aliquam convallis">' +
      '  Aliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet.' +
      '</uib-accordion-group>' +
      '<uib-accordion-group heading="Vulputate dictum">' +
      '  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, eget vulputate orci purus ut lorem. In fringilla mi in ligula. Pellentesque aliquam quam vel dolor. Nunc adipiscing. Sed quam odio, tempus ac, aliquam molestie, varius ac, tellus. Vestibulum ut nulla aliquam risus rutrum interdum. Pellentesque lorem. Curabitur sit amet erat quis risus feugiat viverra. Pellentesque augue justo, sagittis et, lacinia at, venenatis non, arcu. Nunc nec libero. In cursus dictum risus. Etiam tristique nisl a nulla. Ut a orci. Curabitur dolor nunc, egestas at, accumsan at, malesuada nec, magna.' +
      '</uib-accordion-group>' +
      '</uib-accordion>';

    compileHTML(htmlTmp, $scope);
  });

  it('should have correct group height', function () {

    var group = element.find('.panel-group');
    expect(group.length).toBe(1);

    var groupHeight = group.height();
    expect(groupHeight).toBe(350);
  });

  it('should add the correct class to the panel-group element', function () {
    var group = element.find('.panel-group');
    expect(group.length).toBe(1);

    expect(group.hasClass('test-class')).toBeTruthy();
  });
});


text:
copyright:

  years: 2015,2016

lastupdated: "2016-02-17"

---

{:new_window: target="_blank"}
{:shortdesc: .shortdesc}

# Téléchargement de votre application

Une fois que vous êtes connecté à {{site.data.keyword.Bluemix}}, vous pouvez télécharger votre application avec la commande cf push.
{:shortdesc}

Avant de commencer, effectuez les opérations suivantes :
  1. Installez les interfaces de ligne de commande {{site.data.keyword.Bluemix}} et Cloud Foundry.

  2. Connectez-vous à {{site.data.keyword.Bluemix}}.

bluemix api https://api.nom_domaine

  3. Connectez-vous à {{site.data.keyword.Bluemix_notm}}.

bluemix login -u <var class="keyword varname" data-hd-keyref="user_ID">nom_utilisateur</var> -o
<var class="keyword varname" data-hd-keyref="org_name">nom_org</var> -s <var class="keyword varname" data-hd-keyref="space_name">nom_espace</var>

Lorsqu'une commande **cf push** est émise, l'interface de ligne de commande **cf** met le répertoire de travail à disposition de l'environnement {{site.data.keyword.Bluemix_notm}}, qui utilise un pack de construction pour construire et exécuter l'application.

  1. Depuis le répertoire de votre application, entrez la commande **cf push** avec le nom de l'application. Le nom de l'application doit
être unique dans l'environnement {{site.data.keyword.Bluemix_notm}}.

cf push <var class="keyword varname" data-hd-keyref="app_name">nom_app</var> -m 512m

  {{site.data.keyword.Bluemix_notm}} inclut des packs de construction intégrés. Dans certains cas, même pour les packs de construction
intégrés, vous devez indiquer l'option -c afin de spécifier la commande qui est utilisée pour démarrer votre application. Par exemple, vous devez utiliser l'option -c pour envoyer votre application Node.js par commande push :

cf push <var class="keyword varname" data-hd-keyref="app_name">nom_app</var> -c commande_démarrage

  De plus, l'application Node.js doit contenir un fichier package.json valide.

  Tous les autres packs de construction externes doivent être envoyés par commande push avec l'option -b. Par exemple :

cf push <var class="keyword varname" data-hd-keyref="app_name">nom_app</var> -b URL_pack_construction

  **Astuce :** lorsque vous utilisez la commande **cf push**, l'interface de ligne de commande
**cf** copie tous les fichiers et les répertoires depuis votre répertoire de travail vers Bluemix. Assurez-vous que votre répertoire de travail contient uniquement les fichiers requis.

  La commande cf push télécharge et déploie votre application dans {{site.data.keyword.Bluemix_notm}}. Voir
[Commandes cf](/docs/cli/reference/cfcommands/index.html) pour plus d'informations sur cf push. Voir
[Utilisation de packs de construction de communauté](/docs/cfapps/byob.html) pour des informations sur les packs de construction.

  2. Si vous modifiez votre application, vous pouvez télécharger ces modifications en entrant à nouveau la commande cf push. L'interface de ligne de
commande cf utilise vos options précédentes et vos réponses aux invites pour mettre à jour n'importe quelle instance en cours d'exécution de votre application avec
les nouvelles parties de code.

**Astuce :** vous pouvez également télécharger ou déployer une application à partir de DevOps Services. Voir [Developing a {{site.data.keyword.Bluemix_notm}} application in Node.js with the Web IDE](https://hub.jazz.net/tutorials/devopsweb/){: new_window}.


text:
Manage API Product Attributes

### Synopsis

Manage API Product Attributes

### Options

```
  -h, --help          help for attributes
  -n, --name string   API Product name
```

### Options inherited from parent commands

```
  -a, --account string   Path Service Account private key in JSON
      --disable-check    Disable check for newer versions
      --no-output        Disable printing API responses from the control plane
  -o, --org string       Apigee organization name
  -t, --token string     Google OAuth Token
```

### SEE ALSO

* [apigeecli products](apigeecli_products.md)	 - Manage Apigee API products
* [apigeecli products attributes delete](apigeecli_products_attributes_delete.md)	 - Deletes an attribute from an API product
* [apigeecli products attributes get](apigeecli_products_attributes_get.md)	 - Get an attribute of an API product
* [apigeecli products attributes list](apigeecli_products_attributes_list.md)	 - List attributes of an API product
* [apigeecli products attributes update](apigeecli_products_attributes_update.md)	 - Update an attribute of an API product

###### Auto generated by spf13/cobra on 3-Nov-2022


text:
(function () {

    function Payment(disp) {
        this.constructor.prototype.purchase = function(options, callbackOnSuccess, callbackOnFailure) {
            return disp.purchase(options, callbackOnSuccess, callbackOnFailure);
        };
        this.constructor.prototype.getExistingPurchases = function(refresh, callbackOnSuccess, callbackOnFailure) {
            return disp.getExistingPurchases(refresh, callbackOnSuccess, callbackOnFailure);
        };
        this.constructor.prototype.__defineGetter__("developmentMode", disp.getConnectionMode);
        this.constructor.prototype.__defineSetter__("developmentMode", disp.setConnectionMode);
    }

    blackberry.Loader.javascriptLoaded("blackberry.payment", Payment);
})();