text:
package com.sun.pdfview.font.ttf;

import java.nio.ByteBuffer;
import java.util.Date;

/**
 *
 * @author  jkaplan
 */
public class HeadTable extends TrueTypeTable {

    /** Holds value of property version. */
    private int version;

    /** Holds value of property fontRevision. */
    private int fontRevision;

    /** Holds value of property checksumAdjustment. */
    private int checksumAdjustment;

    /** Holds value of property magicNumber. */
    private int magicNumber;

    /** Holds value of property flags. */
    private short flags;

    /** Holds value of property unitsPerEm. */
    private short unitsPerEm;

    /** Holds value of property created. */
    private long created;

    /** Holds value of property modified. */
    private long modified;

    /** Holds value of property xMin. */
    private short xMin;

    /** Holds value of property yMin. */
    private short yMin;

    /** Holds value of property xMax. */
    private short xMax;

    /** Holds value of property yMax. */
    private short yMax;

    /** Holds value of property macStyle. */
    private short macStyle;

    /** Holds value of property lowestRecPPem. */
    private short lowestRecPPem;

    /** Holds value of property fontDirectionHint. */
    private short fontDirectionHint;

    /** Holds value of property indexToLocFormat. */
    private short indexToLocFormat;

    /** Holds value of property glyphDataFormat. */
    private short glyphDataFormat;

    /** Creates a new instance of HeadTable
     * Makes up reasonable(?) defaults for all values
     */
    protected HeadTable() {
        super(TrueTypeTable.HEAD_TABLE);

        setVersion(0x10000);
        setFontRevision(0x10000);
        setChecksumAdjustment(0);
        setMagicNumber(0x5f0f3cf5);
        setFlags((short) 0x0);
        setUnitsPerEm((short) 64);
        setCreated(System.currentTimeMillis());
        setModified(System.currentTimeMillis());
        setXMin((short) 0);
        setXMax((short) Short.MAX_VALUE);
        setYMin((short) 0);
        setYMax((short) Short.MAX_VALUE);
        setMacStyle((short) 0x0);
        setLowestRecPPem((short) 0);
        setFontDirectionHint((short) 0);
        setIndexToLocFormat((short) 0);
        setGlyphDataFormat((short) 0);
    }

    /**
     * Parse the data before it is set
     */
    public void setData(ByteBuffer data) {
        if (data.remaining() != 54) {
            throw new IllegalArgumentException("Bad Head table size");
        }
        setVersion(data.getInt());
        setFontRevision(data.getInt());
        setChecksumAdjustment(data.getInt());
        setMagicNumber(data.getInt());
        setFlags(data.getShort());
        setUnitsPerEm(data.getShort());
        setCreated(data.getLong());
        setModified(data.getLong());
        setXMin(data.getShort());
        setXMax(data.getShort());
        setYMin(data.getShort());
        setYMax(data.getShort());
        setMacStyle(data.getShort());
        setLowestRecPPem(data.getShort());
        setFontDirectionHint(data.getShort());
        setIndexToLocFormat(data.getShort());
        setGlyphDataFormat(data.getShort());
    }

    /**
     * Get the data we have stored
     */
    public ByteBuffer getData() {
        ByteBuffer buf = ByteBuffer.allocate(getLength());

        buf.putInt(getVersion());
        buf.putInt(getFontRevision());
        buf.putInt(getChecksumAdjustment());
        buf.putInt(getMagicNumber());
        buf.putShort(getFlags());
        buf.putShort(getUnitsPerEm());
        buf.putLong(getCreated());
        buf.putLong(getModified());
        buf.putShort(getXMin());
        buf.putShort(getXMax());
        buf.putShort(getYMin());
        buf.putShort(getYMax());
        buf.putShort(getMacStyle());
        buf.putShort(getLowestRecPPem());
        buf.putShort(getFontDirectionHint());
        buf.putShort(getIndexToLocFormat());
        buf.putShort(getGlyphDataFormat());

        // reset the position to the start of the buffer
        buf.flip();

        return buf;
    }

    /**
     * Get the length of this table
     */
    public int getLength() {
        return 54;
    }

    /** Getter for property version.
     * @return Value of property version.
     *
     */
    public int getVersion() {
        return version;
    }

    /** Getter for property fontRevision.
     * @return Value of property fontRevision.
     *
     */
    public int getFontRevision() {
        return this.fontRevision;
    }

    /** Getter for property checksumAdjustment.
     * @return Value of property checksumAdjustment.
     *
     */
    public int getChecksumAdjustment() {
        return this.checksumAdjustment;
    }

    /** Getter for property magicNumber.
     * @return Value of property magicNumber.
     *
     */
    public int getMagicNumber() {
        return this.magicNumber;
    }

    /** Getter for property flags.
     * @return Value of property flags.
     *
     */
    public short getFlags() {
        return this.flags;
    }

    /** Getter for property unitsPerEm.
     * @return Value of property unitsPerEm.
     *
     */
    public short getUnitsPerEm() {
        return this.unitsPerEm;
    }

    /** Getter for property created.
     * @return Value of property created.
     *
     */
    public long getCreated() {
        return this.created;
    }

    /** Getter for property modified.
     * @return Value of property modified.
     *
     */
    public long getModified() {
        return this.modified;
    }

    /** Getter for property xMin.
     * @return Value of property xMin.
     *
     */
    public short getXMin() {
        return this.xMin;
    }

    /** Getter for property yMin.
     * @return Value of property yMin.
     *
     */
    public short getYMin() {
        return this.yMin;
    }

    /** Getter for property xMax.
     * @return Value of property xMax.
     *
     */
    public short getXMax() {
        return this.xMax;
    }

    /** Getter for property yMax.
     * @return Value of property yMax.
     *
     */
    public short getYMax() {
        return this.yMax;
    }

    /** Getter for property macStyle.
     * @return Value of property macStyle.
     *
     */
    public short getMacStyle() {
        return this.macStyle;
    }

    /** Getter for property lowestRecPPem.
     * @return Value of property lowestRecPPem.
     *
     */
    public short getLowestRecPPem() {
        return this.lowestRecPPem;
    }

    /** Getter for property fontDirectionHint.
     * @return Value of property fontDirectionHint.
     *
     */
    public short getFontDirectionHint() {
        return this.fontDirectionHint;
    }

    /** Getter for property indexToLocFormat.
     * @return Value of property indexToLocFormat.
     *
     */
    public short getIndexToLocFormat() {
        return this.indexToLocFormat;
    }

    /** Getter for property glyphDataFormat.
     * @return Value of property glyphDataFormat.
     *
     */
    public short getGlyphDataFormat() {
        return this.glyphDataFormat;
    }

    /** Setter for property XMax.
     * @param xMax New value of property XMax.
     *
     */
    public void setXMax(short xMax) {
        this.xMax = xMax;
    }

    /** Setter for property XMin.
     * @param xMin New value of property XMin.
     *
     */
    public void setXMin(short xMin) {
        this.xMin = xMin;
    }

    /** Setter for property YMax.
     * @param yMax New value of property YMax.
     *
     */
    public void setYMax(short yMax) {
        this.yMax = yMax;
    }

    /** Setter for property YMin.
     * @param yMin New value of property YMin.
     *
     */
    public void setYMin(short yMin) {
        this.yMin = yMin;
    }

    /** Setter for property checksumAdjustment.
     * @param checksumAdjustment New value of property checksumAdjustment.
     *
     */
    public void setChecksumAdjustment(int checksumAdjustment) {
        this.checksumAdjustment = checksumAdjustment;
    }

    /** Setter for property created.
     * @param created New value of property created.
     *
     */
    public void setCreated(long created) {
        this.created = created;
    }

    /** Setter for property flags.
     * @param flags New value of property flags.
     *
     */
    public void setFlags(short flags) {
        this.flags = flags;
    }

    /** Setter for property fontDirectionHint.
     * @param fontDirectionHint New value of property fontDirectionHint.
     *
     */
    public void setFontDirectionHint(short fontDirectionHint) {
        this.fontDirectionHint = fontDirectionHint;
    }

    /** Setter for property fontRevision.
     * @param fontRevision New value of property fontRevision.
     *
     */
    public void setFontRevision(int fontRevision) {
        this.fontRevision = fontRevision;
    }

    /** Setter for property glyphDataFormat.
     * @param glyphDataFormat New value of property glyphDataFormat.
     *
     */
    public void setGlyphDataFormat(short glyphDataFormat) {
        this.glyphDataFormat = glyphDataFormat;
    }

    /** Setter for property indexToLocFormat.
     * @param indexToLocFormat New value of property indexToLocFormat.
     *
     */
    public void setIndexToLocFormat(short indexToLocFormat) {
        this.indexToLocFormat = indexToLocFormat;
    }

    /** Setter for property lowestRecPPem.
     * @param lowestRecPPem New value of property lowestRecPPem.
     *
     */
    public void setLowestRecPPem(short lowestRecPPem) {
        this.lowestRecPPem = lowestRecPPem;
    }

    /** Setter for property macStyle.
     * @param macStyle New value of property macStyle.
     *
     */
    public void setMacStyle(short macStyle) {
        this.macStyle = macStyle;
    }

    /** Setter for property magicNumber.
     * @param magicNumber New value of property magicNumber.
     *
     */
    public void setMagicNumber(int magicNumber) {
        this.magicNumber = magicNumber;
    }

    /** Setter for property modified.
     * @param modified New value of property modified.
     *
     */
    public void setModified(long modified) {
        this.modified = modified;
    }

    /** Setter for property unitsPerEm.
     * @param unitsPerEm New value of property unitsPerEm.
     *
     */
    public void setUnitsPerEm(short unitsPerEm) {
        this.unitsPerEm = unitsPerEm;
    }

    /** Setter for property version.
     * @param version New value of property version.
     *
     */
    public void setVersion(int version) {
        this.version = version;
    }

    /**
     * Create a pretty string
     */
    public String toString() {
        StringBuffer buf = new StringBuffer();
        String indent = "    ";

        buf.append(indent + "Version          : " + Integer.toHexString(getVersion()) + "\n");
        buf.append(indent + "Revision         : " + Integer.toHexString(getFontRevision()) + "\n");
        buf.append(indent + "ChecksumAdj      : " + Integer.toHexString(getChecksumAdjustment()) + "\n");
        buf.append(indent + "MagicNumber      : " + Integer.toHexString(getMagicNumber()) + "\n");
        buf.append(indent + "Flags            : " + Integer.toBinaryString(getFlags()) + "\n");
        buf.append(indent + "UnitsPerEm       : " + getUnitsPerEm() + "\n");
        buf.append(indent + "Created          : " + new Date(getCreated()) + "\n");
        buf.append(indent + "Modified         : " + new Date(getModified()) + "\n");
        buf.append(indent + "XMin             : " + getXMin() + "\n");
        buf.append(indent + "XMax             : " + getXMax() + "\n");
        buf.append(indent + "YMin             : " + getYMin() + "\n");
        buf.append(indent + "YMax             : " + getYMax() + "\n");
        buf.append(indent + "MacStyle         : " + Integer.toBinaryString(getMacStyle()) + "\n");
        buf.append(indent + "LowestPPem       : " + getLowestRecPPem() + "\n");
        buf.append(indent + "FontDirectionHint: " + getFontDirectionHint() + "\n");
        buf.append(indent + "IndexToLocFormat : " + getIndexToLocFormat() + "\n");
        buf.append(indent + "GlyphDataFormat  : " + getGlyphDataFormat() + "\n");

        return buf.toString();
    }
}


text:
module TradoPdfInvoiceModule
end

require 'wicked_pdf'

require 'trado_pdf_invoice_module/engine'
require 'trado_pdf_invoice_module/version'

redpajama_set_name: RedPajamaGithub


text:
Template.hello.greeting = function () {
  return "Welcome to turbo-octo-archer.";
};

/*Template.hello.events({
  'click input': function () {
    // template data, if any, is available in 'this'
    if (typeof console !== 'undefined')
      console.log("You pressed the button");
  }
});*/


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

  create_table "clubs", force: true do |t|
    t.string   "name"
    t.string   "contact_officer"
    t.datetime "date_created"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "teams", force: true do |t|
    t.integer  "club_id"
    t.string   "name"
    t.string   "captain"
    t.datetime "date_created"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "teams", ["club_id"], name: "index_teams_on_club_id"

end


text:
package org.boon.bugs;

import com.examples.model.test.movies.crud.BatchResults;
import com.examples.model.test.movies.crud.RecordReadResponse;
import com.examples.model.test.movies.likeable.Like;
import com.examples.model.test.movies.likeable.LikeabilityUpdate;
import com.examples.model.test.movies.likeable.LikesBulkUpdate;
import com.examples.model.test.movies.likeable.LikingService;
import com.examples.model.test.movies.wathcer.Watcher;
import org.boon.Lists;
import org.boon.Maps;
import org.boon.core.reflection.ClassMeta;
import org.boon.core.reflection.Invoker;
import org.boon.core.reflection.MethodAccess;
import org.junit.Before;
import org.junit.Test;

import java.io.Serializable;
import java.util.Map;

import static org.boon.Boon.fromJson;
import static org.boon.Boon.puts;
import static org.boon.Boon.toJson;
import static org.boon.Exceptions.die;

/**
 * Created by Richard on 8/25/14.
 */
public class Bug211 {

    boolean scoreCalled;
    boolean ok;

    @Before
    public void setup() {
        scoreCalled=false;
    }

    @Test
    public void test() {
        LikingService likingService = new LikingService() {
            @Override
            public BatchResults updatePreferences(LikesBulkUpdate request) {
                return null;
            }

            @Override
            public void score(LikeabilityUpdate scoreUpdate) {
                puts(scoreUpdate);
                scoreCalled=true;

            }

            @Override
            public RecordReadResponse<Watcher> loadUser(String username, long version) {
                return null;
            }
        };

        Invoker.invokeFromObject(likingService, "score", Lists.list(Lists.list("bob", "123", "LIKE", 10)));

        ok = scoreCalled || die("Score was not called");
    }

    @Test
    public void testWithSingleList() {
        LikingService likingService = new LikingService() {
            @Override
            public BatchResults updatePreferences(LikesBulkUpdate request) {
                return null;
            }

            @Override
            public void score(LikeabilityUpdate scoreUpdate) {
                puts(scoreUpdate);
                scoreCalled=true;

            }

            @Override
            public RecordReadResponse<Watcher> loadUser(String username, long version) {
                return null;
            }
        };

        Invoker.invokeFromObject(likingService, "score", Lists.list("bob", "123", "LIKE", 10));

        ok = scoreCalled || die("Score was not called");
    }

    @Test
    public void testWithSingleMap() {
        LikingService likingService = new LikingService() {
            @Override
            public BatchResults updatePreferences(LikesBulkUpdate request) {
                return null;
            }

            @Override
            public void score(LikeabilityUpdate scoreUpdate) {
                puts(scoreUpdate);
                scoreCalled=true;

            }

            @Override
            public RecordReadResponse<Watcher> loadUser(String username, long version) {
                return null;
            }
        };

//        private String username;
//        private String video;
//        private Like like;
//        private int spot;

        Invoker.invokeFromObject(likingService, "score", Maps.map("username", "bob", "video", "123", "like", "LIKE", "spot", 10));

        ok = scoreCalled || die("Score was not called");
    }

    @Test
    public void testWithSingleMap2() {
        LikingService likingService = new LikingService() {
            @Override
            public BatchResults updatePreferences(LikesBulkUpdate request) {
                return null;
            }

            @Override
            public void score(LikeabilityUpdate scoreUpdate) {
                puts(scoreUpdate);
                scoreCalled=true;

            }

            @Override
            public RecordReadResponse<Watcher> loadUser(String username, long version) {
                return null;
            }
        };

//        private String username;
//        private String video;
//        private Like like;
//        private int spot;

        Invoker.invokeFromObject(likingService, "score", Maps.map("username", "bob", "video", "123", "like", "LIKE", "spot", 0));

        ok = scoreCalled || die("Score was not called");
    }

    @Test
    public void listofMaps() {
        LikingService likingService = new LikingService() {
            @Override
            public BatchResults updatePreferences(LikesBulkUpdate request) {
                return null;
            }

            @Override
            public void score(LikeabilityUpdate scoreUpdate) {
                puts(scoreUpdate);
                scoreCalled=true;

            }

            @Override
            public RecordReadResponse<Watcher> loadUser(String username, long version) {
                return null;
            }
        };

//        private String username;
//        private String video;
//        private Like like;
//        private int spot;

        Invoker.invokeFromObject(likingService, "score", Lists.list(Maps.map("username", "bob", "video", "123", "like", "LIKE", "spot", 0)));

        ok = scoreCalled || die("Score was not called");
    }

    @Test
    public void testWithSingleMapWithMethod() {
        LikingService likingService = new LikingService() {
            @Override
            public BatchResults updatePreferences(LikesBulkUpdate request) {
                return null;
            }

            @Override
            public void score(LikeabilityUpdate scoreUpdate) {
                puts(scoreUpdate);
                scoreCalled=true;

            }

            @Override
            public RecordReadResponse<Watcher> loadUser(String username, long version) {
                return null;
            }
        };

        final MethodAccess score = ClassMeta.classMeta(LikingService.class).method("score");

//        private String username;
//        private String video;
//        private Like like;
//        private int spot;

        Invoker.invokeMethodFromObjectArg(likingService, score, Maps.map("username", "bob", "video", "123", "like", "LIKE", "spot", 0));

        ok = scoreCalled || die("Score was not called");
    }

    @Test
    public void testWithSingleMapWithMethodJson() {
        LikingService likingService = new LikingService() {
            @Override
            public BatchResults updatePreferences(LikesBulkUpdate request) {
                return null;
            }

            @Override
            public void score(LikeabilityUpdate scoreUpdate) {
                puts(scoreUpdate);
                scoreCalled=true;

            }

            @Override
            public RecordReadResponse<Watcher> loadUser(String username, long version) {
                return null;
            }
        };

        final MethodAccess score = ClassMeta.classMeta(LikingService.class).method("score");

//        private String username;
//        private String video;
//        private Like like;
//        private int spot;

        final Map<String, ? extends Serializable> map = Maps.map("username", "bob", "video", "123", "like", "LIKE", "spot", 0);
        String json = toJson(map);
        final Object o = fromJson(json);
        Invoker.invokeMethodFromObjectArg(likingService, score, o);

        ok = scoreCalled || die("Score was not called");
    }

}


text:
require 'open3'
require "kaspersky/linux_fs/version"
require "kaspersky/linux_fs/response/fast_scan"

module Kaspersky
  class LinuxFs
    SKIP_ACTION = 'Skip'

    def initialize(bin, use_sudo = false)
      @bin = bin
      @use_sudo = use_sudo
      @default_options = {
        action: SKIP_ACTION
      }
    end

    def fast_scan(path_to_file, options = {})
      command = "#{build_base_request}#{build_options(options.to_hash.merge({ scan_file: path_to_file.to_s }))}"
      output = nil
      success = false

      Open3.popen3(command) do |stdin, stdout, stderr, thread|
        process = thread.value
        output = stderr.read

        # "sudo -n ..." exit with code 0 when password is incorrect
        # so, checking stderr is required
        if process.success? && output.size.zero?
          output = stdout.read
          success = true
        end
      end

      fail "#{output}" unless success

      Kaspersky::LinuxFs::Response::FastScan.new(output)
    end

    private

    def build_base_request
      request = @bin.dup

      # n - non-interactive
      request.prepend('sudo -n ') if @use_sudo

      request
    end

    def build_options(data)
      data = @default_options.merge(data)
      options = ''
      data.each do |key, value|
        options += " --#{key.to_s.tr('_', '-')} \"#{value}\""
      end
      options
    end
  end
end


text:
package org.apache.commons.vfs2.provider.ftp;

import org.apache.commons.vfs2.provider.FileNameParser;
import org.apache.commons.vfs2.provider.HostFileNameParser;

/**
 * Implementation for FTP. Default port is 21.
 */
public class FtpFileNameParser extends HostFileNameParser {

    private static final FtpFileNameParser INSTANCE = new FtpFileNameParser();

    private static final int PORT = 21;

    /**
     * Constructs a new instance with the default port.
     */
    public FtpFileNameParser() {
        super(PORT);
    }

    /**
     * Gets the singleton instance.
     *
     * @return the singleton instance.
     */
    public static FileNameParser getInstance() {
        return INSTANCE;
    }
}


text:
@Components(family = "sample", categories = "Sample")
package org.talend.sdk.component.sample;

import org.talend.sdk.component.api.component.Components;


text:
package org.apache.beam.sdk.io;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.collect.Lists;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.beam.sdk.Pipeline;
import org.apache.beam.sdk.annotations.Experimental;
import org.apache.beam.sdk.coders.Coder;
import org.apache.beam.sdk.coders.SerializableCoder;
import org.apache.beam.sdk.io.Sink.WriteOperation;
import org.apache.beam.sdk.io.Sink.Writer;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.transforms.Create;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.transforms.GroupByKey;
import org.apache.beam.sdk.transforms.PTransform;
import org.apache.beam.sdk.transforms.ParDo;
import org.apache.beam.sdk.transforms.SerializableFunction;
import org.apache.beam.sdk.transforms.View;
import org.apache.beam.sdk.transforms.WithKeys;
import org.apache.beam.sdk.transforms.display.DisplayData;
import org.apache.beam.sdk.transforms.windowing.DefaultTrigger;
import org.apache.beam.sdk.transforms.windowing.GlobalWindows;
import org.apache.beam.sdk.transforms.windowing.Window;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PCollection.IsBounded;
import org.apache.beam.sdk.values.PCollectionView;
import org.apache.beam.sdk.values.PDone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A {@link PTransform} that writes to a {@link Sink}. A write begins with a sequential global
 * initialization of a sink, followed by a parallel write, and ends with a sequential finalization
 * of the write. The output of a write is {@link PDone}.
 *
 *
By default, every bundle in the input {@link PCollection} will be processed by a
 * {@link WriteOperation}, so the number of outputs will vary based on runner behavior, though at
 * least 1 output will always be produced. The exact parallelism of the write stage can be
 * controlled using {@link Write.Bound#withNumShards}, typically used to control how many files are
 * produced or to globally limit the number of workers connecting to an external service. However,
 * this option can often hurt performance: it adds an additional {@link GroupByKey} to the pipeline.
 *
 *
{@code Write} re-windows the data into the global window, so it is typically not well suited
 * to use in streaming pipelines.
 *
 *
Example usage with runner-controlled sharding:
 *
 *
{@code p.apply(Write.to(new MySink(...)));}

 *
 *
Example usage with a fixed number of shards:
 *
 *
{@code p.apply(Write.to(new MySink(...)).withNumShards(3));}

 */
@Experimental(Experimental.Kind.SOURCE_SINK)
public class Write {
  private static final Logger LOG = LoggerFactory.getLogger(Write.class);

  /**
   * Creates a {@link Write} transform that writes to the given {@link Sink}, letting the runner
   * control how many different shards are produced.
   */
  public static <T> Bound<T> to(Sink<T> sink) {
    checkNotNull(sink, "sink");
    return new Bound<>(sink, 0 /* runner-controlled sharding */);
  }

  /**
   * A {@link PTransform} that writes to a {@link Sink}. See the class-level Javadoc for more
   * information.
   *
   * @see Write
   * @see Sink
   */
  public static class Bound<T> extends PTransform<PCollection<T>, PDone> {
    private final Sink<T> sink;
    private int numShards;

    private Bound(Sink<T> sink, int numShards) {
      this.sink = sink;
      this.numShards = numShards;
    }

    @Override
    public PDone expand(PCollection<T> input) {
      checkArgument(IsBounded.BOUNDED == input.isBounded(),
          "%s can only be applied to a Bounded PCollection",
          Write.class.getSimpleName());
      PipelineOptions options = input.getPipeline().getOptions();
      sink.validate(options);
      return createWrite(input, sink.createWriteOperation(options));
    }

    @Override
    public void populateDisplayData(DisplayData.Builder builder) {
      super.populateDisplayData(builder);
      builder
          .add(DisplayData.item("sink", sink.getClass()).withLabel("Write Sink"))
          .include("sink", sink)
          .addIfNotDefault(
              DisplayData.item("numShards", getNumShards()).withLabel("Fixed Number of Shards"),
              0);
    }

    /**
     * Returns the number of shards that will be produced in the output.
     *
     * @see Write for more information
     */
    public int getNumShards() {
      return numShards;
    }

    /**
     * Returns the {@link Sink} associated with this PTransform.
     */
    public Sink<T> getSink() {
      return sink;
    }

    /**
     * Returns a new {@link Write.Bound} that will write to the current {@link Sink} using the
     * specified number of shards.
     *
     *
This option should be used sparingly as it can hurt performance. See {@link Write} for
     * more information.
     *
     *
A value less than or equal to 0 will be equivalent to the default behavior of
     * runner-controlled sharding.
     */
    public Bound<T> withNumShards(int numShards) {
      return new Bound<>(sink, Math.max(numShards, 0));
    }

    /**
     * Writes all the elements in a bundle using a {@link Writer} produced by the
     * {@link WriteOperation} associated with the {@link Sink}.
     */
    private class WriteBundles<WriteT> extends DoFn<T, WriteT> {
      // Writer that will write the records in this bundle. Lazily
      // initialized in processElement.
      private Writer<T, WriteT> writer = null;
      private final PCollectionView<WriteOperation<T, WriteT>> writeOperationView;

      WriteBundles(PCollectionView<WriteOperation<T, WriteT>> writeOperationView) {
        this.writeOperationView = writeOperationView;
      }

      @ProcessElement
      public void processElement(ProcessContext c) throws Exception {
        // Lazily initialize the Writer
        if (writer == null) {
          WriteOperation<T, WriteT> writeOperation = c.sideInput(writeOperationView);
          //LOG.info("Opening writer for write operation {}", writeOperation);
          writer = writeOperation.createWriter(c.getPipelineOptions());
          writer.open(UUID.randomUUID().toString());
          //LOG.debug("Done opening writer {} for operation {}", writer, writeOperationView);
        }
        try {
          writer.write(c.element());
        } catch (Exception e) {
          // Discard write result and close the write.
          try {
            writer.close();
            // The writer does not need to be reset, as this DoFn cannot be reused.
          } catch (Exception closeException) {
            if (closeException instanceof InterruptedException) {
              // Do not silently ignore interrupted state.
              Thread.currentThread().interrupt();
            }
            // Do not mask the exception that caused the write to fail.
            e.addSuppressed(closeException);
          }
          throw e;
        }
      }

      @FinishBundle
      public void finishBundle(Context c) throws Exception {
        if (writer != null) {
          WriteT result = writer.close();
          c.output(result);
          // Reset state in case of reuse.
          writer = null;
        }
      }

      @Override
      public void populateDisplayData(DisplayData.Builder builder) {
        builder.delegate(Write.Bound.this);
      }
    }

    /**
     * Like {@link WriteBundles}, but where the elements for each shard have been collected into
     * a single iterable.
     *
     * @see WriteBundles
     */
    private class WriteShardedBundles<WriteT> extends DoFn<KV<Integer, Iterable<T>>, WriteT> {
      private final PCollectionView<WriteOperation<T, WriteT>> writeOperationView;

      WriteShardedBundles(PCollectionView<WriteOperation<T, WriteT>> writeOperationView) {
        this.writeOperationView = writeOperationView;
      }

      @ProcessElement
      public void processElement(ProcessContext c) throws Exception {
        // In a sharded write, single input element represents one shard. We can open and close
        // the writer in each call to processElement.
        WriteOperation<T, WriteT> writeOperation = c.sideInput(writeOperationView);
        //LOG.info("Opening writer for write operation {}", writeOperation);
        Writer<T, WriteT> writer = writeOperation.createWriter(c.getPipelineOptions());
        writer.open(UUID.randomUUID().toString());
        //LOG.debug("Done opening writer {} for operation {}", writer, writeOperationView);

        try {
          for (T t : c.element().getValue()) {
            writer.write(t);
          }
        } catch (Exception e) {
          try {
            writer.close();
          } catch (Exception closeException) {
            if (closeException instanceof InterruptedException) {
              // Do not silently ignore interrupted state.
              Thread.currentThread().interrupt();
            }
            // Do not mask the exception that caused the write to fail.
            e.addSuppressed(closeException);
          }
          throw e;
        }

        // Close the writer; if this throws let the error propagate.
        WriteT result = writer.close();
        c.output(result);
      }

      @Override
      public void populateDisplayData(DisplayData.Builder builder) {
        builder.delegate(Write.Bound.this);
      }
    }

    private static class ApplyShardingKey<T> implements SerializableFunction<T, Integer> {
      private final int numShards;
      private int shardNumber;

      ApplyShardingKey(int numShards) {
        this.numShards = numShards;
        shardNumber = -1;
      }

      @Override
      public Integer apply(T input) {
        if (shardNumber == -1) {
          // We want to desynchronize the first record sharding key for each instance of
          // ApplyShardingKey, so records in a small PCollection will be statistically balanced.
          shardNumber = ThreadLocalRandom.current().nextInt(numShards);
        } else {
          shardNumber = (shardNumber + 1) % numShards;
        }
        return shardNumber;
      }
    }

    /**
     * A write is performed as sequence of three {@link ParDo}'s.
     *
     *
In the first, a do-once ParDo is applied to a singleton PCollection containing the Sink's
     * {@link WriteOperation}. In this initialization ParDo, {@link WriteOperation#initialize} is
     * called. The output of this ParDo is a singleton PCollection
     * containing the WriteOperation.
     *
     *
This singleton collection containing the WriteOperation is then used as a side input to a
     * ParDo over the PCollection of elements to write. In this bundle-writing phase,
     * {@link WriteOperation#createWriter} is called to obtain a {@link Writer}.
     * {@link Writer#open} and {@link Writer#close} are called in {@link DoFn#startBundle} and
     * {@link DoFn#finishBundle}, respectively, and {@link Writer#write} method is called for
     * every element in the bundle. The output of this ParDo is a PCollection of
     * writer result objects (see {@link Sink} for a description of writer results)-one for
     * each bundle.
     *
     *
The final do-once ParDo uses the singleton collection of the WriteOperation as input and
     * the collection of writer results as a side-input. In this ParDo,
     * {@link WriteOperation#finalize} is called to finalize the write.
     *
     *
If the write of any element in the PCollection fails, {@link Writer#close} will be called
     * before the exception that caused the write to fail is propagated and the write result will be
     * discarded.
     *
     *
Since the {@link WriteOperation} is serialized after the initialization ParDo and
     * deserialized in the bundle-writing and finalization phases, any state change to the
     * WriteOperation object that occurs during initialization is visible in the latter phases.
     * However, the WriteOperation is not serialized after the bundle-writing phase.  This is why
     * implementations should guarantee that {@link WriteOperation#createWriter} does not mutate
     * WriteOperation).
     */
    private <WriteT> PDone createWrite(
        PCollection<T> input, WriteOperation<T, WriteT> writeOperation) {
      Pipeline p = input.getPipeline();

      // A coder to use for the WriteOperation.
      @SuppressWarnings("unchecked")
      Coder<WriteOperation<T, WriteT>> operationCoder =
          (Coder<WriteOperation<T, WriteT>>) SerializableCoder.of(writeOperation.getClass());

      // A singleton collection of the WriteOperation, to be used as input to a ParDo to initialize
      // the sink.
      PCollection<WriteOperation<T, WriteT>> operationCollection =
          p.apply(Create.of(writeOperation).withCoder(operationCoder));

      // Initialize the resource in a do-once ParDo on the WriteOperation.
      operationCollection = operationCollection
          .apply("Initialize", ParDo.of(
              new DoFn<WriteOperation<T, WriteT>, WriteOperation<T, WriteT>>() {
            @ProcessElement
            public void processElement(ProcessContext c) throws Exception {
              WriteOperation<T, WriteT> writeOperation = c.element();
              //LOG.info("Initializing write operation {}", writeOperation);
              writeOperation.initialize(c.getPipelineOptions());
              //LOG.debug("Done initializing write operation {}", writeOperation);
              // The WriteOperation is also the output of this ParDo, so it can have mutable
              // state.
              c.output(writeOperation);
            }
          }))
          .setCoder(operationCoder);

      // Create a view of the WriteOperation to be used as a sideInput to the parallel write phase.
      final PCollectionView<WriteOperation<T, WriteT>> writeOperationView =
          operationCollection.apply(View.<WriteOperation<T, WriteT>>asSingleton());

      // Re-window the data into the global window and remove any existing triggers.
      PCollection<T> inputInGlobalWindow =
          input.apply(
              Window.<T>into(new GlobalWindows())
                  .triggering(DefaultTrigger.of())
                  .discardingFiredPanes());

      // Perform the per-bundle writes as a ParDo on the input PCollection (with the WriteOperation
      // as a side input) and collect the results of the writes in a PCollection.
      // There is a dependency between this ParDo and the first (the WriteOperation PCollection
      // as a side input), so this will happen after the initial ParDo.
      PCollection<WriteT> results;
      if (getNumShards() <= 0) {
        results = inputInGlobalWindow
            .apply("WriteBundles",
                ParDo.of(new WriteBundles<>(writeOperationView))
                    .withSideInputs(writeOperationView));
      } else {
        results = inputInGlobalWindow
            .apply("ApplyShardLabel", WithKeys.of(new ApplyShardingKey<T>(getNumShards())))
            .apply("GroupIntoShards", GroupByKey.<Integer, T>create())
            .apply("WriteShardedBundles",
                ParDo.of(new WriteShardedBundles<>(writeOperationView))
                    .withSideInputs(writeOperationView));
      }
      results.setCoder(writeOperation.getWriterResultCoder());

      final PCollectionView<Iterable<WriteT>> resultsView =
          results.apply(View.<WriteT>asIterable());

      // Finalize the write in another do-once ParDo on the singleton collection containing the
      // Writer. The results from the per-bundle writes are given as an Iterable side input.
      // The WriteOperation's state is the same as after its initialization in the first do-once
      // ParDo. There is a dependency between this ParDo and the parallel write (the writer results
      // collection as a side input), so it will happen after the parallel write.
      operationCollection
          .apply("Finalize", ParDo.of(new DoFn<WriteOperation<T, WriteT>, Integer>() {
            @ProcessElement
            public void processElement(ProcessContext c) throws Exception {
              WriteOperation<T, WriteT> writeOperation = c.element();
              //LOG.info("Finalizing write operation {}.", writeOperation);
              List<WriteT> results = Lists.newArrayList(c.sideInput(resultsView));
              //LOG.debug("Side input initialized to finalize write operation {}.", writeOperation);

              // We must always output at least 1 shard, and honor user-specified numShards if set.
              int minShardsNeeded = Math.max(1, getNumShards());
              int extraShardsNeeded = minShardsNeeded - results.size();
              if (extraShardsNeeded > 0) {
                LOG.info(
                    "Creating {} empty output shards in addition to {} written for a total of {}.",
                    extraShardsNeeded, results.size(), minShardsNeeded);
                for (int i = 0; i < extraShardsNeeded; ++i) {
                  Writer<T, WriteT> writer = writeOperation.createWriter(c.getPipelineOptions());
                  writer.open(UUID.randomUUID().toString());
                  WriteT emptyWrite = writer.close();
                  results.add(emptyWrite);
                }
                LOG.debug("Done creating extra shards.");
              }

              writeOperation.finalize(results, c.getPipelineOptions());
              LOG.debug("Done finalizing write operation {}", writeOperation);
            }
          }).withSideInputs(resultsView));
      return PDone.in(input.getPipeline());
    }
  }
}


text:
using System.Collections.Generic;

namespace parent_bMedecine.DataAccess.Patient
{
    /// <summary>
    /// IPatientDataAccess interface
    /// </summary>
    public interface IPatientDataAccess
    {
        /// <summary>
        /// Retrieve all patients
        /// </summary>
        /// <returns>a list of patients</returns>
        List<ServicePatient.Patient> GetListPatient();

        /// <summary>
        /// Retrieve a unique patient with id
        /// </summary>
        /// <param name="id">patient's id</param>
        /// <returns>a patient if he exists, null otherwise</returns>
        ServicePatient.Patient GetPatient(int id);

        /// <summary>
        /// Add a patient
        /// </summary>
        /// <param name="patient">the patient to add</param>
        /// <returns>true if added, false otherwise</returns>
        bool AddPatient(ServicePatient.Patient patient);

        /// <summary>
        /// Delete a patient
        /// </summary>
        /// <param name="id">patient's id</param>
        /// <returns>true if deleted, false otherwise</returns>
        bool DeletePatient(int id);
    }
}


text:
package swaggerspec

import fixtures.{PetstoreAPI => P}
import helpers.CustomMatchers
import org.scalatest._
import swaggerblocks.rendering.json._

class JsonValiditySpec
    extends WordSpec
    with MustMatchers
    with CustomMatchers
    with ParallelTestExecution {

  "The petstore example spec" when {
    "using 'render'" should {
      "produce valid swagger json" in {
        val json = render(P.petstoreRoot, P.paths, P.schemas)

        json must beValidSwaggerJson
      }
    }

    "using 'renderPretty'" should {
      "produce valid swagger json" in {
        val json = renderPretty(P.petstoreRoot, P.paths, P.schemas)

        json must beValidSwaggerJson
      }
    }
  }
}


text:
// Copyright 2022 Google LLC
//
// 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 com.google.api.ads.admanager.jaxws.v202205;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
 *             A comment associated with a programmatic {@link Proposal} that has been sent to Marketplace.
 *
 *
 *
Java class for MarketplaceComment complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="MarketplaceComment">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="proposalId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *         <element name="comment" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="creationTime" type="{https://www.google.com/apis/ads/publisher/v202205}DateTime" minOccurs="0"/>
 *         <element name="createdBySeller" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MarketplaceComment", propOrder = {
    "proposalId",
    "comment",
    "creationTime",
    "createdBySeller"
})
public class MarketplaceComment {

    protected Long proposalId;
    protected String comment;
    protected DateTime creationTime;
    protected Boolean createdBySeller;

    /**
     * Gets the value of the proposalId property.
     *
     * @return
     *     possible object is
     *     {@link Long }
     *
     */
    public Long getProposalId() {
        return proposalId;
    }

    /**
     * Sets the value of the proposalId property.
     *
     * @param value
     *     allowed object is
     *     {@link Long }
     *
     */
    public void setProposalId(Long value) {
        this.proposalId = value;
    }

    /**
     * Gets the value of the comment property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getComment() {
        return comment;
    }

    /**
     * Sets the value of the comment property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setComment(String value) {
        this.comment = value;
    }

    /**
     * Gets the value of the creationTime property.
     *
     * @return
     *     possible object is
     *     {@link DateTime }
     *
     */
    public DateTime getCreationTime() {
        return creationTime;
    }

    /**
     * Sets the value of the creationTime property.
     *
     * @param value
     *     allowed object is
     *     {@link DateTime }
     *
     */
    public void setCreationTime(DateTime value) {
        this.creationTime = value;
    }

    /**
     * Gets the value of the createdBySeller property.
     *
     * @return
     *     possible object is
     *     {@link Boolean }
     *
     */
    public Boolean isCreatedBySeller() {
        return createdBySeller;
    }

    /**
     * Sets the value of the createdBySeller property.
     *
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *
     */
    public void setCreatedBySeller(Boolean value) {
        this.createdBySeller = value;
    }

}


text:
{% extends 'admin/model/create.html' %}

{% block head %}
        <link href="{{ url_for('admin.static', filename='select2/select2.css') }}" rel="stylesheet">
{% endblock %}

{% block body %}

List Add authentication mechanism

                    Authentication mechanism
                    Create

                {% for auth_type, available, reason in auth_types %}

                        {{ auth_type.name }}
                        {% if available %}
                            Create
                        {% else %}
                            {{ reason }}
                        {% endif %}

                {% endfor %}

{% endblock %}

{% block tail %}

{% endblock %}


text:
<?php

namespace bsadnu\mailgunmailer;

use Yii;
use yii\base\InvalidConfigException;
use yii\mail\BaseMailer;
use \Mailgun\Mailgun;

/**
 * Mailer implements a mailer based on Mailgun.
 *
 * To use Mailer, you should configure it in the application configuration like the following,
 *
 * ~~~
 * 'components' => [
 *     ...
 *     'mailer' => [
 *         'class' => 'bsadnu\mailgunmailer\Mailer',
 *         'key' => 'key-example',
 *         'domain' => 'mg.example.com',
 *     ],
 *     ...
 * ],
 * ~~~
 *
 * To send an email, you may use the following code:
 *
 * ~~~
 * Yii::$app->mailer->compose('contact/html', ['contactForm' => $form])
 *     ->setFrom('from@domain.com')
 *     ->setTo($form->email)
 *     ->setSubject($form->subject)
 *     ->send();
 * ~~~
 * @author Stanislav Bannikov <bsadnu@gmail.com>
 */
class Mailer extends BaseMailer
{
    /**
     * @var string message default class name.
     */
    public $messageClass = 'bsadnu\mailgunmailer\Message';

    /**
     * @var string Mailgun API credentials.
     */
    public $key;

    /**
     * @var string Mailgun domain.
     */
    public $domain;

    /**
     * @var Mailgun Mailgun instance.
     */
    private $_mailgun;

    /**
     * @return Mailgun Mailgun instance.
     */
    public function getMailgun()
    {
        if (!is_object($this->_mailgun)) {
            $this->_mailgun = $this->createMailgun();
        }

        return $this->_mailgun;
    }

    /**
     * @inheritdoc
     */
    protected function sendMessage($message)
    {
        Yii::info('Sending email', __METHOD__);

        $this->getMailgun()->post("{$this->domain}/messages",
            $message->getMessageBuilder()->getMessage(),
            $message->getMessageBuilder()->getFiles());

         return true;
    }

    /**
     * Creates Mailgun instance.
     *
     * @return Mailgun Mailgun instance.
     * @throws InvalidConfigException if required params are not set.
     */
    protected function createMailgun()
    {
        if (!$this->key) {
            throw new InvalidConfigException('Mailer::key must be set.');
        }
        if (!$this->domain) {
            throw new InvalidConfigException('Mailer::domain must be set.');
        }
        return new Mailgun($this->key);
    }
}


text:
import React from 'react';
import {Col, Grid, Row} from 'react-bootstrap';

let jrcLogo = require('../../images/jr_white.svg');
require('../../styles/login/AuthPage.scss');

class AuthPage extends React.Component {

  render() {
    return (

        <Grid>
          <Col sm={6} smOffset={3} md={4} mdOffset={4} xs={12} className="auth-form">
            <Row>

            </Row>
            <Row>
              <this.props.form next={this.props.next} />
            </Row>
          </Col>
        </Grid>

    );
  }
}

export default AuthPage;


text:
# How to Contribute

Contributons from the open source community are curcial to the project's success!

## Just some quick notes:
* Github Issues:
  * Before opening an issue, make sure it doesn't already exist.
  * Indicate the current version or branch you are working from.
  * Include the steps to reproduce the error.
* Pull Requests:
  * Keep commits clean and concise. (Squash them if necessary.)
  * Please tag any relevant issues in your pull requests.
  * Pull requests should be detailed as to what changes were made and why.
  * Make sure to add tests to verify your work.
  * Make sure all tests pass and that you haven't broken any code elsewhere.
  * Document your code inline as well as update the Docs as necessary

## Style and Spacing Conventions
* Javascript (and all other files unless other wise noted/required)
  * SPACES not tabs
  * 2 spaces
  * Sample Code Block
  ```javascript
  /**
   * Explain your Function Here
   */
  var yourFunction = function() {
    // Functions should be set equal for a variable
    // Opening curley braces should be on the same line as the function decleration
    // semicolons after the closing curley brace!
  };
  ```
## Thanks! :-)


text:
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.autofill.settings;

import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

import org.chromium.chrome.R;
import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;

import java.util.List;

/**
 * The base class for credit card settings.
 */
abstract class AutofillCreditCardEditor extends AutofillEditorBase {
    protected CreditCard mCard;
    protected Spinner mBillingAddress;
    protected int mInitialBillingAddressPos;

    @Override
    public View onCreateView(
            LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = super.onCreateView(inflater, container, savedInstanceState);

        // Do not use autofill for the fields.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            getActivity().getWindow().getDecorView().setImportantForAutofill(
                    View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
        }

        // Populate the billing address dropdown.
        ArrayAdapter<AutofillProfile> profilesAdapter = new ArrayAdapter<AutofillProfile>(
                getActivity(), android.R.layout.simple_spinner_item);
        profilesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        AutofillProfile noSelection = new AutofillProfile();
        noSelection.setLabel(getActivity().getString(R.string.select));
        profilesAdapter.add(noSelection);

        List<AutofillProfile> profiles = PersonalDataManager.getInstance().getProfilesForSettings();
        for (int i = 0; i < profiles.size(); i++) {
            AutofillProfile profile = profiles.get(i);
            if (profile.getIsLocal() && !TextUtils.isEmpty(profile.getStreetAddress())) {
                profilesAdapter.add(profile);
            }
        }

        mBillingAddress =
                (Spinner) v.findViewById(R.id.autofill_credit_card_editor_billing_address_spinner);
        mBillingAddress.setAdapter(profilesAdapter);

        // TODO(rouslan): Use an [+ ADD ADDRESS] button instead of disabling the dropdown.
        // http://crbug.com/623629
        if (profilesAdapter.getCount() == 1) mBillingAddress.setEnabled(false);

        mCard = PersonalDataManager.getInstance().getCreditCard(mGUID);
        if (mCard != null) {
            if (!TextUtils.isEmpty(mCard.getBillingAddressId())) {
                for (int i = 0; i < mBillingAddress.getAdapter().getCount(); i++) {
                    AutofillProfile profile =
                            (AutofillProfile) mBillingAddress.getAdapter().getItem(i);
                    if (TextUtils.equals(profile.getGUID(), mCard.getBillingAddressId())) {
                        mInitialBillingAddressPos = i;
                        mBillingAddress.setSelection(i);
                        break;
                    }
                }
            }
        }

        return v;
    }

    @Override
    protected void initializeButtons(View v) {
        super.initializeButtons(v);

        mBillingAddress.setOnItemSelectedListener(this);

        // Listen for touch events on billing address field. We clear the keyboard when user touches
        // the billing address field because it is a drop down menu.
        mBillingAddress.setOnTouchListener(this);
    }
}


text:
#ifndef NANOSVGRAST_H
#define NANOSVGRAST_H

#include "nanosvg.h"

typedef struct NSVGrasterizer NSVGrasterizer;

/* Example Usage:
  // Load SVG
  NSVGimage* image;
  image = nsvgParseFromFile("test.svg", "px", 96);

  // Create rasterizer (can be used to render multiple images).
  struct NSVGrasterizer* rast = nsvgCreateRasterizer();
  // Allocate memory for image
  unsigned char* img = malloc(w*h*4);
  // Rasterize
  nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
*/

// Allocated rasterizer context.
NSVGrasterizer* nsvgCreateRasterizer();

// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
//   r - pointer to rasterizer context
//   image - pointer to image to rasterize
//   tx,ty - image offset (applied after scaling)
//   scale - image scale
//   dst - pointer to destination image data, 4 bytes per pixel (RGBA)
//   w - width of the image to render
//   h - height of the image to render
//   stride - number of bytes per scaleline in the destination buffer
void nsvgRasterize(NSVGrasterizer* r,
                   NSVGimage* image, float tx, float ty, float scale,
                   unsigned char* dst, int w, int h, int stride);

// Deletes rasterizer context.
void nsvgDeleteRasterizer(NSVGrasterizer*);

#endif // NANOSVGRAST_H

/**
 * In the original software, The nanosvgrast implementation was followed here.
 * We have moved the implementation to nanosvgrast.cc.
 */


text:
<?php

namespace Zephir\Code\Builder;

/**
 * Class Struct
 *
 * Represents an internal extension global structure
 *
 * @package Code\Builder
 */
class Struct
{
    /**
     * @var string
     */
    protected $_name;

    /**
     * @var string
     */
    protected $_simpleName;

    /**
     * @var array
     */
    protected $_properties = array();

    /**
     * @param string $name
     * @param string $simpleName
     * @throws \InvalidArgumentException
     */
    public function __construct($name, $simpleName)
    {
        if (!is_string($name)) {
            throw new \InvalidArgumentException('Struct name must be string');
        }

        if (!is_string($simpleName)) {
            throw new \InvalidArgumentException('Struct name must be string');
        }

        if (empty($name)) {
            throw new \InvalidArgumentException('Struct name must not be empty');
        }

        $this->_name = $name;
        $this->_simpleName = $simpleName;
    }

    /**
     * @param string $field
     * @param array $global
     * @throws \InvalidArgumentException
     */
    public function addProperty($field, $global)
    {
        if (!isset($global['type'])) {
            throw new \InvalidArgumentException('Property type must be string');
        }

        if (!is_string($global['type'])) {
            throw new \InvalidArgumentException('Property type must be string');
        }

        if (!is_string($field)) {
            throw new \InvalidArgumentException('Property name must be string');
        }

        if (isset($this->_properties[$field])) {
            throw new \InvalidArgumentException('Property was defined more than once');
        }

        $this->_properties[$field] = $this->convertToCType($global['type']);
    }

    /**
     * Generates the internal c-type according to the php's type
     *
     * @param string $type
     * @return string
     * @throws \Exception
     */
    protected function convertToCType($type)
    {
        switch ($type) {

            case 'boolean':
            case 'bool':
                return 'zend_bool';

            case 'hash':
                return 'HashTable* ';

            case 'int':
            case 'uint':
            case 'long':
            case 'char':
            case 'uchar':
            case 'double':
                return $type;

            default:
                throw new \Exception('Unknown global type: ' . $type);
        }
    }

    /**
     * Returns the C code that initializes the extension global
     *
     * @param string $name
     * @param array $global
     */
    public function getCDefault($name, $global, $namespace)
    {
        if (!isset($global['default'])) {
            throw new \Exception('Field "' . $name . '" does not have a default value');
        }

        switch ($global['type']) {

            case 'boolean':
            case 'bool':
                return '';
                /*
                if ($global['default'] === true) {
                    return "\t" . $namespace . '_globals->' . $this->_simpleName . '.' . $name . ' = 1;';
                } else {
                    if ($global['default'] === false) {
                        return "\t" . $namespace . '_globals->' . $this->_simpleName . '.' . $name . ' = 0;';
                    } else {
                        throw new \Exception('Invalid default type for boolean field "' . $name . '", it must be false/true');
                    }
                }
                */
                break;

            case 'int':
            case 'uint':
            case 'long':
            case 'double':
            case 'hash':
                return "\t" . $namespace . '_globals->' . $this->_simpleName . '.' . $name . ' = ' . $global['default'] . ';';

            default:
                throw new \Exception('Unknown global type: ' . $global['type']);
        }
    }

    /**
     * @return string
     */
    public function __toString()
    {
        $code = 'typedef struct '. $this->_name .' { '.PHP_EOL;

        foreach ($this->_properties as $name => $type) {
            $code .= T . $type . ' ' . $name . ';' . PHP_EOL;
        }

        return $code . '} ' . substr($this->_name, 1) . ';' . PHP_EOL;
    }

    /**
     * @return string
     */
    public function getInitEntry($name, $global, $namespace)
    {
        $iniEntry = array();
        if (isset($global['ini-entry'])) {
            $iniEntry = $global['ini-entry'];
        }
        $structName = $this->_simpleName . '.' . $name;
        if (!isset($iniEntry['name'])) {
            $iniName = $namespace . '.' . $structName;
        } else {
            $iniName = $iniEntry['name'];
        }
        if (!isset($iniEntry['scope'])) {
            $scope = 'PHP_INI_ALL';
        } else {
            $scope = $iniEntry['scope'];
        }

        switch ($global['type']) {
            case 'boolean':
            case 'bool':
                return
                    'STD_PHP_INI_BOOLEAN("' .
                    $iniName .
                    '", "' .
                    (int) ($global['default'] === true) .
                    '", ' .
                    $scope .
                    ', OnUpdateBool, ' .
                    $structName .
                    ', zend_' .
                    $namespace .
                    '_globals, ' .
                    $namespace . '_globals)';
            break;
        }
        return '';
    }
}


text:
package com.google.appengine.demos;
// enable async in the servlet

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet(urlPatterns = {"/simplesse"})
public class AsyncTest extends HttpServlet {

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
          throws IOException, ServletException {

    // set content type
    res.setContentType("text/event-stream");
    res.setCharacterEncoding("UTF-8");

    String msg = req.getParameter("msg");

    PrintWriter writer = res.getWriter();

    // send SSE
    writer.write("data: " + msg + "\n\n");
  }
}


text:
import re, sys, zipfile

class Jar:
  """Class to parse a Java Jar file"""

  def __init__(self, jarfile):
    """Constructor. Takes a filename or file object"""
    self.zip = zipfile.ZipFile(jarfile, 'r')
    self.manifest = None

  def getEntry(self, name):
    """Return a file object for a Jar file entry named 'name'"""
    return self.zip.open(name)

  def findEntries(self, name):
    """Return a list of Jar file entries that match the given regular expression 'name'"""
    pattern = re.compile(name)
    list = []
    for info in self.zip.infolist():
      if pattern.match(info.filename):
        list.append(info.filename)
    return list

  def readManifest(self):
    """Read the Jar's manifest and return it as a dictionary"""
    pattern = re.compile('(^\S*): (.*)$')
    if not self.manifest:
      self.manifest = {}
      key = None
      value = None
      with self.getEntry('META-INF/MANIFEST.MF') as f:
        for line in f:
          line = line[:-2]
          match = pattern.match(line)
          if match:
            if (key):
              self.manifest[key] = value
            key = match.group(1)
            value = match.group(2)
          else:
            value = ''.join([value, line[1:]])
      self.manifest[key] = value
    return self.manifest

if __name__ == "__main__":
  jar = Jar(sys.argv[1])
  print jar.readManifest()['Class-Path']
  pom = jar.findEntries('.*/pom.xml$')
  print pom[0]


text:
<!-- author: TestAuthor -->
<!-- title: TestTitle -->
<!-- tags: tag1, tag2 -->

# Test_Headline

Test-Text


text:
class ApplicationMailer < ActionMailer::Base
  default from: 'from@example.com'
end


text:
require "formtastic-separate_html5_date_and_time/version"

module Formtastic
  module SeparateHtml5DateAndTime
    class Engine < ::Rails::Engine
      initializer 'separate_html5_date_and_time.initialize' do
        require 'formtastic'
        require 'formtastic-separate_html5_date_and_time/formtastic'

        if defined?(ActiveRecord::Base)
          require 'formtastic-separate_html5_date_and_time/active_record'
        end

        if defined?(Mongoid::Document)
          require 'formtastic-separate_html5_date_and_time/mongoid'
        end
      end
    end
  end
end


text:
<?php
/**
 * @name ldapUser
 * @author vtacius
 */
namespace Agenlad\Controller\ldapLogin;

use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\EquatableInterface;

class ldapUser implements UserInterface, EquatableInterface {
    private $username;
    private $password;
    private $salt;
    private $roles;
    private $dnUser;
    private $dominio;

    public function __construct($username, $password, array $roles, $dominio, $dnUser) {
        $this->username = $username;
        $this->password = $password;
        $this->roles = $roles;
        $this->dominio = $dominio;
        $this->dnUser = $dnUser;
    }

    function getDominio() {
        return $this->dominio;
    }

    function getDnUser() {
        return $this->dnUser;
    }

    function setDnUser($dnUser) {
        $this->dnUser = $dnUser;
    }

    public function getRoles() {
        return $this->roles;
    }

    public function getPassword() {
        return $this->password;
    }

    public function getSalt() {
        return $this->salt;
    }

    public function getUsername() {
        return $this->username;
    }

    public function eraseCredentials() {
    }

    public function isEqualTo(UserInterface $user) {
        if (!$user instanceof ldapUser) {
            return false;
        }
        if ($this->password !== $user->getPassword()) {
            return false;
        }
        if ($this->salt !== $user->getSalt()) {
            return false;
        }
        if ($this->username !== $user->getUsername()) {
            return false;
        }
        return true;
    }
}


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

    <dataSet config="main" >
        <source path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res" >
            <file
                name="ic_launcher"
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/drawable-hdpi/ic_launcher.png"
                qualifiers="hdpi"
                type="drawable" />
            <file
                name="ic_launcher"
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/drawable-mdpi/ic_launcher.png"
                qualifiers="mdpi"
                type="drawable" />
            <file
                name="ic_launcher"
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/drawable-xhdpi/ic_launcher.png"
                qualifiers="xhdpi"
                type="drawable" />
            <file
                name="ic_launcher"
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/drawable-xxhdpi/ic_launcher.png"
                qualifiers="xxhdpi"
                type="drawable" />
            <file
                name="activity_main"
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/layout/activity_main.xml"
                qualifiers=""
                type="layout" />
            <file
                name="main"
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/menu/main.xml"
                qualifiers=""
                type="menu" />
            <file
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/values/dimens.xml"
                qualifiers="" >
                <dimen name="activity_horizontal_margin" >16dp
                </dimen>
                <dimen name="activity_vertical_margin" >16dp
                </dimen>
            </file>
            <file
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/values/strings.xml"
                qualifiers="" >
                <string name="action_settings" >Settings
                </string>
                <string name="app_name" >VolleyTest
                </string>
                <string name="hello_world" >Hello world!
                </string>
            </file>
            <file
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/values/styles.xml"
                qualifiers="" >

                <style
                    name="AppBaseTheme"
                    parent="android:Theme.Light" >

                    <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
                    -->
                </style>

                <style
                    name="AppTheme"
                    parent="AppBaseTheme" >

                    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
                </style>
            </file>
            <file
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/values-sw600dp/dimens.xml"
                qualifiers="sw600dp" />
            <file
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/values-sw720dp-land/dimens.xml"
                qualifiers="sw720dp-land" >
                <dimen name="activity_horizontal_margin" >128dp
                </dimen>
            </file>
            <file
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/values-v11/styles.xml"
                qualifiers="v11" >

                <style
                    name="AppBaseTheme"
                    parent="android:Theme.Holo.Light" >

                    <!-- API 11 theme customizations can go here. -->
                </style>
            </file>
            <file
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/values-v14/styles.xml"
                qualifiers="v14" >

                <style
                    name="AppBaseTheme"
                    parent="android:Theme.Holo.Light.DarkActionBar" >

                    <!-- API 14 theme customizations can go here. -->
                </style>
            </file>
            <file
                name="row_listview"
                path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/main/res/layout/row_listview.xml"
                qualifiers=""
                type="layout" />
        </source>
        <source path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/build/res/rs/debug" />
    </dataSet>
    <dataSet config="debug" >
        <source path="/Users/indianic/AndroidStudioProjects/VolleyTest/VolleyTest/src/debug/res" />
    </dataSet>

</merger>


text:
"use strict";
import { GET, POST, PUT, DELETE, OPTIONS, ALL, route, routePrefix } from "../Routes/Decorator";
import { Context } from "koa";
import { injectParam, injectProperty } from "../DependencyInjection/Decorator";
import { A, B } from "../InjectionTest"

@routePrefix("/hello")
export class HelloController {
    @injectProperty("a1")
    v1!: A;
    @injectProperty("a2")
    v2!: A;
    @injectProperty("a3")
    v3!: A;
    @injectProperty("a3")
    v4!: A;
    @injectProperty("b")
    v5!: B;

    constructor( @injectParam("a1") p1: A, @injectParam("a2") p2: A, @injectParam("a3") p3: A, @injectParam("b") p4: B) {
        console.log(p1)
        console.log(p2)
        console.log(p3)
        console.log(p4)
        console.log("create controller hello");
    }

    @GET("world")
    async getWorld(ctx: Context): Promise<void> {
        console.log(this.v1)
        console.log(this.v2)
        console.log(this.v3)
        console.log(this.v4)
        console.log(this.v5);
        ctx.body = "hello world get";
    }

    @PUT("world")
    async putWorld(ctx: Context): Promise<void> {
        ctx.body = "hello world put";
    }

    @POST("world")
    async postWorld(ctx: Context): Promise<void> {
        ctx.body = "hello world post";
    }

    @DELETE("world")
    async deleteWorld(ctx: Context): Promise<void> {
        ctx.body = "hello world delete";
    }

    @OPTIONS("world")
    async optionsWorld(ctx: Context): Promise<void> {
        ctx.body = "hello world options";
    }

    @route("PATCH", "world")
    async patchWorld(ctx: Context): Promise<void> {
        ctx.body = "hello world patch";
    }

    @ALL("all/world")
    async allWorld(ctx: Context): Promise<void> {
        ctx.body = "hello world all";
    }

    @OPTIONS("test")
    @GET("test")
    @route("HEAD", "test")
    async test(ctx: Context): Promise<void> {
        let methods = ["GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"];
        ctx.response.set("X-Url", "/hello/world");
        ctx.response.set("X-Support-Method", methods.join(";"));
        if (ctx.request.method == "GET") {
            ctx.body = { url: "/hello/world", method: methods }
        } else {
            ctx.body = null;
        }
        console.log(this.v1);
        console.log(this.v2);
        console.log(this.v3);
        console.log(this.v4);
        console.log(this.v5);
    }
}


text:
package org.apache.accumulo.test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

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

import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.hadoop.io.Text;
import org.junit.jupiter.api.Test;

public class FindMaxIT extends AccumuloClusterHarness {

  private static Mutation nm(byte[] row) {
    Mutation m = new Mutation(new Text(row));
    m.put("cf", "cq", "v");
    return m;
  }

  private static Mutation nm(String row) {
    Mutation m = new Mutation(row);
    m.put("cf", "cq", "v");
    return m;
  }

  @Test
  public void test1() throws Exception {
    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
      String tableName = getUniqueNames(1)[0];

      client.tableOperations().create(tableName);

      try (BatchWriter bw = client.createBatchWriter(tableName)) {
        bw.addMutation(nm(new byte[] {0}));
        bw.addMutation(nm(new byte[] {0, 0}));
        bw.addMutation(nm(new byte[] {0, 1}));
        bw.addMutation(nm(new byte[] {0, 1, 0}));
        bw.addMutation(nm(new byte[] {1, 0}));
        bw.addMutation(nm(new byte[] {'a', 'b', 'c'}));
        bw.addMutation(nm(new byte[] {(byte) 0xff}));
        bw.addMutation(nm(new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
            (byte) 0xff, (byte) 0xff}));

        for (int i = 0; i < 1000; i += 5) {
          bw.addMutation(nm(String.format("r%05d", i)));
        }
      }

      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {

        ArrayList<Text> rows = new ArrayList<>();

        for (Entry<Key,Value> entry : scanner) {
          rows.add(entry.getKey().getRow());
        }

        for (int i = rows.size() - 1; i > 0; i--) {
          Text max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
              rows.get(i), false);
          assertEquals(rows.get(i - 1), max);

          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
              true, rows.get(i), false);
          assertEquals(rows.get(i - 1), max);

          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
              false, rows.get(i), false);
          assertNull(max);

          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
              rows.get(i), true);
          assertEquals(rows.get(i), max);

          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i),
              true, rows.get(i), true);
          assertEquals(rows.get(i), max);

          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
              false, rows.get(i), true);
          assertEquals(rows.get(i), max);

        }

        Text max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
            null, true);
        assertEquals(rows.get(rows.size() - 1), max);

        max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
            new Text(new byte[] {0}), false);
        assertNull(max);

        max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
            new Text(new byte[] {0}), true);
        assertEquals(rows.get(0), max);
      }
    }
  }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <title>Sol&Luna</title>

<link rel="stylesheet" href="css/materialize.min.css" media="screen,projection">

<link rel="stylesheet" href="css/mystyle.css" media="screen,projection">

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

one

two

three

one

two

three

one

two

three

one

two

three

Contact Uscall

Incio

Independent living

Assisting livig

Memory Care

person_pin

Contact uscall

Independent living

Assisting livig

Memory Care

person_pin

MEMORY CARE

     Find a Health Resort

          <select>

            <option value="1" >Mexico</option>

            <option value="2">EUA</option>

            <option value="3">CUBA</option>

          </select>

           Country

       <select>

            <option value="1" >Vida asistida</option>

            <option value="2">Vida independiente</option>

            <option value="3">Cuidado de Memoria</option>

          </select>

           Tipo de Cuidado

          <select>

            <option value="1" >Jalisco</option>

            <option value="2">Quintana Roo</option>

          </select>

           State

          <select>

            <option value="1" >Puerto Vallarta</option>

            <option value="2">Sayulita</option>

            <option value="3">Cancun</option>

          </select>

           Town

        offline_pin

Memory care

Specifically designed memory care secured environments to care and protect your love ones with healthcare professionals trained to care for people living with dementia and cognitive disorders. Access to private nurses, physicians, hospitals and interactive communications to family members and healthcare provided as needed.

Memory Care communities, which include Alzheimer's care and Dementia care facilities, consist of specially designed living spaces and supporting environments for those who are living with cognitive challenges brought on by Alzheimer's care and dementia. These may include carefully considered flooring to reduce problematic patterns for those with Alzheimer's or dementia and wall colors that help them to find the way. The dementia care environment helps cue its residents in their daily lives. Areas of the community are set up for safe engagement in activities such as gardening, kitchen work, and other life skills that provide purposeful and meaningful successful moments

Why Sol & Luna Health Resorts?

        Aqui redactar el porque es mejor elegir Sol & Luna Health Resorts respecto a la competencia, ademas

        de los beneficios que tiene hospedarse con nosotros y la diferencia de hospedarse en otra parte.

Find out Memory Care Residences
trending_flat

            © 2015 Copyright Sol & Luna Health Exclusive Resorts
            About Us
            Inversionistas
            Politicy


text:
require 'dm-serializer/common'

if RUBY_VERSION >= '1.9.0'
 require 'csv'
else
  begin
    gem 'fastercsv', '~>1.5.0'
    require 'fastercsv'
    CSV = FasterCSV
  rescue LoadError
    # do nothing
  end
end

module DataMapper
  module Serialize
    # Serialize a Resource to comma-separated values (CSV).
    #
    # @return <String> a CSV representation of the Resource
    def to_csv(writer = '')
      CSV.generate(writer) do |csv|
        row = model.properties(repository.name).map do |property|
          __send__(property.name).to_s
        end
        csv << row
      end
    end
  end

  class Collection
    def to_csv
      result = ''
      each do |item|
        result << item.to_csv + "\n"
      end
      result
    end
  end

  if Serialize::Support.dm_validations_loaded?

    module Validate
      class ValidationErrors
        def to_csv(writer = '')
          CSV.generate(writer) do |csv|
            errors.each do |key, value|
              value.each do |error|
                row = []
                row << key.to_s
                row << error.to_s
                csv << row
              end
            end
          end
        end
      end
    end

  end

end


text:
<?php

use function DI\autowire;

$definitions = [];

if (class_exists(Asm89\Twig\CacheExtension\Extension::class)) {
    $definitions = array_merge($definitions, [
        Asm89\Twig\CacheExtension\CacheProviderInterface::class
        => autowire(Mopsis\Extensions\Twig\Cache\CacheAdapter::class),

        Asm89\Twig\CacheExtension\CacheStrategyInterface::class
        => autowire(Asm89\Twig\CacheExtension\CacheStrategy\GenerationalCacheStrategy::class),

        Asm89\Twig\CacheExtension\CacheStrategy\KeyGeneratorInterface::class
        => autowire(Mopsis\Extensions\Twig\Cache\KeyGenerator::class)
    ]);
}

if (class_exists(Aptoma\Twig\Extension\MarkdownExtension::class)) {
    $definitions = array_merge($definitions, [
        Aptoma\Twig\Extension\MarkdownEngineInterface::class
        => autowire(Mopsis\Extensions\Twig\Markdown\MarkdownEngine::class)
    ]);
}

if (class_exists(CacheTool\CacheTool::class)) {
    $definitions = array_merge($definitions, [
        CacheTool::class
        => function () {
            $adapter = new CacheTool\Adapter\FastCGI('127.0.0.1:9000');

            return CacheTool\CacheTool::factory($adapter);
        }

    ]);
}

if (class_exists(Mailgun\Mailgun::class)) {
    $definitions = array_merge($definitions, [
        Mailgun::class
        => autowire(Mailgun\Mailgun::class)
            ->constructorParameter('httpClient', autowire(Http\Adapter\Guzzle6\Client::class))
    ]);
}

return $definitions;


text:
package com.strategicgains.repoexpress.mongodb;

import java.util.Properties;

import org.restexpress.common.exception.ConfigurationException;

import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoClientOptions.Builder;
import com.mongodb.MongoClientURI;

public class MongoConfig
{
	private static final String URI_PROPERTY = "mongodb.uri";
	private static final String URI_ENVIRONMENT_PROPERTY = "MONGODB_URI";

	private String dbName;
	private MongoClient client;

	public MongoConfig(Properties p) {
		this(p, null);
	}

    public MongoConfig(Properties p, Builder builder)
    {
		String uri = p.getProperty(URI_ENVIRONMENT_PROPERTY);

		if (uri == null)
		{
			uri = p.getProperty(URI_PROPERTY);
		}

		if (uri == null)
		{
			throw new ConfigurationException(String.format("Please define a MongoDB URI for property: %s or %s", URI_PROPERTY, URI_ENVIRONMENT_PROPERTY));
		}

		MongoClientURI mongoUri = new MongoClientURI(uri, (builder != null) ? builder : new MongoClientOptions.Builder());
		dbName = mongoUri.getDatabase();
        client = new MongoClient(mongoUri);
		initialize(p);
    }

    /**
     * Sub-classes can override to initialize other properties.
     *
     * @param p Propreties
     */
	protected void initialize(Properties p)
    {
		// default is to do nothing.
    }

	public String getDbName()
	{
		return dbName;
	}

	public MongoClient getClient()
	{
		return client;
	}
}


text:
require 'spec_helper'

describe 'taurus::jmeter' do
  let(:chef_run) do
    ChefSpec::ServerRunner.new(step_into: ['taurus']).converge('taurus::jmeter')
  end
  it { expect(chef_run).to include_recipe('java') }

  # it { expect(chef_run).to install_package('openjdk-7-jdk') }

  it 'creates jmeter directory' do
    expect(chef_run).to create_directory('/opt/taurus/tools/jmeter')
  end

  it 'downloads jmeter-taurus' do
    expect(chef_run).to put_ark('jmeter')
  end

  it 'downloads jmeter libraries' do
    expect(chef_run).to dump_ark('jmeter-plugin-Standard')
    expect(chef_run).to dump_ark('jmeter-plugin-Extras')
    expect(chef_run).to dump_ark('jmeter-plugin-ExtrasLibs')
    expect(chef_run).to dump_ark('jmeter-plugin-WebDriver')
    expect(chef_run).to dump_ark('jmeter-plugin-XMPP')
    expect(chef_run).to dump_ark('jmeter-plugin-Hadoop')
  end

  it 'sets bin/jmeter perms to 755' do
    expect(chef_run).to create_file('/opt/taurus/tools/jmeter/bin/jmeter').with(
      mode: '0755'
    )
  end
  it 'sets bin/jmeter-server perms to 755' do
    expect(chef_run).to create_file('/opt/taurus/tools/jmeter/bin/jmeter-server').with(
      mode: '0755'
    )
  end
  it 'sets bin/ApacheJMeter.jar perms to 755' do
    expect(chef_run).to create_file('/opt/taurus/tools/jmeter/bin/ApacheJMeter.jar').with(
      mode: '0755'
    )
  end

  it 'creates jmeter-service directory' do
    expect(chef_run).to create_directory('/var/log/jmeter-service')
  end

  it 'creates runit_service[jmeter-service]' do
    expect(chef_run).to enable_runit_service('jmeter-service')
  end
end


text:
require 'feed_tools_ram_cache'
require 'test/unit'

require 'benchmark'
require 'open-uri'

class IntegrationTest < Test::Unit::TestCase
  def setup
    FeedTools.configurations[:feed_cache] = FeedTools::RamFeedCache
    FeedTools::RamFeedCache.clear
  end

  def test_with_atom
    uri = 'http://feeds2.feedburner.com/VictorCostan'
    _test_cache uri
  end

  def test_with_rss
    uri = 'http://events.mit.edu/rss/'
    _test_cache uri
  end

  def _test_cache(uri)
    feed, cached_feed = nil, nil
    time = Benchmark.realtime do
      feed = FeedTools::Feed.open(uri)
      # NOTE: would like to include item instantiation, but it turns out parsing
      #       takes forever and dominates the running time
      # feed.items.each { |item| item.description }
    end

    # Make sure the cache's state is YAML-serializable
    yaml_state = FeedTools::RamFeedCache.state.to_yaml
    FeedTools::RamFeedCache.state = YAML.load yaml_state

    cached_time = Benchmark.realtime do
      cached_feed = FeedTools::Feed.open uri
      # NOTE: would like to include item instantiation, but it turns out parsing
      #       takes forever and dominates the running time
      # cached_feed.items.each { |item| item.description }
    end

    assert !cached_feed.live?, 'cached_feed is live?'
    assert_operator cached_time, :< , time / 3,
                    'Cached retrieval should be faster'

    assert_equal feed.items.length, cached_feed.items.length,
                 'Incorrect cached data (item count)'
    feed.items.each_index do |i|
      [:guid, :published, :link, :summary, :description].each do |field|
        assert_equal cached_feed.items[i].send(field),
                     feed.items[i].send(field),
                     "Incorrect cached data at index #{i} field #{field}: " +
                     feed.items[i].inspect + ' vs ' +
                     cached_feed.items[i].inspect
      end
    end
  end
end


text:
import { expect } from 'chai';
import usertags from '../../src/lib/api/usertags';

describe('Codeforces', function() {
    describe('#usertags', function() {

        it('should throw error when parameter is empty', function(done) {
            expect(function () {
                usertags();
            }).to.throw(Error);
            done();
        });

        it('should throw error when handle is empty', function(done) {
            expect(function () {
                usertags({});
            }).to.throw(Error);
            done();
        });

        it('should throw error when handle is not a string', function(done) {

            expect(function () {
                usertags({ handle: {} });
            }).to.throw(Error);

            expect(function () {
                usertags({ handle: null });
            }).to.throw(Error);

            expect(function () {
                usertags({ handle: undefined });
            }).to.throw(Error);

            done();
        });

    });
});