text:
package com.veryant.joe;

import java.util.ArrayDeque;

public class Tokenizer {
   public static final String rcsid = "$Id$";

   private ArrayDeque<Token> tokens;
   private StringBuilder word;
   private TokenType status = TokenType._INIT;
   private int cCol = 0;
   private int cRow = 0;
   private String fname;

   private Token newToken (String w, TokenType t) {
      return new Token (w, t, cRow, cCol - w.length(), fname);
   }
   private Token newToken (String w, TokenType t, int col) {
      return new Token (w, t, cRow, col, fname);
   }
   private boolean breakChar (char c) {
      boolean Return = true;
      switch (status) {
      case _INIT:
         break;
      case _INTEGER:
      case _FLOAT:
      case _DECIMAL:
      case _WORD:
         tokens.add (newToken(word.toString(), status));
         word = null;
         status = TokenType._INIT;
         break;
      case _STRING:
         word.append (c);
         Return = false;
         break;
      case _ML_COMMENT:
         Return = false;
         break;
      }
      return Return;
   }

   public boolean tokenize (char line[], ArrayDeque<Token> t, FileInfo fi) {
      boolean Return = false;
      fname = fi.getName();
      cRow = fi.getLineNumber();

      int idx = 0;
      int ila = 0;

      tokens = t;
      word = null;

      for (idx = 0; idx < line.length; idx++) {
         ila = cCol = idx + 1;
         switch (line[idx]) {
         case ' ':
         case '\t':
         case '\r':
            breakChar(line[idx]);
            break;
         case '*':
            switch (status) {
            case _ML_COMMENT:
               if (++idx < line.length && line[idx] == '/')
                  status = TokenType._INIT;
               else
                  --idx;
               break;
            case _STRING:
               word.append (line[idx]);
               break;
            case _INIT:
            case _WORD:
            case _INTEGER:
            case _FLOAT:
               if (++idx < line.length && line[idx] == '>') {
                  idx = line.length;
                  break;
               } else {
                  --idx;
                  if (status == TokenType._WORD)
                     tokens.add (newToken(word.toString(),TokenType._WORD));
                  else if (status == TokenType._INTEGER)
                     tokens.add (newToken(word.toString(),TokenType._INTEGER));
                  else if (status == TokenType._FLOAT)
                     tokens.add (newToken(word.toString(),TokenType._FLOAT));
                  word = null;
                  status = TokenType._INIT;
                  tokens.add (newToken("multiply", TokenType._WORD, cCol));
               }
            }
            break;
         case '=':
            if (breakChar(line[idx]))
               tokens.add (newToken("equals", TokenType._WORD, cCol));
            break;
         case '<':
            if (breakChar(line[idx])) {
               ++idx;
               if (idx < line.length && line[idx] == '=') {
                  tokens.add (newToken("le", TokenType._WORD, cCol));
               } else if (idx < line.length && line[idx] == '>') {
                  tokens.add (newToken("ne", TokenType._WORD, cCol));
               } else if (idx + 1 < line.length && line[idx + 1] == '>' &&
                                    (line[idx] == '0' || line[idx] == '1')) {
                  if (line[idx] == '1')
                     tokens.add (newToken("<1>", TokenType._TRUE, cCol));
                  else
                     tokens.add (newToken("<0>", TokenType._FALSE, cCol));
                  idx++;
               } else {
                  --idx;
                  tokens.add (newToken("lt", TokenType._WORD, cCol));
               }
            }
            break;
         case '>':
            if (breakChar(line[idx])) {
               ++idx;
               if (idx < line.length && line[idx] == '=') {
                  tokens.add (newToken("ge", TokenType._WORD, cCol));
               } else {
                  --idx;
                  tokens.add (newToken("gt", TokenType._WORD, cCol));
               }
            }
            break;
         case ':':
            if (breakChar(line[idx])) {
               ++idx;
               if (idx < line.length && line[idx] == '=') {
                  tokens.add (newToken(":=", TokenType._ASSIGN, cCol));
               } else {
                  --idx;
                  tokens.add (newToken(":", TokenType._COLON_, cCol));
               }
            }
            break;
         case '-':
            if (breakChar(line[idx])) {
               ++idx;
               if (idx < line.length && line[idx] >= '0' && line[idx] <= '9') {
                  --idx;
                  status = TokenType._INTEGER;
                  word = new StringBuilder (Character.toString(line[idx]));
               } else {
                  --idx;
                  tokens.add (newToken("subtract", TokenType._WORD, cCol));
               }
            }
            break;
         case '+':
            if (breakChar(line[idx]))
               tokens.add (newToken("add", TokenType._WORD, cCol));
            break;
         case '/':
            if (breakChar(line[idx]))
               if (++idx < line.length && line[idx] == '*')
                  status = TokenType._ML_COMMENT;
               else {
                  idx--;
                  tokens.add (newToken("divide", TokenType._WORD, cCol));
               }
            break;
         case '%':
            if (breakChar(line[idx]))
               tokens.add (newToken("remainder", TokenType._WORD, cCol));
            break;
         case '(':
            if (breakChar(line[idx]))
               if (ila < line.length && line[ila] == ')') {
                  tokens.add (newToken("()", TokenType._NULL, cCol));
                  idx++;
               } else {
                  tokens.add (newToken("(", TokenType._PAR_OPEN_, cCol));
               }
            break;
         case ')':
            if (breakChar(line[idx]))
               tokens.add (newToken(")", TokenType._PAR_CLOSE_, cCol));
            break;
         case '{':
            if (breakChar(line[idx]))
               tokens.add (newToken("{", TokenType._BRACE_OPEN_, cCol));
            break;
         case '}':
            if (breakChar(line[idx]))
               tokens.add (newToken("}", TokenType._BRACE_CLOSE_, cCol));
            break;
         case ',':
            if (breakChar(line[idx]))
               tokens.add (newToken(",", TokenType._COMMA_, cCol));
            break;
         case ';':
            if (breakChar(line[idx]))
               tokens.add (newToken(";", TokenType._SEMICOLON_, cCol));
            break;
         case '.':
            if (status == TokenType._INTEGER &&
                ila < line.length && line[ila] >= '0' && line[ila] <= '9') {
               word.append ('.');
               status = TokenType._FLOAT;
            } else {
               if (breakChar(line[idx]))
                  tokens.add (newToken(".", TokenType._DOT_, cCol));
            }
            break;
         case '!':
            if (breakChar(line[idx]))
               if (ila < line.length && line[ila] == '!') {
                  tokens.add (newToken("!!", TokenType._BANGBANG_, cCol));
                  idx++;
               } else
                  tokens.add (newToken("!", TokenType._BANG_, cCol));
            break;
         case '"':
            switch (status) {
            case _ML_COMMENT:
               break;
            case _INTEGER:
            case _FLOAT:
            case _WORD:
               tokens.add (newToken(word.toString(), status));
               // PASSTHRU
            case _INIT:
               status = TokenType._STRING;
               word = new StringBuilder();
               break;
            case _STRING:
               if (++idx <line.length && line[idx] == '"') {
                  word.append(line[idx]);
               } else {
                  --idx;
                  tokens.add (newToken(word.toString(), TokenType._STRING,
                                       cCol - word.length() - 1));
                  word = new StringBuilder();
                  status = TokenType._INIT;
               }
               break;
            }
            break;
         case '0':
         case '1':
         case '2':
         case '3':
         case '4':
         case '5':
         case '6':
         case '7':
         case '8':
         case '9':
            switch (status) {
            case _ML_COMMENT:
               break;
            case _INIT:
               status = TokenType._INTEGER;
               word = new StringBuilder (Character.toString(line[idx]));
               break;
            case _INTEGER:
            case _FLOAT:
            case _STRING:
            case _WORD:
               word.append (line[idx]);
               break;
            }
            break;
         case 'e':
         case 'E':
         case 'm':
         case 'M':
            if (status == TokenType._INTEGER || status == TokenType._FLOAT) {
               if (line[idx] == 'e' || line[idx] == 'E') {
                  if (ila < line.length && line[ila]>='0' && line[ila]<='9') {
                     word.append ('e');
                     status = TokenType._FLOAT;
                     break;
                  }
               } else {
                  status = TokenType._DECIMAL;
                  breakChar('\000');
                  break;
               }
            }
            // PASSTHRU
         default:
            switch (status) {
            case _ML_COMMENT:
               break;
            case _INIT:
               if (idx == 0 && line[0] == '#' && line.length > 1
                            && line[1] == '!') {
                  idx = line.length;
               } else {
                  word = new StringBuilder (Character.toString(line[idx]));
                  status = TokenType._WORD;
               }
               break;
            case _INTEGER:
            case _FLOAT:
               breakChar('\000');
               word = new StringBuilder (Character.toString(line[idx]));
               status = TokenType._WORD;
               break;
            case _STRING:
            case _WORD:
               word.append (line[idx]);
               break;
            }
            break;
         }
      }
      cCol++; // in case of errors
      switch (status) {
      case _ML_COMMENT:
      case _INIT:
         break;
      case _INTEGER:
      case _FLOAT:
      case _WORD:
         tokens.add (newToken(word.toString(), status));
         word = null;
         status = TokenType._INIT;
         break;
      case _STRING:
         tokens.add (newToken("\""+word.toString(),TokenType._UNCLOSED_STRING));
         status = TokenType._INIT;
         break;
      }

      return Return;
   }
}


text:
<?php

namespace Webmozart\Console\Style;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;

/**
 * A color style which prefers cyan for its good readability.
 *
 * @since  1.0
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class NeptunStyle
{
    /**
     * Adds styles to an output formatter.
     *
     * @param OutputFormatterInterface $formatter The output formatter.
     */
    public static function addStyles(OutputFormatterInterface $formatter)
    {
        $formatter->setStyle('h', new OutputFormatterStyle(null, null, array('bold')));
        $formatter->setStyle('b', new OutputFormatterStyle(null, null, array('bold')));
        $formatter->setStyle('em', new OutputFormatterStyle('cyan'));
        $formatter->setStyle('tt', new OutputFormatterStyle(null, null, array('underscore')));
    }

    private function __construct() {}
}

redpajama_set_name: RedPajamaGithub


text:
<title>Showdown Compatibility Unit Test Generator for erlmarkdown</title>

Showdown Compatibility Unit Test Generator For erlmarkdown

Purpose

erlmarkdown is a server-side implementation of markdown written in Erlang. In order to practically use it, you need a client side implementation (written in javascript) which produces the same outputs from the same inputs.

The client-side library of choice for erlmarkdown is showdown from Attack Labs.

It is not clear if showdown is still maintained - it is not available
from a version control system. The current version we track is 0.9 and the
source code is included with erlmarkdown.

This page just has a set of markdown terms in it which it runs through showdown to generate the unit tests that are included in erlmarkdown

<textarea id="tests_display" cols=120 rows=20></textarea>


text:
require 'rails_helper'

RSpec.describe Bono, type: :model do

end


text:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
exec $DIR/build_default_release/package/bin/Orbit


text:
//*****************************************************************************
//
// ucs.h - Driver for the UCS Module.
//
//*****************************************************************************

#ifndef __MSP430WARE_UCS_H__
#define __MSP430WARE_UCS_H__

#include "inc/hw_memmap.h"

#ifdef __MSP430_HAS_UCS__

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

//*****************************************************************************
//
// Internal very low power VLOCLK, low frequency oscillator with 10 kHz typical
// frequency
//
//*****************************************************************************
#define UCS_VLOCLK_FREQUENCY                                              10000

//*****************************************************************************
//
// Internal, trimmed, low-frequency oscillator with 32768 Hz typical frequency
//
//*****************************************************************************
#define UCS_REFOCLK_FREQUENCY                                             32768

//*****************************************************************************
//
// The following are values that can be passed to the clockSourceDivider
// parameter for functions: UCS_clockSignalInit().
//
//*****************************************************************************
#define UCS_CLOCK_DIVIDER_1                                             DIVM__1
#define UCS_CLOCK_DIVIDER_2                                             DIVM__2
#define UCS_CLOCK_DIVIDER_4                                             DIVM__4
#define UCS_CLOCK_DIVIDER_8                                             DIVM__8
#define UCS_CLOCK_DIVIDER_12                                           DIVM__32
#define UCS_CLOCK_DIVIDER_16                                           DIVM__16
#define UCS_CLOCK_DIVIDER_32                                           DIVM__32

//*****************************************************************************
//
// The following are values that can be passed to the selectedClockSignal
// parameter for functions: UCS_clockSignalInit().
//
//*****************************************************************************
#define UCS_ACLK                                                           0x01
#define UCS_MCLK                                                           0x02
#define UCS_SMCLK                                                          0x04
#define UCS_FLLREF                                                         0x08

//*****************************************************************************
//
// The following are values that can be passed to the clockSource parameter for
// functions: UCS_clockSignalInit().
//
//*****************************************************************************
#define UCS_XT1CLK_SELECT                                          SELM__XT1CLK
#define UCS_VLOCLK_SELECT                                          SELM__VLOCLK
#define UCS_REFOCLK_SELECT                                        SELM__REFOCLK
#define UCS_DCOCLK_SELECT                                          SELM__DCOCLK
#define UCS_DCOCLKDIV_SELECT                                    SELM__DCOCLKDIV
#define UCS_XT2CLK_SELECT                                          SELM__XT2CLK

//*****************************************************************************
//
// The following are values that can be passed to the xcap parameter for
// functions: UCS_LFXT1Start(), and UCS_LFXT1StartWithTimeout().
//
//*****************************************************************************
#define UCS_XCAP_0                                                       XCAP_0
#define UCS_XCAP_1                                                       XCAP_1
#define UCS_XCAP_2                                                       XCAP_2
#define UCS_XCAP_3                                                       XCAP_3

//*****************************************************************************
//
// The following are values that can be passed to the xt1drive parameter for
// functions: UCS_LFXT1Start(), UCS_HFXT1Start(), UCS_LFXT1StartWithTimeout(),
// and UCS_HFXT1StartWithTimeout().
//
//*****************************************************************************
#define UCS_XT1_DRIVE0                                               XT1DRIVE_0
#define UCS_XT1_DRIVE1                                               XT1DRIVE_1
#define UCS_XT1_DRIVE2                                               XT1DRIVE_2
#define UCS_XT1_DRIVE3                                               XT1DRIVE_3

//*****************************************************************************
//
// The following are values that can be passed to the highOrLowFrequency
// parameter for functions: UCS_bypassXT1(), and UCS_bypassXT1WithTimeout().
//
//*****************************************************************************
#define UCS_XT1_HIGH_FREQUENCY                                              XTS
#define UCS_XT1_LOW_FREQUENCY                                              0x00

//*****************************************************************************
//
// The following are values that can be passed to the xt2drive parameter for
// functions: UCS_XT2Start(), and UCS_XT2StartWithTimeout().
//
//*****************************************************************************
#define UCS_XT2DRIVE_4MHZ_8MHZ                                       XT2DRIVE_0
#define UCS_XT2DRIVE_8MHZ_16MHZ                                      XT2DRIVE_1
#define UCS_XT2DRIVE_16MHZ_24MHZ                                     XT2DRIVE_2
#define UCS_XT2DRIVE_24MHZ_32MHZ                                     XT2DRIVE_3

//*****************************************************************************
//
// The following are values that can be passed to the selectClock parameter for
// functions: UCS_enableClockRequest(), and UCS_disableClockRequest().
//
//*****************************************************************************
#define UCS_ACLK                                                           0x01
#define UCS_SMCLK                                                          0x04
#define UCS_MCLK                                                           0x02
#define UCS_MODOSC                                                  MODOSCREQEN

//*****************************************************************************
//
// The following are values that can be passed to the mask parameter for
// functions: UCS_faultFlagStatus(), and UCS_clearFaultFlag() as well as
// returned by the UCS_clearAllOscFlagsWithTimeout() function.
//
//*****************************************************************************
#define UCS_XT2OFFG                                                     XT2OFFG
#define UCS_XT1HFOFFG                                                 XT1HFOFFG
#define UCS_XT1LFOFFG                                                 XT1LFOFFG
#define UCS_DCOFFG                                                       DCOFFG

//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
extern void UCS_setExternalClockSource(uint16_t baseAddress,
                                       uint32_t XT1CLK_frequency,
                                       uint32_t XT2CLK_frequency);

extern void UCS_clockSignalInit(uint16_t baseAddress,
                                uint8_t selectedClockSignal,
                                uint16_t clockSource,
                                uint16_t clockSourceDivider);

extern void UCS_LFXT1Start(uint16_t baseAddress,
                           uint16_t xt1drive,
                           uint8_t xcap);

extern void UCS_HFXT1Start(uint16_t baseAddress,
                           uint16_t xt1drive);

extern void UCS_bypassXT1(uint16_t baseAddress,
                          uint8_t highOrLowFrequency);

extern bool UCS_LFXT1StartWithTimeout(uint16_t baseAddress,
                                      uint16_t xt1drive,
                                      uint8_t xcap,
                                      uint16_t timeout);

extern bool UCS_HFXT1StartWithTimeout(uint16_t baseAddress,
                                      uint16_t xt1drive,
                                      uint16_t timeout);

extern bool UCS_bypassXT1WithTimeout(uint16_t baseAddress,
                                     uint8_t highOrLowFrequency,
                                     uint16_t timeout);

extern void UCS_XT1Off(uint16_t baseAddress);

extern void UCS_XT2Start(uint16_t baseAddress,
                         uint16_t xt2drive);

extern void UCS_bypassXT2(uint16_t baseAddress);

extern bool UCS_XT2StartWithTimeout(uint16_t baseAddress,
                                    uint16_t xt2drive,
                                    uint16_t timeout);

extern bool UCS_bypassXT2WithTimeout(uint16_t baseAddress,
                                     uint16_t timeout);

extern void UCS_XT2Off(uint16_t baseAddress);

extern void UCS_initFLLSettle(uint16_t baseAddress,
                              uint16_t fsystem,
                              uint16_t ratio);

extern void UCS_initFLL(uint16_t baseAddress,
                        uint16_t fsystem,
                        uint16_t ratio);

extern void UCS_enableClockRequest(uint16_t baseAddress,
                                   uint8_t selectClock);

extern void UCS_disableClockRequest(uint16_t baseAddress,
                                    uint8_t selectClock);

extern uint8_t UCS_faultFlagStatus(uint16_t baseAddress,
                                   uint8_t mask);

extern void UCS_clearFaultFlag(uint16_t baseAddress,
                               uint8_t mask);

extern void UCS_SMCLKOff(uint16_t baseAddress);

extern void UCS_SMCLKOn(uint16_t baseAddress);

extern uint32_t UCS_getACLK(uint16_t baseAddress);

extern uint32_t UCS_getSMCLK(uint16_t baseAddress);

extern uint32_t UCS_getMCLK(uint16_t baseAddress);

extern uint16_t UCS_clearAllOscFlagsWithTimeout(uint16_t baseAddress,
                                                uint16_t timeout);

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif

#endif
#endif // __MSP430WARE_UCS_H__


text:
 package org.apache.mahout.math.map;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.apache.mahout.math.function.ShortFloatProcedure;
import org.apache.mahout.math.function.ShortProcedure;
import org.apache.mahout.math.list.ShortArrayList;
import org.apache.mahout.math.list.FloatArrayList;
import org.apache.mahout.math.set.AbstractSet;

import org.junit.Assert;
import org.junit.Test;

public class OpenShortFloatHashMapTest extends Assert {

  @Test
  public void testConstructors() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    int[] capacity = new int[1];
    double[] minLoadFactor = new double[1];
    double[] maxLoadFactor = new double[1];

    map.getInternalFactors(capacity, minLoadFactor, maxLoadFactor);
    assertEquals(AbstractSet.defaultCapacity, capacity[0]);
    assertEquals(AbstractSet.defaultMaxLoadFactor, maxLoadFactor[0], 0.001);
    assertEquals(AbstractSet.defaultMinLoadFactor, minLoadFactor[0], 0.001);
    int prime = PrimeFinder.nextPrime(907);
    map = new OpenShortFloatHashMap(prime);

    map.getInternalFactors(capacity, minLoadFactor, maxLoadFactor);
    assertEquals(prime, capacity[0]);
    assertEquals(AbstractSet.defaultMaxLoadFactor, maxLoadFactor[0], 0.001);
    assertEquals(AbstractSet.defaultMinLoadFactor, minLoadFactor[0], 0.001);

    map = new OpenShortFloatHashMap(prime, 0.4, 0.8);
    map.getInternalFactors(capacity, minLoadFactor, maxLoadFactor);
    assertEquals(prime, capacity[0]);
    assertEquals(0.4, minLoadFactor[0], 0.001);
    assertEquals(0.8, maxLoadFactor[0], 0.001);
  }

  @Test
  public void testEnsureCapacity() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    int prime = PrimeFinder.nextPrime(907);

    map.ensureCapacity(prime);
    int[] capacity = new int[1];
    double[] minLoadFactor = new double[1];
    double[] maxLoadFactor = new double[1];

    map.getInternalFactors(capacity, minLoadFactor, maxLoadFactor);
    assertEquals(prime, capacity[0]);
  }

  @Test
  public void testClear() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    assertEquals(1, map.size());
    map.clear();
    assertEquals(0, map.size());
    assertEquals(0, map.get((short) 11), 0.0000001);
  }

  @Test
  public void testClone() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    OpenShortFloatHashMap map2 = (OpenShortFloatHashMap) map.clone();
    map.clear();
    assertEquals(1, map2.size());
  }

  @Test
  public void testContainsKey() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    assertTrue(map.containsKey((short) 11));
    assertFalse(map.containsKey((short) 12));
  }

  @Test
  public void testContainValue() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    assertTrue(map.containsValue((float) 22));
    assertFalse(map.containsValue((float) 23));
  }

  @Test
  public void testForEachKey() {
    final ShortArrayList keys = new ShortArrayList();
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    map.put((short) 13, (float) 24);
    map.put((short) 14, (float) 25);
    map.removeKey((short) 13);
    map.forEachKey(new ShortProcedure() {

      @Override
      public boolean apply(short element) {
        keys.add(element);
        return true;
      }
    });

    short[] keysArray = keys.toArray(new short[keys.size()]);
    Arrays.sort(keysArray);

    assertArrayEquals(new short[] {11, 12, 14}, keysArray );
  }

  private static class Pair implements Comparable<Pair> {
    short k;
    float v;

    Pair(short k, float v) {
      this.k = k;
      this.v = v;
    }

    @Override
    public int compareTo(Pair o) {
      if (k < o.k) {
        return -1;
      } else if (k == o.k) {
        return 0;
      } else {
        return 1;
      }
    }
  }

  @Test
  public void testForEachPair() {
    final List<Pair> pairs = new ArrayList<Pair>();
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    map.put((short) 13, (float) 24);
    map.put((short) 14, (float) 25);
    map.removeKey((short) 13);
    map.forEachPair(new ShortFloatProcedure() {

      @Override
      public boolean apply(short first, float second) {
        pairs.add(new Pair(first, second));
        return true;
      }
    });

    Collections.sort(pairs);
    assertEquals(3, pairs.size());
    assertEquals((short) 11, pairs.get(0).k );
    assertEquals((float) 22, pairs.get(0).v , (float)0.000001);
    assertEquals((short) 12, pairs.get(1).k );
    assertEquals((float) 23, pairs.get(1).v , (float)0.000001);
    assertEquals((short) 14, pairs.get(2).k );
    assertEquals((float) 25, pairs.get(2).v , (float)0.000001);

    pairs.clear();
    map.forEachPair(new ShortFloatProcedure() {
      int count = 0;

      @Override
      public boolean apply(short first, float second) {
        pairs.add(new Pair(first, second));
        count++;
        return count < 2;
      }
    });

    assertEquals(2, pairs.size());
  }

  @Test
  public void testGet() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    assertEquals(22, map.get((short)11) , (float)0.000001);
    assertEquals(0, map.get((short)0) , (float)0.000001);
  }

  @Test
  public void testAdjustOrPutValue() {
   OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    map.put((short) 13, (float) 24);
    map.put((short) 14, (float) 25);
    map.adjustOrPutValue((short)11, (float)1, (float)3);
    assertEquals(25, map.get((short)11) , (float)0.000001);
    map.adjustOrPutValue((short)15, (float)1, (float)3);
    assertEquals(1, map.get((short)15) , (float)0.000001);
  }

  @Test
  public void testKeys() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 22);
    ShortArrayList keys = new ShortArrayList();
    map.keys(keys);
    keys.sort();
    assertEquals(11, keys.get(0) );
    assertEquals(12, keys.get(1) );
    ShortArrayList k2 = map.keys();
    k2.sort();
    assertEquals(keys, k2);
  }

  @Test
  public void testPairsMatching() {
    ShortArrayList keyList = new ShortArrayList();
    FloatArrayList valueList = new FloatArrayList();
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    map.put((short) 13, (float) 24);
    map.put((short) 14, (float) 25);
    map.removeKey((short) 13);
    map.pairsMatching(new ShortFloatProcedure() {

      @Override
      public boolean apply(short first, float second) {
        return (first % 2) == 0;
      }},
        keyList, valueList);
    keyList.sort();
    valueList.sort();
    assertEquals(2, keyList.size());
    assertEquals(2, valueList.size());
    assertEquals(12, keyList.get(0) );
    assertEquals(14, keyList.get(1) );
    assertEquals(23, valueList.get(0) , (float)0.000001);
    assertEquals(25, valueList.get(1) , (float)0.000001);
  }

  @Test
  public void testValues() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    map.put((short) 13, (float) 24);
    map.put((short) 14, (float) 25);
    map.removeKey((short) 13);
    FloatArrayList values = new FloatArrayList(100);
    map.values(values);
    assertEquals(3, values.size());
    values.sort();
    assertEquals(22, values.get(0) , (float)0.000001);
    assertEquals(23, values.get(1) , (float)0.000001);
    assertEquals(25, values.get(2) , (float)0.000001);
  }

  // tests of the code in the abstract class

  @Test
  public void testCopy() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    OpenShortFloatHashMap map2 = (OpenShortFloatHashMap) map.copy();
    map.clear();
    assertEquals(1, map2.size());
  }

  @Test
  public void testEquals() {
    // since there are no other subclasses of
    // Abstractxxx available, we have to just test the
    // obvious.
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    map.put((short) 13, (float) 24);
    map.put((short) 14, (float) 25);
    map.removeKey((short) 13);
    OpenShortFloatHashMap map2 = (OpenShortFloatHashMap) map.copy();
    assertEquals(map, map2);
    assertTrue(map2.equals(map));
    assertFalse("Hello Sailor".equals(map));
    assertFalse(map.equals("hello sailor"));
    map2.removeKey((short) 11);
    assertFalse(map.equals(map2));
    assertFalse(map2.equals(map));
  }

  // keys() tested in testKeys

  @Test
  public void testKeysSortedByValue() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 22);
    map.put((short) 12, (float) 23);
    map.put((short) 13, (float) 24);
    map.put((short) 14, (float) 25);
    map.removeKey((short) 13);
    ShortArrayList keys = new ShortArrayList();
    map.keysSortedByValue(keys);
    short[] keysArray = keys.toArray(new short[keys.size()]);
    assertArrayEquals(new short[] {11, 12, 14},
        keysArray );
  }

  @Test
  public void testPairsSortedByKey() {
    OpenShortFloatHashMap map = new OpenShortFloatHashMap();
    map.put((short) 11, (float) 100);
    map.put((short) 12, (float) 70);
    map.put((short) 13, (float) 30);
    map.put((short) 14, (float) 3);

    ShortArrayList keys = new ShortArrayList();
    FloatArrayList values = new FloatArrayList();
    map.pairsSortedByKey(keys, values);

    assertEquals(4, keys.size());
    assertEquals(4, values.size());
    assertEquals((short) 11, keys.get(0) );
    assertEquals((float) 100, values.get(0) , (float)0.000001);
    assertEquals((short) 12, keys.get(1) );
    assertEquals((float) 70, values.get(1) , (float)0.000001);
    assertEquals((short) 13, keys.get(2) );
    assertEquals((float) 30, values.get(2) , (float)0.000001);
    assertEquals((short) 14, keys.get(3) );
    assertEquals((float) 3, values.get(3) , (float)0.000001);
    keys.clear();
    values.clear();
    map.pairsSortedByValue(keys, values);
    assertEquals((short) 11, keys.get(3) );
    assertEquals((float) 100, values.get(3) , (float)0.000001);
    assertEquals((short) 12, keys.get(2) );
    assertEquals((float) 70, values.get(2) , (float)0.000001);
    assertEquals((short) 13, keys.get(1) );
    assertEquals((float) 30, values.get(1) , (float)0.000001);
    assertEquals((short) 14, keys.get(0) );
    assertEquals((float) 3, values.get(0) , (float)0.000001);
  }

 }


text:
A convenient wrapper for what persists you

## About

Courier is as thin a wrapper as possible around (by default in the browser) localStorage and sessionStorage.
It can be extended to use whatever flavor of persistence you'd prefer by simply swapping out `Courier.Storage` and/or `Courier.EphemeralStorage` for an object that honors the same API as the localStorage object.

## Transformers

The real reason for Courier's existence, transformers are a convenience layer provided to manipulate data
before storage and after retrieval, and are simply functions that take a single argument `data`, act on it
and return the altered data.

This is necessary because `localStorage#setItem` calls any
non-string argument's `toString()` method before persisting. If you're saving an object full of data,
special care must be taken so that you don't get back a string that looks like `'[object Object]'` instead of your data.

A transformer for this use case (and in fact, Courier's built-in `object` transformer), might look like this:

```javascript
function (data) {
    if (typeof data === 'string') {
        return JSON.parse(data);
    } else if (typeof data === 'object') {
        return JSON.stringify(data);
    }

    return data;
}
```

If a transformer receives data that it doesn't know how to process, it should return that data unmodified.
One or more transformers can be provided to process the data in sequence.

## API

### `Courier#clear([ephemeral])`
Clears all keys from storage.

#### Arguments
ephemeral : **boolean** - whether to operate on `Courier.EphemeralStorage` (truthy) or `Courier.Storage` (falsy)

### `Courier#get(key[, options])`
Retrieves string stored at `key` from storage

#### Arguments
options : **object** -

* ephemeral : **boolean** - default `false`, whether to operate on `Courier.EphemeralStorage`
* transformers : **Array** - default `[]`, transformers to apply to data after retrieval
* bubbleErrors : **boolean** - default `false`, whether to re-throw errors that occur during data transform.
When false, any errors raised in transformers are caught and silently swallowed, with the data returning unmodified.

The `get` method tries to intelligently accept frequently-used arguments in place of an object literal,
and will recognize a boolean `options` argument as the `ephemeral` option, or a function or array argument as the
`transformers` option, using the given defaults for the other options. For example:

```
Courier.get('foo', function (data) { return JSON.parse(data); });
```

is functionally equivalent to

```
Courier.get('foo', {
  transformers: function (data) { return JSON.parse(data); },
  ephemeral: false,
  bubbleErrors: false
});
```

### `Courier#length([ephemeral])`
Returns the number of keys in the given storage object. This is a method instead of a property to allow
selecting from both ephemeral and permanent storage objects, and for compatibility in browsers that do not
support getters and setters on javascript objects.

### `Courier#remove(key[, ephemeral])`
Deletes a key from the storage object. Has no effect if the key is not set.

### `Courier#set(key, data[, options])`
Persists `data` as a string under `key` on the storage object. The options argument follows the same behavior
as the `get` method.


text:
sudo mkdir /gotmp
sudo mount tmpfs -t tmpfs /gotmp
TMPDIR=/gotmp go test -v -race
sudo umount /gotmp
sudo rm -rf /gotmp


text:
namespace Skylight
{
    using System;
    using PlayerIOClient;

    /// <summary>
    ///     The class that handles all chat-based messages from the server
    ///     including ones sent to the user through system.
    /// </summary>
    public class ChatEventArgs : EventArgs
    {
        /// <summary>
        ///     The player who sent the message.
        /// </summary>
        public readonly Player speaker;

        /// <summary>
        ///     The message sent by player.
        /// </summary>
        public readonly string message;

        /// <summary>
        ///     The origin (room) where the message came from.
        /// <summary>
        public readonly Room origin;

        /// <summary>
        /// Initializes a new instance of the <see cref="ChatEventArgs"/> class.
        ///     The main method where the chat messages are sent. This method sets the properties in
        ///     this class to the speaker and origin of the message, where it is handed off to a delegate
        ///     later.
        /// </summary>
        /// <param name="speaker">
        /// The player who said the message.
        /// </param>
        /// <param name="origin">
        /// The room where the message originated.
        /// </param>
        internal ChatEventArgs(Player speaker, Message m, Room origin, string message)
        {
            this.origin = origin;
            if (this.Origin != null)
            {
                this.Origin.ChatLog = origin.ChatLog;
            }

            this.speaker = speaker;
            this.message = message;
            RawMessage = m;
        }

        /// <summary>
        ///     Gets the player whe sent the message.
        /// </summary>
        /// <value>The player who sent the message.</value>
        public Player Speaker
        {
            get { return this.speaker; }
        }

        /// <summary>
        ///     Gets the message sent by player
        /// <summary>
        /// <value>The message sent by player.</value>
        public string ChatMessage
        {
            get { return this.message; }
        }

        /// <summary>
        ///     The unparsed message sent from the connection.
        /// </summary>
        public Message RawMessage { get; internal set; }

        /// <summary>
        ///     Gets the origin (room) where the message came from.
        /// </summary>
        /// <value>The origin (room) where the message came from.</value>
        public Room Origin
        {
            get { return this.origin; }
        }
    }
}


text:
package com.lanyuan.service;

import com.lanyuan.entity.Roles;
import com.lanyuan.entity.User;
import com.lanyuan.util.PageView;

public interface UserService{
	public PageView query(PageView pageView,User user);

	public void add(User user);

	public void delete(String id);

	public void modify(User user);

	public User getById(String id);

	public int countUser(String userName,String userPassword);

	public User querySingleUser(String userName);

	public Roles findbyUserRole(String userId);
}


text:
package com.reallymany.trapgrid;

import java.awt.geom.Point2D;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;

import au.com.bytecode.opencsv.CSVReader;
/**
 * Amazing Outbreak class abstracts a collection of OutbreakLocations. The constructor expects
 * a tab-separated file containing x, y, n and D values where (x, y) is the location of
 * an outbreak, n is the number of flies and D is their diffusion coefficient.
 * @author bhall
 *
 */
public class Outbreak {
	ArrayList<OutbreakLocation> allOutbreakLocations;

	// Not using this constructor these days -- will we ever want a single outbreak
	// with multiple locations? Because if not, we could completely scrap this class.
	public Outbreak(String filename, long seed) throws NumberFormatException, IOException {
		ArrayList<OutbreakLocation> myPoints = new ArrayList<OutbreakLocation>();
		try {
			CSVReader reader = new CSVReader(new FileReader(filename), '\t');
			String[] nextLine;
			while ((nextLine = reader.readNext()) != null) {
				if (nextLine.length == 4) {
					double x = Double.parseDouble(nextLine[0]);
					double y = Double.parseDouble(nextLine[1]);
					int n = Integer.parseInt(nextLine[2]);
					double diffc = Double.parseDouble(nextLine[3]);
					Point2D.Double newPoint = new Point2D.Double(x, y);
					OutbreakLocation newOutbreakLocation = new OutbreakLocation(newPoint, n, diffc, 0, 0, 0, false, seed);
					myPoints.add(newOutbreakLocation);
				} else {
					System.err.println("Invalid input! " +
							"OutbreakLocation file must have 4 values per line (x, y, number of flies, diffusion coefficient).");
					reader.close();
					throw new IOException();
				}
			}
			reader.close();
			this.allOutbreakLocations = myPoints;
		} catch (FileNotFoundException e) {
			System.err.println("Input file " + filename + " not found");
			e.printStackTrace();
			throw new FileNotFoundException();
		}
		// TODO Auto-generated constructor stub
	}
	/**
	 * Constructor for a randomized Outbreak
	 * returns an Outbreak object with a single,
	 * randomly-chosen OutbreakLocation
	 * @param n Number of flies
	 * @param diffCoeff Diffusion Coefficient for outbreak
	 * @param rng Random object
	 */
	public Outbreak(double x, double y, int n, double diffCoeff, double stepSize, int stepsPerDay, double turnAngleStdev,
			boolean useMDD, long seed, boolean locationIsRandom) {
		this.allOutbreakLocations = new ArrayList<OutbreakLocation>();
		Point2D.Double myPoint;
		if (locationIsRandom) {
			Random r = new Random(seed);
			myPoint = EsotericMath.pickPointInGrid(x, y, r);
		} else {
			myPoint = new Point2D.Double(x, y);
		}
		OutbreakLocation rp = new OutbreakLocation(myPoint, n, diffCoeff, stepSize, stepsPerDay,
				turnAngleStdev, useMDD, seed);
		this.allOutbreakLocations.add(rp);
	}

	public String toString() {
		int numberOfRPoints = this.allOutbreakLocations.size();
		if (numberOfRPoints == 1) {
			return this.allOutbreakLocations.get(0).shortString();
		} else {
			String result = "Outbreak with " + numberOfRPoints + " OutbreakLocation(s): ";
			for (int i=0; i<numberOfRPoints-1; i++) {
				result += this.allOutbreakLocations.get(i).toString() + "; ";
			}
			// Don't want to add ';' to last OutbreakLocation entry...
			result += this.allOutbreakLocations.get(numberOfRPoints-1).toString();
			return result;
		}
	}

}


text:
//  Copyright © 2017 Estimote. All rights reserved.

#import <Foundation/Foundation.h>

@class EILLocationPin;

NS_ASSUME_NONNULL_BEGIN

/**
 * A block object to be executed when the request finishes.
 */
typedef void (^EILRequestUpdateLocationPinBlock)(EILLocationPin * _Nullable locationPin, NSError * _Nullable error);

/**
 * Request for updating already existing location pin in Estimote Cloud.
 *
 * Note that in order to have request working you need to be authenticated in Estimote Cloud.
 * To do that you have to call -[ESTConfig setupAppID:andAppToken:] first.
 * You can find your API App ID and API App Token in the Apps: http://cloud.estimote.com/#/apps
 * section of the Estimote Cloud: http://cloud.estimote.com/.
 */
@interface EILRequestUpdateLocationPin : NSObject

/**
 * Returns a new request object for updating location pin in Estimote Cloud.
 *
 * @param pin Updated pin.
 * @param pinIdentifier Updated pin identifier.
 * @return A request initialized with location pin and its identifier.
 */
- (instancetype)initWithPin:(EILLocationPin *)pin
              pinIdentifier:(NSNumber *)pinIdentifier;

/**
 * Sends request to Estimote Cloud with completion block.
 *
 * param completion Completion block to be executed when the request finishes.
 */
- (void)sendRequestWithCompletion:(EILRequestUpdateLocationPinBlock)completion;

@end

NS_ASSUME_NONNULL_END


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head/>
<body bgcolor="white">
Provides classes and interfaces for communication tasks on behalf of the service layer, but without depending on the service layer.
</body>
</html>


text:
package com.medicapital.common.entities;

import com.google.gwt.user.client.rpc.IsSerializable;

public enum UserRole implements IsSerializable {

	User(1), Doctor(2);

	private int accessLevel;

	private UserRole(int accessLevel) {
		this.accessLevel = accessLevel;
	}

	public int getAccessLevel() {
		return accessLevel;
	}
}


text:
require File.expand_path('../../../test_helper', __FILE__)
require 'shellwords'
require 'fileutils'

class BinRimlTest < Riml::TestCase
  EXEC = Shellwords.escape(File.join(Riml::Environment::BINDIR, 'riml'))

  test "compiles riml from stdin to viml on stdout with -s option" do
    pathogen_riml_path = File.expand_path('../../pathogen/pathogen.riml', __FILE__)
    expected = File.read File.expand_path('../../pathogen/pathogen.vim', __FILE__)
    assert_equal expected, `cat #{Shellwords.escape(pathogen_riml_path)} | #{EXEC} -s -d`
    assert_equal 0, $?.exitstatus
  end

  test "fails when given a file that doesn't exist with -c option" do
    bad_path = './nonexistent_file.riml'
    out, err = capture_subprocess_io do
      system "#{EXEC} -c #{Shellwords.escape(bad_path)}"
    end
    assert_equal 1, $?.exitstatus
    assert out.empty?
    refute err.empty?
  end

  test "compiles riml paths to viml files with -c option, outputting them into cwd" do
    Dir.chdir(File.expand_path('../', __FILE__)) do
      with_file_cleanup('./pathogen.vim', './smartinput.vim') do
        system "#{EXEC} -c ../pathogen/pathogen.riml,../smartinput/smartinput.riml"
        assert_equal 0, $?.exitstatus
        assert File.exist?('./pathogen.vim')
        assert File.exist?('./smartinput.vim')
      end
    end
  end

  test "checks syntax with -k option (success)" do
    Dir.chdir(File.expand_path("../../riml_commands", __FILE__)) do
      out, err = capture_subprocess_io do
        system "#{EXEC} -k file1.riml"
      end
      assert_equal 0, $?.exitstatus
      assert err.empty?
      assert_match(/ok/, out)
      assert_match(/\(1 file\)/,  out)
    end
  end

  test "checks syntax with -k option (failure)" do
    source_file = File.expand_path("../../riml_commands/compiler_test.rb", __FILE__)
    out, err = capture_subprocess_io do
      system "#{EXEC} -k #{Shellwords.escape(source_file)}"
    end
    assert_equal 1, $?.exitstatus
    refute err.empty?
    assert out.empty?
  end

  test "sets source path with -S option" do
    riml_commands_dir = File.expand_path("../../riml_commands", __FILE__)
    sourced1_vim_path = './sourced1.vim'
    sourced2_vim_path = File.join(riml_commands_dir, 'sourced2.vim')
    sourced2_bad_vim_path = './sourced2.vim'
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        system "#{EXEC} -S #{riml_commands_dir} -c ../riml_commands/sourced1.riml"
        assert_equal 0, $?.exitstatus
        assert File.exist?(sourced1_vim_path), "sourced1_vim_path doesn't exist"
        assert File.exist?(sourced2_vim_path), "sourced2_vim_path doesn't exist"
        refute File.exist?(sourced2_bad_vim_path), "sourced2_bad_vim_path exists"
      ensure
        File.delete(sourced1_vim_path) if File.exist?(sourced1_vim_path)
        File.delete(sourced2_vim_path) if File.exist?(sourced2_vim_path)
        File.delete(sourced2_bad_vim_path) if File.exist?(sourced2_bad_vim_path)
      end
    end
  end

  test "sets source_path with RIML_SOURCE_PATH env. variable" do
    riml_commands_dir = File.expand_path("../../riml_commands", __FILE__)
    sourced1_vim_path = './sourced1.vim'
    sourced2_vim_path = File.join(riml_commands_dir, 'sourced2.vim')
    sourced2_bad_vim_path = './sourced2.vim'
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        ENV['RIML_SOURCE_PATH'] = riml_commands_dir
        system "#{EXEC} -c ../riml_commands/sourced1.riml"
        assert_equal 0, $?.exitstatus
        assert File.exist?(sourced1_vim_path), "sourced1_vim_path doesn't exist"
        assert File.exist?(sourced2_vim_path), "sourced2_vim_path doesn't exist"
        refute File.exist?(sourced2_bad_vim_path), "sourced2_bad_vim_path doesn't exist"
      ensure
        File.delete(sourced1_vim_path) if File.exist?(sourced1_vim_path)
        File.delete(sourced2_vim_path) if File.exist?(sourced2_vim_path)
        File.delete(sourced2_bad_vim_path) if File.exist?(sourced2_bad_vim_path)
        ENV['RIML_SOURCE_PATH'] = nil
      end
    end
  end

  test "sets include_path with -I option" do
    riml_commands_dir = File.expand_path("../../riml_commands", __FILE__)
    include1_vim_path = './riml_include_lib.vim'
    include2_vim_path = '../riml_commands/riml_include_lib2.vim'
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        system "#{EXEC} -I #{riml_commands_dir} -c ../riml_commands/riml_include_lib.riml"
        assert_equal 0, $?.exitstatus
        assert File.exist?(include1_vim_path)
        refute File.exist?(include2_vim_path)
      ensure
        File.delete(include1_vim_path) if File.exist?(include1_vim_path)
        File.delete(include2_vim_path) if File.exist?(include2_vim_path)
      end
    end
  end

  test "sets include_path with RIML_INCLUDE_PATH env. variable" do
    riml_commands_dir = File.expand_path("../../riml_commands", __FILE__)
    include1_vim_path = './riml_include_lib.vim'
    include2_vim_path = '../riml_commands/riml_include_lib2.vim'
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        ENV['RIML_INCLUDE_PATH'] = riml_commands_dir
        system "#{EXEC} -c ../riml_commands/riml_include_lib.riml"
        assert_equal 0, $?.exitstatus
        assert File.exist?(include1_vim_path)
        refute File.exist?(include2_vim_path)
      ensure
        File.delete(include1_vim_path) if File.exist?(include1_vim_path)
        File.delete(include2_vim_path) if File.exist?(include2_vim_path)
        ENV['RIML_INCLUDE_PATH'] = nil
      end
    end
  end

  test "aborts if Riml.source_path is set with -S option and one of the dirs doesn't exist" do
    riml_commands_dir = File.expand_path("../../riml_commands", __FILE__)
    sourced1_vim_path = './sourced1.vim'
    sourced2_vim_path = File.join(riml_commands_dir, 'sourced2.vim')
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        _, err = capture_subprocess_io do
          system "#{EXEC} -S #{riml_commands_dir}/nonexistent_dir -c ../riml_commands/sourced1.riml"
        end
        assert_equal 1, $?.exitstatus
        assert err =~ /error trying to set source_path/i
        refute File.exist?(sourced1_vim_path)
        refute File.exist?(sourced2_vim_path)
      ensure
        File.delete(sourced1_vim_path) if File.exist?(sourced1_vim_path)
        File.delete(sourced2_vim_path) if File.exist?(sourced2_vim_path)
      end
    end
  end

  test "aborts if Riml.include_path is set with -I option and one of the dirs doesn't exist" do
    riml_commands_dir = File.expand_path("../../riml_commands", __FILE__)
    include1_vim_path = './riml_include_lib.vim'
    include2_vim_path = '../riml_commands/riml_include_lib2.vim'
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        _, err = capture_subprocess_io do
          system "#{EXEC} -I #{riml_commands_dir}:nonexistent_dir -c ../riml_commands/riml_include_lib.riml"
        end
        assert_equal 1, $?.exitstatus
        assert err =~ /error trying to set include_path/i
        refute File.exist?(include1_vim_path)
        refute File.exist?(include2_vim_path)
      ensure
        File.delete(include1_vim_path) if File.exist?(include1_vim_path)
        File.delete(include2_vim_path) if File.exist?(include2_vim_path)
      end
    end
  end

  test "--output-dir option outputs all .vim files into specified dir and mirrors the input file structure" do
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        system "#{EXEC} -c test_output_dir.riml -o newdir -S test_output_dir"
        assert_equal 0, $?.exitstatus
        assert File.exist?('./newdir/test_output_dir.vim')
        assert File.exist?('./newdir/test_output_dir/sourced.vim')
        refute File.exist?('./test_output_dir.vim')
        refute File.exist?('./test_output_dir/sourced.vim')
      ensure
        FileUtils.rm_r 'newdir' if File.directory?('newdir')
      end
    end
  end

  test "--allow-undef-global-classes option keeps on compiling when hitting undefined global class" do
    Dir.chdir(File.expand_path("../", __FILE__)) do
      begin
        system "#{EXEC} --allow-undef-global-classes -c undefined_global_class.riml"
        assert_equal 0, $?.exitstatus
        assert File.exist?('./undefined_global_class.vim')
      ensure
        File.delete('./undefined_global_class.vim') if File.exist?('./undefined_global_class.vim')
      end
    end
  end

end


text:
//
//  UINavigationController+PushVCByName.m
//  LowCouplingUIViewController
//
//  Created by Albert Mao on 7/28/15.
//  Copyright (c) 2015 mk. All rights reserved.
//

#import "UINavigationController+PushVCByName.h"

#import <objc/runtime.h>

@implementation UINavigationController (PushVCByName)

- (void)pushViewControllerName:(NSString *)viewControllerName para:(NSDictionary *)para animated:(BOOL)animated
{
    //需要加载视图文件?(xib,storyboard)
    const char *name = [viewControllerName UTF8String];
    Class vcClass = objc_getClass(name);
    if (vcClass != NULL) {
        UIViewController *vc = [[vcClass alloc]init];

        if (para != nil) {
            [para enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
                 NSString *propertyName = key;
                objc_property_t property = class_getProperty(vcClass, [propertyName UTF8String]);
                if (property != NULL) {
                  [vc setValue:obj forKey:propertyName];
                }else{
                    @throw [NSException exceptionWithName:@"UIViewController set Wrong property" reason:[NSString stringWithFormat:@"%@ don't have propery %@", viewControllerName, propertyName] userInfo:nil];
                }

            }];
        }

        [self pushViewController:vc animated:YES];
    }
}

- (void)pushViewControllerName:(NSString *)viewControllerName animated:(BOOL)animated
{
    [self pushViewControllerName:viewControllerName para:nil animated:animated];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
//
// Created by Mark van der Broek on 27/02/2017.
//

#ifndef ORACS_ROUTE_H
#define ORACS_ROUTE_H

#include <vector>
#include <fstream>

class Env;

/**
 * Route is a class that holds a route.
 */
class Route {

    Env *                   d_env; /*!< Environment pointer */
    int                     d_depotID; /*!< ID of the depot where the route belongs to */
    int                     d_load; /*!< Total load of the route */
    double                  d_length; /*!< Total length of the route */
    double                  d_serviceTime; /*!< Total service time of the route. (Customers + distance) */
    std::vector<int>        d_route; /*!< Vector of ints containing the ID of the customers in the route */
    std::vector<int>        d_demandRoute; /*!< Vector of ints containing the demands corresponds to the route */

public:
    Route() = delete;
    Route(Env *env, int depotID);
    Route(Env *env, int depotID, std::vector<int> route, std::vector<int> demandRoute);

    std::vector<int> &      getRoute();
    std::vector<int>        getRouteCopy();
    std::vector<int> &      getDemandRoute();
    std::vector<int> const &getRoute()         const;
    int const               getLoad()           const;
    double const            getDistance()       const;
    double const            getServiceTime()    const;

    int                     removeCustomer(int customerID);
    void                    addCustomer(int customerID, int load, int routePos);
    long                    findCustomer(int customerID) const;
    void                    twoOpt(int bIdx, int cIdx);
    void                    swap(int aIdx, int bIdx);

    friend std::ostream &operator<<(std::ostream &, Route const &route);

private:
    void updateDistance();
    void updateServiceTime();
    void updateLoad();

};

/**
 * Get the actual route.
 * @return Vector of ints containing the IDs of the customers to traverse
 */
inline std::vector<int> &Route::getRoute()
{
    return d_route;
}

/**
 * Get the actual route as a copy.
 * @return Vector of ints containing the IDs of the customers to traverse
 */
inline std::vector<int> Route::getRouteCopy()
{
    return d_route;
}

/**
 * Get the actual route (consts).
 * @return Vector of ints containing the IDs of the customers to traverse (const)
 */
inline std::vector<int> const &Route::getRoute() const
{
    return d_route;
}

/**
 * Get the demands of the route.
 * @return Vector of ints containing the demands of the customers to traverse
 */
inline std::vector<int> &Route::getDemandRoute()
{
    return d_demandRoute;
}

/**
 * Get the total load of the route.
 * @return Load of the route
 */
inline int const Route::getLoad() const
{
    return d_load;
}

/**
 * Get the total distance travelled by the route.
 * @return Total distance of the route
 */
inline double const Route::getDistance() const
{
    return d_length;
}

/**
 * Get the total service time of the route
 * @return Total service time of the route
 */
inline double const Route::getServiceTime() const
{
    return d_serviceTime;
}
#endif //ORACS_ROUTE_H


text:
require 'coveralls'
require 'simplecov'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
    SimpleCov::Formatter::HTMLFormatter,
    Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
  add_filter '.bundle/'
end

# Configure Rails environment
ENV['RAILS_ENV'] = 'test'

require 'rails'
require 'rails/test_help'
require 'minitest-power_assert'

# For generators
require 'rails/generators/test_case'

def copy_routes
  routes = File.expand_path('../support/routes.rb', __FILE__)
  destination = File.join(destination_root, 'config')

  FileUtils.mkdir_p(destination)
  FileUtils.cp routes, destination
end


text:
  <form name="loginForm" ng-submit="loginForm.$valid && login(username, password)" class="cd-form" novalidate >

      E-mail
      <input class="full-width has-padding has-border" name="email" id="signin-email" type="text" placeholder="E-mail" ng-model="username" required>
      Error message here!

      Password
      <input class="full-width has-padding has-border" id="signin-password" type="text"  placeholder="Password" ng-model="password" required>
      Hide
      Error message here!

      <input type="checkbox" id="remember-me">
      Remember me

      <input class="full-width" type="submit" ng-disabled="isSubmitting" value="{{isSubmitting ? 'Logging...' : 'Login'}}">

  </form>

    Forgot your password?


text:
2016-05-06, Version 1.1.6
=========================

 * update copyright notices and license (Ryan Graham)

 * Refer to licenses with a link (Sam Roberts)

 * package: Add nyc dependency and a coverage script (Miroslav Bajtoš)

 * Use strongloop conventions for licensing (Sam Roberts)

2015-06-03, Version 1.1.5
=========================

 * Update all dependencies to the latest version (Miroslav Bajtoš)

 * Fix tests on Node v0.10, v0.12 and io.js 1.6 (Miroslav Bajtoš)

 * test: enable nexpect debug log for DEBUG=* (Miroslav Bajtoš)

 * Use IPv4 localhost address in tests. (Miroslav Bajtoš)

 * package: uses jshint and mocha, added as dev-deps (Sam Roberts)

2015-01-12, Version 1.1.4
=========================

 * Fix bad CLA URL in CONTRIBUTING.md (Ryan Graham)

2014-12-12, Version 1.1.3
=========================

 * package: use debug v2.x in all strongloop deps (Sam Roberts)

2014-11-03, Version 1.1.2
=========================

 * Update contribution guidelines (Ryan Graham)

2014-08-06, Version 1.1.1
=========================

 * Rename strong-cli to strongloop (Krishna Raman)

 * Update package license to match LICENSE.md (Sam Roberts)

 * README: list features, explain diff from npmrc (Miroslav Bajtoš)

 * doc: add CONTRIBUTING.md and LICENSE.md (Ben Noordhuis)

2014-05-20, Version 1.1.0
=========================

 * Preserve non-registry options in ~/.npmrc (Miroslav Bajtoš)

 * promote: use $HOME/.npmrc when appropriate (Miroslav Bajtoš)

 * list: mention -h option (Miroslav Bajtoš)

 * promote: correctly support default npm cache path (Miroslav Bajtoš)

 * promote: Implement defaults for --from and --to (Miroslav Bajtoš)

 * Implement `promote` command (Miroslav Bajtoš)

 * refactor: storage.loadOrExit (Miroslav Bajtoš)

 * Extract RegistryConfig hasAuthCredentials (Miroslav Bajtoš)

 * Extract spawnNpmLogin into standalone file. (Miroslav Bajtoš)

 * test: split cli suite into smaller files (Miroslav Bajtoš)

 * test: refactor helper functions to helpers/sandbox (Miroslav Bajtoš)

 * Store `cache` in per-registry config files (Miroslav Bajtoš)

2014-04-28, Version 1.0.2
=========================

 * Make credentials queries work with npm (Miroslav Bajtoš)

2014-04-22, Version 1.0.1
=========================

 * Improve the messages printed in initialization (Miroslav Bajtoš)

2014-04-18, Version 1.0.0
=========================

 * First release!


text:
var application_root = __dirname,
    express = require( 'express' ), //Web framework
    bodyParser = require('body-parser'), //Parser for reading request body
    path = require( 'path' ), //Utilities for dealing with file paths
    mongoose = require( 'mongoose' ); //MongoDB integration

//Create server
var app = express();

//Where to serve static content
app.use( express.static( path.join( application_root, 'site') ) );

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
  extended: true
}));

//Start server
var port = 4711;

app.listen( port, function() {
    console.log( 'Express server listening on port %d in %s mode', port, app.settings.env );
});

// Routes
app.get('/api', function(req, res){
	res.send('Library API is running');
});

// connect to database
mongoose.connect('mongodb://localhost/library_database');

// Schemas

var Book = new mongoose.Schema({
	title: String,
	author: String,
	releaseDate: Date,
	keywords: [ Keywords ]
});

var Keywords = new mongoose.Schema({
    keyword: String
});

// models
var BookModel = mongoose.model('Book', Book);

// Configure server

app.use(express.static(path.join(application_root, 'site')));

//Get a list of all books
app.get( '/api/books', function( request, response ) {
    return BookModel.find( function( err, books ) {
        if( !err ) {
            return response.send( books );
        } else {
            return console.log( err );
        }
    });
});

//Insert a new book
app.post( '/api/books', function( request, response ) {
    var book = new BookModel({
        title: request.body.title,
        author: request.body.author,
        releaseDate: request.body.releaseDate,
		keywords: request.body.keywords
    });

    return book.save( function( err ) {
        if( !err ) {
            console.log( 'created' );
            return response.send( book );
            } else {
                console.log( err );
            }
    });
});

// Get a single book by id

app.get('/api/books/:id', function(request, response){
	return BookModel.findById( request.params.id, function(err, book){
		if(!err){
			return response.send(book);
		} else {
			return console.log(err);
		}
	});
});

app.put('/api/books/:id', function(request, response){
	console.log('Updating book ' + request.body.title);
	return BookModel.findById(request.params.id, function(err, book){
		book.title = request.body.title;
		book.author = request.body.author;
		book.releaseDate = request.body.releaseDate;
		book.keywords = request.body.keywords;

		return book.save(function(err){
			if(!err) {
				console.log('book updated');
				return response.send(book);
			} else {
				console.log(err);
			}
		});
	});
});

// delete a book

app.delete('/api/books/:id', function(request, response){
	console.log('Deleting book with :id' + request.params.id);
	return BookModel.findById(request.params.id, function(err, book){
		return book.remove(function(err){
			if (!err) {
				console.log('Book removed');
				return response.send('');
			} else {
				console.log(err);
			}
		});
	});
});


text:
'use strict';

import { ViewLineToken } from 'vs/editor/common/core/viewLineToken';
import { CharCode } from 'vs/base/common/charCode';
import { LineDecoration, LineDecorationsNormalizer } from 'vs/editor/common/viewLayout/lineDecorations';
import * as strings from 'vs/base/common/strings';
import { IStringBuilder, createStringBuilder } from 'vs/editor/common/core/stringBuilder';

export const enum RenderWhitespace {
	None = 0,
	Boundary = 1,
	All = 2
}

class LinePart {
	_linePartBrand: void;

	/**
	 * last char index of this token (not inclusive).
	 */
	public readonly endIndex: number;
	public readonly type: string;

	constructor(endIndex: number, type: string) {
		this.endIndex = endIndex;
		this.type = type;
	}
}

export class RenderLineInput {

	public readonly useMonospaceOptimizations: boolean;
	public readonly lineContent: string;
	public readonly mightContainRTL: boolean;
	public readonly fauxIndentLength: number;
	public readonly lineTokens: ViewLineToken[];
	public readonly lineDecorations: LineDecoration[];
	public readonly tabSize: number;
	public readonly spaceWidth: number;
	public readonly stopRenderingLineAfter: number;
	public readonly renderWhitespace: RenderWhitespace;
	public readonly renderControlCharacters: boolean;
	public readonly fontLigatures: boolean;

	constructor(
		useMonospaceOptimizations: boolean,
		lineContent: string,
		mightContainRTL: boolean,
		fauxIndentLength: number,
		lineTokens: ViewLineToken[],
		lineDecorations: LineDecoration[],
		tabSize: number,
		spaceWidth: number,
		stopRenderingLineAfter: number,
		renderWhitespace: 'none' | 'boundary' | 'all',
		renderControlCharacters: boolean,
		fontLigatures: boolean
	) {
		this.useMonospaceOptimizations = useMonospaceOptimizations;
		this.lineContent = lineContent;
		this.mightContainRTL = mightContainRTL;
		this.fauxIndentLength = fauxIndentLength;
		this.lineTokens = lineTokens;
		this.lineDecorations = lineDecorations;
		this.tabSize = tabSize;
		this.spaceWidth = spaceWidth;
		this.stopRenderingLineAfter = stopRenderingLineAfter;
		this.renderWhitespace = (
			renderWhitespace === 'all'
				? RenderWhitespace.All
				: renderWhitespace === 'boundary'
					? RenderWhitespace.Boundary
					: RenderWhitespace.None
		);
		this.renderControlCharacters = renderControlCharacters;
		this.fontLigatures = fontLigatures;
	}

	public equals(other: RenderLineInput): boolean {
		return (
			this.useMonospaceOptimizations === other.useMonospaceOptimizations
			&& this.lineContent === other.lineContent
			&& this.mightContainRTL === other.mightContainRTL
			&& this.fauxIndentLength === other.fauxIndentLength
			&& this.tabSize === other.tabSize
			&& this.spaceWidth === other.spaceWidth
			&& this.stopRenderingLineAfter === other.stopRenderingLineAfter
			&& this.renderWhitespace === other.renderWhitespace
			&& this.renderControlCharacters === other.renderControlCharacters
			&& this.fontLigatures === other.fontLigatures
			&& LineDecoration.equalsArr(this.lineDecorations, other.lineDecorations)
			&& ViewLineToken.equalsArr(this.lineTokens, other.lineTokens)
		);
	}
}

export const enum CharacterMappingConstants {
	PART_INDEX_MASK = 0b11111111111111110000000000000000,
	CHAR_INDEX_MASK = 0b00000000000000001111111111111111,

	CHAR_INDEX_OFFSET = 0,
	PART_INDEX_OFFSET = 16
}

/**
 * Provides a both direction mapping between a line's character and its rendered position.
 */
export class CharacterMapping {

	public static getPartIndex(partData: number): number {
		return (partData & CharacterMappingConstants.PART_INDEX_MASK) >>> CharacterMappingConstants.PART_INDEX_OFFSET;
	}

	public static getCharIndex(partData: number): number {
		return (partData & CharacterMappingConstants.CHAR_INDEX_MASK) >>> CharacterMappingConstants.CHAR_INDEX_OFFSET;
	}

	public readonly length: number;
	private readonly _data: Uint32Array;
	private readonly _absoluteOffsets: Uint32Array;

	constructor(length: number, partCount: number) {
		this.length = length;
		this._data = new Uint32Array(this.length);
		this._absoluteOffsets = new Uint32Array(this.length);
	}

	public setPartData(charOffset: number, partIndex: number, charIndex: number, partAbsoluteOffset: number): void {
		let partData = (
			(partIndex << CharacterMappingConstants.PART_INDEX_OFFSET)
			| (charIndex << CharacterMappingConstants.CHAR_INDEX_OFFSET)
		) >>> 0;
		this._data[charOffset] = partData;
		this._absoluteOffsets[charOffset] = partAbsoluteOffset + charIndex;
	}

	public getAbsoluteOffsets(): Uint32Array {
		return this._absoluteOffsets;
	}

	public charOffsetToPartData(charOffset: number): number {
		if (this.length === 0) {
			return 0;
		}
		if (charOffset < 0) {
			return this._data[0];
		}
		if (charOffset >= this.length) {
			return this._data[this.length - 1];
		}
		return this._data[charOffset];
	}

	public partDataToCharOffset(partIndex: number, partLength: number, charIndex: number): number {
		if (this.length === 0) {
			return 0;
		}

		let searchEntry = (
			(partIndex << CharacterMappingConstants.PART_INDEX_OFFSET)
			| (charIndex << CharacterMappingConstants.CHAR_INDEX_OFFSET)
		) >>> 0;

		let min = 0;
		let max = this.length - 1;
		while (min + 1 < max) {
			let mid = ((min + max) >>> 1);
			let midEntry = this._data[mid];
			if (midEntry === searchEntry) {
				return mid;
			} else if (midEntry > searchEntry) {
				max = mid;
			} else {
				min = mid;
			}
		}

		if (min === max) {
			return min;
		}

		let minEntry = this._data[min];
		let maxEntry = this._data[max];

		if (minEntry === searchEntry) {
			return min;
		}
		if (maxEntry === searchEntry) {
			return max;
		}

		let minPartIndex = CharacterMapping.getPartIndex(minEntry);
		let minCharIndex = CharacterMapping.getCharIndex(minEntry);

		let maxPartIndex = CharacterMapping.getPartIndex(maxEntry);
		let maxCharIndex: number;

		if (minPartIndex !== maxPartIndex) {
			// sitting between parts
			maxCharIndex = partLength;
		} else {
			maxCharIndex = CharacterMapping.getCharIndex(maxEntry);
		}

		let minEntryDistance = charIndex - minCharIndex;
		let maxEntryDistance = maxCharIndex - charIndex;

		if (minEntryDistance <= maxEntryDistance) {
			return min;
		}
		return max;
	}
}

export class RenderLineOutput {
	_renderLineOutputBrand: void;

	readonly characterMapping: CharacterMapping;
	readonly containsRTL: boolean;
	readonly containsForeignElements: boolean;

	constructor(characterMapping: CharacterMapping, containsRTL: boolean, containsForeignElements: boolean) {
		this.characterMapping = characterMapping;
		this.containsRTL = containsRTL;
		this.containsForeignElements = containsForeignElements;
	}
}

export function renderViewLine(input: RenderLineInput, sb: IStringBuilder): RenderLineOutput {
	if (input.lineContent.length === 0) {

		let containsForeignElements = false;

		// This is basically for IE's hit test to work
		let content: string = '\u00a0';

		if (input.lineDecorations.length > 0) {
			// This line is empty, but it contains inline decorations
			let classNames: string[] = [];
			for (let i = 0, len = input.lineDecorations.length; i < len; i++) {
				const lineDecoration = input.lineDecorations[i];
				if (lineDecoration.insertsBeforeOrAfter) {
					classNames[i] = input.lineDecorations[i].className;
					containsForeignElements = true;
				}
			}

			if (containsForeignElements) {
				content = `<span><span class="${classNames.join(' ')}">\u00a0</span></span>`;
			}
		}

		sb.appendASCIIString(content);
		return new RenderLineOutput(
			new CharacterMapping(0, 0),
			false,
			containsForeignElements
		);
	}

	return _renderLine(resolveRenderLineInput(input), sb);
}

export class RenderLineOutput2 {
	constructor(
		public readonly characterMapping: CharacterMapping,
		public readonly html: string,
		public readonly containsRTL: boolean,
		public readonly containsForeignElements: boolean
	) {
	}
}

export function renderViewLine2(input: RenderLineInput): RenderLineOutput2 {
	let sb = createStringBuilder(10000);
	let out = renderViewLine(input, sb);
	return new RenderLineOutput2(out.characterMapping, sb.build(), out.containsRTL, out.containsForeignElements);
}

class ResolvedRenderLineInput {
	constructor(
		public readonly fontIsMonospace: boolean,
		public readonly lineContent: string,
		public readonly len: number,
		public readonly isOverflowing: boolean,
		public readonly parts: LinePart[],
		public readonly containsForeignElements: boolean,
		public readonly tabSize: number,
		public readonly containsRTL: boolean,
		public readonly spaceWidth: number,
		public readonly renderWhitespace: RenderWhitespace,
		public readonly renderControlCharacters: boolean,
	) {
		//
	}
}

function resolveRenderLineInput(input: RenderLineInput): ResolvedRenderLineInput {
	const useMonospaceOptimizations = input.useMonospaceOptimizations;
	const lineContent = input.lineContent;

	let isOverflowing: boolean;
	let len: number;

	if (input.stopRenderingLineAfter !== -1 && input.stopRenderingLineAfter < lineContent.length) {
		isOverflowing = true;
		len = input.stopRenderingLineAfter;
	} else {
		isOverflowing = false;
		len = lineContent.length;
	}

	let tokens = transformAndRemoveOverflowing(input.lineTokens, input.fauxIndentLength, len);
	if (input.renderWhitespace === RenderWhitespace.All || input.renderWhitespace === RenderWhitespace.Boundary) {
		tokens = _applyRenderWhitespace(lineContent, len, tokens, input.fauxIndentLength, input.tabSize, useMonospaceOptimizations, input.renderWhitespace === RenderWhitespace.Boundary);
	}
	let containsForeignElements = false;
	if (input.lineDecorations.length > 0) {
		for (let i = 0, len = input.lineDecorations.length; i < len; i++) {
			const lineDecoration = input.lineDecorations[i];
			if (lineDecoration.insertsBeforeOrAfter) {
				containsForeignElements = true;
				break;
			}
		}
		tokens = _applyInlineDecorations(lineContent, len, tokens, input.lineDecorations);
	}
	let containsRTL = false;
	if (input.mightContainRTL) {
		containsRTL = strings.containsRTL(lineContent);
	}
	if (!containsRTL && !input.fontLigatures) {
		tokens = splitLargeTokens(lineContent, tokens);
	}

	return new ResolvedRenderLineInput(
		useMonospaceOptimizations,
		lineContent,
		len,
		isOverflowing,
		tokens,
		containsForeignElements,
		input.tabSize,
		containsRTL,
		input.spaceWidth,
		input.renderWhitespace,
		input.renderControlCharacters
	);
}

/**
 * In the rendering phase, characters are always looped until token.endIndex.
 * Ensure that all tokens end before `len` and the last one ends precisely at `len`.
 */
function transformAndRemoveOverflowing(tokens: ViewLineToken[], fauxIndentLength: number, len: number): LinePart[] {
	let result: LinePart[] = [], resultLen = 0;

	// The faux indent part of the line should have no token type
	if (fauxIndentLength > 0) {
		result[resultLen++] = new LinePart(fauxIndentLength, '');
	}

	for (let tokenIndex = 0, tokensLen = tokens.length; tokenIndex < tokensLen; tokenIndex++) {
		const token = tokens[tokenIndex];
		const endIndex = token.endIndex;
		if (endIndex <= fauxIndentLength) {
			// The faux indent part of the line should have no token type
			continue;
		}
		const type = token.getType();
		if (endIndex >= len) {
			result[resultLen++] = new LinePart(len, type);
			break;
		}
		result[resultLen++] = new LinePart(endIndex, type);
	}

	return result;
}

/**
 * written as a const enum to get value inlining.
 */
const enum Constants {
	LongToken = 50
}

/**
 * See https://github.com/Microsoft/vscode/issues/6885.
 * It appears that having very large spans causes very slow reading of character positions.
 * So here we try to avoid that.
 */
function splitLargeTokens(lineContent: string, tokens: LinePart[]): LinePart[] {
	let lastTokenEndIndex = 0;
	let result: LinePart[] = [], resultLen = 0;
	for (let i = 0, len = tokens.length; i < len; i++) {
		const token = tokens[i];
		const tokenEndIndex = token.endIndex;
		let diff = (tokenEndIndex - lastTokenEndIndex);
		if (diff > Constants.LongToken) {
			const tokenType = token.type;
			const piecesCount = Math.ceil(diff / Constants.LongToken);
			for (let j = 1; j < piecesCount; j++) {
				let pieceEndIndex = lastTokenEndIndex + (j * Constants.LongToken);
				let lastCharInPiece = lineContent.charCodeAt(pieceEndIndex - 1);
				if (strings.isHighSurrogate(lastCharInPiece)) {
					// Don't cut in the middle of a surrogate pair
					pieceEndIndex--;
				}
				result[resultLen++] = new LinePart(pieceEndIndex, tokenType);
			}
			result[resultLen++] = new LinePart(tokenEndIndex, tokenType);
		} else {
			result[resultLen++] = token;
		}
		lastTokenEndIndex = tokenEndIndex;
	}

	return result;
}

/**
 * Whitespace is rendered by "replacing" tokens with a special-purpose `vs-whitespace` type that is later recognized in the rendering phase.
 * Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (→ or ·) do not have the same width as  .
 * The rendering phase will generate `style="width:..."` for these tokens.
 */
function _applyRenderWhitespace(lineContent: string, len: number, tokens: LinePart[], fauxIndentLength: number, tabSize: number, useMonospaceOptimizations: boolean, onlyBoundary: boolean): LinePart[] {

	let result: LinePart[] = [], resultLen = 0;
	let tokenIndex = 0;
	let tokenType = tokens[tokenIndex].type;
	let tokenEndIndex = tokens[tokenIndex].endIndex;

	let firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);
	let lastNonWhitespaceIndex: number;
	if (firstNonWhitespaceIndex === -1) {
		// The entire line is whitespace
		firstNonWhitespaceIndex = len;
		lastNonWhitespaceIndex = len;
	} else {
		lastNonWhitespaceIndex = strings.lastNonWhitespaceIndex(lineContent);
	}

	let tmpIndent = 0;
	for (let charIndex = 0; charIndex < fauxIndentLength; charIndex++) {
		const chCode = lineContent.charCodeAt(charIndex);
		if (chCode === CharCode.Tab) {
			tmpIndent = tabSize;
		} else {
			tmpIndent++;
		}
	}
	tmpIndent = tmpIndent % tabSize;

	let wasInWhitespace = false;
	for (let charIndex = fauxIndentLength; charIndex < len; charIndex++) {
		const chCode = lineContent.charCodeAt(charIndex);

		let isInWhitespace: boolean;
		if (charIndex < firstNonWhitespaceIndex || charIndex > lastNonWhitespaceIndex) {
			// in leading or trailing whitespace
			isInWhitespace = true;
		} else if (chCode === CharCode.Tab) {
			// a tab character is rendered both in all and boundary cases
			isInWhitespace = true;
		} else if (chCode === CharCode.Space) {
			// hit a space character
			if (onlyBoundary) {
				// rendering only boundary whitespace
				if (wasInWhitespace) {
					isInWhitespace = true;
				} else {
					const nextChCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : CharCode.Null);
					isInWhitespace = (nextChCode === CharCode.Space || nextChCode === CharCode.Tab);
				}
			} else {
				isInWhitespace = true;
			}
		} else {
			isInWhitespace = false;
		}

		if (wasInWhitespace) {
			// was in whitespace token
			if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) {
				// leaving whitespace token or entering a new indent
				result[resultLen++] = new LinePart(charIndex, 'vs-whitespace');
				tmpIndent = tmpIndent % tabSize;
			}
		} else {
			// was in regular token
			if (charIndex === tokenEndIndex || (isInWhitespace && charIndex > fauxIndentLength)) {
				result[resultLen++] = new LinePart(charIndex, tokenType);
				tmpIndent = tmpIndent % tabSize;
			}
		}

		if (chCode === CharCode.Tab) {
			tmpIndent = tabSize;
		} else {
			tmpIndent++;
		}

		wasInWhitespace = isInWhitespace;

		if (charIndex === tokenEndIndex) {
			tokenIndex++;
			tokenType = tokens[tokenIndex].type;
			tokenEndIndex = tokens[tokenIndex].endIndex;
		}
	}

	if (wasInWhitespace) {
		// was in whitespace token
		result[resultLen++] = new LinePart(len, 'vs-whitespace');
	} else {
		// was in regular token
		result[resultLen++] = new LinePart(len, tokenType);
	}

	return result;
}

/**
 * Inline decorations are "merged" on top of tokens.
 * Special care must be taken when multiple inline decorations are at play and they overlap.
 */
function _applyInlineDecorations(lineContent: string, len: number, tokens: LinePart[], _lineDecorations: LineDecoration[]): LinePart[] {
	_lineDecorations.sort(LineDecoration.compare);
	const lineDecorations = LineDecorationsNormalizer.normalize(_lineDecorations);
	const lineDecorationsLen = lineDecorations.length;

	let lineDecorationIndex = 0;
	let result: LinePart[] = [], resultLen = 0, lastResultEndIndex = 0;
	for (let tokenIndex = 0, len = tokens.length; tokenIndex < len; tokenIndex++) {
		const token = tokens[tokenIndex];
		const tokenEndIndex = token.endIndex;
		const tokenType = token.type;

		while (lineDecorationIndex < lineDecorationsLen && lineDecorations[lineDecorationIndex].startOffset < tokenEndIndex) {
			const lineDecoration = lineDecorations[lineDecorationIndex];

			if (lineDecoration.startOffset > lastResultEndIndex) {
				lastResultEndIndex = lineDecoration.startOffset;
				result[resultLen++] = new LinePart(lastResultEndIndex, tokenType);
			}

			if (lineDecoration.endOffset + 1 <= tokenEndIndex) {
				// This line decoration ends before this token ends
				lastResultEndIndex = lineDecoration.endOffset + 1;
				result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className);
				lineDecorationIndex++;
			} else {
				// This line decoration continues on to the next token
				lastResultEndIndex = tokenEndIndex;
				result[resultLen++] = new LinePart(lastResultEndIndex, tokenType + ' ' + lineDecoration.className);
				break;
			}
		}

		if (tokenEndIndex > lastResultEndIndex) {
			lastResultEndIndex = tokenEndIndex;
			result[resultLen++] = new LinePart(lastResultEndIndex, tokenType);
		}
	}

	return result;
}

/**
 * This function is on purpose not split up into multiple functions to allow runtime type inference (i.e. performance reasons).
 * Notice how all the needed data is fully resolved and passed in (i.e. no other calls).
 */
function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): RenderLineOutput {
	const fontIsMonospace = input.fontIsMonospace;
	const containsForeignElements = input.containsForeignElements;
	const lineContent = input.lineContent;
	const len = input.len;
	const isOverflowing = input.isOverflowing;
	const parts = input.parts;
	const tabSize = input.tabSize;
	const containsRTL = input.containsRTL;
	const spaceWidth = input.spaceWidth;
	const renderWhitespace = input.renderWhitespace;
	const renderControlCharacters = input.renderControlCharacters;

	const characterMapping = new CharacterMapping(len + 1, parts.length);

	let charIndex = 0;
	let tabsCharDelta = 0;
	let charOffsetInPart = 0;

	let prevPartContentCnt = 0;
	let partAbsoluteOffset = 0;

	sb.appendASCIIString('');

	for (let partIndex = 0, tokensLen = parts.length; partIndex < tokensLen; partIndex++) {
		partAbsoluteOffset += prevPartContentCnt;

		const part = parts[partIndex];
		const partEndIndex = part.endIndex;
		const partType = part.type;
		const partRendersWhitespace = (renderWhitespace !== RenderWhitespace.None && (partType.indexOf('vs-whitespace') >= 0));
		charOffsetInPart = 0;

		sb.appendASCIIString('<span class="');
		sb.appendASCIIString(partType);
		sb.appendASCII(CharCode.DoubleQuote);

		if (partRendersWhitespace) {

			let partContentCnt = 0;
			{
				let _charIndex = charIndex;
				let _tabsCharDelta = tabsCharDelta;
				let _charOffsetInPart = charOffsetInPart;

				for (; _charIndex < partEndIndex; _charIndex++) {
					const charCode = lineContent.charCodeAt(_charIndex);

					if (charCode === CharCode.Tab) {
						let insertSpacesCount = tabSize - (_charIndex + _tabsCharDelta) % tabSize;
						_tabsCharDelta += insertSpacesCount - 1;
						_charOffsetInPart += insertSpacesCount - 1;
						partContentCnt += insertSpacesCount;
					} else {
						partContentCnt++;
					}

					_charOffsetInPart++;
				}
			}

			if (!fontIsMonospace) {
				const partIsOnlyWhitespace = (partType === 'vs-whitespace');
				if (partIsOnlyWhitespace || !containsForeignElements) {
					sb.appendASCIIString(' style="width:');
					sb.appendASCIIString(String(spaceWidth * partContentCnt));
					sb.appendASCIIString('px"');
				}
			}
			sb.appendASCII(CharCode.GreaterThan);

			for (; charIndex < partEndIndex; charIndex++) {
				characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset);
				const charCode = lineContent.charCodeAt(charIndex);

				if (charCode === CharCode.Tab) {
					let insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize;
					tabsCharDelta += insertSpacesCount - 1;
					charOffsetInPart += insertSpacesCount - 1;
					if (insertSpacesCount > 0) {
						sb.write1(0x2192); // →
						insertSpacesCount--;
					}
					while (insertSpacesCount > 0) {
						sb.write1(0xA0); //
						insertSpacesCount--;
					}
				} else {
					// must be CharCode.Space
					sb.write1(0xb7); // ·
				}

				charOffsetInPart++;
			}

			prevPartContentCnt = partContentCnt;

		} else {

			let partContentCnt = 0;

			if (containsRTL) {
				sb.appendASCIIString(' dir="ltr"');
			}
			sb.appendASCII(CharCode.GreaterThan);

			for (; charIndex < partEndIndex; charIndex++) {
				characterMapping.setPartData(charIndex, partIndex, charOffsetInPart, partAbsoluteOffset);
				const charCode = lineContent.charCodeAt(charIndex);

				switch (charCode) {
					case CharCode.Tab:
						let insertSpacesCount = tabSize - (charIndex + tabsCharDelta) % tabSize;
						tabsCharDelta += insertSpacesCount - 1;
						charOffsetInPart += insertSpacesCount - 1;
						while (insertSpacesCount > 0) {
							sb.write1(0xA0); //
							partContentCnt++;
							insertSpacesCount--;
						}
						break;

					case CharCode.Space:
						sb.write1(0xA0); //
						partContentCnt++;
						break;

					case CharCode.LessThan:
						sb.appendASCIIString('<');
						partContentCnt++;
						break;

					case CharCode.GreaterThan:
						sb.appendASCIIString('>');
						partContentCnt++;
						break;

					case CharCode.Ampersand:
						sb.appendASCIIString('&');
						partContentCnt++;
						break;

					case CharCode.Null:
						sb.appendASCIIString('�');
						partContentCnt++;
						break;

					case CharCode.UTF8_BOM:
					case CharCode.LINE_SEPARATOR_2028:
						sb.write1(0xfffd);
						partContentCnt++;
						break;

					default:
						if (renderControlCharacters && charCode < 32) {
							sb.write1(9216 + charCode);
							partContentCnt++;
						} else {
							sb.write1(charCode);
							partContentCnt++;
						}
				}

				charOffsetInPart++;
			}

			prevPartContentCnt = partContentCnt;
		}

		sb.appendASCIIString('');

	}

	// When getting client rects for the last character, we will position the
	// text range at the end of the span, insteaf of at the beginning of next span
	characterMapping.setPartData(len, parts.length - 1, charOffsetInPart, partAbsoluteOffset);

	if (isOverflowing) {
		sb.appendASCIIString('…');
	}

	sb.appendASCIIString('');

	return new RenderLineOutput(characterMapping, containsRTL, containsForeignElements);
}


text:
![BecassoLogo](becassologo.jpg)
=======

Paint and imaging software for Haiku, originally written for BeOS by Sum Software.
![Becasso](becasso.png)

Compilation
-----------

To compile, simply run jam:
	$> jam

Then you can run jam install to copy binaries and data files to subdirectory "target":
	$> jam install


text:
package org.pentaho.di.trans.steps.delay;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.ClassRule;
import org.junit.Test;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment;
import org.pentaho.di.trans.steps.loadsave.LoadSaveTester;

public class DelayMetaTest {
  @ClassRule public static RestorePDIEngineEnvironment env = new RestorePDIEngineEnvironment();

  @Test
  public void testStepMeta() throws KettleException {
    List<String> attributes = Arrays.asList( "timeout", "scaletime" );

    Map<String, String> getterMap = new HashMap<String, String>();
    getterMap.put( "timeout", "getTimeOut" );
    getterMap.put( "scaletime", "getScaleTimeCode" );

    Map<String, String> setterMap = new HashMap<String, String>();
    setterMap.put( "timeout", "setTimeOut" );
    setterMap.put( "scaletime", "setScaleTimeCode" );

    LoadSaveTester loadSaveTester = new LoadSaveTester( DelayMeta.class, attributes, getterMap, setterMap );
    loadSaveTester.testSerialization();
  }
}


text:
import csv
import MySQLdb
from decimal import Decimal

class DataWriter(object):
    """Write out the data to our preferred logging mechanism"""

    #Write out the data stream to our preferred location
    def __init__(self):
        #Do Nothing
        pass

    def __del__(self):
        #Do nothing
        pass

    def writeData(self, iteratorable):
        #Must be defined by base class
        raise NotImplementedError("Please Implement this method")

class DatabaseWriter(DataWriter):
    def __init__(self):
        #For now, do nothing
        DataWriter.__init__(self)
        self.db = MySQLdb.connect(read_default_file='/home/pi/.my.cnf') # name of the data base

        # you must create a Cursor object. It will let
        #  you execute all the queries you need
        self.cur = self.db.cursor()

    def __del__(self):
        DataWriter.__del__(self)
        self.cur.close();
        self.db.close();

    def writeData(self, iteratorable):
        #We don't care about the timestamp.  The database instance will set it
        self.cur.execute('''INSERT into beerviewer_readings (timestamp, primary_temp, heater_state, cooling_state)
                  values (UTC_TIMESTAMP(), %s, %s, %s)''',
                  (iteratorable[1], iteratorable[2], iteratorable[3]))
        self.db.commit()
        pass

class CSVWriter(DataWriter):
    #Write out the data stream to our preferred location
    def __init__(self):
        DataWriter.__init__(self)
        #For now, we'll be using CSV files
        #Prepare our stream writer
        self.m_CSVFile = open("/home/pi/data/readings.csv", "wb");
        self.m_CSVWriter = csv.writer(self.m_CSVFile);

    def __del__(self):
        DataWriter.__del__(self)
        self.m_CSVFile.close();

    #Write out a line of data to our storage mechanism
    def writeData(self, iteratorable):
        self.m_CSVWriter.writerow(iteratorable);
        self.m_CSVFile.flush()


text:
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>
<content type="xhtml">

my movie

</content>
</entry>
</feed>


text:
(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define([], factory);
  } else if (typeof exports !== "undefined") {
    factory();
  } else {
    var mod = {
      exports: {}
    };
    factory();
    global.tabsConfig = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function () {

  'use strict';

  var _require = require('../../globals/js/settings'),
      prefix = _require.prefix;

  var items = function items(idSuffix) {
    return [{
      linkId: "tab-link-1-".concat(idSuffix),
      panelId: "tab-panel-1-".concat(idSuffix),
      panelClass: "tab-1-".concat(idSuffix),
      label: 'Tab label 1',
      panelContent: 'Content for first tab goes here.',
      selected: true
    }, {
      linkId: "tab-link-2-".concat(idSuffix),
      panelId: "tab-panel-2-".concat(idSuffix),
      panelClass: "tab-2-".concat(idSuffix),
      label: 'Tab label 2',
      panelContent: 'Content for second tab goes here.'
    }, {
      linkId: "tab-link-3-".concat(idSuffix),
      panelId: "tab-panel-3-".concat(idSuffix),
      panelClass: "tab-3-".concat(idSuffix),
      label: 'Tab label 3',
      panelContent: 'Content for third tab goes here.'
    }, {
      linkId: "tab-link-4-".concat(idSuffix),
      panelId: "tab-panel-4-".concat(idSuffix),
      panelClass: "tab-4-".concat(idSuffix),
      label: 'Tab label 4',
      panelContent: 'Content for fourth tab goes here.',
      disabled: true
    }];
  };

  module.exports = {
    context: {
      prefix: prefix
    },
    variants: [{
      name: 'default',
      label: 'Tabs',
      context: {
        items: items('default')
      }
    }, {
      name: 'container',
      label: 'Tabs (container)',
      context: {
        container: true,
        items: items('container')
      }
    }]
  };
});