text:
import io

from oslo_utils import units
from tempest.common import utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
from tempest.scenario import manager

CONF = config.CONF

class ImageQuotaTest(manager.ScenarioTest):
    credentials = ['primary', 'system_admin']

    @classmethod
    def resource_setup(cls):
        super(ImageQuotaTest, cls).resource_setup()

        # Figure out and record the glance service id
        services = cls.os_system_admin.identity_services_v3_client.\
            list_services()
        glance_services = [x for x in services['services']
                           if x['name'] == 'glance']
        cls.glance_service_id = glance_services[0]['id']

        # Pre-create all the quota limits and record their IDs so we can
        # update them in-place without needing to know which ones have been
        # created and in which order.
        cls.limit_ids = {}

        try:
            cls.limit_ids['image_size_total'] = cls._create_limit(
                'image_size_total', 10)
            cls.limit_ids['image_stage_total'] = cls._create_limit(
                'image_stage_total', 10)
            cls.limit_ids['image_count_total'] = cls._create_limit(
                'image_count_total', 10)
            cls.limit_ids['image_count_uploading'] = cls._create_limit(
                'image_count_uploading', 10)
        except lib_exc.Forbidden:
            # If we fail to set limits, it means they are not
            # registered, and thus we will skip these tests once we
            # have our os_system_admin client and run
            # check_quotas_enabled().
            pass

    def setUp(self):
        super(ImageQuotaTest, self).setUp()
        self.created_images = []

    def create_image(self, data=None, **kwargs):
        """Wrapper that returns a test image."""

        if 'name' not in kwargs:
            name = data_utils.rand_name(self.__name__ + "-image")
            kwargs['name'] = name

        params = dict(kwargs)
        if data:
            # NOTE: On glance v1 API, the data should be passed on
            # a header. Then here handles the data separately.
            params['data'] = data

        image = self.image_client.create_image(**params)
        # Image objects returned by the v1 client have the image
        # data inside a dict that is keyed against 'image'.
        if 'image' in image:
            image = image['image']
        self.created_images.append(image['id'])
        self.addCleanup(
            self.image_client.wait_for_resource_deletion,
            image['id'])
        self.addCleanup(
            test_utils.call_and_ignore_notfound_exc,
            self.image_client.delete_image, image['id'])
        return image

    def check_quotas_enabled(self):
        # Check to see if we should even be running these tests. Use
        # the presence of a registered limit that we recognize as an
        # indication.  This will be set up by the operator (or
        # devstack) if glance is configured to use/honor the unified
        # limits. If one is set, they must all be set, because glance
        # has a single all-or-nothing flag for whether or not to use
        # keystone limits. If anything, checking only one helps to
        # assert the assumption that, if enabled, they must all be at
        # least registered for proper operation.
        registered_limits = self.os_system_admin.identity_limits_client.\
            get_registered_limits()['registered_limits']
        if 'image_count_total' not in [x['resource_name']
                                       for x in registered_limits]:
            raise self.skipException('Target system is not configured with '
                                     'glance unified limits')

    @classmethod
    def _create_limit(cls, name, value):
        return cls.os_system_admin.identity_limits_client.create_limit(
            CONF.identity.region, cls.glance_service_id,
            cls.image_client.tenant_id, name, value)['limits'][0]['id']

    def _update_limit(self, name, value):
        self.os_system_admin.identity_limits_client.update_limit(
            self.limit_ids[name], value)

    def _cleanup_images(self):
        while self.created_images:
            image_id = self.created_images.pop()
            try:
                self.image_client.delete_image(image_id)
            except lib_exc.NotFound:
                pass

    @decorators.idempotent_id('9b74fe24-183b-41e6-bf42-84c2958a7be8')
    @utils.services('image', 'identity')
    def test_image_count_quota(self):
        self.check_quotas_enabled()

        # Set a quota on the number of images for our tenant to one.
        self._update_limit('image_count_total', 1)

        # Create one image
        image = self.create_image(name='first',
                                  container_format='bare',
                                  disk_format='raw',
                                  visibility='private')

        # Second image would put us over quota, so expect failure.
        self.assertRaises(lib_exc.OverLimit,
                          self.create_image,
                          name='second',
                          container_format='bare',
                          disk_format='raw',
                          visibility='private')

        # Update our limit to two.
        self._update_limit('image_count_total', 2)

        # Now the same create should succeed.
        self.create_image(name='second',
                          container_format='bare',
                          disk_format='raw',
                          visibility='private')

        # Third image would put us over quota, so expect failure.
        self.assertRaises(lib_exc.OverLimit,
                          self.create_image,
                          name='third',
                          container_format='bare',
                          disk_format='raw',
                          visibility='private')

        # Delete the first image to put us under quota.
        self.image_client.delete_image(image['id'])

        # Now the same create should succeed.
        self.create_image(name='third',
                          container_format='bare',
                          disk_format='raw',
                          visibility='private')

        # Delete all the images we created before the next test runs,
        # so that it starts with full quota.
        self._cleanup_images()

    @decorators.idempotent_id('b103788b-5329-4aa9-8b0d-97f8733460db')
    @utils.services('image', 'identity')
    def test_image_count_uploading_quota(self):
        if not CONF.image_feature_enabled.import_image:
            skip_msg = (
                "%s skipped as image import is not available" % __name__)
            raise self.skipException(skip_msg)

        self.check_quotas_enabled()

        # Set a quota on the number of images we can have in uploading state.
        self._update_limit('image_stage_total', 10)
        self._update_limit('image_size_total', 10)
        self._update_limit('image_count_total', 10)
        self._update_limit('image_count_uploading', 1)

        file_content = data_utils.random_bytes(1 * units.Mi)

        # Create and stage an image
        image1 = self.create_image(name='first',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.image_client.stage_image_file(image1['id'],
                                           io.BytesIO(file_content))

        # Check that we can not stage another
        image2 = self.create_image(name='second',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.assertRaises(lib_exc.OverLimit,
                          self.image_client.stage_image_file,
                          image2['id'], io.BytesIO(file_content))

        # ... nor upload directly
        image3 = self.create_image(name='third',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.assertRaises(lib_exc.OverLimit,
                          self.image_client.store_image_file,
                          image3['id'],
                          io.BytesIO(file_content))

        # Update our quota to make room
        self._update_limit('image_count_uploading', 2)

        # Now our upload should work
        self.image_client.store_image_file(image3['id'],
                                           io.BytesIO(file_content))

        # ...and because that is no longer in uploading state, we should be
        # able to stage our second image from above.
        self.image_client.stage_image_file(image2['id'],
                                           io.BytesIO(file_content))

        # Finish our import of image2
        self.image_client.image_import(image2['id'], method='glance-direct')
        waiters.wait_for_image_imported_to_stores(self.image_client,
                                                  image2['id'])

        # Set our quota back to one
        self._update_limit('image_count_uploading', 1)

        # Since image1 is still staged, we should not be able to upload
        # an image.
        image4 = self.create_image(name='fourth',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.assertRaises(lib_exc.OverLimit,
                          self.image_client.store_image_file,
                          image4['id'],
                          io.BytesIO(file_content))

        # Finish our import of image1 to make space in our uploading quota.
        self.image_client.image_import(image1['id'], method='glance-direct')
        waiters.wait_for_image_imported_to_stores(self.image_client,
                                                  image1['id'])

        # Make sure that freed up the one upload quota to complete our upload
        self.image_client.store_image_file(image4['id'],
                                           io.BytesIO(file_content))

        # Delete all the images we created before the next test runs,
        # so that it starts with full quota.
        self._cleanup_images()

    @decorators.idempotent_id('05e8d064-c39a-4801-8c6a-465df375ec5b')
    @utils.services('image', 'identity')
    def test_image_size_quota(self):
        self.check_quotas_enabled()

        # Set a quota on the image size for our tenant to 1MiB, and allow ten
        # images.
        self._update_limit('image_size_total', 1)
        self._update_limit('image_count_total', 10)
        self._update_limit('image_count_uploading', 10)

        file_content = data_utils.random_bytes(1 * units.Mi)

        # Create and upload a 1MiB image.
        image1 = self.create_image(name='first',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.image_client.store_image_file(image1['id'],
                                           io.BytesIO(file_content))

        # Create and upload a second 1MiB image. This succeeds, but
        # after completion, we are over quota. Despite us being at
        # quota above, the initial quota check for the second
        # operation has no idea what the image size will be, and thus
        # uses delta=0. This will succeed because we're not
        # technically over-quota and have not asked for any more (this
        # is oslo.limit behavior). After the second operation,
        # however, we will be over-quota regardless of the delta and
        # subsequent attempts will fail. Because glance goes not
        # require an image size to be declared before upload, this is
        # really the best it can do without an API change.
        image2 = self.create_image(name='second',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.image_client.store_image_file(image2['id'],
                                           io.BytesIO(file_content))

        # Create and attempt to upload a third 1MiB image. This should fail to
        # upload (but not create) because we are over quota.
        image3 = self.create_image(name='third',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.assertRaises(lib_exc.OverLimit,
                          self.image_client.store_image_file,
                          image3['id'], io.BytesIO(file_content))

        # Increase our size quota to 2MiB.
        self._update_limit('image_size_total', 2)

        # Now the upload of the already-created image is allowed, but
        # after completion, we are over quota again.
        self.image_client.store_image_file(image3['id'],
                                           io.BytesIO(file_content))

        # Create and attempt to upload a fourth 1MiB image. This should
        # fail to upload (but not create) because we are over quota.
        image4 = self.create_image(name='fourth',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.assertRaises(lib_exc.OverLimit,
                          self.image_client.store_image_file,
                          image4['id'], io.BytesIO(file_content))

        # Delete our first image to make space in our existing 2MiB quota.
        self.image_client.delete_image(image1['id'])

        # Now the upload of the already-created image is allowed.
        self.image_client.store_image_file(image4['id'],
                                           io.BytesIO(file_content))

        # Delete all the images we created before the next test runs,
        # so that it starts with full quota.
        self._cleanup_images()

    @decorators.idempotent_id('fc76b8d9-aae5-46fb-9285-099e37f311f7')
    @utils.services('image', 'identity')
    def test_image_stage_quota(self):
        if not CONF.image_feature_enabled.import_image:
            skip_msg = (
                "%s skipped as image import is not available" % __name__)
            raise self.skipException(skip_msg)

        self.check_quotas_enabled()

        # Create a staging quota of 1MiB, allow 10MiB of active
        # images, and a total of ten images.
        self._update_limit('image_stage_total', 1)
        self._update_limit('image_size_total', 10)
        self._update_limit('image_count_total', 10)
        self._update_limit('image_count_uploading', 10)

        file_content = data_utils.random_bytes(1 * units.Mi)

        # Create and stage a 1MiB image.
        image1 = self.create_image(name='first',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.image_client.stage_image_file(image1['id'],
                                           io.BytesIO(file_content))

        # Create and stage a second 1MiB image. This succeeds, but
        # after completion, we are over quota.
        image2 = self.create_image(name='second',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.image_client.stage_image_file(image2['id'],
                                           io.BytesIO(file_content))

        # Create and attempt to stage a third 1MiB image. This should fail to
        # stage (but not create) because we are over quota.
        image3 = self.create_image(name='third',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.assertRaises(lib_exc.OverLimit,
                          self.image_client.stage_image_file,
                          image3['id'], io.BytesIO(file_content))

        # Make sure that even though we are over our stage quota, we
        # can still create and upload an image the regular way.
        image_upload = self.create_image(name='uploaded',
                                         container_format='bare',
                                         disk_format='raw',
                                         visibility='private')
        self.image_client.store_image_file(image_upload['id'],
                                           io.BytesIO(file_content))

        # Increase our stage quota to two MiB.
        self._update_limit('image_stage_total', 2)

        # Now the upload of the already-created image is allowed, but
        # after completion, we are over quota again.
        self.image_client.stage_image_file(image3['id'],
                                           io.BytesIO(file_content))

        # Create and attempt to stage a fourth 1MiB image. This should
        # fail to stage (but not create) because we are over quota.
        image4 = self.create_image(name='fourth',
                                   container_format='bare',
                                   disk_format='raw',
                                   visibility='private')
        self.assertRaises(lib_exc.OverLimit,
                          self.image_client.stage_image_file,
                          image4['id'], io.BytesIO(file_content))

        # Finish our import of image1 to make space in our stage quota.
        self.image_client.image_import(image1['id'], method='glance-direct')
        waiters.wait_for_image_imported_to_stores(self.image_client,
                                                  image1['id'])

        # Now the upload of the already-created image is allowed.
        self.image_client.stage_image_file(image4['id'],
                                           io.BytesIO(file_content))

        # Delete all the images we created before the next test runs,
        # so that it starts with full quota.
        self._cleanup_images()


text:
import Dispatcher from "dispatchers/Dispatcher";
import BaseStore from "stores/BaseStore";
import ProjectImageCollection from "collections/ProjectImageCollection";
import ProjectImageConstants from "constants/ProjectImageConstants";
import ImageCollection from "collections/ImageCollection";
import Image from "models/Image";
import stores from "stores";

let _modelsFor = {};
let _isFetchingFor = {};
let _pendingProjectImages = new ImageCollection();

function addPending(model) {
    _pendingProjectImages.add(model);
}

function removePending(model) {
    _pendingProjectImages.remove(model);
}

var ProjectImageStore = BaseStore.extend({
    collection: ProjectImageCollection,

    initialize: function() {
        this.models = new ProjectImageCollection();
    },

    fetchModelsFor: function(projectId) {
        if (!_modelsFor[projectId] && !_isFetchingFor[projectId]) {
            _isFetchingFor[projectId] = true;
            var models = new ProjectImageCollection();
            models.fetch({
                url: models.url + "?project__id=" + projectId
            }).done(function() {
                _isFetchingFor[projectId] = false;
                // add models to existing cache
                this.models.add(models.models);

                // convert ProjectImage collection to an ImageCollection
                var images = models.map(function(project_image) {
                    return new Image(project_image.get("image"), {
                        parse: true
                    });
                });
                images = new ImageCollection(images);

                _modelsFor[projectId] = images;
                this.emitChange();
            }.bind(this));
        }
    },

    getImagesFor: function(project) {
        var allImages = stores.ImageStore.getForProject(project.id);
        if (!project.id) return;
        if (!_modelsFor[project.id]) return this.fetchModelsFor(project.id);
        if (!allImages) return;

        var images = this.models.filter(function(project_image) {
            // filter out irrelevant project images (not in target project)
            return project_image.get("project").id === project.id;
        }).filter(function(project_image) {
            // filter out the images that don't exist (not in local cache)
            return allImages.get(project_image.get("image").id);
        }).map(function(project_image) {
            // return the actual images
            return allImages.get(project_image.get("image").id);
        });
        return new ImageCollection(images);
    },

    getProjectsFor: function(imageId) {
        var allProjects = stores.ImageStore.getProjects(imageId);
        if (!imageId) return;
        if (!allProjects) return;

        return allProjects;
    }
});

let store = new ProjectImageStore();

Dispatcher.register(function(dispatch) {
    var actionType = dispatch.action.actionType;
    var payload = dispatch.action.payload;
    var options = dispatch.action.options || options;

    switch (actionType) {

        case ProjectImageConstants.ADD_PROJECT_IMAGE:
            store.add(payload.projectImage);
            break;

        case ProjectImageConstants.REMOVE_PROJECT_IMAGE:
            store.remove(payload.projectImage);
            break;

        case ProjectImageConstants.ADD_PENDING_PROJECT_IMAGE:
            addPending(payload.projectImage);
            break;

        case ProjectImageConstants.REMOVE_PENDING_PROJECT_IMAGE:
            removePending(payload.projectImage);
            break;

        case ProjectImageConstants.EMIT_CHANGE:
            break;

        default:
            return true;
    }

    if (!options.silent) {
        store.emitChange();
    }

    return true;
});

export default store;

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <declare-styleable name="BubbleImageView">
        <attr name="bubble_arrowTop" format="dimension|reference" />
        <attr name="bubble_arrowWidth" format="dimension|reference" />
        <attr name="bubble_arrowHeight" format="dimension|reference" />
        <attr name="bubble_arrowOffset" format="dimension|reference" />
        <attr name="bubble_angle" format="dimension|reference" />
        <attr name="bubble_arrowLocation" format="enum">
            <enum name="left" value="0" />
            <enum name="right" value="1" />
        </attr>
    </declare-styleable>

</resources>


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Plan extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model('plan_model','model');
	}

	public function showPlans($type)
	{
		if($type !== '1' && $type !== '2' && $type !== '3')
		  	show_404();
		else
		{
			$data['plans'] = $this->model->getPlans($type);
			// var_dump($data['plans']);
			$this->load->view('service' , $data);
		}
	}
}


text:
import Zone from './Zone';

export default class SetAside extends Zone {
    constructor() {
        super();
        this.contents = [];
        this.maxSlots = 0;
    }
}


text:
package service

import (
	"context"
	"database/sql"
	"go-common/app/service/live/wallet/model"
	"go-common/library/ecode"
)

const TX_STATUS_SUCC = 0   //事务执行成功
const TX_STATUS_FAILED = 1 //事务执行失败
type QueryHandler struct {
}

func (handler *QueryHandler) NeedCheckUid() bool {
	return false
}

func (handler *QueryHandler) NeedTransactionMutex() bool {
	return false
}
func (handler *QueryHandler) BizExecute(ws *WalletService, basicParam *model.BasicParam, uid int64, params ...interface{}) (v interface{}, err error) {
	tid, _ := params[1].(string)
	var record *model.CoinStreamRecord
	if uid == 0 {
		record, err = ws.s.dao.GetCoinStreamByTid(ws.c, tid)
	} else {
		record, err = ws.s.dao.GetCoinStreamByUidTid(ws.c, uid, tid)
	}

	if err != nil {
		if err == sql.ErrNoRows {
			err = ecode.NothingFound
		} else {
			err = ecode.ServerErr
		}
		return
	}

	var (
		result bool
		opType model.ServiceType
	)

	opType = model.ServiceType(record.OpType)
	switch opType {
	case model.PAYTYPE:
		result = record.OpReason == 0
	case model.RECHARGETYPE:
		result = record.OpReason == 0 || record.OpResult == model.STREAM_OP_REASON_POST_QUERY_FAILED
	case model.EXCHANGETYPE:
		result = record.OpReason == 0 || record.OpResult == model.STREAM_OP_REASON_EXECUTE_UNKNOWN
	default:
	}

	res := &model.QueryResp{}
	if result {
		res.Status = TX_STATUS_SUCC
	} else {
		res.Status = TX_STATUS_FAILED
	}

	v = res

	return
}

func (s *Service) Query(c context.Context, basicParam *model.BasicParam, uid int64, params ...interface{}) (v interface{}, err error) {
	handler := QueryHandler{}
	return s.execByHandler(&handler, c, basicParam, uid, params...)
}


text:
package Logos::Generator::Base::StaticClassGroup;
use strict;

sub _methodForClassWithScope {
	my $self = shift;
	my $class = shift;
	my $scope = shift;
	my $return = "";
	my $methodname = Logos::sigil($scope eq "+" ? "static_metaclass_lookup" : "static_class_lookup").$class;
	my $lookupMethod = $scope eq "+" ? "objc_getMetaClass" : "objc_getClass";

	# This is a dirty assumption - we believe that we will always be using a compiler that defines __GNUC__ and respects GNU C attributes.
	return "static __inline__ __attribute__((always_inline)) __attribute__((unused)) Class ".$methodname."(void) { static Class _klass; if(!_klass) { _klass = ".$lookupMethod."(\"".$class."\"); } return _klass; }";
}

sub declarations {
	my $self = shift;
	my $group = shift;
	my $return = "";
	return "" if scalar(keys %{$group->usedMetaClasses}) + scalar(keys %{$group->usedClasses}) + scalar(keys %{$group->declaredOnlyClasses}) == 0;
	foreach(keys %{$group->usedMetaClasses}) {
		$return .= $self->_methodForClassWithScope($_, "+");
	}
	foreach(keys %{$group->usedClasses}) {
		$return .= $self->_methodForClassWithScope($_, "-");
	}
	return $return;
}

sub initializers {
	return "";
}

1;


text:
package models.hbase090

import models.hbase.{HBase, HBaseContext}

class HBaseContext090 extends HBaseContext {
  override val hBase:HBase = new HBase090
  override val logFileParser = new LogFileParser090
}


text:
package com.lcw.one.sys.dao;

import com.lcw.one.sys.entity.SysConfigEO;
import com.lcw.one.util.http.PageInfo;
import com.lcw.one.util.persistence.BaseRepositoryImpl;
import com.lcw.one.util.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.support.JpaEntityInformationSupport;
import org.springframework.stereotype.Component;

import javax.persistence.EntityManager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class SysConfigEODao extends BaseRepositoryImpl<SysConfigEO, String> {

    @Autowired
    public SysConfigEODao(EntityManager entityManager) {
        super(JpaEntityInformationSupport.getEntityInformation(SysConfigEO.class, entityManager), entityManager);
    }

    public PageInfo<SysConfigEO> page(PageInfo pageInfo, String configName, String configKey) {
        Map<String, Object> paramMap = new HashMap<>();
        StringBuilder hql = new StringBuilder();
        hql.append(" from SysConfigEO where 1=1 ");
        if (StringUtils.isNotEmpty(configKey)) {
            hql.append(" and configKey like :configKey ");
            paramMap.put("configKey", "%" + configKey + "%");
        }
        if (StringUtils.isNotEmpty(configName)) {
            hql.append(" and configName like :configName ");
            paramMap.put("configName", "%" + configName + "%");
        }
        return super.page(pageInfo, hql.toString(), paramMap);
    }

    public List<SysConfigEO> list(String typeCode) {
        return super.list("from SysConfigEO where typeCode = ?1", typeCode);
    }

    public void update(String key, String value) {
        executeUpdate("update SysConfigEO set configValue = ?1 where configKey = ?2", value, key);
    }
}


text:
package org.panteleyev.money.app;

import org.panteleyev.money.bundles.CategoryTypeBundle;
import org.panteleyev.money.bundles.ContactTypeBundle;
import org.panteleyev.money.bundles.DocumentTypeBundle;
import org.panteleyev.money.bundles.TransactionPredicateBundle;
import org.panteleyev.money.bundles.TransactionTypeBundle;
import org.panteleyev.money.model.CategoryType;
import org.panteleyev.money.model.ContactType;
import org.panteleyev.money.model.DocumentType;
import org.panteleyev.money.model.TransactionType;

import java.util.ResourceBundle;

import static java.util.ResourceBundle.getBundle;

public final class Bundles {
    private static final ResourceBundle CATEGORY_TYPE_BUNDLE =
            getBundle(CategoryTypeBundle.class.getCanonicalName());
    private static final ResourceBundle CONTACT_TYPE_BUNDLE =
            getBundle(ContactTypeBundle.class.getCanonicalName());
    private static final ResourceBundle TRANSACTION_TYPE_BUNDLE =
            getBundle(TransactionTypeBundle.class.getCanonicalName());
    private static final ResourceBundle DOCUMENT_TYPE_BUNDLE =
            getBundle(DocumentTypeBundle.class.getCanonicalName());
    private static final ResourceBundle TRANSACTION_PREDICATE_BUNDLE =
            getBundle(TransactionPredicateBundle.class.getCanonicalName());

    public static String translate(CategoryType type) {
        return CATEGORY_TYPE_BUNDLE.getString(type.name() + "_name");
    }

    public static String translate(ContactType type) {
        return CONTACT_TYPE_BUNDLE.getString(type.name());
    }

    public static String translate(TransactionType type) {
        return TRANSACTION_TYPE_BUNDLE.getString(type.name());
    }

    public static String translate(DocumentType type) {
        return DOCUMENT_TYPE_BUNDLE.getString(type.name());
    }

    public static String translate(TransactionPredicate predicate) {
        return TRANSACTION_PREDICATE_BUNDLE.getString(predicate.name());
    }

    private Bundles() {
    }
}


text:
package excelsheetcolumnnumber;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class MyTest {
	Solution s;

	@Before
	public void init() {
		s = new Solution();
	}

	@Test
	public void test1() {
		assertEquals(1, s.titleToNumber("A"));
	}

	@Test
	public void test2() {
		assertEquals(2, s.titleToNumber("B"));
	}

	@Test
	public void test26() {
		assertEquals(26, s.titleToNumber("Z"));
	}

	@Test
	public void test27() {
		assertEquals(27, s.titleToNumber("AA"));
	}
}


text:
package com.planet_ink.coffee_mud.Races;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

@SuppressWarnings("unchecked")
public class WereAmphibian extends StdRace
{
	public String ID(){	return "WereAmphibian"; }
	public String name(){ return "WereAmphibian"; }
	public int shortestMale(){return 59;}
	public int shortestFemale(){return 59;}
	public int heightVariance(){return 12;}
	public int lightestWeight(){return 80;}
	public int weightVariance(){return 80;}
	public long forbiddenWornBits(){return 0;}
	public String racialCategory(){return "Amphibian";}
	private String[]racialAbilityNames={"Skill_Swim"};
	private int[]racialAbilityLevels={1};
	private int[]racialAbilityProficiencies={100};
	private boolean[]racialAbilityQuals={false};
	protected String[] racialAbilityNames(){return racialAbilityNames;}
	protected int[] racialAbilityLevels(){return racialAbilityLevels;}
	protected int[] racialAbilityProficiencies(){return racialAbilityProficiencies;}
	protected boolean[] racialAbilityQuals(){return racialAbilityQuals;}

	//                                an ey ea he ne ar ha to le fo no gi mo wa ta wi
	private static final int[] parts={0 ,2 ,2 ,1 ,1 ,2 ,2 ,1 ,2 ,2 ,1 ,1 ,1 ,1 ,1 ,0 };
	public int[] bodyMask(){return parts;}

	private int[] agingChart={0,4,8,12,16,20,24,28,32};
	public int[] getAgingChart(){return agingChart;}

	protected static Vector resources=new Vector();

	public Weapon myNaturalWeapon()
	{
		if(naturalWeapon==null)
		{
			naturalWeapon=CMClass.getWeapon("StdWeapon");
			naturalWeapon.setName("sharp claws");
			naturalWeapon.setWeaponType(Weapon.TYPE_SLASHING);
		}
		return naturalWeapon;
	}
	public void affectEnvStats(Environmental affected, EnvStats affectableStats)
	{
		MOB mob=(MOB)affected;
		if(mob.location()!=null)
	    {
			if((mob.location().domainType()==Room.DOMAIN_OUTDOORS_UNDERWATER)
			||(mob.location().domainType()==Room.DOMAIN_INDOORS_UNDERWATER)
			||(mob.location().domainType()==Room.DOMAIN_INDOORS_WATERSURFACE)
			||(mob.location().domainType()==Room.DOMAIN_OUTDOORS_WATERSURFACE))
			{
				if((affectableStats.sensesMask()&EnvStats.CAN_NOT_BREATHE)==EnvStats.CAN_NOT_BREATHE)
					affectableStats.setSensesMask(affectableStats.sensesMask()-EnvStats.CAN_NOT_BREATHE);
			}
			affectableStats.setDisposition(affectableStats.disposition()|EnvStats.IS_SWIMMING);
		}
	}
	public String healthText(MOB viewer, MOB mob)
	{
		double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints()));

		if(pct<.10)
			return "^r" + mob.displayName(viewer) + "^r is facing a cold death!^N";
		else
		if(pct<.20)
			return "^r" + mob.displayName(viewer) + "^r is covered in blood.^N";
		else
		if(pct<.30)
			return "^r" + mob.displayName(viewer) + "^r is bleeding badly from lots of wounds.^N";
		else
		if(pct<.40)
			return "^y" + mob.displayName(viewer) + "^y has numerous bloody wounds and gashes.^N";
		else
		if(pct<.50)
			return "^y" + mob.displayName(viewer) + "^y has some bloody wounds and gashes.^N";
		else
		if(pct<.60)
			return "^p" + mob.displayName(viewer) + "^p has a few bloody wounds.^N";
		else
		if(pct<.70)
			return "^p" + mob.displayName(viewer) + "^p is cut and bruised heavily.^N";
		else
		if(pct<.80)
			return "^g" + mob.displayName(viewer) + "^g has some minor cuts and bruises.^N";
		else
		if(pct<.90)
			return "^g" + mob.displayName(viewer) + "^g has a few bruises and scratched scales.^N";
		else
		if(pct<.99)
			return "^g" + mob.displayName(viewer) + "^g has a few small bruises.^N";
		else
			return "^c" + mob.displayName(viewer) + "^c is in perfect health.^N";
	}
	public Vector myResources()
	{
		synchronized(resources)
		{
			if(resources.size()==0)
			{
				resources.addElement(makeResource
				("a "+name().toLowerCase()+" tongue",RawMaterial.RESOURCE_MEAT));
				for(int i=0;i<5;i++)
					resources.addElement(makeResource
					("a pound of "+name().toLowerCase()+" meat",RawMaterial.RESOURCE_MEAT));
				for(int i=0;i<15;i++)
					resources.addElement(makeResource
					("a "+name().toLowerCase()+" hide",RawMaterial.RESOURCE_SCALES));
				resources.addElement(makeResource
				("some "+name().toLowerCase()+" blood",RawMaterial.RESOURCE_BLOOD));
			}
		}
		return resources;
	}
}


text:
package org.neo4j.kernel.api.properties;

final class LongProperty extends IntegralNumberProperty
{
    private final long value;

    LongProperty( int propertyKeyId, long value )
    {
        super( propertyKeyId );
        this.value = value;
    }

    @Override
    public Long value()
    {
        return value;
    }

    @Override
    public long longValue()
    {
        return value;
    }
}


text:
package auth

import (
	"github.com/kuzzleio/sdk-go/types"
)

// DeleteMyCredentials delete credentials of the specified strategy for the current user.
func (a *Auth) DeleteMyCredentials(strategy string, options types.QueryOptions) error {
	if strategy == "" {
		return types.NewError("Auth.DeleteMyCredentials: strategy is required", 400)
	}

	type body struct {
		Strategy string `json:"strategy"`
	}
	result := make(chan *types.KuzzleResponse)

	query := &types.KuzzleRequest{
		Controller: "auth",
		Action:     "deleteMyCredentials",
		Strategy:   strategy,
	}

	go a.kuzzle.Query(query, options, result)

	res := <-result

	if res.Error.Error() != "" {
		return res.Error
	}

	return nil
}


text:
layout: post
title: Testing Docker apps with Wercker
date: 2015-05-19
tag: [docker, testing, ci]
twitter: starefossen
published: true
facts:
  - title: Docker
    facts:
      - Docker is an open platform for developing, shipping, and running
        applications.
      - First released 13th of March 2013.
      - You can build Docker images that hold your applications.
      - You can create Docker containers from those Docker images to
        run your applications.
      - You can share those Docker images via Docker Hub or your own
        registry.
    source: docs.docker.com
  - title: Wercker
    facts:
      - Wercker is a continuous delivery platform made by engineers previously
        with OpenStack, Google AppEngine, Simple, Digg and Disqus.
      - Launched publicly early 2012.
      - Initial Docker support November 2013.
      - Second round of funding October 2014.
      - Full Docker support April 2015.
    source: wercker.com
---

Wercker is a free and hosted continuous delivery platform with a lot of
flexibility.  Wercker offers everything you would expect from a modern CI
service, and they recently announced full support for the Docker container
runtime.

![Wercker Promo](/uploads/2015/05/19/wercker.png "Wercker Promo")

<!--more-->

The Wercker platform has two modes (known as stacks) to run applications;
`Classic` using custom made pre-built containers, and `Ewok` using the Docker
container runtime.  If you don't know what Docker is, I suggest you read [this
article](http://docs.docker.com/introduction/understanding-docker/) in order to
get a basic understanding of Docker.

With the `Ewok` stack your application is run using Docker containers from
Docker Hub - linked together just as you would have locally or in production.
Yay for identical environments!!

## Boxes

You application code is run in a primary container (known as a `box`).  In Ewok
the name this `box` is the name of a [Docker
image](http://docs.docker.com/terms/container/) from [Docker
Hub](https://hub.docker.com/) + an optional image tag.

```yaml
box: node:0.10
```

## Services

Adhering to the [Docker best
practices](https://docs.docker.com/articles/dockerfile_best-practices/) you
should only run a single process per container.  If your application depends on
another service (such as a database or a cache) you can link multiple containers
together using `services`.

The services directive looks just like a box, but you can define as many of them
as you like.  They will automatically be linked together with your box before your
application starts.

```yaml
services:
    - mongo:2.6
    - redis:2.8
```

When Wercker starts, any service you have defined will be started and [linked
together](http://docs.docker.com/userguide/dockerlinks/) with your box
automatically.  The IP-address of a given service will be available as a
hostname corresponding to the name of the image.  Any ports exposed by the
container can be used as they are.

Wercker also has support for [advanced service
configurations](http://devcenter.wercker.com/docs/services/advanced-services.html),
such as injecting custom environment variables and altering the startup command.

```yaml
services:
    - id: mariadb
      env:
          MYSQL_ROOT_USERNAME: myusername
          MYSQL_ROOT_PASSWORD: mysecretpassword
```

## Build Steps

Your containers are started and linked together, and it is time to run the
build. This is done with one, or many, build steps. Wercker has an
astonishingly amount of pre-defined build steps for every language in their
step registry.

```
build:
    steps:
        - npm-install
        - npm-test
```

You can also submit your own build steps to the step registry, or script them in
your build configuration using the `script` build step like this.

```
build:
    steps:
        - script:
            name: my custom script
            code: |
                # some command
                # more command
```

## Putting it all togheter

And there you have it; `box`, `services` and `build steps` all go into one file
in your project repository named `wercker.yml`.  This is your Wercker build
configuration file.

```yaml
box: node:0.10

services:
    - mongo:2.6
    - redis:2.8

build:
    steps:
        - npm-install
        - npm-test
```

## Getting Started

You can read more about the Wercker platform at
[devcenter.wercker.com](http://devcenter.wercker.com), or check out their GitHub
repo [werkcer/docs](https://github.com/wercker/docs) where you can search
through all of their documentation which is nicely formatted in Markdown.

Wercker also provides a lot of example projects to get you started.  Check them
out as well:

 * [Python Wercker Example](https://github.com/wercker/getting-started-python)
 * [Go Wercker Example](https://github.com/wercker/getting-started-golang)
 * [Node.JS Wercker Example](https://github.com/wercker/getting-started-nodejs)
 * [Ruby Wercker Example](https://github.com/wercker/getting-started-ruby)


text:
module ReifiesHelper
end


text:
namespace _02.BankAccounts.Bank
{
    public enum CustomerType
    {
        Individual = 0,
        Company = 1
    }
}


text:
using System;

namespace MvcTemplate.Components.Security
{
    public interface IAuthorizationProvider
    {
        Boolean IsAuthorizedFor(Int32? accountId, String area, String controller, String action);

        void Refresh();
    }
}


text:
**If you saw `Error: uninitialized constant Formulary::HOMEBREW_CORE_FORMULA_REGEX. Please report this bug: ...` don't worry: it's [already been fixed](https://github.com/Homebrew/homebrew/commit/ac5707c37470c25583d8fb712bf5dc04ab91db4b). Please only create an issue (or comment on [the existing one](https://github.com/Homebrew/homebrew/issues/42553)) if running `brew update` again doesn't fix it. Thanks!**

## Read this first!

Please run `brew update` and `brew doctor` *before* creating an issue!

If you create an issue related to a formula, please also create a [Gist][] by running

```
brew gist-logs <formula name>
```

and include a link to the gist in the issue.

Read on for more detailed instructions.

Thank you!

## Check for common issues
* Run `brew update` — then try again.
* Run `brew doctor` — the doctor diagnoses common issues.
* Read through the [Common Issues](Common-Issues.md) page.
* If you're installing something Java-related, maybe you need the [Java Developer Update][] or [JDK 7][]?
* If things fail with permissions errors, check the permissions in `/usr/local`. If you're unsure what to do, you can `sudo chown -R $(whoami) /usr/local`.

#### Listen to Dr. Brew

* If `brew doctor` warns about unbrewed dylibs, be advised that they are **very likely to cause build problems**.

## Check to see if the issue has been reported
* Browse open issues on the [issue tracker](https://github.com/Homebrew/linuxbrew/issues) to see if someone else has already reported the same problem.
* Make sure you check issues on the correct repository. If the formula that failed to build is part of a tap, like [homebrew-science](https://github.com/Homebrew/homebrew-science) or [homebrew-dupes](https://github.com/Homebrew/homebrew-dupes), check there instead.

## Create an issue

1. [Create a new issue](https://github.com/Homebrew/linuxbrew/issues/new)
  * Again, make sure you file the issue against the correct repository.
  * If you are reporting a build failure, title it "\<formula name> failed to build on \<Distribution> \<Version>", where \<formula name> is the name of the formula that failed to build, and \<Distribution> and \<Version> is the Linux distribution and version you are using, e.g., Ubuntu Trusty.
  * Otherwise, choose a title that best describes the problem you are experiencing.

2. Upload a [Gist][] with relevant debugging information
  * The simplest method is to run `brew gist-logs <formula name>`
  * You can also create a [Gist][] manually. Include the following:
     1. The output from `HOMEBREW_MAKE_JOBS=1 brew install -v <formula name> 2>&1`
     2. The contents of the largest numbered log in `~/Library/Logs/Homebrew/<formula name>`, e.g. `03.make`
     3. The output from `brew config` and `brew doctor`
  * If you are reporting a bug rather than a build failure, please include `brew config`, `brew doctor`, and enough information to reliably reproduce the bug.

3. Include a link to the gist in your new issue
  * Be sure to use the `https:` URL (i.e. the URL in your browser's address bar), not the `git:` URL.

[Gist]:https://gist.github.com
[Apple Developer]:https://developer.apple.com/downloads
[Java Developer Update]:https://support.apple.com/kb/DL1572
[JDK 7]:https://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-install-faq.html


text:
import {Req} from "@tsed/common";
import {Context} from "aws-lambda";

/**
 * Return the Serverless context
 * @decorator
 */
export function ServerlessContext(): ParameterDecorator {
  return Req("serverless.context");
}

export type ServerlessContext = Context;


text:
module ActiveRecord
  module AttributeMethods
    module Serialization
      module ClassMethods

        def serializable method, class_name = Object

          coder = if [:load, :dump].all? { |x| class_name.respond_to?(x) }
                    class_name
                  else
                    Coders::YAMLColumn.new(class_name)
                  end

          self.send(:define_method, "#{method}") do
            if self[method]
              @serializable_cache ||= {}
              @serializable_cache[method] ||= coder.load(self[method])
            else
              nil
            end
          end

          self.send(:define_method, "#{method}=") do |value|
            @serializable_cache ||= {}
            @serializable_cache[method] = value

            self[method] = coder.dump(value)
          end

        end

      end
    end
  end
end


text:
namespace rubinius {
  struct CallFrame;
  class Dispatch;
  class Arguments;
  class BlockEnvironment;

  class BlockAsMethod : public Executable {
  public:
    const static object_type type = BlockAsMethodType;

  private:
    BlockEnvironment* block_env_; // slot

  public:
    attr_accessor(block_env, BlockEnvironment);

    // Rubinius.primitive :block_as_method_create
    static BlockAsMethod* create(STATE, Object* self, BlockEnvironment* be);

    static Object* block_executor(STATE, CallFrame* call_frame,
                           Executable* exec, Module* mod, Arguments& args);

    class Info : public Executable::Info {
    public:
      BASIC_TYPEINFO(Executable::Info)
    };
  };
}


text:
package org.keycloak.testsuite.account;

import org.jboss.arquillian.graphene.page.Page;
import org.junit.After;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.keycloak.testsuite.auth.page.account.Account;

/**
 *
 * @author Petr Mensik
 * @author tkyjovsk
 */
public class AccountTest extends AbstractAccountManagementTest {

    private static final String UPDATED_EMAIL = "new-name@email.test";
    private static final String NEW_FIRST_NAME = "John";
    private static final String NEW_LAST_NAME = "Smith";

    @Page
    private Account testRealmAccountPage;

    @Override
    public void setDefaultPageUriParameters() {
        super.setDefaultPageUriParameters();
        testRealmAccountPage.setAuthRealm(testRealmPage);
    }

    @Before
    public void beforeAccountTest() {
        testRealmAccountManagementPage.navigateTo();
        testRealmLoginPage.form().login(testUser);
    }

    @After
    public void afterAccountTest() {
        testRealmAccountManagementPage.navigateTo();
        testRealmAccountManagementPage.signOut();
    }

    @Test
    public void editAccount() {
        testRealmAccountManagementPage.account();
        assertEquals(testRealmAccountPage.getUsername(), testUser.getUsername());

        testRealmAccountPage.setEmail(UPDATED_EMAIL);
        testRealmAccountPage.setFirstName(NEW_FIRST_NAME);
        testRealmAccountPage.setLastName(NEW_LAST_NAME);
        testRealmAccountPage.save();
        assertAlertSuccess();

        testRealmAccountManagementPage.signOut();
        testRealmLoginPage.form().login(testUser);

        testRealmAccountManagementPage.account();
        assertEquals(testRealmAccountPage.getEmail(), UPDATED_EMAIL);
        assertEquals(testRealmAccountPage.getFirstName(), NEW_FIRST_NAME);
        assertEquals(testRealmAccountPage.getLastName(), NEW_LAST_NAME);
    }

}


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

	sap.ui.controller("sap.ui.core.mvctest.controller.Async", {

		onInit: function() {
			this.myLayout = this.byId("Layout");

			this.showDetailsLink = this.byId("showMore");
			this.hideDetailsLink = this.byId("hideMore");

			this.myLayout.setWidths(["100px","150px"]);
			this.hideMore();
		},

		showMore: function(oEvent) {
			for (var i = 1; i < 4; i++) {
				this.byId("More" + i).setVisible(true);
				this.byId("TFMore" + i).setVisible(true);
			}
			this.showDetailsLink.setVisible(false);
			this.hideDetailsLink.setVisible(true);
		},

		hideMore: function(oEvent) {
			for (var i = 1; i < 4; i++) {
				this.byId("More" + i).setVisible(false);
				this.byId("TFMore" + i).setVisible(false);
			}
			this.showDetailsLink.setVisible(true);
			this.hideDetailsLink.setVisible(false);
		}
	});

}());


text:
#pragma once
//------------------------------------------------------------------------------
/**
    @class Oryol::Args
    @ingroup Core
    @brief access command line args
    @see AppEntry

    The command line args are extracted by the platform-specific OryolApp()
    macro and handed to the OryolMain() function. Not all platform support
    command line arguments. Arguments will be split by space and tab, the fence
    character is ". There is no special handling for "-" or "--". There
    is no key-value-pair concept built in, the number of arguments is simply
    the number of string tokens separated by spaces.

    Example:
    ```
    // -name "Jack Shaftoe" -age 30 -male

    args.HasArg("-name") => true
    args.GetString("-name") => "Jack Shaftoe"
    args.GetInt("-age") => 30
    args.GetInt("-bla", 10) => 10 (default value since arg not present)
    args.HasArg("-male") => true
    args.HasArg("-female") => false
    ```
*/
#include "Core/Types.h"
#include "Core/String/String.h"
#include "Core/String/WideString.h"
#include "Core/Containers/Array.h"

namespace Oryol {

class Args {
public:
    /// default constructor
    Args();
    /// construct from string
    Args(const String& str);
    /// construct from wide-string (args will be converted to UTF-8)
    Args(const WideString& wstr);
    /// construct from c-style main args
    Args(int argc, const char** argv);

    /// test if an argument exists
    bool HasArg(const String& arg) const;
    /// get string after 'arg', or default value if 'arg' doesn't exist
    String GetString(const String& arg, const String& defaultValue="") const;
    /// get int after 'arg', or default value if 'arg' doesn't exist
    int GetInt(const String& arg, int defaultValue=0) const;
    /// get float after 'arg', or default value if 'arg' doesn't exist
    float GetFloat(const String& arg, float defaultValue=0.0f) const;
    /// gives you access to all of the arguments that were provided to the application
    const Array<String>& GetArgs() const;
private:
    Array<String> args;
};

} // namespace Oryol


text:
package feerefund

import (
	"fmt"
	"net/http"

	stripe "github.com/stripe/stripe-go"
	"github.com/stripe/stripe-go/form"
)

// Client is used to invoke /application_fees/refunds APIs.
type Client struct {
	B   stripe.Backend
	Key string
}

// New creates an application fee refund.
func New(params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {
	return getC().New(params)
}

// New creates an application fee refund.
func (c Client) New(params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {
	if params == nil {
		return nil, fmt.Errorf("params cannot be nil")
	}
	if params.ApplicationFee == nil {
		return nil, fmt.Errorf("params.ApplicationFee must be set")
	}

	path := stripe.FormatURLPath("/v1/application_fees/%s/refunds",
		stripe.StringValue(params.ApplicationFee))
	refund := &stripe.FeeRefund{}
	err := c.B.Call(http.MethodPost, path, c.Key, params, refund)
	return refund, err
}

// Get returns the details of an application fee refund.
func Get(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {
	return getC().Get(id, params)
}

// Get returns the details of an application fee refund.
func (c Client) Get(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {
	if params == nil {
		return nil, fmt.Errorf("params cannot be nil")
	}
	if params.ApplicationFee == nil {
		return nil, fmt.Errorf("params.ApplicationFee must be set")
	}

	path := stripe.FormatURLPath("/v1/application_fees/%s/refunds/%s",
		stripe.StringValue(params.ApplicationFee), id)
	refund := &stripe.FeeRefund{}
	err := c.B.Call(http.MethodGet, path, c.Key, params, refund)
	return refund, err
}

// Update updates an application fee refund.
func Update(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {
	return getC().Update(id, params)
}

// Update updates an application fee refund.
func (c Client) Update(id string, params *stripe.FeeRefundParams) (*stripe.FeeRefund, error) {
	if params == nil {
		return nil, fmt.Errorf("params cannot be nil")
	}
	if params.ApplicationFee == nil {
		return nil, fmt.Errorf("params.ApplicationFee must be set")
	}

	path := stripe.FormatURLPath("/v1/application_fees/%s/refunds/%s",
		stripe.StringValue(params.ApplicationFee), id)
	refund := &stripe.FeeRefund{}
	err := c.B.Call(http.MethodPost, path, c.Key, params, refund)

	return refund, err
}

// List returns a list of application fee refunds.
func List(params *stripe.FeeRefundListParams) *Iter {
	return getC().List(params)
}

// List returns a list of application fee refunds.
func (c Client) List(listParams *stripe.FeeRefundListParams) *Iter {
	path := stripe.FormatURLPath("/v1/application_fees/%s/refunds",
		stripe.StringValue(listParams.ApplicationFee))

	return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListMeta, error) {
		list := &stripe.FeeRefundList{}
		err := c.B.CallRaw(http.MethodGet, path, c.Key, b, p, list)

		ret := make([]interface{}, len(list.Data))
		for i, v := range list.Data {
			ret[i] = v
		}

		return ret, list.ListMeta, err
	})}
}

// Iter is an iterator for application fee refunds.
type Iter struct {
	*stripe.Iter
}

// FeeRefund returns the application fee refund which the iterator is currently pointing to.
func (i *Iter) FeeRefund() *stripe.FeeRefund {
	return i.Current().(*stripe.FeeRefund)
}

func getC() Client {
	return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}


text:
<?php

namespace SVApp\Classes;

class RedisCache extends \Doctrine\Common\Cache\RedisCache {
	public function get($key, \Closure $fallback = null, $expiration = null) {
		$result = $this->fetch($key);

		if ($result === false && $fallback instanceof \Closure) {
			$result = $fallback();
			if ($this->save($key, $result, $expiration) === false) {
				return false;
			}
		}

		return $result;
	}

	/**
	 * Clears Redis cache by pattern (or everything if empty)
	 *
	 * @param string $pattern
	 * @return int
	 */
	public function flushCurrent($pattern = '') {
		$fullPattern = '*' . $pattern;

		$c=0;
		$cr = $this->getRedis()->keys($fullPattern);
		foreach ($cr as $oneKey) {
			list(, $key) = explode (':', $oneKey);

			$this->doDelete($key);
			$c++;
		}
		return $c;
	}
}


text:
My heroes

  Hero name:
  <input #heroName/>
  <button type="button" class="btn btn-primary" (click)="add(heroName.value); heroName.value=''">
    Add
  </button>

    {{hero.id}}
    {{hero.name}}
    <button type="button" class="btn btn-danger btn-sm pull-xs-right" (click)="delete(hero); $event.stopPropagation()">x</button>

    {{selectedHero.name | uppercase}} is my hero

  <button type="button" class="btn btn-primary" (click)="gotoDetail()">View Details</button>


text:
package org.mycontroller.standalone.db.tables;

import org.mycontroller.standalone.db.DB_TABLES;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @author Jeeva Kandasamy (jkandasa)
 * @since 0.0.3
 */
@DatabaseTable(tableName = DB_TABLES.ALARM_NOTIFICATION_MAP)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString(includeFieldNames = true)
public class NotificationAlarmDefinitionMap {
    public static final String KEY_NOTIFICATION_ID = "notificationId";
    public static final String KEY_ALARM_DEFINITION_ID = "alarmDefinitionId";

    @DatabaseField(canBeNull = false, columnName = KEY_ALARM_DEFINITION_ID, uniqueCombo = true, foreign = true,
            foreignAutoRefresh = true, maxForeignAutoRefreshLevel = 0)
    private AlarmDefinition alarmDefinition;
    @DatabaseField(canBeNull = false, columnName = KEY_NOTIFICATION_ID, uniqueCombo = true, foreign = true,
            foreignAutoRefresh = true, maxForeignAutoRefreshLevel = 0)
    private Notification notification;

}


text:
package com.amazonaws.services.apigateway.model;

import com.amazonaws.hal.*;
import com.amazonaws.http.*;

import java.util.*;

public interface BasePathMappings extends ResourceInfo {

    /**
     *
     */
    @Link(relation = "basepathmapping:by-path")
    BasePathMapping getBasePathMappingByPath(
        @UriVariable(name = "base_path") String basePath);

    /**
     *
     */
    @Link(relation = "basepathmapping:create", method = HttpMethodName.POST)
    BasePathMapping createBasePathMapping(CreateBasePathMappingInput createBasePathMappingInput);

    /**
     *
     */
    @Link(relation = "next")
    BasePathMappings getNext();

    /**
     *
     */
    @Link(relation = "first")
    BasePathMappings getFirst();

    /**
     *
     */
    @Link(relation = "item")
    java.util.List<BasePathMapping> getItem();

}