text:
#ifndef _S5P_MIPI_DSI_LOWLEVEL_H
#define _S5P_MIPI_DSI_LOWLEVEL_H

void s5p_mipi_dsi_func_reset(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_sw_reset(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_set_interrupt_mask(struct mipi_dsim_device *dsim,
		unsigned int mode, unsigned int mask);
void s5p_mipi_dsi_set_data_lane_number(struct mipi_dsim_device *dsim,
		unsigned int count);
void s5p_mipi_dsi_init_fifo_pointer(struct mipi_dsim_device *dsim,
		unsigned int cfg);
void s5p_mipi_dsi_set_phy_tunning(struct mipi_dsim_device *dsim,
		unsigned int value);
void s5p_mipi_dsi_set_main_disp_resol(struct mipi_dsim_device *dsim,
		unsigned int vert_resol, unsigned int hori_resol);
void s5p_mipi_dsi_set_main_disp_vporch(struct mipi_dsim_device *dsim,
	unsigned int cmd_allow, unsigned int vfront, unsigned int vback);
void s5p_mipi_dsi_set_main_disp_hporch(struct mipi_dsim_device *dsim,
		unsigned int front, unsigned int back);
void s5p_mipi_dsi_set_main_disp_sync_area(struct mipi_dsim_device *dsim,
		unsigned int vert, unsigned int hori);
void s5p_mipi_dsi_set_sub_disp_resol(struct mipi_dsim_device *dsim,
		unsigned int vert, unsigned int hori);
void s5p_mipi_dsi_init_config(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_display_config(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_set_data_lane_number(struct mipi_dsim_device *dsim,
		unsigned int count);
void s5p_mipi_dsi_enable_lane(struct mipi_dsim_device *dsim,
		unsigned int lane, unsigned int enable);
void s5p_mipi_dsi_enable_afc(struct mipi_dsim_device *dsim,
		unsigned int enable, unsigned int afc_code);
void s5p_mipi_dsi_enable_pll_bypass(struct mipi_dsim_device *dsim,
		unsigned int enable);
void s5p_mipi_dsi_set_pll_pms(struct mipi_dsim_device *dsim,
		unsigned int p, unsigned int m, unsigned int s);
void s5p_mipi_dsi_pll_freq_band(struct mipi_dsim_device *dsim,
		unsigned int freq_band);
void s5p_mipi_dsi_pll_freq(struct mipi_dsim_device *dsim,
		unsigned int pre_divider, unsigned int main_divider,
		unsigned int scaler);
void s5p_mipi_dsi_pll_stable_time(struct mipi_dsim_device *dsim,
		unsigned int lock_time);
void s5p_mipi_dsi_enable_pll(struct mipi_dsim_device *dsim,
		unsigned int enable);
void s5p_mipi_dsi_set_byte_clock_src(struct mipi_dsim_device *dsim,
		unsigned int src);
void s5p_mipi_dsi_enable_byte_clock(struct mipi_dsim_device *dsim,
		unsigned int enable);
void s5p_mipi_dsi_set_esc_clk_prs(struct mipi_dsim_device *dsim,
		unsigned int enable, unsigned int prs_val);
void s5p_mipi_dsi_enable_esc_clk_on_lane(struct mipi_dsim_device *dsim,
		unsigned int lane_sel, unsigned int enable);
void s5p_mipi_dsi_force_dphy_stop_state(struct mipi_dsim_device *dsim,
		unsigned int enable);
void s5p_mipi_dsi_force_bta(struct mipi_dsim_device *dsim);
unsigned int s5p_mipi_dsi_is_lane_state(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_set_stop_state_counter(struct mipi_dsim_device *dsim,
		unsigned int cnt_val);
void s5p_mipi_dsi_set_bta_timeout(struct mipi_dsim_device *dsim,
		unsigned int timeout);
void s5p_mipi_dsi_set_lpdr_timeout(struct mipi_dsim_device *dsim,
		unsigned int timeout);
void s5p_mipi_dsi_set_lcdc_transfer_mode(struct mipi_dsim_device *dsim,
		unsigned int lp);
void s5p_mipi_dsi_set_cpu_transfer_mode(struct mipi_dsim_device *dsim,
		unsigned int lp);
void s5p_mipi_dsi_enable_hs_clock(struct mipi_dsim_device *dsim,
		unsigned int enable);
void s5p_mipi_dsi_dp_dn_swap(struct mipi_dsim_device *dsim,
		unsigned int swap_en);
void s5p_mipi_dsi_hs_zero_ctrl(struct mipi_dsim_device *dsim,
		unsigned int hs_zero);
void s5p_mipi_dsi_prep_ctrl(struct mipi_dsim_device *dsim, unsigned int
		prep);
void s5p_mipi_dsi_clear_interrupt(struct mipi_dsim_device *dsim,
		unsigned int int_src);
void s5p_mipi_dsi_clear_all_interrupt(struct mipi_dsim_device *dsim);
unsigned int s5p_mipi_dsi_is_pll_stable(struct mipi_dsim_device *dsim);
unsigned int s5p_mipi_dsi_get_fifo_state(struct mipi_dsim_device *dsim);
unsigned int _s5p_mipi_dsi_get_frame_done_status(struct mipi_dsim_device *dsim);
void _s5p_mipi_dsi_clear_frame_done(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_wr_tx_header(struct mipi_dsim_device *dsim,
		unsigned int di, unsigned int data0, unsigned int data1);
void s5p_mipi_dsi_wr_tx_data(struct mipi_dsim_device *dsim,
		unsigned int tx_data);
unsigned int s5p_mipi_dsi_get_int_status(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_clear_int_status(struct mipi_dsim_device *dsim, unsigned int intSrc);
unsigned int s5p_mipi_dsi_get_FIFOCTRL_status(struct mipi_dsim_device *dsim);
void s5p_mipi_dsi_set_b_dphyctrl(struct mipi_dsim_device *dsim,
	unsigned int ulpsexitctrl);
void s5p_mipi_dsi_set_timing_register0(struct mipi_dsim_device *dsim,
	unsigned int m_tlpxctl, unsigned int m_thsexitctl);
void s5p_mipi_dsi_set_timing_register1(struct mipi_dsim_device *dsim,
	unsigned int m_tclkprprctl, unsigned int m_tclkzeroctl,
	unsigned int m_tclkpostctl, unsigned int m_tclktrailctl);
void s5p_mipi_dsi_set_timing_register2(struct mipi_dsim_device *dsim,
	unsigned int m_thsprprctl, unsigned int m_thszeroctl,
	unsigned int m_thstrailctl);
#endif /* _S5P_MIPI_DSI_LOWLEVEL_H */


text:
<?php
namespace Owl\Service;

// https://github.com/nrk/predis
if (!class_exists('\Predis\Client')) {
    throw new \Exception('Require Predis library');
}

/**
 * @example
 * $parameters = [
 *     'scheme' => 'tcp',
 *     'host' => '127.0.0.1',
 *     'port' => 6379,
 *     'database' => 1,
 *     'persistent' => true,
 *     'timeout' => 3.0,
 * ];
 *
 * $options = [
 *     'exception' => true,
 * ];
 *
 * $redis = new \Owl\Service\Predis($parameters, $options);
 */
class Predis extends \Owl\Service {
    protected $client;

    protected $command_alias = [
        'settimeout' => 'expire',
        'delete' => 'del',
    ];

    public function __call($method, array $args) {
        $client = $this->connect();

        $command = strtolower($method);
        if (isset($this->command_alias[$command])) {
            $method = $this->command_alias[$command];
        }

        return $args ? call_user_func_array([$client, $method], $args) : $client->$method();
    }

    public function connect() {
        if (!$this->client || !$this->client->isConnected()) {
            $parameters = $this->getConfig('parameters');
            $options = $this->getConfig('options') ?: [];

            $this->client = new \Predis\Client($parameters, $options);
        }

        return $this->client;
    }

    public function disconnect() {
        if ($this->client) {
            $parameters = $this->getConfig('parameters');

            $is_persistent = isset($parameters['persistent']) && $parameters['persistent'];
            if (!$is_persistent) {
                $this->client->disconnect();
            }

            $this->client = null;
        }
    }

    public function multi() {
        return $this->connect()->transaction();
    }

    public function hMGet($key, array $fields) {
        $redis = $this->connect();

        $values = $redis->hmget($key, $fields);

        $result = [];
        foreach ($values as $i => $value) {
            $key = $fields[$i];

            $result[$key] = $value;
        }

        return $result;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.karuslabs.commons.item.meta;

import com.karuslabs.commons.item.Builder;

import java.util.*;
import javax.annotation.Nonnull;

import org.bukkit.block.banner.Pattern;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;

import static org.bukkit.Material.BANNER;

public class BannerBuilder extends Builder<BannerBuilder, BannerMeta> {

    public BannerBuilder() {
        this(new ItemStack(BANNER));
    }

    public BannerBuilder(ItemStack item) {
        super(item);
    }

    public BannerBuilder(Builder builder) {
        super(builder);
    }

    public BannerBuilder pattern(Pattern pattern) {
        meta.addPattern(pattern);
        return this;
    }

    public BannerBuilder patterns(List<Pattern> patterns) {
        meta.getPatterns().addAll(patterns);
        return this;
    }

    @Override
    protected @Nonnull BannerBuilder getThis() {
        return this;
    }

}


text:
package io.druid.server.metrics;

import com.google.inject.Inject;
import com.metamx.emitter.service.ServiceEmitter;
import com.metamx.emitter.service.ServiceMetricEvent;
import com.metamx.metrics.AbstractMonitor;
import io.druid.client.DruidServerConfig;
import io.druid.query.DruidMetrics;
import io.druid.server.coordination.ServerManager;

import java.util.Map;

public class HistoricalMetricsMonitor extends AbstractMonitor
{
  private final DruidServerConfig serverConfig;
  private final ServerManager serverManager;

  @Inject
  public HistoricalMetricsMonitor(
      DruidServerConfig serverConfig,
      ServerManager serverManager
  )
  {
    this.serverConfig = serverConfig;
    this.serverManager = serverManager;
  }

  @Override
  public boolean doMonitor(ServiceEmitter emitter)
  {
    emitter.emit(new ServiceMetricEvent.Builder().build("segment/max", serverConfig.getMaxSize()));

    for (Map.Entry<String, Long> entry : serverManager.getDataSourceSizes().entrySet()) {
      String dataSource = entry.getKey();
      long used = entry.getValue();

      final ServiceMetricEvent.Builder builder =
          new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource)
                                          .setDimension("tier", serverConfig.getTier())
                                          .setDimension("priority", String.valueOf(serverConfig.getPriority()));

      emitter.emit(builder.build("segment/used", used));
      final double usedPercent = serverConfig.getMaxSize() == 0 ? 0 : used / (double) serverConfig.getMaxSize();
      emitter.emit(builder.build("segment/usedPercent", usedPercent));
    }

    for (Map.Entry<String, Long> entry : serverManager.getDataSourceCounts().entrySet()) {
      String dataSource = entry.getKey();
      long count = entry.getValue();
      final ServiceMetricEvent.Builder builder =
          new ServiceMetricEvent.Builder().setDimension(DruidMetrics.DATASOURCE, dataSource)
                                          .setDimension("tier", serverConfig.getTier())
                                          .setDimension(
                                              "priority",
                                              String.valueOf(serverConfig.getPriority())
                                          );

      emitter.emit(builder.build("segment/count", count));
    }

    return true;
  }
}


text:
from rest_framework import generics, serializers
from rest_framework.response import Response

from waffle.decorators import waffle_switch

from olympia import amo
from olympia.addons.models import Addon

class AddonSerializer(serializers.ModelSerializer):
    addon_type = serializers.SerializerMethodField('get_addon_type')
    description = serializers.CharField()
    download_url = serializers.SerializerMethodField('get_download_url')
    icons = serializers.SerializerMethodField('get_icons')
    name = serializers.CharField()
    rating = serializers.FloatField(source='average_rating')
    summary = serializers.CharField()

    class Meta:
        model = Addon
        fields = [
            'addon_type',
            'description',
            'download_url',
            'icons',
            'id',
            'guid',
            'name',
            'rating',
            'slug',
            'summary',
        ]

    def get_addon_type(self, instance):
        return unicode(amo.ADDON_TYPE[instance.type])

    def get_icons(self, instance):
        return {
            '32': instance.get_icon_url(32),
            '64': instance.get_icon_url(64),
        }

    def get_download_url(self, instance):
        return instance.current_version.all_files[0].get_url_path('mozlando')

base_queryset = Addon.objects.public().filter(type__in=amo.GROUP_TYPE_ADDON)

class SearchView(generics.RetrieveAPIView):
    serializer_class = AddonSerializer

    @waffle_switch('frontend-prototype')
    def retrieve(self, request, *args, **kwargs):
        queryset = base_queryset
        if 'q' in request.GET:
            queryset = queryset.filter(slug__contains=request.GET['q'])
        serializer = self.get_serializer(queryset[:20], many=True)
        return Response(serializer.data, headers={
            'Access-Control-Allow-Origin': '*',
        })

class DetailView(generics.RetrieveAPIView):
    serializer_class = AddonSerializer

    @waffle_switch('frontend-prototype')
    def retrieve(self, request, slug, *args, **kwargs):
        queryset = base_queryset.filter(slug=slug)
        try:
            serializer = self.get_serializer(queryset.get())
        except Addon.DoesNotExist:
            return Response({'detail': 'Not Found'}, headers={
                'Access-Control-Allow-Origin': '*',
            }, status=404)
        else:
            return Response(serializer.data, headers={
                'Access-Control-Allow-Origin': '*',
            })


text:
package org.kaaproject.kaa.server.common.log.shared;

import java.io.IOException;

import org.apache.avro.Schema;
import org.kaaproject.kaa.server.common.log.shared.avro.gen.RecordHeader;
import org.kaaproject.kaa.server.common.utils.FileUtils;

public class RecordWrapperSchemaGenerator {

    public static String RECORD_HEADER_FIELD = "recordHeader";
    public static String RECORD_DATA_FIELD = "recordData";

    /** The Constant RECORD_WRAPPER_SCHEMA_TEMPLATE. */
    private static final String RECORD_WRAPPER_SCHEMA_TEMPLATE = "avro/record_wrapper_schema.avsc.template";

    /** The Constant RECORD_HEADER_SCHEMA_VAR. */
    private static final String RECORD_HEADER_SCHEMA_VAR = "\\$\\{record_header_schema\\}";

    /** The Constant RECORD_DATA_SCHEMA_VAR. */
    private static final String RECORD_DATA_SCHEMA_VAR = "\\$\\{record_data_schema\\}";

    private static String recordWrapperSchemaTemplate;

    public static Schema generateRecordWrapperSchema(String userRecordSchema) throws IOException {
        if (recordWrapperSchemaTemplate == null) {
            recordWrapperSchemaTemplate = FileUtils.readResource(RECORD_WRAPPER_SCHEMA_TEMPLATE);
            String recordHeaderSchema = RecordHeader.getClassSchema().toString();
            recordWrapperSchemaTemplate = recordWrapperSchemaTemplate.replaceAll(RECORD_HEADER_SCHEMA_VAR, recordHeaderSchema);
        }
        String recordWrapperSchemaString = recordWrapperSchemaTemplate.replaceAll(RECORD_DATA_SCHEMA_VAR, userRecordSchema);
        Schema.Parser parser = new Schema.Parser();
        Schema recordWrapperSchema = parser.parse(recordWrapperSchemaString);
        return recordWrapperSchema;
    }

}


text:
package org.keycloak.admin.client.resource;

import java.util.List;
import java.util.Map;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

public interface RealmLocalizationResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    List<String> getRealmSpecificLocales();

    @Path("{locale}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    Map<String, String> getRealmLocalizationTexts(final @PathParam("locale") String locale);

    @Path("{locale}/{key}")
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    String getRealmLocalizationText(final @PathParam("locale") String locale, final @PathParam("key") String key);

    @Path("{locale}")
    @DELETE
    void deleteRealmLocalizationTexts(@PathParam("locale") String locale);

    @Path("{locale}/{key}")
    @DELETE
    void deleteRealmLocalizationText(@PathParam("locale") String locale, @PathParam("key") String key);

    @Path("{locale}/{key}")
    @PUT
    @Consumes(MediaType.TEXT_PLAIN)
    void saveRealmLocalizationText(@PathParam("locale") String locale, @PathParam("key") String key, String text);

    @Path("{locale}")
    @POST
    @Consumes("application/json")
    void createOrUpdateRealmLocalizationTexts(@PathParam("locale") String locale, Map<String, String> localizationTexts);
}


text:
using System;
using System.Collections.Generic;

namespace ClosedXML.Excel
{
    internal interface IXLStylized
    {
        IXLStyle Style { get; set; }
        IEnumerable<IXLStyle> Styles { get; }
        Boolean UpdatingStyle { get; set; }
        IXLStyle InnerStyle { get; set; }
        IXLRanges RangesUsed { get; }
        Boolean StyleChanged { get; set; }
        //Boolean IsDefault { get; set; }
    }
}


text:
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package google.registry.rde;

import com.google.common.base.Splitter;
import com.google.common.flogger.FluentLogger;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpException;
import google.registry.config.RegistryConfig.Config;
import java.io.Closeable;
import java.net.URI;
import javax.inject.Inject;
import org.joda.time.Duration;

/**
 * SFTP connection {@link Session} delegate that implements {@link Closeable}.
 *
 * <p>This class acts as syntactic sugar for JSch so we can open and close SFTP connections in a
 * way that's friendlier to Java 7 try-resource statements. Delegate methods are provided on an
 * as-needed basis.
 *
 * @see JSchSftpChannel
 * @see RdeUploadAction
 * @see com.jcraft.jsch.Session
 */
final class JSchSshSession implements Closeable {

  private static final FluentLogger logger = FluentLogger.forEnclosingClass();

  /** Factory for {@link JSchSshSession}. */
  static final class JSchSshSessionFactory {

    private final Duration sshTimeout;

    @Inject
    JSchSshSessionFactory(@Config("sshTimeout") Duration sshTimeout) {
      this.sshTimeout = sshTimeout;
    }

    /**
     * Connect to remote SSH endpoint specified by {@code url}.
     *
     * @throws JSchException if we fail to open the connection.
     */
    JSchSshSession create(JSch jsch, URI uri) throws JSchException {
      RdeUploadUrl url = RdeUploadUrl.create(uri);
      logger.atInfo().log("Connecting to SSH endpoint: %s", url);
      Session session = jsch.getSession(
          url.getUser().orElse("domain-registry"),
          url.getHost(),
          url.getPort());
      if (url.getPass().isPresent()) {
        session.setPassword(url.getPass().get());
      }
      session.setTimeout((int) sshTimeout.getMillis());
      session.connect((int) sshTimeout.getMillis());
      return new JSchSshSession(session, url, (int) sshTimeout.getMillis());
    }
  }

  private final Session session;
  private final RdeUploadUrl url;
  private final int timeout;

  private JSchSshSession(Session session, RdeUploadUrl url, int timeout) {
    this.session = session;
    this.url = url;
    this.timeout = timeout;
  }

  /**
   * Opens a new SFTP channel over this SSH session.
   *
   * @throws JSchException
   * @throws SftpException
   * @see JSchSftpChannel
   */
  public JSchSftpChannel openSftpChannel() throws JSchException, SftpException {
    ChannelSftp chan = (ChannelSftp) session.openChannel("sftp");
    chan.connect(timeout);
    if (url.getPath().isPresent()) {
      String dir = url.getPath().get();
      try {
        chan.cd(dir);
      } catch (SftpException e) {
        logger.atWarning().withCause(e).log("Could not open SFTP channel.");
        mkdirs(chan, dir);
        chan.cd(dir);
      }
    }
    return new JSchSftpChannel(chan);
  }

  private void mkdirs(ChannelSftp chan, String dir) throws SftpException {
    StringBuilder pathBuilder = new StringBuilder(dir.length());
    for (String part : Splitter.on('/').omitEmptyStrings().split(dir)) {
      pathBuilder.append(part);
      chan.mkdir(pathBuilder.toString());
      pathBuilder.append('/');
    }
  }

  /** @see com.jcraft.jsch.Session#disconnect() */
  @Override
  public void close() {
    session.disconnect();
  }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.adexchangebuyer2.v2beta1.model;

/**
 * Represents a buyer of inventory. Each buyer is identified by a unique Authorized Buyers account
 * ID.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Ad Exchange Buyer API II. For a detailed explanation
 * see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Buyer extends com.google.api.client.json.GenericJson {

  /**
   * Authorized Buyers account ID of the buyer.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String accountId;

  /**
   * Authorized Buyers account ID of the buyer.
   * @return value or {@code null} for none
   */
  public java.lang.String getAccountId() {
    return accountId;
  }

  /**
   * Authorized Buyers account ID of the buyer.
   * @param accountId accountId or {@code null} for none
   */
  public Buyer setAccountId(java.lang.String accountId) {
    this.accountId = accountId;
    return this;
  }

  @Override
  public Buyer set(String fieldName, Object value) {
    return (Buyer) super.set(fieldName, value);
  }

  @Override
  public Buyer clone() {
    return (Buyer) super.clone();
  }

}


text:
 * order_reference:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: 9
 * id_currency:
    * lang: false
    * shop: false
    * validator: none
    * required: true
    * size: undefined
 * amount:
    * lang: false
    * shop: false
    * validator: none
    * required: true
    * size: undefined
 * payment_method:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: undefined
 * conversion_rate:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: undefined
 * transaction_id:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: 254
 * card_number:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: 254
 * card_brand:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: 254
 * card_expiration:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: 254
 * card_holder:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: 254
 * date_add:
    * lang: false
    * shop: false
    * validator: none
    * required: false
    * size: undefined


text:
package fr.ourten.brokkgui.wrapper;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import fr.ourten.brokkgui.data.EAlignment;
import fr.ourten.brokkgui.data.Vector2i;
import fr.ourten.brokkgui.internal.EGuiRenderMode;
import fr.ourten.brokkgui.internal.IGuiHelper;
import fr.ourten.brokkgui.internal.IGuiRenderer;
import fr.ourten.brokkgui.paint.Color;
import fr.ourten.brokkgui.paint.Texture;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;

public class GuiHelper implements IGuiHelper
{
    private final RenderItem itemRender;
    private final Minecraft  mc;

    public GuiHelper()
    {
        this.mc = Minecraft.getMinecraft();
        this.itemRender = new RenderItem();
    }

    @Override
    public final void bindTexture(final Texture texture)
    {
        this.mc.renderEngine.bindTexture(new ResourceLocation(texture.getResource()));
    }

    @Override
    public final void scissorBox(final float f, final float g, final float h, final float i)
    {
        final int width = (int) (h - f);
        final int height = (int) (i - g);
        final ScaledResolution sr = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
        final int factor = sr.getScaleFactor();
        final int bottomY = (int) (this.mc.currentScreen.height - i);
        GL11.glScissor((int) (f * factor), bottomY * factor, width * factor, height * factor);
    }

    // TODO: Handle UP/DOWN/LEFT/RIGHTS alignments combinaisons
    @Override
    public final void drawString(final String string, final int x, final int y, final float zLevel, final Color color,
            final EAlignment alignment, final boolean shadow)
    {
        if (zLevel != 0)
        {
            GL11.glPushMatrix();
            GL11.glTranslated(0, 0, zLevel);
        }
        if (!shadow)
            this.mc.fontRenderer.drawString(string,
                    x - (alignment.isHorizontalCentered() ? this.mc.fontRenderer.getStringWidth(string) / 2 : 0),
                    y - (alignment.isVerticalCentered() ? this.mc.fontRenderer.FONT_HEIGHT / 2 : 0), color.toInt());
        else
            this.mc.fontRenderer.drawStringWithShadow(string,
                    x - (alignment.isHorizontalCentered() ? this.mc.fontRenderer.getStringWidth(string) / 2 : 0),
                    y - (alignment.isVerticalCentered() ? this.mc.fontRenderer.FONT_HEIGHT / 2 : 0), color.toInt());
        if (zLevel != 0)
            GL11.glPopMatrix();
    }

    @Override
    public final void drawString(final String string, final double x, final double y, final float zLevel,
            final Color color, final boolean shadow)
    {
        this.drawString(string, (int) x, (int) y, zLevel, color, EAlignment.LEFT_UP, shadow);
    }

    @Override
    public final void drawString(final String string, final double x, final double y, final float zLevel,
            final Color color, final EAlignment alignment)
    {
        this.drawString(string, (int) x, (int) y, zLevel, color, alignment, true);
    }

    @Override
    public final void drawString(final String string, final double x, final double y, final float zLevel,
            final Color color)
    {
        this.drawString(string, (int) x, (int) y, zLevel, color, EAlignment.LEFT_UP, true);
    }

    @Override
    public final void drawTexturedModalRect(final IGuiRenderer renderer, final double xStart, final double yStart,
            final double uMin, final double vMin, final double uMax, final double vMax, final double width,
            final double height, final float zLevel)
    {
        renderer.beginDrawingQuads();
        renderer.addVertexWithUV(xStart + 0, yStart + height, zLevel, uMin, vMax);
        renderer.addVertexWithUV(xStart + width, yStart + height, zLevel, uMax, vMax);
        renderer.addVertexWithUV(xStart + width, yStart + 0, zLevel, uMax, vMin);
        renderer.addVertexWithUV(xStart + 0, yStart + 0, zLevel, uMin, vMin);
        renderer.endDrawing();
    }

    @Override
    public final void drawTexturedModalRect(final IGuiRenderer renderer, final double xStart, final double yStart,
            final double uMin, final double vMin, final double width, final double height, final float zLevel)
    {
        this.drawTexturedModalRect(renderer, xStart, yStart, uMin, vMin, 1, 1, width, height, zLevel);
    }

    @Override
    public final void drawColoredEmptyRect(final IGuiRenderer renderer, final float startX, final float startY,
            final float width, final float height, final float zLevel, final Color c, final float thin)
    {
        this.drawColoredRect(renderer, startX, startY, width - thin, thin, zLevel, c);
        this.drawColoredRect(renderer, startX + width - thin, startY, thin, height - thin, zLevel, c);
        this.drawColoredRect(renderer, startX + thin, startY + height - thin, width - thin, thin, zLevel, c);
        this.drawColoredRect(renderer, startX, startY + thin, thin, height - thin, zLevel, c);
    }

    @Override
    public final void drawColoredRect(final IGuiRenderer renderer, final float startX, final float startY,
            final float width, final float height, final float zLevel, final Color c)
    {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        renderer.beginDrawingQuads();
        GL11.glColor4f(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
        renderer.addVertex(startX, startY, zLevel);
        renderer.addVertex(startX, startY + height, zLevel);
        renderer.addVertex(startX + width, startY + height, zLevel);
        renderer.addVertex(startX + width, startY, zLevel);
        renderer.endDrawing();
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
    }

    @Override
    public final void drawColoredEmptyCircle(final IGuiRenderer renderer, final float startX, final float startY,
            final float radius, final float zLevel, final Color c, final float thin)
    {
        if (thin > 0)
        {
            float x = radius;
            float y = 0;
            float err = 0;

            GL11.glEnable(GL11.GL_BLEND);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            OpenGlHelper.glBlendFunc(770, 771, 1, 0);
            GL11.glColor4f(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
            renderer.beginDrawing(EGuiRenderMode.POINTS);
            while (x >= y)
            {
                renderer.addVertex(startX + x, startY + y, zLevel);
                renderer.addVertex(startX + y, startY + x, zLevel);

                renderer.addVertex(startX - y, startY + x, zLevel);
                renderer.addVertex(startX - x, startY + y, zLevel);

                renderer.addVertex(startX - x, startY - y, zLevel);
                renderer.addVertex(startX - y, startY - x, zLevel);

                renderer.addVertex(startX + y, startY - x, zLevel);
                renderer.addVertex(startX + x, startY - y, zLevel);

                y += 1;
                err += 1 + 2 * y;
                if (2 * (err - x) + 1 > 0)
                {
                    x -= 1;
                    err += 1 - 2 * x;
                }
            }
            renderer.endDrawing();
            GL11.glColor4f(1, 1, 1, 1);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_BLEND);
        }
        if (thin > 1)
            this.drawColoredEmptyCircle(renderer, startX + 1, startY + 1, radius - 1, zLevel, c, thin - 1);
    }

    @Override
    public final void drawColoredCircle(final IGuiRenderer renderer, final float startX, final float startY,
            final float radius, final float zLevel, final Color c)
    {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glColor4f(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
        renderer.beginDrawing(EGuiRenderMode.POINTS);
        final float r2 = radius * radius;
        final float area = r2 * 4;
        final float rr = radius * 2;

        for (int i = 0; i < area; i++)
        {
            final float tx = i % rr - radius;
            final float ty = i / rr - radius;

            if (tx * tx + ty * ty <= r2)
                renderer.addVertex(startX + tx, startY + ty, zLevel);
        }
        renderer.endDrawing();
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
    }

    @Override
    public final void drawColoredLine(final IGuiRenderer renderer, final float startX, final float startY,
            final float endX, final float endY, final float lineWeight, final float zLevel, final Color c)
    {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glColor4f(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());

        renderer.beginDrawing(EGuiRenderMode.LINE);
        GL11.glLineWidth(lineWeight);

        renderer.addVertex(startX, startY, zLevel);
        renderer.addVertex(endX, endY, zLevel);

        renderer.endDrawing();
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
    }

    public final void drawItemStack(final IGuiRenderer renderer, final float startX, final float startY,
            final float width, final float height, final float zLevel, final ItemStack stack)
    {
        this.drawItemStack(renderer, startX, startY, width, height, zLevel, stack, null);
    }

    public final void drawItemStack(final IGuiRenderer renderer, final float startX, final float startY,
            final float width, final float height, final float zLevel, final ItemStack stack,
            final String displayString)
    {
        GL11.glPushMatrix();
        GL11.glTranslated(-9, -9, 0);

        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        RenderHelper.disableStandardItemLighting();
        GL11.glDisable(GL11.GL_LIGHTING);
        RenderHelper.enableGUIStandardItemLighting();
        GL11.glTranslatef(0.0F, 0.0F, 32.0F);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        final short short1 = 240;
        final short short2 = 240;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, short1 / 1.0F, short2 / 1.0F);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        final float oldItemZLevel = this.itemRender.zLevel;
        this.itemRender.zLevel = 200.0F;
        FontRenderer font = null;
        if (stack != null)
            font = stack.getItem().getFontRenderer(stack);
        if (font == null)
            font = this.mc.fontRenderer;
        this.itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), stack, (int) startX,
                (int) startY);
        this.itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), stack, (int) startX, (int) startY,
                displayString);
        this.itemRender.zLevel = oldItemZLevel;
        GL11.glPopMatrix();
    }

    @Override
    public final void translateVecToScreenSpace(final Vector2i vec)
    {
        vec.setX((int) (vec.getX() / ((float) this.mc.currentScreen.width / this.mc.displayWidth)));
        vec.setY((int) ((this.mc.currentScreen.height - vec.getY())
                / ((float) this.mc.currentScreen.height / this.mc.displayHeight) - 1));
    }

    @Override
    public final String trimStringToPixelWidth(final String str, final int pixelWidth)
    {
        return this.mc.fontRenderer.trimStringToWidth(str, pixelWidth);
    }

    @Override
    public final float getStringWidth(final String str)
    {
        return this.mc.fontRenderer.getStringWidth(str);
    }

    @Override
    public final float getStringHeight()
    {
        return this.mc.fontRenderer.FONT_HEIGHT;
    }

    @Override
    public void beginScissor()
    {
        GL11.glEnable(GL11.GL_SCISSOR_TEST);
    }

    @Override
    public void endScissor()
    {
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
    }
}


text:
using base::android::ScopedJavaLocalRef;

namespace dom_distiller {
namespace android {

ScopedJavaLocalRef<jobject> DomDistillerServiceFactoryAndroid::GetForProfile(
    JNIEnv* env,
    jclass clazz,
    jobject j_profile) {
  dom_distiller::DomDistillerService* service =
      dom_distiller::DomDistillerServiceFactory::GetForBrowserContext(
          ProfileAndroid::FromProfileAndroid(j_profile));
  DomDistillerServiceAndroid* service_android =
      new DomDistillerServiceAndroid(service);
  return ScopedJavaLocalRef<jobject>(service_android->java_ref_);
}

bool DomDistillerServiceFactoryAndroid::Register(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

ScopedJavaLocalRef<jobject> GetForProfile(
    JNIEnv* env,
    const JavaParamRef<jclass>& clazz,
    const JavaParamRef<jobject>& j_profile) {
  return DomDistillerServiceFactoryAndroid::GetForProfile(env, clazz,
                                                          j_profile);
}

}  // namespace android
}  // namespace dom_distiller


text:
module Main where

import Test.DocTest
import System.Directory
import System.FilePath
import Data.List
import Control.Monad
import Control.Applicative

main = do
  -- sources <- findSources "Web"
  doctest $ args -- ++ sources
  where
    args = [ "-i."
           , "-idist/build/autogen"
           , "-optP-include"
           , "-optPdist/build/autogen/cabal_macros.h"
           , "Web/Twitter/Conduit.hs"
           ]


text:
package com.navercorp.pinpoint.profiler.sender.grpc;

import com.navercorp.pinpoint.common.util.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

/**
 * @author Woonduk Kang(emeroad)
 */
public class ReconnectExecutor {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    private volatile boolean shutdown;
    private final ScheduledExecutorService scheduledExecutorService;
    private final AtomicLong rejectedCounter = new AtomicLong();

    public ReconnectExecutor(ScheduledExecutorService scheduledExecutorService) {
        this.scheduledExecutorService = Assert.requireNonNull(scheduledExecutorService, "scheduledExecutorService");
    }

    private void execute0(Runnable command) {
        Assert.requireNonNull(command, "command");

        if (shutdown) {
            logger.debug("already shutdown");
            return;
        }
        if (command instanceof ReconnectJob) {
            ReconnectJob reconnectJob = (ReconnectJob) command;
            try {
                scheduledExecutorService.schedule(reconnectJob, reconnectJob.nextBackoffNanos(), TimeUnit.NANOSECONDS);
            } catch (RejectedExecutionException e) {
                final long failCount = rejectedCounter.incrementAndGet();
                logger.info("{} reconnectJob scheduled fail {}", command, failCount);
            }
        }
        throw new IllegalArgumentException("unknown command type " + command);
    }

    public void close() {
        shutdown = true;
    }

    public Reconnector newReconnector(Runnable reconnectJob) {
        Assert.requireNonNull(reconnectJob, "reconnectJob");
        if (logger.isInfoEnabled()) {
            logger.info("newReconnector(reconnectJob = [{}])", reconnectJob);
        }

        final Executor dispatch = new Executor() {
            @Override
            public void execute(Runnable command) {
                ReconnectExecutor.this.execute0(command);
            }
        };
        final ReconnectJob reconnectJobWrap = wrapReconnectJob(reconnectJob);
        return new ReconnectAdaptor(dispatch, reconnectJobWrap);
    }

    private ReconnectJob wrapReconnectJob(Runnable runnable) {
        return new ExponentialBackoffReconnectJob(runnable);
    }
}


text:
package com.btj10.io.xml.utils;

/**
 * Static variables used throughout for handling XML data.
 */
public class XMLStatics {
    public static String XML_DEFAULT_ENCODING_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    public static String XML_DEFAULT_ROOT_ELEMENT_NAME = "root";
    public static String XML_COMMENT_INDICATOR = "!";
    public static String NEW_LINE = System.getProperty("line.separator");
    public static String TAB = "\t";
    public static String ESCAPE_STRING = "\"";
    public static String EMPTY_STRING = "";
    public static String SPACE_STRING = " ";
    public static String UNDERSCORE_STRING = "_";
    public static char SPACE_CHAR = ' ';
    public static char UNDERSCORE_CHAR = '_';
    public static String EQUAL_SIGN = "=";
    public static String SLASH = "/";
    public static String DOT_NOTATION = "\\.";
    public static String PERIOD = ".";
}


text:
<?php

namespace Shopware\Plugin\Services\ConsoleInteraction;

use Shopware\Plugin\Struct\Plugin;
use ShopwareCli\Services\IoService;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;

/**
 * Will trigger the PluginColumnRenderer until an valid answer was made. Will then return the corresponding plugin/answer
 *
 * Class PluginInputVerificator
 * @package ShopwareCli\Command\Services
 */
class PluginInputVerificator
{
    /**
     * @var InputInterface
     */
    protected $inputInterface;

    /**
     * @var OutputInterface
     */
    protected $outputInterface;

    /**
     * @var  PluginColumnRenderer
     */
    protected $outputRenderer;

    /**
     * @var IoService
     */
    private $ioService;

    /**
     * @param IoService            $ioService
     * @param PluginColumnRenderer $outputRenderer
     */
    public function __construct(IoService $ioService, PluginColumnRenderer $outputRenderer)
    {
        $this->outputRenderer = $outputRenderer;
        $this->ioService = $ioService;
    }

    /**
     * Ask the user to select one of the given plugins or enter one of $allowedAnswers
     * Will loop until a valid choice was made
     *
     * @param  Plugin[] $plugins
     * @param  string[] $allowedAnswers
     * @return string
     */
    public function selectPlugin($plugins, $allowedAnswers = array('all'))
    {
        while (true) {
            system('clear');
            $this->outputRenderer->show($plugins);

            $question = new Question(
                $this->formatQuestion(count($plugins), $allowedAnswers)
            );

            $response = $this->ioService->ask($question);

            if ($range = $this->getPluginRange($response)) {
                return array_filter(
                    array_map(
                        function ($number) use ($plugins) {
                            return isset($plugins[$number - 1]) ? $plugins[$number - 1] : null;
                        },
                        $range
                    ),
                    function ($plugin) {
                        return $plugin;
                    }
                );
            } elseif (isset($plugins[$response - 1])) {
                return $plugins[$response - 1];
            } elseif (in_array($response, $allowedAnswers)) {
                return $response;
            } else {
                $question = new Question('<error>Invalid answer, hit enter to continue</error>');
                $this->ioService->ask($question);
            }
        }
    }

    /**
     * Format the question for the user
     *
     * @param  integer  $count
     * @param  string[] $allowedAnswers
     * @return string
     */
    private function formatQuestion($count, $allowedAnswers)
    {
        $template = "\n<question>Which plugin(s) do you want to install?</question> Type <comment>1-{$count}</comment> %s ";

        if (empty($allowedAnswers)) {
            return sprintf($template, '');
        } elseif (count($allowedAnswers) == 1) {
            return sprintf($template, sprintf('or "%s"', $allowedAnswers[0]));
        } else {
            $allowedAnswers = array_map(
                function ($option) {
                    return sprintf('"<comment>%s</comment>"', $option);
                },
                $allowedAnswers
            );

            return sprintf($template, sprintf('or one of these: %s', implode(', ', $allowedAnswers)));
        }
    }

    /**
     * Check if a range like 12-99 was entered
     *
     * Will return false if not or the numbers from the range as an array
     *
     * @param  string     $userInput
     * @return array|bool
     */
    private function getPluginRange($userInput)
    {
        $pattern = '#(?P<from>[0-9]+)-(?P<to>[0-9]+)#';
        $matches = array();

        preg_match($pattern, $userInput, $matches);

        if (empty($matches) || !isset($matches['from']) || !isset($matches['to'])) {
            return false;
        }

        return range($matches['from'], $matches['to']);
    }
}


text:
// Only modify this file to include
// - function definitions (prototypes)
// - include files
// - extern variable definitions
// In the appropriate section

#ifndef _ioFrogs_H_
#define _ioFrogs_H_
#include "Arduino.h"
//add your includes for the project ioFrogs here

//end of add your includes here
#ifdef __cplusplus
extern "C" {
#endif
void loop();
void setup();
#ifdef __cplusplus
} // extern "C"
#endif

//add your function definitions for the project ioFrogs here

//Do not add code below this line
#endif /* _ioFrogs_H_ */


text:
namespace SimpleInjector.CodeSamples.Tests.Unit
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using SimpleInjector.Tests.Unit;

    [TestClass]
    public class ResolvingExtensionsTests
    {
        [TestMethod]
        public void CanGetInstanceGeneric_OnRegisteredType_ReturnsTrue()
        {
            // Arrange
            var container = new Container();

            container.Register<ICommand, ConcreteCommand>();

            // Act
            bool result = container.CanGetInstance<ICommand>();

            // Assert
            Assert.IsTrue(result);
        }

        [TestMethod]
        public void CanGetInstanceNonGeneric_OnRegisteredType_ReturnsTrue()
        {
            // Arrange
            var container = new Container();

            container.Register<ICommand, ConcreteCommand>();

            // Act
            bool result = container.CanGetInstance(typeof(ICommand));

            // Assert
            Assert.IsTrue(result);
        }

        [TestMethod]
        public void CanGetInstanceGeneric_OnOnregisteredAbstractType_ReturnsFalse()
        {
            // Arrange
            var container = new Container();

            // Act
            bool result = container.CanGetInstance<ICommand>();

            // Assert
            Assert.IsFalse(result);
        }

        [TestMethod]
        public void CanGetInstanceNonGeneric_OnOnregisteredAbstractType_ReturnsFalse()
        {
            // Arrange
            var container = new Container();

            // Act
            bool result = container.CanGetInstance(typeof(ICommand));

            // Assert
            Assert.IsFalse(result);
        }

        [TestMethod]
        public void CanGetInstanceGeneric_OnOnregisteredString_ReturnsFalse()
        {
            // Arrange
            var container = new Container();

            // Act
            bool result = container.CanGetInstance<string>();

            // Assert
            Assert.IsFalse(result);
        }

        [TestMethod]
        public void CanGetInstanceGeneric_OnValueType_ReturnsFalse()
        {
            // Arrange
            var container = new Container();

            // Act
            bool result = container.CanGetInstance<int>();

            // Assert
            Assert.IsFalse(result);
        }

        [TestMethod]
        public void CanGetInstanceGeneric_OnUnregisteredConcreteType_ReturnsTrue()
        {
            // Arrange
            var container = new Container();
            container.Options.ResolveUnregisteredConcreteTypes = true;

            // Act
            bool result = container.CanGetInstance<ConcreteCommand>();

            // Assert
            Assert.IsTrue(result);
        }

        [TestMethod]
        public void CanGetInstanceGeneric_TypeResolvedByUnregisteredTypeResolution_ReturnsTrue()
        {
            // Arrange
            var container = new Container();

            container.ResolveUnregisteredType += (sender, e) =>
            {
                if (e.UnregisteredServiceType == typeof(ICommand))
                {
                    e.Register(() => new ConcreteCommand());
                }
            };

            // Act
            bool result = container.CanGetInstance<ICommand>();

            // Assert
            Assert.IsTrue(result);
        }

        [TestMethod]
        public void TryGetInstanceOfT_ServiceTypeRegistered_ReturnsTrue()
        {
            // Arrange
            var container = new Container();

            container.RegisterInstance<ICommand>(new ConcreteCommand());

            // Act
            ICommand command;

            bool found = container.TryGetInstance<ICommand>(out command);

            // Assert
            Assert.IsTrue(found, "TryGetInstance<T> is expected to return true when the type is registered.");
        }

        [TestMethod]
        public void TryGetInstanceOfT_ServiceTypeRegistered_ReturnsInstance()
        {
            // Arrange
            var container = new Container();

            container.RegisterInstance<ICommand>(new ConcreteCommand());

            // Act
            ICommand command;

            container.TryGetInstance<ICommand>(out command);

            // Assert
            Assert.IsNotNull(command, "TryGetInstance<T> is expected to return an instance when the type is registered.");
        }

        [TestMethod]
        public void TryGetInstanceOfT_ServiceTypeNotRegistered_ReturnsFalse()
        {
            // Arrange
            var container = new Container();

            // Act
            ICommand command;

            bool found = container.TryGetInstance<ICommand>(out command);

            // Assert
            Assert.IsFalse(found, "TryGetInstance<T> is expected to return false when the type is not registered.");
        }

        [TestMethod]
        public void TryGetInstanceOfT_ServiceTypeNotRegistered_ReturnsNull()
        {
            // Arrange
            var container = new Container();

            // Act
            ICommand command;

            container.TryGetInstance<ICommand>(out command);

            // Assert
            Assert.IsNull(command, "TryGetInstance<T> is expected to return null when the type is not registered.");
        }

        [TestMethod]
        public void TryGetInstance_ServiceTypeRegistered_ReturnsTrue()
        {
            // Arrange
            var container = new Container();

            container.RegisterInstance<ICommand>(new ConcreteCommand());

            // Act
            object command;

            bool found = container.TryGetInstance(typeof(ICommand), out command);

            // Assert
            Assert.IsTrue(found, "TryGetInstance is expected to return true when the type is registered.");
        }

        [TestMethod]
        public void TryGetInstance_ServiceTypeRegistered_ReturnsInstance()
        {
            // Arrange
            var container = new Container();

            container.RegisterInstance<ICommand>(new ConcreteCommand());

            // Act
            object command;

            container.TryGetInstance(typeof(ICommand), out command);

            // Assert
            Assert.IsNotNull(command, "TryGetInstance is expected to return an instance when the type is registered.");
        }

        [TestMethod]
        public void TryGetInstance_ServiceTypeNotRegistered_ReturnsFalse()
        {
            // Arrange
            var container = new Container();

            // Act
            object command;

            bool found = container.TryGetInstance(typeof(ICommand), out command);

            // Assert
            Assert.IsFalse(found, "TryGetInstance is expected to return false when the type is not registered.");
        }

        [TestMethod]
        public void TryGetInstance_ServiceTypeNotRegistered_ReturnsNull()
        {
            // Arrange
            var container = new Container();

            // Act
            object command;

            container.TryGetInstance(typeof(ICommand), out command);

            // Assert
            Assert.IsNull(command, "TryGetInstance is expected to return null when the type is not registered.");
        }

        [TestMethod]
        public void TryGetInstance_ServiceTypeRegistered_ReturnsInstanceOfExpectedType()
        {
            // Arrange
            var container = new Container();

            container.RegisterInstance<ICommand>(new ConcreteCommand());

            // Act
            object command;

            container.TryGetInstance(typeof(ICommand), out command);

            // Assert
            AssertThat.IsInstanceOfType(typeof(ConcreteCommand), command);
        }
    }
}


text:
package com.mongodb.event;

import com.mongodb.annotations.Beta;
import com.mongodb.connection.ServerId;

/**
 * A connection pool-related event.
 */
@Beta
public class ConnectionPoolEvent extends ClusterEvent {
    private final ServerId serverId;

    /**
     * Constructs a new instance of the event.
     *
     * @param serverId the server id
     */

    public ConnectionPoolEvent(final ServerId serverId) {
        super(serverId.getClusterId());
        this.serverId = serverId;
    }

    /**
     * Gets the server address associated with this connection pool
     *
     * @return the server address
     */
    public ServerId getServerId() {
        return serverId;
    }
}


text:
use std::{
    env, fs,
    path::{Path, PathBuf},
    process::{Command, Stdio},
};

use anyhow::{anyhow, Context, Result};
use cargo_metadata::MetadataCommand;
use lazy_static::lazy_static;
use structopt::{clap::arg_enum, StructOpt};

lazy_static! {
    static ref WORKSPACE_ROOT: PathBuf = MetadataCommand::new()
        .no_deps()
        .exec()
        .unwrap()
        .workspace_root;
    static ref FUZZ_ROOT: PathBuf = WORKSPACE_ROOT.join("fuzz");
    static ref FUZZ_TARGETS: Vec<String> = {
        let source = FUZZ_ROOT.join("targets/mod.rs");
        let targets_rs = fs::read_to_string(&source).unwrap();
        let match_fuzz_fs = regex::Regex::new(r"pub fn fuzz_(\w+)\(").unwrap();
        let target_names = match_fuzz_fs
            .captures_iter(&targets_rs)
            .map(|x| format!("fuzz_{}", &x[1]));
        target_names.collect()
    };
    static ref SEED_ROOT: PathBuf = FUZZ_ROOT.join("common/seeds");
}

#[derive(StructOpt, Debug)]
enum Cli {
    /// List all available targets
    #[structopt(name = "list-targets")]
    ListTargets,
    /// Run matched fuzz test with specific fuzzer.
    #[structopt(name = "run")]
    Run {
        /// The fuzzer to use.
        fuzzer: Fuzzer,
        /// The target fuzz to run.
        target: String,
    },
}

arg_enum! {
    #[derive(Debug, PartialEq, Eq, Clone, Copy)]
    enum Fuzzer {
        Afl,
        Honggfuzz,
        Libfuzzer,
    }
}

impl Fuzzer {
    /// Get Cargo package name of corresponding fuzzers.
    fn package_name(self) -> &'static str {
        match self {
            Fuzzer::Afl => "fuzzer-afl",
            Fuzzer::Honggfuzz => "fuzzer-honggfuzz",
            Fuzzer::Libfuzzer => "fuzzer-libfuzzer",
        }
    }

    /// Get Cargo directory of corresponding fuzzers.
    fn directory(self) -> PathBuf {
        FUZZ_ROOT.join(self.package_name())
    }
}

fn main() -> Result<(), i32> {
    match Cli::from_args() {
        Cli::ListTargets => {
            for target in &*FUZZ_TARGETS {
                println!("{}", target);
            }
        }
        Cli::Run { fuzzer, target } => {
            if let Err(error) = run(fuzzer, &target) {
                eprintln!("Running fuzzer failed: {}", error);
                return Err(1);
            }
        }
    }
    Ok(())
}

/// Write the fuzz target source file from corresponding template file.
///
/// `target` must be a valid target.
fn write_fuzz_target_source_file(fuzzer: Fuzzer, target: &str) -> Result<()> {
    use std::io::Write;

    let template_file_path = fuzzer.directory().join("template.rs");
    let template = fs::read_to_string(&template_file_path).context(format!(
        "Error reading template file {}",
        template_file_path.display()
    ))?;

    let target_file_path = fuzzer.directory().join(&format!("src/bin/{}.rs", target));
    let mut file = fs::OpenOptions::new()
        .write(true)
        .create(true)
        .truncate(true)
        .open(&target_file_path)
        .context(format!(
            "Error writing fuzz target source file {}",
            target_file_path.display()
        ))?;

    let source = template.replace("__FUZZ_CLI_TARGET__", target).replace(
        "__FUZZ_GENERATE_COMMENT__",
        "NOTE: AUTO GENERATED FROM `template.rs`",
    );

    file.write_all(source.as_bytes())?;
    Ok(())
}

/// Run one target fuzz test with specific fuzzer
fn run(fuzzer: Fuzzer, target: &str) -> Result<()> {
    if !FUZZ_TARGETS.iter().any(|x| x == target) {
        panic!(
            "Unknown fuzz target `{}`. Run `list-targets` command to see available fuzz targets.",
            target
        );
    }
    write_fuzz_target_source_file(fuzzer, target)?;
    match fuzzer {
        Fuzzer::Afl => run_afl(target),
        Fuzzer::Honggfuzz => run_honggfuzz(target),
        Fuzzer::Libfuzzer => run_libfuzzer(target),
    }
}

/// Get input seeds for fuzz target
fn get_seed_dir(target: &str) -> PathBuf {
    let seeds_dir = SEED_ROOT.join(target);
    if seeds_dir.exists() {
        seeds_dir
    } else {
        SEED_ROOT.join("default")
    }
}

/// Create corpus dir for fuzz target
fn create_corpus_dir(base: impl AsRef<Path>, target: &str) -> Result<PathBuf> {
    let base = base.as_ref();
    let corpus_dir = base.join(&format!("corpus-{}", target));
    fs::create_dir_all(&corpus_dir).context(format!(
        "unable to create corpus dir for {}{}",
        base.display(),
        target
    ))?;
    Ok(corpus_dir)
}

fn pre_check(command: &mut Command, hint: &str) -> Result<()> {
    let check = command
        .stdout(Stdio::null())
        .stderr(Stdio::null())
        .status()
        .unwrap();
    if !check.success() {
        Err(anyhow!(
            "Pre-checking for fuzzing failed. Consider run `{}` before fuzzing.",
            hint
        ))
    } else {
        Ok(())
    }
}

/// Run one target fuzz test using AFL
fn run_afl(target: &str) -> Result<()> {
    let fuzzer = Fuzzer::Afl;

    let seed_dir = get_seed_dir(target);
    let corpus_dir = create_corpus_dir(fuzzer.directory(), target)?;

    pre_check(
        Command::new("cargo").args(&["afl", "--version"]),
        "cargo install afl",
    )?;

    // 1. cargo afl build (in fuzzer-afl directory)
    let fuzzer_build = Command::new("cargo")
        .args(&["afl", "build", "--bin", target])
        .current_dir(fuzzer.directory())
        .spawn()
        .context(format!("Failed to build {}", fuzzer))?
        .wait()
        .context(format!("Failed to complete building {}", fuzzer))?;

    if !fuzzer_build.success() {
        return Err(anyhow!(
            "error building afl instrumented binary, exit code {:?}",
            fuzzer_build.code()
        ));
    }

    // 2. cargo afl fuzz -i {seed_dir} -o {corpus_dir} target/debug/{instrumented_binary}
    let instrumented_bin = WORKSPACE_ROOT.join("target/debug").join(target);
    let fuzzer_bin = Command::new("cargo")
        .args(&["afl", "fuzz"])
        .arg("-i")
        .arg(&seed_dir)
        .arg("-o")
        .arg(&corpus_dir)
        .arg(&instrumented_bin)
        .current_dir(fuzzer.directory())
        .spawn()
        .context(format!("Failed to run {}", fuzzer))?
        .wait()
        .context(format!("Failed to wait {}", fuzzer))?;

    if !fuzzer_bin.success() {
        return Err(anyhow!(
            "{} exited with code {:?}",
            fuzzer,
            fuzzer_bin.code()
        ));
    }

    Ok(())
}

/// Run one target fuzz test using Honggfuzz
fn run_honggfuzz(target: &str) -> Result<()> {
    pre_check(
        Command::new("cargo").args(&["hfuzz", "version"]),
        "cargo install honggfuzz --version 0.5.45",
    )?;

    let fuzzer = Fuzzer::Honggfuzz;

    let mut rust_flags = env::var("RUSTFLAGS").unwrap_or_default();
    rust_flags.push_str(" -Z sanitizer=address");

    let hfuzz_args = format!(
        "-f {} \
         --exit_upon_crash \
         {}",
        get_seed_dir(target).to_string_lossy(),
        env::var("HFUZZ_RUN_ARGS").unwrap_or_default()
    );

    let fuzzer_bin = Command::new("cargo")
        .args(&["hfuzz", "run", target])
        .env("RUSTFLAGS", &rust_flags)
        .env("HFUZZ_RUN_ARGS", &hfuzz_args)
        .current_dir(fuzzer.directory())
        .spawn()
        .context(format!("Failed to run {}", fuzzer))?
        .wait()
        .context(format!("Failed to wait {}", fuzzer))?;

    if !fuzzer_bin.success() {
        return Err(anyhow!(
            "{} exited with code {:?}",
            fuzzer,
            fuzzer_bin.code()
        ));
    }

    Ok(())
}

/// Run one target fuzz test using Libfuzzer
fn run_libfuzzer(target: &str) -> Result<()> {
    let fuzzer = Fuzzer::Libfuzzer;
    let seed_dir = get_seed_dir(target);
    let corpus_dir = create_corpus_dir(fuzzer.directory(), target)?;

    #[cfg(target_os = "macos")]
    let target_platform = "x86_64-apple-darwin";
    #[cfg(target_os = "linux")]
    let target_platform = "x86_64-unknown-linux-gnu";
    #[cfg(not(any(target_os = "linux", target_os = "macos")))]
    panic!("libfuzzer-sys only supports Linux and macOS");

    // FIXME: The -C codegen-units=1 and -C incremental=..
    // below seem to workaround some difficult issues in Rust nightly
    // https://github.com/rust-lang/rust/issues/53945.
    // If this is ever fixed remember to remove the fuzz-incremental
    // entry from .gitignore.
    let mut rust_flags = env::var("RUSTFLAGS").unwrap_or_default();
    rust_flags.push_str(
        "--cfg fuzzing \
         -C codegen-units=1 \
         -C incremental=fuzz-incremental \
         -C passes=sancov \
         -C llvm-args=-sanitizer-coverage-level=4 \
         -C llvm-args=-sanitizer-coverage-trace-compares \
         -C llvm-args=-sanitizer-coverage-inline-8bit-counters \
         -C llvm-args=-sanitizer-coverage-trace-geps \
         -C llvm-args=-sanitizer-coverage-prune-blocks=0 \
         -C debug-assertions=on \
         -C debuginfo=0 \
         -C opt-level=3 \
         -Z sanitizer=address",
    );

    let mut asan_options = env::var("ASAN_OPTIONS").unwrap_or_default();
    asan_options.push_str(" detect_odr_violation=0");

    let fuzzer_bin = Command::new("cargo")
        .args(&["run", "--target", target_platform, "--bin", target, "--"])
        .arg(&corpus_dir)
        .arg(&seed_dir)
        .env("RUSTFLAGS", &rust_flags)
        .env("ASAN_OPTIONS", &asan_options)
        .current_dir(fuzzer.directory())
        .spawn()
        .context(format!("Failed to run {}", fuzzer))?
        .wait()
        .context(format!("Failed to wait {}", fuzzer))?;

    if !fuzzer_bin.success() {
        return Err(anyhow!(
            "{} exited with code {:?}",
            fuzzer,
            fuzzer_bin.code()
        ));
    }

    Ok(())
}


text:
import { assert } from 'chai';
import * as R from 'ramda';

import * as RA from '../src';
import MAX_SAFE_INTEGER from '../src/internal/ponyfills/Number.MAX_SAFE_INTEGER';
import MIN_SAFE_INTEGER from '../src/internal/ponyfills/Number.MIN_SAFE_INTEGER';
import BigInt from './shared/BigInt';
import args from './shared/arguments';
import Symbol from './shared/Symbol';

describe('isBigInt', function () {
  if (BigInt !== undefined) {
    context('given a big integer value', function () {
      specify('should return true', function () {
        assert.isTrue(RA.isBigInt(BigInt(9007199254740991)));
        assert.isTrue(RA.isBigInt(BigInt(-9007199254740991)));
        assert.isTrue(RA.isBigInt(BigInt('9007199254740991')));
        assert.isTrue(RA.isBigInt(BigInt(10)));
        assert.isTrue(RA.isBigInt(BigInt(-10)));
        assert.isTrue(RA.isBigInt(BigInt(0)));
        assert.isTrue(RA.isBigInt(BigInt(-0)));
        assert.isTrue(RA.isBigInt(BigInt(MAX_SAFE_INTEGER)));
        assert.isTrue(RA.isBigInt(BigInt(MIN_SAFE_INTEGER)));
        assert.isTrue(RA.isBigInt(BigInt(Number.MAX_VALUE)));
        assert.isTrue(RA.isBigInt(BigInt('0x1fffffffffffff')));
        assert.isTrue(
          RA.isBigInt(
            BigInt('0b11111111111111111111111111111111111111111111111111111')
          )
        );
      });
    });
  }

  context('given a non-big-integer value', function () {
    specify('should return false', function () {
      assert.isFalse(RA.isBigInt(new Date()));
      assert.isFalse(RA.isBigInt(args));
      assert.isFalse(RA.isBigInt([1, 2, 3]));
      assert.isFalse(RA.isBigInt(Object(false)));
      assert.isFalse(RA.isBigInt(new Error()));
      assert.isFalse(RA.isBigInt(RA));
      assert.isFalse(RA.isBigInt(Array.prototype.slice));
      assert.isFalse(RA.isBigInt({ a: 1 }));
      assert.isFalse(RA.isBigInt(/x/));
      assert.isFalse(RA.isBigInt(Object('a')));
      assert.isFalse(RA.isBigInt('a string'));
      assert.isFalse(RA.isBigInt(0));
      assert.isFalse(RA.isBigInt(1));
      assert.isFalse(RA.isBigInt(-1));
      assert.isFalse(RA.isBigInt(0.1));
      assert.isFalse(RA.isBigInt(-0.1));
      assert.isFalse(RA.isBigInt(Infinity));
      assert.isFalse(RA.isBigInt(-Infinity));
      assert.isFalse(RA.isBigInt(9007199254740991));
      assert.isFalse(RA.isBigInt('9007199254740991'));
      assert.isFalse(RA.isBigInt(MAX_SAFE_INTEGER));
      assert.isFalse(RA.isBigInt(MIN_SAFE_INTEGER));
      assert.isFalse(RA.isBigInt(Number.MAX_VALUE));
      assert.isFalse(RA.isBigInt(Number.MIN_VALUE));
      assert.isFalse(RA.isBigInt(NaN));
      assert.isFalse(RA.isBigInt(Object(0)));
      assert.isFalse(RA.isBigInt(Object(0.1)));

      if (Symbol !== 'undefined') {
        assert.isFalse(RA.isBigInt(Symbol));
      }

      assert.isFalse(RA.isBigInt(null));
      assert.isFalse(RA.isBigInt(undefined));
    });
  });

  it('should support placeholder to specify "gaps"', function () {
    const isBigInt = RA.isBigInt(R.__);

    assert.isFalse(isBigInt(1));
  });
});


text:
/* eslint-disable camelcase */
import 'ionic';
import 'driftyco/ng-cordova';
import 'driftyco/ng-cordova/dist/ng-cordova-mocks';
import 'gsklee/ngStorage';
import qs from 'nodelibs/querystring';

import settingsModule from './settings';

import secrets from '../../secrets.json!';

const AUTH_SCOPE = 'all*';
const REFRESH_TOKEN_EXPIRES_IN = 1200; // 目前 98 的实现有问题,时间太短,后续会改的

Accounts.$inject = ['$http', '$q', '$localStorage', '$cordovaToast', '$cordovaKeyboard', 'settings'];
function Accounts($http, $q, $localStorage, $cordovaToast, $cordovaKeyboard, settings) {
  let services = {
    get: get,
    set: set,

    all: all,

    getCurrent: getCurrent,
    setCurrent: setCurrent,

    login: login,
    logout: logout,
    refresh: refresh
  };
  return services;

  /**
   * get a stored account by userName or userId
   * (if both provided, the userName has higher priority during search)
   * @param  {string} options.userName
   * @param  {number} options.userId
   * @return {Object} the found account or null
   */
  function get({userName, userId}) {
    return $localStorage.find((x) => x.userName === userName || x.userId === userId);
  }

  /**
   * append/update a account in the accounts array
   * @param {Object} user the user account to set
   */
  function set(user) {
    $localStorage.accounts = $localStorage.accounts || [];
    let found = $localStorage.accounts.find(x => x.userName === user.userName);
    if (found) {
      Object.assign(found, user);
    } else {
      $localStorage.accounts.push(user);
    }
  }

  /**
   * get all accounts
   * @return {Array} array of all stored accounts,
   * the reason to use array rather than object is that the user needs to see
   * the accounts in order when managing accounts
   */
  function all() {
    return $localStorage.accounts;
  }

  /**
   * get current user
   * @return {Object} the current user's account info
   */
  function getCurrent() {
    return $localStorage.current;
  }

  /**
   * set current user with the given params
   * @param {Object} user the user account object
   * @param {string} user.access_token
   * @param {number} user.access_token_expires timestamp indicating when access_token expires
   * @param {string} user.refresh_token
   * @param {number} user.refresh_token_expires timestamp indicating when access_token expires
   * @param {number} [user.userId]
   * @param {string} [user.userName]
   * @param {string} [user.avatar]
   */
  function setCurrent(user) {
    $localStorage.current = Object.assign($localStorage.current || {}, user);
    // 如果有用户名,就 push/update 它到 accounts 数组中
    if ($localStorage.current.userName) {
      set($localStorage.current);
    }
  }

  // Client-Side Applications had better use implicit_grant
  // see here -> http://wiki.dev.app.360.cn/index.php?title=OAuth2.0%E6%96%87%E6%A1%A3
  // But as the website's implicit granted access token expires in such a short time (1200s currently),
  // that it is unrealistic to take this approach in a client app.
  // So here I implemented an OAuth service with the authorization code approach.

  /**
   * login
   * @return {Promise} [description]
   */
  function login() {
    let deferred = $q.defer();

    $cordovaKeyboard.hideAccessoryBar(false);
    let authorizeUrl = settings.authorizeEndpoint + '?' + qs.stringify({
      response_type: 'code',
      grant_type: 'authorization_code',
      client_id: secrets.client_id,
      redirect_uri: secrets.redirect_uri,
      scope: AUTH_SCOPE
    });
    let ref = window.open(authorizeUrl, '_blank');
    ref.addEventListener('loadstart', (evt) => {
      if (!evt.url.startsWith(secrets.redirect_uri)) { return; }
      $cordovaKeyboard.hideAccessoryBar(true);

      let {code, error} = qs.parse(evt.url.split('?')[1]);
      if (error) {
        deferred.reject('Failed to get authorization code!');
      } else {
        deferred.resolve(code);
      }
    });

    return deferred.promise
      .finally(() => ref.close()) // 先关窗口免得用户看到跳转页
      .then(_getTokens);
  }

  /**
   * refresh access token with refresh token
   * @return {Promise}
   */
  function refresh() {
    return $http({
      method: 'POST',
      url: settings.tokenEndpoint,
      data: {
        grant_type: 'refresh_token',
        refresh_token: $localStorage.current.refresh_token,
        client_id: secrets.client_id,
        client_secret: secrets.client_secret,
        redirect_uri: secrets.redirect_uri
      },
      headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
      transformRequest: qs.stringify
    }).success(({access_token, expires_in}) => {
      let access_token_expiry = Date.now() + expires_in * 1000;

      setCurrent({access_token, access_token_expiry});
    }).error((data, status) => {
      throw new Error(`HTTP Error ${status}. Failed to refresh token!`);
    });
  }

  /**
   * get access_token & refresh_token with oauth authorization code
   * @param  {string} code authorization code
   * @return {Promise}
   */
  function _getTokens(code) {
    return $http({
      method: 'POST',
      url: settings.tokenEndpoint,
      data: {
        grant_type: 'authorization_code',
        client_id: secrets.client_id,
        client_secret: secrets.client_secret,
        redirect_uri: secrets.redirect_uri,
        code: code
      },
      headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
      transformRequest: qs.stringify
    }).success(({access_token, expires_in, refresh_token}) => {
      let access_token_expiry = Date.now() + expires_in * 1000;
      let refresh_token_expiry = Date.now() + REFRESH_TOKEN_EXPIRES_IN * 1000;

      setCurrent({access_token, refresh_token, access_token_expiry, refresh_token_expiry});
    }).error((data, status) => {
      throw new Error(`HTTP Error ${status}. Failed to get tokens!`);
    });
  }

  /**
   * logout the current account and delele cookie
   * @return {Promise}
   */
  function logout() {}
}

export default angular
  .module('resources.accounts', [
    'ngStorage',
    'ngCordovaMocks',
    settingsModule.name
  ])
  .factory(Accounts.name, Accounts);


text:
class Fastly::GetCustomer
  include Fastly::Request

  request_method :get
  request_path { |r| "/customer/#{r.customer_id}" }

  parameter :customer_id

  def mock
    mock_response(find!(:customers, customer_id))
  end
end