text:
module NetSuite
  module Utilities

    # Warning this was developed with a Web Services user whose time zone was set to CST
    # the time zone setting of the user seems to effect how times work in NS

    # modifying time without rails:
    # http://stackoverflow.com/questions/238684/subtract-n-hours-from-a-datetime-in-ruby

    # converting between time and datetime:
    # http://stackoverflow.com/questions/279769/convert-to-from-datetime-and-time-in-ruby

    # use when sending times to NS
    def self.normalize_datetime_to_netsuite(datetime)
      # normalize the time to UCT0
      # add 6 hours (21600 seconds) of padding (CST offset)
      # to force the same time to be displayed in the NS UI

      is_dst = Time.parse(datetime.to_s).dst?

      datetime.new_offset(0) + datetime.offset + Rational(is_dst ? 5 : 6, 24)
    end

    # use when displaying times from a NS record
    def self.normalize_datetime_from_netsuite(datetime)
      # the code below eliminates the TimeZone offset then shifts the date forward 2 hours (7200 seconds)
      # this ensures that ActiveRecord is given a UTC0 DateTime with the exact hour that
      # was displayed in the NS UI (CST time zone), which will result in the correct display on the web side

      datetime.new_offset(0) + datetime.offset + Rational(2, 24)
    end

  end
end


text:
// Originally submitted to OSEHRA 2/21/2017 by DSS, Inc.
// Authored by DSS, Inc. 2014-2017

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace VA.Gov.Artemis.Commands.Vpr.Data
{
    [Serializable]
    public class Qualifier
    {
        [XmlAttribute("name")]
        public string Name { get; set; }
    }

}

redpajama_set_name: RedPajamaGithub


text:
package register

import (
	// register vfs
	_ "github.com/containers/storage/drivers/vfs"
)


text:
package onion.factory.infrastructure;

import onion.factory.core.THREE_domain.Factory;
import onion.factory.core.TWO_domainservices.IFactoryRepository;

public class FactoryRepository implements IFactoryRepository {

	public void save(Factory factory) {
		Database.insert(factory.getId(), factory);
	}

	public Factory load(Long factoryId) {
		return (Factory) Database.select(factoryId);
	}

	public void update(Factory factory) {
		Database.update(factory.getId(), factory);
	}

}


text:
## Groovy Goodness
1. Groovy syntax is very similar to Java, JavaScript and other scripting languages. Most Java or JavaScript code is valid Groovy code.
2. Groovy comments are designated using `// comment` or `/* comment */`.
3. Using Groovy, properties that are accessed using getters and setters can be retrieved and set by simply referencing the property name. For example, as seen below, the ultimate parent of the Table object, has a name property. Instead of accessing the propery using the getter, `table.getName()`, you can access the name property thusly: `table.name`. This also works to set the property value. In this case `table.setName('EMP')` becomes `table.name = 'EMP'`.
 ![](images/getterSetter.png)

4. Some properties are actually collections rather than scalar values. For example, as seen in the *index.html* file, the unique and primary keys of a table are referenced as a collection. Please note that a `DesignObject` is the parent class for many types of objects. In this case, the entire collection can be referenced directly from the table object like this: `table.UKeys`.
 ![](images/pkAndUk.png)

 Typically, the property will be the lower-case version of the item `table.getName() == table.name`, however as is seen here, if the property begins with two upper-case letters, that is carried over in the property name `table.getPKeys() == table.PKeys`.

5. The collections used in the SDDM model are primarily Java List objects. Groovy lists are easy to work with and have many helper methods, some handy ones are described [here](http://grails.asia/groovy-list-tutorial-and-examples).

6. Groovy has  full support for regular expressions. The use of the extremely handy matcher operator is detailed [here](http://mrhaki.blogspot.com/2009/09/groovy-goodness-matchers-for-regular.html).

7. Groovy strings can be denoted with either single or double quotes. String elements can be accessed using a 0-based array. The last member of a string can be retrieved using an index of -1, the second-last using -2 and so on. There are a multitude of convenience methods on strings. A good listing can be found [here](https://www.tutorialspoint.com/groovy/groovy_strings.htm).
8. Debugging can be tricky, but you can send messages to the application log window like this:
```groovy
// get a handle to the application object
def app = oracle.dbtools.crest.swingui.ApplicationView
// output to log
app.log("Table name:${table.name}")
```
However, using SDDM^Plus, you can simply use the *log()* method with no set up, like this:
```groovy
// output to log using sddm-plus
log("Table name:${table.name}")
```
Click on **Apply**, and the output appears in the **Messages - Log** pane. If the Log pane is not visible, select **View | Log** from the top-level menu.

 ![](images/useLog.png)

9. In the event that you make a coding mistake, script errors will appear in a separate **Error** dialog popup. If you are using more than one monitor the error window may show up on another monitor.

 ![](images/errorMsg.png)

10. Control structures in Groovy are similar to those found in most programming languages. For example *for* loops can be defined the old-fashoned way using `for (i=0; i < j; i++) { ... }`, but they can also be defined using the *in* syntax. For example  `for (table in tables) { ... }` will loop through all of the objects in the *tables* list.

11. Automatic iterators and closures are a very powerful aspects of Groovy programming that become second nature very quickly. You don't need to know much about either of these topics to take advantage of them so I will not go into detail here. If you are curious, there are numerious sources on the web where you can learn more, but suffice it to say that a closure is like a function or method, and the built-in iterators use closures to make working with collections very efficient and easy. In the example below, we are using the **sddm-plus** methods, getTables() and getColumns() (abbreviated as described above) to print the table names and the associated colums from a model to a file. We use the *each{}* closure to iterate through the list of tables in the model and the columns in the table. The *<<* operator makes adding content to a file extremely easy. Groovy takes care of opening and closing the file for you.

 ```groovy
def file = new File('Desktop/test.txt')
// using sddm-plus commands
tables.each { table ->
  file << "Table: ${table.name}\n"
  table.columns.each { col ->
    file << "  col: ${col.name}\n"
  }
}
```


text:
==================
 |InProgress| API
==================

.. include:: /../common/stub-overview.txt

We are working to move the API documentation into the developer center.  In the meantime, you can view the `DNN 8.0 API documentation online <http://www.dnnsoftware.com/dnn-api/>`_ or `download the documentation <http://dotnetnuke.codeplex.com/downloads/get/1540250>`_ from the project page on CodePlex.


text:
package metrics

// Message defines an interface for processing bytes.
type Processor interface {
	Process([]byte) error
}

// DoProcess executes m.Process with messaging metrics.
func DoProcess(m Processor, b []byte) error {
	MsgRx()
	t := Start()
	defer func() {
		_ = t.Track("process") // we keep this package simple thus not reporting this error
	}()

	err := m.Process(b)

	switch err {
	case nil:
		MsgProc()
	default:
		MsgErr()
	}

	return err
}

// Logger defines an interface for logging.
type Logger interface {
	Printf(string, ...interface{})
}

type discarder struct {
}

func (d discarder) Printf(string, ...interface{}) {
}


text:
require 'ruby_enum'

class Instruction
  attr_accessor :opcode
  attr_accessor :operand_count
  def initialize(opcode, operand_count = 0)
    @opcode = opcode
    @operand_count = operand_count
  end

  def to_s
    "opcode: #{opcode}, operand_count: #{operand_count}"
  end
end

class Bytecodes
  include Ruby::Enum

  define :INVALID, Instruction.new(0)
  define :IADD, Instruction.new(1)
  define :ISUB, Instruction.new(2)
  define :IMUL, Instruction.new(3)
  define :IIL, Instruction.new(4)
  define :IEQ, Instruction.new(5)
  define :BR, Instruction.new(6, 1)
  define :BRT, Instruction.new(7, 1)
  define :BRF, Instruction.new(8, 1)
  define :ICONST, Instruction.new(9, 1)
  define :LOAD, Instruction.new(10, 1)
  define :GLOAD, Instruction.new(11, 1)
  define :STORE, Instruction.new(12, 1)
  define :GSTORE, Instruction.new(13, 1)
  define :PRINT, Instruction.new(14)
  define :POP, Instruction.new(15, 1)
  define :CALL, Instruction.new(16, 1)
  define :RET, Instruction.new(17, 1)
  define :HALT, Instruction.new(18)

  def self.to_instruction_from_opcode(opcode)
    Bytecodes.keys[opcode]
  end
end


text:
using namespace std;

// base logic
enum Direction { North, South, East, West };

class MapSite {
    public:
        virtual void Enter() = 0;
};

class Room : public MapSite {
    public:
        Room(int roomNumber) { _roomNumber = roomNumber; }

        MapSite* GetSide(Direction direction) const { return 0; }
        void SetSide(Direction direction, MapSite* mapSite) { }

        virtual void Enter() { }
    private:
        MapSite* _sides[4];
        int _roomNumber;
};

class Wall : public MapSite {
    public:
        Wall() { }

        virtual void Enter() { }
};

class Door : public MapSite {
    public:
        Door(Room* room1 = 0, Room* room2 = 0) {
            _room1 = room1;
            _room2 = room2;
        }

        virtual void Enter() { }

        Room* OtherSideFrom(Room* room) { return 0; }
    private:
        Room* _room1;
        Room* _room2;
        bool _isOpen;
};

class Maze {
    public:
        Maze() { }

        void AddRoom(Room* room) { }

        Room* RoomNumber(int number) const { return 0; }
};

// pattern declarations

// abstract factory
class MazeFactory {
    public:
        MazeFactory() {}

        virtual Maze* MakeMaze() const
        {
            return new Maze();
        }

        virtual Wall* MakeWall() const
        {
            return new Wall();
        }

        virtual Room* MakeRoom(int number) const
        {
            return new Room(number);
        }

        virtual Door* MakeDoor(Room* room1, Room* room2) const
        {
            return new Door(room1, room2);
        }
};

// auxiliary logic classes
class Spell {
};

class EnchantedRoom : public Room {
    public:
        EnchantedRoom(int number, Spell *spell)
            : Room(number), _spell(spell)
        {

        }

    private:
        Spell* _spell;
};

class DoorNeedingSpell : public Door {
    public:
        DoorNeedingSpell(Room* room1, Room* room2)
            : Door(room1, room2)
        {
        }
};

// auxiliary factory
class EnchantedMazeFactory : public MazeFactory {
    public:
        EnchantedMazeFactory() { }

        virtual Room* MakeRoom(int number) const
        {
            return new EnchantedRoom(number, CastSpell());
        }

        virtual Door* MakeDoor(Room* room1, Room* room2) const
        {
            return new DoorNeedingSpell(room1, room2);
        }
    private:
        Spell* CastSpell() const
        {
            return 0;
        }
};

// auxiliary logic
class BombedWall : public Wall {

};

class RoomWithABomb : public Room {
    public:
        RoomWithABomb(int number)
            : Room(number) { }
};

// auxiliary factory
class BombedMazeFactory : public MazeFactory {
    public:
        Wall* MakeWall() const
        {
            return new BombedWall();
        }

        Room* MakeRoom(int number) const
        {
            return new RoomWithABomb(number);
        }
};

// pattern using
class MazeGame {
    public:
        Maze* CreateMaze(MazeFactory& factory)
        {
            Maze* aMaze = factory.MakeMaze();

            Room* room1 = factory.MakeRoom(1);
            Room* room2 = factory.MakeRoom(2);
            Door* aDoor = factory.MakeDoor(room1, room2);

            aMaze->AddRoom(room1);
            aMaze->AddRoom(room2);

            room1->SetSide(North, factory.MakeWall());
            room1->SetSide(East, aDoor);
            room1->SetSide(South, factory.MakeWall());
            room1->SetSide(West, factory.MakeWall());

            room2->SetSide(North, factory.MakeWall());
            room2->SetSide(East, factory.MakeWall());
            room2->SetSide(South, factory.MakeWall());
            room2->SetSide(West, aDoor);

            return aMaze;
        }
};

// the main procedure
int main()
{
    MazeGame game;

    MazeFactory mazeFactory;
    game.CreateMaze(mazeFactory);

    EnchantedMazeFactory enchantedMazeFactory;
    game.CreateMaze(enchantedMazeFactory);

    BombedMazeFactory bombedMazeFactory;
    game.CreateMaze(bombedMazeFactory);

    return 0;
}


text:
/*
 * $Id$
 */
package com.ivstars.astrology.util;

import junit.framework.TestCase;

import java.util.Date;
import java.util.TimeZone;
import java.text.SimpleDateFormat;
import java.text.MessageFormat;

/**
 * TestCommonUtil
 *
 * @author Fengbo Xie (fengbo.xie at gmail.com)
 *         Everything that has a beginning has an end.
 */
public class TestCommonUtil extends TestCase {
    int count =10000;
    public void testParseDate(){
        Date d = CommonUtil.parseDate("2002-01-02",null);
        System.out.println(d);
        Date d2 = CommonUtil.parseDate("2002-1-2 0:00:00", TimeZone.getDefault().getID());
        assertEquals(d,d2);
        d2 = CommonUtil.parseDate("2002/01/02 0:0:0",null);
        assertEquals(d,d2);
    }
    public void testFormatDate(){
        String pattern = "yyyyMMdd";
        for(int i=0;i<count;i++){
            CommonUtil.formatDate(new Date(),pattern);
        }
    }
    public void testFormatDate2(){
        String pattern = "yyyyMMdd";
        SimpleDateFormat sdf =new SimpleDateFormat(pattern);
        for(int i=0;i<count;i++){
            sdf.format(new Date());
        }
    }

    public void testFormatString(){
        MessageFormat mf = new MessageFormat("{0}-{1}-{2}-{3}");

    }
}


text:
@interface HZYFormLabel : UILabel<HZYFormCellSubViewProtocol>
@property (nonatomic, assign) HZYFormViewCellOption type;
@property (nonatomic, strong) NSString *value;
+ (instancetype)labelWithType:(HZYFormViewCellOption)type;
@end

@interface HZYFormInputField : UITextField<HZYFormCellSubViewProtocol, HZYFormCellSubViewPlaceholderProtocol>
@property (nonatomic, assign) HZYFormViewCellOption type;
@property (nonatomic, strong) NSString *value;
@end

@interface HZYFormButton : UIButton<HZYFormCellSubViewProtocol>
+ (instancetype)buttonWithOption:(HZYFormViewCellOption)type;
@property (nonatomic, assign) HZYFormViewCellOption type;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, strong) id value;
@end

@interface HZYFormImageView : UIImageView<HZYFormCellSubViewProtocol, HZYFormCellSubViewPlaceholderProtocol>
@property (nonatomic, assign) HZYFormViewCellOption type;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, strong) UIImage *placeholder;
@property (nonatomic, copy) NSString *url;
@property (nonatomic, assign) BOOL didSetImage;
@property (nonatomic, strong) id value;
@end

@interface HZYFormInputView : UITextView<HZYFormCellSubViewProtocol, HZYFormCellSubViewPlaceholderProtocol>
@property (nonatomic, assign) HZYFormViewCellOption type;
@property (nonatomic, strong) NSString *placeholder;
@property (nonatomic, strong) NSString *value;
@end


text: #include "comms-precomp.h"	// Precompiled headers


text:
/**
 * Created by Administrator on 2015/5/18.
 */

function RequestError(requestId) {
    this.name = 'RequestError';
    this.requestId = requestId;
}

RequestError.prototype = Object.create(Error.prototype);
RequestError.prototype.constructor = RequestError;

module.exports = RequestError;


text:
@interface EXReactDelegateWrapper()

@property (nonatomic, weak) ExpoReactDelegate *expoReactDelegate;

@end

@implementation EXReactDelegateWrapper

- (instancetype)initWithExpoReactDelegate:(ExpoReactDelegate *)expoReactDelegate
{
  if (self = [super init]) {
    _expoReactDelegate = expoReactDelegate;
  }
  return self;
}

- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate
                          launchOptions:(nullable NSDictionary *)launchOptions
{
  return [_expoReactDelegate createBridgeWithDelegate:delegate launchOptions:launchOptions];
}

- (RCTRootView *)createRootViewWithBridge:(RCTBridge *)bridge
                               moduleName:(NSString *)moduleName
                        initialProperties:(nullable NSDictionary *)initialProperties
{
  return [_expoReactDelegate createRootViewWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
}

- (UIViewController *)createRootViewController
{
  return [_expoReactDelegate createRootViewController];
}

@end


text:
package org.apache.geode.management.internal.rest;

import static org.apache.geode.lang.Identifiable.find;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import java.util.Objects;

import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;

import org.apache.geode.cache.configuration.CacheConfig;
import org.apache.geode.distributed.internal.InternalConfigurationPersistenceService;
import org.apache.geode.management.api.ClusterManagementRealizationResult;
import org.apache.geode.management.api.ClusterManagementResult;
import org.apache.geode.management.api.ClusterManagementService;
import org.apache.geode.management.api.RealizationResult;
import org.apache.geode.management.builder.GeodeClusterManagementServiceBuilder;
import org.apache.geode.management.client.ClusterManagementServiceBuilder;
import org.apache.geode.management.configuration.Region;
import org.apache.geode.management.configuration.RegionType;
import org.apache.geode.test.dunit.rules.ClientVM;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
import org.apache.geode.test.dunit.rules.MemberVM;
import org.apache.geode.test.junit.rules.MemberStarterRule;

public class ClientClusterManagementServiceDunitTest {
  @ClassRule
  public static ClusterStartupRule cluster = new ClusterStartupRule(4);

  private static MemberVM locator;
  private static MemberVM server;
  private static ClientVM client;

  private static String groupA = "group-a";
  private static ClusterManagementService cmsClient;

  @BeforeClass
  public static void beforeClass() {
    locator = cluster.startLocatorVM(0, MemberStarterRule::withHttpService);
    server = cluster.startServerVM(1, locator.getPort());
    cluster.startServerVM(2, groupA, locator.getPort());
    cmsClient = new ClusterManagementServiceBuilder()
        .setPort(locator.getHttpPort())
        .build();
  }

  @Test
  public void createRegion() {
    Region region = new Region();
    region.setName("customer");
    region.setType(RegionType.PARTITION);

    ClusterManagementRealizationResult result = cmsClient.create(region);

    assertThat(result.isSuccessful()).isTrue();
    assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK);
    assertThat(result.getMemberStatuses()).extracting(RealizationResult::getMemberName)
        .containsExactlyInAnyOrder("server-1", "server-2");

    assertThatThrownBy(() -> cmsClient.create(region)).hasMessageContaining("ENTITY_EXISTS");
  }

  @Test
  public void createRegionWithNullGroup() {
    Region region = new Region();
    region.setName("orders");
    region.setType(RegionType.PARTITION);

    ClusterManagementRealizationResult result = cmsClient.create(region);

    assertThat(result.isSuccessful()).isTrue();
    assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK);
    assertThat(result.getMemberStatuses()).extracting(RealizationResult::getMemberName)
        .containsExactlyInAnyOrder("server-1", "server-2");
  }

  @Test
  public void createRegionWithInvalidName() {
    Region region = new Region();
    region.setName("__test");

    assertThatThrownBy(() -> cmsClient.create(region)).hasMessageContaining("ILLEGAL_ARGUMENT");
  }

  @Test
  public void createRegionWithGroup() {
    Region region = new Region();
    region.setName("company");
    region.setType(RegionType.PARTITION);
    region.setGroup(groupA);

    ClusterManagementRealizationResult result = cmsClient.create(region);

    assertThat(result.isSuccessful()).isTrue();
    assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK);

    // server 1 should not be in the set
    assertThat(result.getMemberStatuses()).extracting(RealizationResult::getMemberName)
        .containsExactlyInAnyOrder("server-2");

    locator.invoke(() -> {
      InternalConfigurationPersistenceService persistenceService =
          Objects.requireNonNull(ClusterStartupRule.getLocator())
              .getConfigurationPersistenceService();
      CacheConfig clusterCacheConfig = persistenceService.getCacheConfig("cluster", true);
      CacheConfig groupACacheConfig = persistenceService.getCacheConfig("group-a");
      assertThat(find(clusterCacheConfig.getRegions(), "company")).isNull();
      assertThat(find(groupACacheConfig.getRegions(), "company")).isNotNull();
    });
  }

  @Test
  public void invokeFromClientCacheWithLocatorPool() throws Exception {
    int locatorPort = locator.getPort();
    client = cluster.startClientVM(3, c -> c.withLocatorConnection(locatorPort));

    client.invoke(() -> {
      ClusterManagementService service =
          new GeodeClusterManagementServiceBuilder()
              .setCache(ClusterStartupRule.getClientCache())
              .build();
      assertThat(service.isConnected()).isTrue();
    });
    client.stop();
  }

  @Test
  public void invokeFromClientCacheWithServerPool() throws Exception {
    int serverPort = server.getPort();
    client = cluster.startClientVM(3, c -> c.withServerConnection(serverPort));

    client.invoke(() -> {
      assertThatThrownBy(() -> new GeodeClusterManagementServiceBuilder()
          .setCache(ClusterStartupRule.getClientCache())
          .build())
              .isInstanceOf(IllegalStateException.class)
              .hasMessageContaining(
                  "the client needs to have a client pool connected with a locator");
    });
    client.stop();
  }
}


text:
package org.imirsel.nema.flowservice.notification;

import org.imirsel.nema.model.Notification;

/**
 * Interface for classes that provide services for sending notifications.
 *
 * @author shirk
 * @since 0.5.0
 *
 */
public interface NotificationSender {

   /**
    * Send a notification. The destination of the notification will be
    * implementation specific.
    *
    * @param notification Notification to send.
    */
	public void send(Notification notification);
}


text:
let gen = (() => {
  var _ref = _skipFirstGeneratorNext(function* () {
    let _functionSent = yield;

    let sent = _functionSent;
  });

  return function gen() {
    return _ref.apply(this, arguments);
  };
})();

function _skipFirstGeneratorNext(fn) { return function () { var it = fn.apply(this, arguments); it.next(); return it; }; }


text:
<?php

// Don't redefine the functions if included multiple times.
if (!\function_exists('DeliciousBrains\\WP_Offload_SES\\Aws3\\GuzzleHttp\\uri_template')) {
    require __DIR__ . '/functions.php';
}


text:
package org.dasein.cloud.azure.compute.image.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

/**
 * Created by Vlad_Munthiu on 8/15/2014.
 */
@XmlRootElement(name="VMImages", namespace ="http://schemas.microsoft.com/windowsazure")
@XmlAccessorType(XmlAccessType.FIELD)
public class VMImagesModel
{
    @XmlElement(name="VMImage", namespace ="http://schemas.microsoft.com/windowsazure")
    private List<VMImageModel> vmImages;

    public List<VMImageModel> getVmImages() {
        return vmImages;
    }

    public void setVmImages(List<VMImageModel> vmImages) {
        this.vmImages = vmImages;
    }
}


text:
package com.amazonaws.services.ivschat.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.ivschat.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * GetRoomResult JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetRoomResultJsonUnmarshaller implements Unmarshaller<GetRoomResult, JsonUnmarshallerContext> {

    public GetRoomResult unmarshall(JsonUnmarshallerContext context) throws Exception {
        GetRoomResult getRoomResult = new GetRoomResult();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return getRoomResult;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("arn", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setArn(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("createTime", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setCreateTime(DateJsonUnmarshallerFactory.getInstance("iso8601").unmarshall(context));
                }
                if (context.testExpression("id", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setId(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("loggingConfigurationIdentifiers", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setLoggingConfigurationIdentifiers(new ListUnmarshaller<String>(context.getUnmarshaller(String.class))

                    .unmarshall(context));
                }
                if (context.testExpression("maximumMessageLength", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setMaximumMessageLength(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
                if (context.testExpression("maximumMessageRatePerSecond", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setMaximumMessageRatePerSecond(context.getUnmarshaller(Integer.class).unmarshall(context));
                }
                if (context.testExpression("messageReviewHandler", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setMessageReviewHandler(MessageReviewHandlerJsonUnmarshaller.getInstance().unmarshall(context));
                }
                if (context.testExpression("name", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setName(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("tags", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setTags(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class))
                            .unmarshall(context));
                }
                if (context.testExpression("updateTime", targetDepth)) {
                    context.nextToken();
                    getRoomResult.setUpdateTime(DateJsonUnmarshallerFactory.getInstance("iso8601").unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return getRoomResult;
    }

    private static GetRoomResultJsonUnmarshaller instance;

    public static GetRoomResultJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new GetRoomResultJsonUnmarshaller();
        return instance;
    }
}


text:
package com.gs.collections.test.lazy;

import com.gs.collections.api.LazyIterable;
import com.gs.collections.impl.lazy.TapIterable;
import com.gs.collections.test.LazyNoIteratorTestCase;
import com.gs.collections.test.list.mutable.FastListNoIterator;
import com.gs.junit.runners.Java8Runner;
import org.junit.runner.RunWith;

@RunWith(Java8Runner.class)
public class TapIterableTestNoIteratorTest implements LazyNoIteratorTestCase
{
    @Override
    public <T> LazyIterable<T> newWith(T... elements)
    {
        return new TapIterable<>(new FastListNoIterator<T>().with(elements), ignored -> {
        });
    }
}


text:
{% load wagtailmodeladmin_tags %}
{% for item in result %}
	{% result_row_value_display item obj action_buttons forloop.counter %}
{% endfor %}


text:
package control

import (
	"encoding/binary"
	"io"

	"github.com/google/uuid"
)

const (
	// ActualProtocolVersion is the supported protocol version, and the default one used to send outbound messages
	ActualProtocolVersion   uint8 = 0
	maximumSupportedVersion uint8 = ActualProtocolVersion
	outboundMessageVersion        = maximumSupportedVersion
)

type MessageFlag uint8

/*
MessageHeader represents a message header

+---------+---------+-------+----------+--------+
|         |   0-8   |  8-16 |   16-24  |  24-32 |
+---------+---------+-------+----------+--------+
| 0-32    | version | flags | <unused> | opcode |
+---------+---------+-------+----------+--------+
| 32-64   |              uuid[0:4]              |
+---------+-------------------------------------+
| 64-96   |              uuid[4:8]              |
+---------+-------------------------------------+
| 96-128  |              uuid[8:12]             |
+---------+-------------------------------------+
| 128-160 |             uuid[12:16]             |
+---------+-------------------------------------+
| 160-192 |                length               |
+---------+-------------------------------------+
*/
type MessageHeader struct {
	version uint8
	flags   uint8
	opcode  uint8
	uuid    [16]byte
	// In bytes
	length uint32
}

// Version returns the protocol version
func (m MessageHeader) Version() uint8 {
	return m.version
}

// Check returns true if the flag is 1, false otherwise
func (m MessageHeader) Check(flag MessageFlag) bool {
	return (m.flags & uint8(flag)) == uint8(flag)
}

// OpCode returns the opcode of the message
func (m MessageHeader) OpCode() uint8 {
	return m.opcode
}

// UUID returns the message uuid
func (m MessageHeader) UUID() uuid.UUID {
	return m.uuid
}

// UUID returns the payload length
func (m MessageHeader) Length() uint32 {
	return m.length
}

func (m MessageHeader) WriteTo(w io.Writer) (int64, error) {
	var b [4]byte
	var n int64
	b[0] = m.version
	b[1] = m.flags
	b[3] = m.opcode
	n1, err := w.Write(b[0:4])
	n = n + int64(n1)
	if err != nil {
		return n, err
	}

	n1, err = w.Write(m.uuid[0:16])
	n = n + int64(n1)
	if err != nil {
		return n, err
	}

	binary.BigEndian.PutUint32(b[0:4], m.length)
	n1, err = w.Write(b[0:4])
	n = n + int64(n1)
	return n, err
}

func messageHeaderFromBytes(b [24]byte) MessageHeader {
	m := MessageHeader{}
	m.version = b[0]
	m.flags = b[1]
	m.opcode = b[3]
	for i := 0; i < 16; i++ {
		m.uuid[i] = b[4+i]
	}
	m.length = binary.BigEndian.Uint32(b[20:24])
	return m
}

// Message is a MessageHeader and a payload
type Message struct {
	MessageHeader
	payload []byte
}

// MessageOpt is an additional option for NewMessage
type MessageOpt func(*Message)

// WithVersion specifies the version to use when creating a new Message
func WithVersion(version uint8) MessageOpt {
	return func(message *Message) {
		message.version = version
	}
}

// WithVersion specifies the flags to use when creating a new Message
func WithFlags(flags uint8) MessageOpt {
	return func(message *Message) {
		message.flags = flags
	}
}

// NewMessage creates a new message.
func NewMessage(uuid [16]byte, opcode uint8, payload []byte, opts ...MessageOpt) Message {
	length := uint32(0)
	if payload != nil {
		length = uint32(len(payload))
	}
	msg := Message{
		MessageHeader: MessageHeader{
			version: outboundMessageVersion,
			flags:   0,
			opcode:  opcode,
			uuid:    uuid,
			length:  length,
		},
		payload: payload,
	}

	for _, f := range opts {
		f(&msg)
	}

	return msg
}

func (m Message) Payload() []byte {
	return m.payload
}

func (m *Message) ReadFrom(r io.Reader) (count int64, err error) {
	var b [24]byte
	var n int
	n, err = io.ReadAtLeast(io.LimitReader(r, 24), b[0:24], 24)
	count = count + int64(n)
	if err != nil {
		return count, err
	}

	m.MessageHeader = messageHeaderFromBytes(b)
	if m.Length() != 0 {
		// We need to read the payload
		m.payload = make([]byte, m.Length())
		n, err = io.ReadAtLeast(io.LimitReader(r, int64(m.Length())), m.payload, int(m.Length()))
		count = count + int64(n)
	}
	return count, err
}

func (m *Message) WriteTo(w io.Writer) (count int64, err error) {
	n, err := m.MessageHeader.WriteTo(w)
	count = count + n
	if err != nil {
		return count, err
	}

	if m.payload != nil {
		var n1 int
		n1, err = w.Write(m.payload)
		count = count + int64(n1)
	}
	return count, err
}


text:
package gnu.kawa.reflect;
import gnu.bytecode.*;
import gnu.mapping.*;
import java.io.*;

public class ArrayLength
  extends Procedure1
  implements Externalizable
{
  Type element_type;

  public ArrayLength (Type element_type)
  {
    this.element_type = element_type;
    setProperty(Procedure.validateApplyKey,
                "gnu.kawa.reflect.CompileArrays:validateArrayLength");
    Procedure.compilerKey.set(this, "*gnu.kawa.reflect.CompileArrays:getForArrayLength");
  }

  public Object apply1 (Object array)
  {
    return gnu.math.IntNum.make(java.lang.reflect.Array.getLength(array));
  }

  public boolean isSideEffectFree ()
  {
    return true;
  }

  public void writeExternal(ObjectOutput out) throws IOException
  {
    out.writeObject(element_type);
  }

  public void readExternal(ObjectInput in)
    throws IOException, ClassNotFoundException
  {
    element_type = (Type) in.readObject();
  }
}


text:
#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TANH_H_
#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TANH_H_

#include <limits>

#include "fixedpoint/fixedpoint.h"
#include "tensorflow/lite/kernels/internal/common.h"

namespace tflite {
namespace reference_integer_ops {

inline void Tanh(int32_t input_zero_point, int32_t input_range_radius,
                 int32_t input_multiplier, int32_t input_shift,
                 int32_t input_size, const int8_t* input_data,
                 int8_t* output_data) {
  // Integer bits must be in sync with Prepare() function.
  static constexpr int32_t kInputIntegerBits = 4;
  static constexpr int32_t kOutputScale = 7;
  static constexpr int32_t kMinInt8 = std::numeric_limits<int8_t>::min();
  static constexpr int32_t kMaxInt8 = std::numeric_limits<int8_t>::max();
  using F4 = gemmlowp::FixedPoint<int32_t, kInputIntegerBits>;

  for (int i = 0; i < input_size; ++i) {
    const int32_t input =
        static_cast<int32_t>(input_data[i]) - input_zero_point;
    if (input <= -input_range_radius) {
      output_data[i] = kMinInt8;
    } else if (input >= input_range_radius) {
      output_data[i] = kMaxInt8;
    } else {
      const int32_t input_in_q4 =
          MultiplyByQuantizedMultiplier(input, input_multiplier, input_shift);
      const int32_t output_in_q0 =
          gemmlowp::tanh(F4::FromRaw(input_in_q4)).raw();

      // Rescale and downcast.
      using gemmlowp::RoundingDivideByPOT;
      int32_t output_in_q24 =
          RoundingDivideByPOT(output_in_q0, 31 - kOutputScale);
      output_in_q24 = std::min(std::max(output_in_q24, kMinInt8), kMaxInt8);
      output_data[i] = static_cast<int8_t>(output_in_q24);
    }
  }
}

inline void Tanh(int32_t input_multiplier, int32_t input_left_shift,
                 int32_t input_size, const int16_t* ptr_input_data,
                 int16_t* ptr_output_data) {
  // We use the LUT for sigmoid and take into account, that
  // tanh(x) = 2*sigmoid(2*x) - 1

  int32_t input_data_mul = (input_multiplier > 0) ? input_multiplier : 1;

  for (int i = 0; i < input_size; ++i, ptr_input_data++, ptr_output_data++) {
    int32_t input_data = (*ptr_input_data) * input_data_mul;

    if (input_left_shift == 1) {
      input_data <<= 1;
    }

    // Scale by 3/4 to expand range [-8,8]->[-10.7,10.7].
    uint32_t abs_input_data = 3 * abs(input_data);
    uint32_t uh = abs_input_data >> 8;
    int32_t result;

    if (uh >= 255) {
      // Saturate to maximum.
      result = 0xFFFF << 8;
    } else {
      uint32_t ua = sigmoid_table_uint16[uh];
      uint32_t ub = sigmoid_table_uint16[uh + 1];

      uint8_t ut = abs_input_data & 0xFF;

      result = (ua << 8) + ut * (ub - ua);
    }

    result = (input_data >= 0)
                 ? (result - (1 << (14 + 9)) + (1 << (9 - 2)))
                 : (-result + (1 << (14 + 9)) + (1 << (9 - 2)) - 1);

    // Convert back to 16-bit.
    result >>= (9 - 1);

    *ptr_output_data = result;
  }
}

}  // namespace reference_integer_ops
}  // namespace tflite

#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TANH_H_


text:
<?php namespace CompareAsiaGroup\LaravelWpApi\Facades;

use Illuminate\Support\Facades\Config;
use CompareAsiaGroup\LaravelWpApi\Models\ArticleCollection;
use CompareAsiaGroup\GuzzleCache\Facades\GuzzleCache;

class WpApi
{

    protected $client;

    public function __construct($endpoint, $options = [])
    {
        $this->options = array_merge([
            'auth' => Config::get('wp-api.auth', false),
            'posts_per_page' => Config::get('wp-api.posts_per_page', 10),
            'debug' => Config::get('wp-api.debug', false)
        ], $options);

        $this->endpoint = $endpoint;
        $this->client   = GuzzleCache::client();
    }

    public function posts($page = null, $options = [])
    {
        $options['page'] = $page;
        $opts = $this->extendDefaults($options);

        return $this->_resultsCollection($this->_get(
            'posts',
            $opts
        ));
    }

    public function pages($page = null, $options = [])
    {
        $options['type'] = 'page';
        $options['page'] = $page;
        $opts = $this->extendDefaults($options);

        return $this->_resultsCollection($this->_get(
            'posts',
            $opts
        ));
    }

    public function post($slug)
    {
        return $this->_get('posts', ['filter' => ['name' => $slug]]);
    }

    public function page($slug)
    {
        return $this->_get('posts', ['type' => 'page', 'filter' => ['name' => $slug]]);
    }

    public function categories($options=[])
    {
        $segment = (isset($options['segment'])) ? $options['segment'] : 'category';
        return $this->_resultsCollection($this->_get('taxonomies/' . $segment . '/terms'));
    }

    public function tags($options=[])
    {
        $segment = (isset($options['segment'])) ? $options['segment'] : 'post_tag';
        return $this->_resultsCollection($this->_get('taxonomies/' . $segment . '/terms'));
    }

    public function category_posts($slug, $page = null, $options = [])
    {
        $options['page'] = $page;
        $options['filter']['category_name'] = $slug;
        $opts = $this->extendDefaults($options);

        return $this->_resultsCollection($this->_get(
            'posts',
            $opts
        ));
    }

    public function author_posts($name, $page = null, $options = [])
    {
        $options['page'] = $page;
        $options['filter']['author_name'] = $name;
        $opts = $this->extendDefaults($options);

        return $this->_resultsCollection($this->_get(
            'posts',
            $opts
        ));
    }

    public function tag_posts($tags, $page = null, $options = [])
    {
        $options['page'] = $page;
        $options['filter']['tag'] = $tags;
        $opts = $this->extendDefaults($options);

        return $this->_resultsCollection($this->_get(
            'posts',
            $opts
        ));
    }

    public function search($query, $page = null, $options = [])
    {
        $options['page'] = $page;
        $options['filter']['s'] = $query;
        $opts = $this->extendDefaults($options);

        return $this->_resultsCollection($this->_get(
            'posts',
            $opts
        ));
    }

    public function archive($year, $month, $page = null, $options = [])
    {
        $options['page'] = $page;
        $options['filter']['year'] = $year;
        $options['filter']['monthnum'] = $month;
        $opts = $this->extendDefaults($options);

        return $this->_resultsCollection($this->_get(
            'posts',
            $opts
        ));
    }

    public function _get($method, array $query = array())
    {
        try {

            $query = ['query' => $query];

            if($this->options['auth']) {
                $query['auth'] = $this->options['auth'];
            }

            $response = $this->client->get($this->endpoint . $method, $query);

            $return = [
                'results' => $response->json(),
                'total'   => $response->getHeader('X-WP-Total'),
                'pages'   => $response->getHeader('X-WP-TotalPages')
            ];

        } catch (\GuzzleHttp\Exception\TransferException $e) {

            $error['message'] = $e->getMessage();

            if ($e->getResponse()) {
                $error['code'] = $e->getResponse()->getStatusCode();
            }

            $return = [
                'error'   => $error,
                'results' => [],
                'total'   => 0,
                'pages'   => 0
            ];

        }

        return $return;

    }

    protected function _resultsCollection ($response)
    {
        if(count($response) > 0) {
            $response['results'] = new ArticleCollection($response['results']);
        }
        return $response;
    }

    /**
     * @param $options
     */
    protected function extendDefaults($options = [])
    {
        return array_merge([
            'filter' => [
                'posts_per_page' => $this->options['posts_per_page']
            ]
        ], $options);
    }

}


text:
import sys;print("Please run using the launcher");sys.exit()

def tokenize(reg,debug=False):
    '''Tokenizes reg'''
    tokens=[""]
    incharclass=False
    for i in reg: #tokenize input
        if debug:print("tokens",tokens[1:],incharclass)
        if incharclass: #character class
            if i=="]" and tokens[-1][-1]!="\\":
                incharclass=False
            else:
                tokens[-1]+=i
        elif i=="+": #repeat 1-inf
            tokens+=["+"]
        elif i=="[": #enter character class
            incharclass=True
            tokens+=["\\"]
        else: #character
            tokens+=["\\"+i]
    return tokens[1:]
def items(x,y):
    if len(y)<3:
        return x[y[0]:y[1]]
    else:
        return x[y[0]:y[1]:y[2]]
def match(reg,inp,dotokenize=True,debug=False):
    '''reg is the regex,
inp is what you want to match,
tokenize controls tokenizing (provide a tokenized regex as reg instead)
returns [start,end] of match'''
    if dotokenize:
        tokens=tokenize(reg)
    else:
        tokens=reg
    tkindex=0 #position in token list
    inindex=0 #position in input
    start=0 #start of match
    stack=[] #store backtracking points format=[inindex,tkindex]
    while tkindex<len(tokens): #stay in the regex
        if debug:print("stack",stack,start,"regex",tkindex,tokens[tkindex],"text",inindex,inp[inindex] if inindex<len(inp) else "out of text")
        if tokens[tkindex][0]=="\\": #character/char class
            if inindex==len(inp): #fell out of the text
                ##restart
                pass
            else: #still in the text
                if inp[inindex] in tokens[tkindex][1:]:
                    tkindex+=1
                    inindex+=1
                else:
                    ##restart
                    pass
        elif tokens[tkindex ]=="+":
            if tokens[tkindex-1]!=")": #no group behind (groups not implemented yet, so always the case)
                stack+=[[inindex,tkindex+1]]
                tkindex-=1
    return [start,inindex]
print(match("d+c+","abcddbddcc",True,True))
print(items("abcddbddcc",match("d+c+","abcddbddcc")))


text:
{% extends 'layout.html' %}
{% from '_macros.html' import render_event %}
{% from '_macros.html' import render_event_action %}
    {% block body %}

                {% if events|count > 0 %}

                        {% for event in events %}

                                            {{ render_event_action(event) }}

                                       {{ render_event(event) }}

                        {% endfor %}

                {% endif %}

                sidebar

    {% endblock body %}


text:
package com.puresoltechnologies.ductiledb.xo.test.relation.qualified;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import com.puresoltechnologies.ductiledb.xo.api.annotation.EdgeDefinition;

@EdgeDefinition("OneToMany")
@Retention(RetentionPolicy.RUNTIME)
public @interface QualifiedOneToMany {
}


text:
/*
 * discountingPricer prices an instrument based on a list of cashflows,
 * it uses additional constructs of cashflows element in order to compute
 * different types of duration and convexity
 * */
(function(){
    function discountingPricer(rateCurve){
        this.rateCurve = curve;
    };

    discountingPricer.prototype.price = function (bond, evaluationDate){
        var val = 0,
            i = 0,
            cashfows= bond.cashflows(),
            n = cashflows.length;
        for(;i<n;i++){
            // here, we want things to be very simple!
            // if i pass the date to the cashflow, it should return 0
            // if the cashflow won't be received at that date
            // if we call cashflow without passing a date, it just return the value without extrat check
                val+= cashflows[i].value(evaluationDate)*rateCurve.discountFactor(cashflows[i].date)
            }
        return val;
    };

    discountingPricer.prototype.riskAnalytics = function (bond){
    };

    discountingPricer.prototype.pricingAnalytics = function (bond){

        var simpleResults = this.price(bond);

        return {
            price : simpleResults.price,
            accruedInterest  : simpleResults.accruedInterest,
            duration : 0,
            macaulayDuration :9,
            modifiedDuration: 9,
            convexity: 9,
        };
    };

}());


text:
* [Release notes](about/release-notes.md)

* About

    * [License](about/license.md)

    * [Packages](about/packages.md)

* Benchmarks

    * [Version 3.1.2](benchmarks/version-3.1.2.md)

    * [Version 5.0.0](benchmarks/version-5.md)

* Breaking changes

    * [Version 5.0.0](breaking-changes/version-5.md)

## Tutorials

* [Getting started](tutorials/getting-started.md)

* Basic Features

    * [Queries](tutorials/basic-features/queries.md)

    * [Fail fast](tutorials/basic-features/fail-fast.md)

    * [Global settings](tutorials/basic-features/global-settings.md)

    * [Local parameter](tutorials/basic-features/local-parameter.md)

* Facets

    * [Facet field](tutorials/facets/field.md)

	* [Facet query](tutorials/facets/query.md)

	* [Facet range](tutorials/facets/range.md)

	* [Facet spatial](tutorials/facets/spatial.md)

	* [Nested facet](tutorials/facets/nested.md)

* Advanced Features

    * [Authentication and Authorization](tutorials/advanced-features/authentication-and-authorization.md)

	* [Dynamic field behaviour](tutorials/advanced-features/dynamic-field-behaviours.md)

	* [Result interceptors](tutorials/advanced-features/result-interceptors.md)


text:
ActionController::Base.session = {
  :key         => '_dinersclub_session',
  :secret      => 'c99953a41200463c09d8a65710bd6aa3e06951d70ca0b4d3996e8da6495bf2536d4b8cd552b69763477ee7c62dee30ccd89e4878989128d936412bae299b8288'
}

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
# ActionController::Base.session_store = :active_record_store


text:
using namespace std;

void append(char* toAppend, char symbol)
{
	size_t length = strlen(toAppend);
	toAppend[length++] = symbol;
	toAppend[length] = '\0';
}

//Приемаме, че translation е достатъчно голям, за да побере превода
void translate(Dictionary const& dictionary, char const* sentence, char* translation)
{
	int sentenceIndex = 0, currentWordIndex = 0;

	//Пазим си текущата дума в currentWord
	//Заделяме си толкова памет, колкото е голямо изречението, в случай че
	//то се състои от една дума
	char* currentWord = new char[strlen(sentence) + 1];

	//"Нулираме" translation, тъй като е възможно потребителят да не подаде празен низ
	strcpy(translation, "");

	while (sentence[sentenceIndex] != '\0')
	{
		//Ако текущият символ в изречението ни е буква, копираме го в текущата дума
		if (isalpha(sentence[sentenceIndex]))
			currentWord[currentWordIndex++] = sentence[sentenceIndex];
		else
		{
			//Ако текущата ни дума не е празният низ
			if (strlen(currentWord) > 0)
			{
				//Не забравяме затапващия символ накрая
				currentWord[currentWordIndex] = '\0';
				//Както и да нулираме индекса за следващата дума
				currentWordIndex = 0;

				//Ако думата я има в речника, копираме превода ѝ
				if (dictionary.withinDict(currentWord) != -1)
					strcat(translation, dictionary.getTranslation(currentWord));
				//Иначе копираме текущата дума
				else
					strcat(translation, currentWord);

				//"Нулираме" текущата ни дума
				strcpy(currentWord, "");
			}

			// Проблеми със strcat? Нищо, пишем си наша функция :)
			append(translation, sentence[sentenceIndex]);
		}

		sentenceIndex++;
	}

	delete[] currentWord;
}

int main()
{
	Dictionary d;

	d.addWord("Robert", "Downey");
	d.addWord("Alfred", "Nobel");
	d.addWord("Johnny", "Bravo");
	d.print();

	cout << endl;
	d.deleteWord("Alfred");
	d.print();
	cout << endl;

	char tr[100];
	translate(d, "Robert and Johnny went to a party.", tr);
	cout << tr;
}


text:
'use babel'

import { select, take } from 'redux-saga/effects'

function notfifyIfNeeded({ currentUser, sender, message }) {
  message.text.split(/(<.*?>)/g).forEach((word) => {
    if (word.indexOf('<!') === 0) {
      const [id, name] = word.split(/<(.*)>/)[1].replace(/^!/, '').split('|')
      atom.notifications.addInfo(
        `User @${sender.username}: send #${name || id} message`,
        {
          description: message.text,
        }
      )
    }

    if (word.indexOf('<@') === 0) {
      const id = word.split(/<(.*)>/)[1].replace(/^@/, '').split('|')[0]
      if (id === currentUser.id) {
        atom.notifications.addInfo(
          `User @${sender.username}: mention you.`,
          {
            description: message.text,
          }
        )
      }
    }
  })
}

export default function* notifyOnMessage() {
  while (true) {
    const action = yield take('reciveMessage')

    const message = action.payload
    const currentUser = yield select(state => state.users[state.currentTeam.id][state.currentTeam.userId])
    const sender = yield select(state => state.users[state.currentTeam.id][message.senderId])
    const channel = yield select(state => state.channels[state.currentTeam.id][message.channelId])
    const currentOpenChannel = yield select(state => state.activeChannels[state.currentTeam.id])

    if (message.senderId === currentUser.id) {
      return
    }

    notfifyIfNeeded({ currentUser, sender, message, channel, currentOpenChannel })
  }
}


text: Copyrightⓒ roundtable All Rights Reserved.


text:
(function () {
    'use strict';
    angular.module('common')
        .directive('svLinkBack', function (userAuth, $state) {
            return {
                replace: true,
                templateUrl: 'scripts/common/directives/sv-link-back.html',
                scope: {
                    url: '@',
                    method: '&',
                    params: '=',
                    lTitle: '@'
                },
                link: function ($scope, el, attrs) {
                    $scope.navigate = function () {
                        if ($scope.params) {
                            var authorKey = $scope.params.uid;
                            if (authorKey === userAuth.key) {
                                $scope.params.uid = userAuth.profile.userName;
                            }
                        }
                        $state.go($scope.url, $scope.params)
                    };
                }
            };
        });
})();


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Web;

namespace eBank.Models
{
    public class Store
    {
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.None)]
        public virtual int StoreID { get; set; }

        public virtual string StoreName { get; set; }

        public virtual int EnergyCost { get; set; }

        [DisplayFormat(DataFormatString = "{0:c}")]
        [Column(TypeName = "money")]
        public virtual decimal TravelCost { get; set; }

        public virtual ICollection<StoreItem> StoreItems { get; set; }
    }
}


text:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:g="http://www.backbase.com/2008/gadget">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <title><%= widget_title %></title>

    <link rel="stylesheet" type='text/css' href="styles/base.css"/>
    <script type="text/javascript" src="scripts/main.js"></script>
</head>

<body class="<%= widget_name %>" g:onload="window['<%= widget_name %>'](__WIDGET__)">

</body>
</html>


text:
package com.haulmont.cuba.core;

import com.haulmont.cuba.core.entity.BaseEntityInternalAccess;
import com.haulmont.cuba.security.entity.Group;
import com.haulmont.cuba.security.entity.User;
import com.haulmont.cuba.testsupport.TestContainer;
import com.haulmont.cuba.testsupport.TestSupport;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.Test;

import java.util.UUID;

import static com.haulmont.cuba.testsupport.TestSupport.reserialize;
import static org.junit.jupiter.api.Assertions.*;

public class EntityStateTest {

    @RegisterExtension
    public static TestContainer cont = TestContainer.Common.INSTANCE;

    private UUID userId;

    @AfterEach
    public void tearDown() throws Exception {
        if (userId != null)
            cont.deleteRecord("SEC_USER", userId);
    }

    @Test
    public void testTransactions() throws Exception {
        User user;
        Group group;

        // create and persist

        Transaction tx = cont.persistence().createTransaction();
        try {
            EntityManager em = cont.persistence().getEntityManager();

            user = new User();
            assertTrue(BaseEntityInternalAccess.isNew(user));
            assertFalse(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            userId = user.getId();
            user.setName("testUser");
            user.setLogin("testLogin");
            user.setGroup(em.find(Group.class, UUID.fromString("0fa2b1a5-1d68-4d69-9fbd-dff348347f93")));
            em.persist(user);

            assertTrue(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            tx.commit();
        } finally {
            tx.end();
        }

        assertFalse(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertTrue(BaseEntityInternalAccess.isDetached(user));

        // load from DB

        tx = cont.persistence().createTransaction();
        try {
            EntityManager em = cont.persistence().getEntityManager();
            // find
            user = em.find(User.class, userId);
            assertNotNull(user);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            group = user.getGroup();
            assertNotNull(group);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            tx.commit();
        } finally {
            tx.end();
        }

        tx = cont.persistence().createTransaction();
        try {
            EntityManager em = cont.persistence().getEntityManager();
            // query
            Query query = em.createQuery("select u from sec$User u where u.id = ?1").setParameter(1, userId);
            user = (User) query.getFirstResult();
            assertNotNull(user);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            group = user.getGroup();
            assertNotNull(group);

            assertFalse(BaseEntityInternalAccess.isNew(group));
            assertTrue(BaseEntityInternalAccess.isManaged(group));
            assertFalse(BaseEntityInternalAccess.isDetached(group));

            tx.commit();
        } finally {
            tx.end();
        }

        assertFalse(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertTrue(BaseEntityInternalAccess.isDetached(user));

        assertFalse(BaseEntityInternalAccess.isNew(group));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertTrue(BaseEntityInternalAccess.isDetached(user));

        user.setName("changed name");

        // merge changed

        tx = cont.persistence().createTransaction();
        try {
            EntityManager em = cont.persistence().getEntityManager();
            user = em.merge(user);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            tx.commit();
        } finally {
            tx.end();
        }

        assertFalse(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertTrue(BaseEntityInternalAccess.isDetached(user));
    }

    @Test
    public void testSerialization() throws Exception {
        User user;
        Group group;

        // serialize new

        user = new User();
        assertTrue(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertFalse(BaseEntityInternalAccess.isDetached(user));

        user = reserialize(user);

        assertTrue(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertFalse(BaseEntityInternalAccess.isDetached(user));

        // serialize managed

        Transaction tx = cont.persistence().createTransaction();
        try {
            EntityManager em = cont.persistence().getEntityManager();

            user = new User();
            userId = user.getId();
            user.setName("testUser");
            user.setLogin("testLogin");
            user.setGroup(em.find(Group.class, UUID.fromString("0fa2b1a5-1d68-4d69-9fbd-dff348347f93")));
            em.persist(user);

            tx.commit();
        } finally {
            tx.end();
        }

        tx = cont.persistence().createTransaction();
        try {
            EntityManager em = cont.persistence().getEntityManager();
            user = em.find(User.class, userId);
            assertNotNull(user);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            group = user.getGroup();
            assertNotNull(group);

            assertFalse(BaseEntityInternalAccess.isNew(group));
            assertTrue(BaseEntityInternalAccess.isManaged(group));
            assertFalse(BaseEntityInternalAccess.isDetached(group));

            user = reserialize(user);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertFalse(BaseEntityInternalAccess.isManaged(user));
            assertTrue(BaseEntityInternalAccess.isDetached(user));

            tx.commit();
        } finally {
            tx.end();
        }

        user.setName("changed name");

        // merge changed and serialize

        tx = cont.persistence().createTransaction();
        try {
            EntityManager em = cont.persistence().getEntityManager();
            user = em.merge(user);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            tx.commit();
        } finally {
            tx.end();
        }

        assertFalse(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertTrue(BaseEntityInternalAccess.isDetached(user));

        user = reserialize(user);

        assertFalse(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertTrue(BaseEntityInternalAccess.isDetached(user));
    }

    @Test
    public void testTransactionRollback_new() throws Exception {
        User user = null;

        // create and persist

        Transaction tx = cont.persistence().createTransaction();
        try {
            user = new User();
            assertTrue(BaseEntityInternalAccess.isNew(user));
            assertFalse(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            userId = user.getId();

            cont.persistence().getEntityManager().persist(user);

            assertTrue(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));

            tx.commit();

            fail(); // due to absence login
        } catch (Exception e) {
            // ok
        } finally {
            tx.end();
        }

        assertTrue(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertFalse(BaseEntityInternalAccess.isDetached(user));
    }

    @Test
    public void testTransactionRollback_loaded() {
        User user;

        Transaction tx = cont.persistence().createTransaction();
        try {
            user = cont.persistence().getEntityManager().find(User.class, TestSupport.ADMIN_USER_ID);

            assertFalse(BaseEntityInternalAccess.isNew(user));
            assertTrue(BaseEntityInternalAccess.isManaged(user));
            assertFalse(BaseEntityInternalAccess.isDetached(user));
        } finally {
            tx.end();
        }

        assertFalse(BaseEntityInternalAccess.isNew(user));
        assertFalse(BaseEntityInternalAccess.isManaged(user));
        assertTrue(BaseEntityInternalAccess.isDetached(user));
    }
}


text:
from __future__ import absolute_import, division, print_function
__metaclass__ = type

ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = '''
---
module: portinstall
short_description: Installing packages from FreeBSD's ports system
description:
    - Manage packages for FreeBSD using 'portinstall'.
version_added: "1.3"
options:
    name:
        description:
            - name of package to install/remove
        required: true
    state:
        description:
            - state of the package
        choices: [ 'present', 'absent' ]
        required: false
        default: present
    use_packages:
        description:
            - use packages instead of ports whenever available
        type: bool
        required: false
        default: yes
author: "berenddeboer (@berenddeboer)"
'''

EXAMPLES = '''
# Install package foo
- portinstall:
    name: foo
    state: present

# Install package security/cyrus-sasl2-saslauthd
- portinstall:
    name: security/cyrus-sasl2-saslauthd
    state: present

# Remove packages foo and bar
- portinstall:
    name: foo,bar
    state: absent
'''

import os
import re
import sys

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six.moves import shlex_quote

def query_package(module, name):

    pkg_info_path = module.get_bin_path('pkg_info', False)

    # Assume that if we have pkg_info, we haven't upgraded to pkgng
    if pkg_info_path:
        pkgng = False
        pkg_glob_path = module.get_bin_path('pkg_glob', True)
        rc, out, err = module.run_command("%s -e `pkg_glob %s`" % (pkg_info_path, shlex_quote(name)), use_unsafe_shell=True)
    else:
        pkgng = True
        pkg_info_path = module.get_bin_path('pkg', True)
        pkg_info_path = pkg_info_path + " info"
        rc, out, err = module.run_command("%s %s" % (pkg_info_path, name))

    found = rc == 0

    if not found:
        # databases/mysql55-client installs as mysql-client, so try solving
        # that the ugly way. Pity FreeBSD doesn't have a fool proof way of checking
        # some package is installed
        name_without_digits = re.sub('[0-9]', '', name)
        if name != name_without_digits:
            if pkgng:
                rc, out, err = module.run_command("%s %s" % (pkg_info_path, name_without_digits))
            else:
                rc, out, err = module.run_command("%s %s" % (pkg_info_path, name_without_digits))

        found = rc == 0

    return found

def matching_packages(module, name):

    ports_glob_path = module.get_bin_path('ports_glob', True)
    rc, out, err = module.run_command("%s %s" % (ports_glob_path, name))
    # counts the number of packages found
    occurrences = out.count('\n')
    if occurrences == 0:
        name_without_digits = re.sub('[0-9]', '', name)
        if name != name_without_digits:
            rc, out, err = module.run_command("%s %s" % (ports_glob_path, name_without_digits))
            occurrences = out.count('\n')
    return occurrences

def remove_packages(module, packages):

    remove_c = 0
    pkg_glob_path = module.get_bin_path('pkg_glob', True)

    # If pkg_delete not found, we assume pkgng
    pkg_delete_path = module.get_bin_path('pkg_delete', False)
    if not pkg_delete_path:
        pkg_delete_path = module.get_bin_path('pkg', True)
        pkg_delete_path = pkg_delete_path + " delete -y"

    # Using a for loop in case of error, we can report the package that failed
    for package in packages:
        # Query the package first, to see if we even need to remove
        if not query_package(module, package):
            continue

        rc, out, err = module.run_command("%s `%s %s`" % (pkg_delete_path, pkg_glob_path, shlex_quote(package)), use_unsafe_shell=True)

        if query_package(module, package):
            name_without_digits = re.sub('[0-9]', '', package)
            rc, out, err = module.run_command("%s `%s %s`" % (pkg_delete_path, pkg_glob_path,
                                                              shlex_quote(name_without_digits)),
                                              use_unsafe_shell=True)
            if query_package(module, package):
                module.fail_json(msg="failed to remove %s: %s" % (package, out))

        remove_c += 1

    if remove_c > 0:

        module.exit_json(changed=True, msg="removed %s package(s)" % remove_c)

    module.exit_json(changed=False, msg="package(s) already absent")

def install_packages(module, packages, use_packages):

    install_c = 0

    # If portinstall not found, automagically install
    portinstall_path = module.get_bin_path('portinstall', False)
    if not portinstall_path:
        pkg_path = module.get_bin_path('pkg', False)
        if pkg_path:
            module.run_command("pkg install -y portupgrade")
        portinstall_path = module.get_bin_path('portinstall', True)

    if use_packages:
        portinstall_params = "--use-packages"
    else:
        portinstall_params = ""

    for package in packages:
        if query_package(module, package):
            continue

        # TODO: check how many match
        matches = matching_packages(module, package)
        if matches == 1:
            rc, out, err = module.run_command("%s --batch %s %s" % (portinstall_path, portinstall_params, package))
            if not query_package(module, package):
                module.fail_json(msg="failed to install %s: %s" % (package, out))
        elif matches == 0:
            module.fail_json(msg="no matches for package %s" % (package))
        else:
            module.fail_json(msg="%s matches found for package name %s" % (matches, package))

        install_c += 1

    if install_c > 0:
        module.exit_json(changed=True, msg="present %s package(s)" % (install_c))

    module.exit_json(changed=False, msg="package(s) already present")

def main():
    module = AnsibleModule(
        argument_spec=dict(
            state=dict(default="present", choices=["present", "absent"]),
            name=dict(aliases=["pkg"], required=True),
            use_packages=dict(type='bool', default='yes')))

    p = module.params

    pkgs = p["name"].split(",")

    if p["state"] == "present":
        install_packages(module, pkgs, p["use_packages"])

    elif p["state"] == "absent":
        remove_packages(module, pkgs)

if __name__ == '__main__':
    main()


text:
HTTP request/responce parser for Erlang

## Inspiration

The library implements a simple HTTP stream parser, is designed to handle up/down stream of HTTP protocol. The library is provide a minimal overhead, which make is suitable for high throughtput applcations. The library targets to minimize its external dependencies.

## Changelog

* 1.0.x - release a unified HTTP request/response parsing with symmetic state machine. Both HTTP request/response follows a same parsing logic.
* 0.12.x - improve http parsing using symmetic state machine.
* 0.11.x - initial production quality release candidate


text:
module Sad
	module Worker
		def queue_name
			name = if self.respond_to?(:queue)
				self.send :queue
			else
				nil
			end
			Sad::Config.queue(name)
		end

		def enqueue(*args)
			payload = ::Sad::Payload.new(self.to_s, args)
			payload.sad_args['queue'] = queue_name
			payload.redis = self.redis if self.respond_to?(:redis)
			payload.enqueue do |value|
				yield value if block_given?
			end
		end
	end
end


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Strategy.Xdb.Ingest.DataReaders;
using Sitecore.Data.Managers;
using Sitecore.Strategy.Xdb.Ingest.Items.DataReaders;

namespace Sitecore.Strategy.Xdb.Ingest.Demandbase.Items
{
    public class DemandbaseDataReaderItem : JsonDataReaderItem
    {
        public DemandbaseDataReaderItem(Item innerItem) : base(innerItem)
        {
        }

        public static implicit operator DemandbaseDataReaderItem(Item item)
        {
            if (item == null) { return null; }
            var template = TemplateManager.GetTemplate(item.TemplateID, item.Database);
            if (!template.InheritsFrom(DemandbaseTemplateIDs.DemandbaseDataReader)) { return null; }
            return new DemandbaseDataReaderItem(item);
        }

        public string ApiKey
        {
            get
            {
                return base[DemandbaseFieldIDs.ApiKey];
            }
        }

        public NameValueCollection IPAddressMappings
        {
            get
            {
                NameValueListField field = this.InnerItem.Fields[DemandbaseFieldIDs.IPAddressMappings];
                if (field == null)
                {
                    return null;
                }
                return field.NameValues;
            }
        }
        public override IDataReader GetDataReader()
        {
            var type = this.DataReaderType;
            if (type == null)
            {
                Log.SingleError(string.Format("Could not determine the data reader type for the item {0}", this.InnerItem.ID.ToString()), this);
                return null;
            }
            var reader = Activator.CreateInstance(type) as JsonDataReader;
            if (reader == null)
            {
                Log.SingleError(string.Format("The type {0} is not a {1}", type.FullName, typeof(JsonDataReader).FullName), this);
                return null;
            }
            reader.Endpoint = this.Endpoint;
            reader.Parameters["key"] = this.ApiKey;
            var ipAddress = HttpContext.Current.Request.UserHostAddress;
            var mappings = this.IPAddressMappings;
            if (mappings != null)
            {
                var overrideAddress = mappings[ipAddress.Replace('.', '_')];
                if (! string.IsNullOrEmpty(overrideAddress))
                {
                    Log.Info(string.Format("Will pass the IP address {0} instead of {1} to Demandbase", overrideAddress, ipAddress), this);
                    ipAddress = overrideAddress;
                }
            }
            reader.Parameters["query"] = ipAddress;
            Log.Debug(string.Format("The IP address {0} will be passed to Demandbase", ipAddress), this);
            return reader;
        }
    }
}


text:
package com.project.learnrealmdb.daos;

import android.content.Context;

import com.project.learnrealmdb.models.Contact;
import com.project.learnrealmdb.utils.HelperRealmDB;

import io.realm.Realm;

/**
 * Created by r028367 on 11/04/2017.
 */

public class ContactDao {
    private Context context;
    private Realm realm;

    public ContactDao(Context context) {
        this.context = context;
        this.realm = HelperRealmDB.getInstance(context);
    }

    public Context getContext() {
        return context;
    }

    public void insert(final Contact contact) {
        realm.executeTransaction(new Realm.Transaction() {
            @Override
            public void execute(Realm realm) {
                realm.beginTransaction();
                Contact c   = realm.createObject(Contact.class);
                int id      = HelperRealmDB.lastId(contact, getContext());
                c.setId(id);
                c.setName(contact.getName());
                c.setCategory(contact.getCategory());
                c.setEmail(contact.getEmail());
                realm.commitTransaction();
            }
        });
    }
}


text:
'''
Used to generate variable data such as random strings and ids
'''
# Import python libs
import os
import time
import random
import struct
import binascii
import datetime

# create a standard epoch so all platforms will count ids from
# a standard epoch of jan 1 2014
STD_EPOCH = time.mktime(datetime.datetime(2014, 1, 1).timetuple()) * 1000000

def rand_hex_str(size):
    '''
    Return a random string of the passed size using hex encoding
    '''
    return binascii.hexlify(os.urandom(size/2))

def rand_raw_str(size):
    '''
    Return a raw byte string of the given size
    '''
    return os.urandom(size)

def gen_id():
    '''
    Return a revision based on timestamp
    '''
    r_time = time.time() * 1000000 - STD_EPOCH
    return struct.pack('>HQ', random.randint(0, 65535), r_time).encode('hex')

def rand_dict():
    '''
    Populate a dict with random data, types etc for testing
    '''
    deep = random.randint(0, 100)
    ret = {}
    top = ret
    for ind in range(deep):
        key = rand_hex_str(random.randint(0, 50))
        top[key] = {}
        top = top[key]
    return ret


text:
//
// ===============================================================================
// clReflect, Database.h - Offline representation of the entire Reflection
// Database, built during scanning, merged and then exported to whatever format.
// -------------------------------------------------------------------------------
// Copyright (c) 2011-2012 Don Williamson & clReflect Authors (see AUTHORS file)
// Released under MIT License (see LICENSE file)
// ===============================================================================
//

#pragma once

#include <string>
#include <vector>
#include <map>
#include <cassert>
#include <clcpp/clcpp.h>

namespace cldb
{
	//
	// Some handy types
	//
	typedef unsigned char		u8;
	typedef unsigned short		u16;
	typedef unsigned int		u32;

	//
	// Calculate the unique ID for binding a function to its parameters
	//
	struct Field;
	u32 CalculateFunctionUniqueID(const std::vector<Field>& parameters);

	//
	// A descriptive text name with a unique 32-bit hash value for mapping primitives.
	//
	// Note this new representation requires string copying whenever the name is
	// copied.
	//
	struct Name
	{
		// No-name default constructor
		Name() : hash(0) { }

		// Initialise with hash and string representation
		Name(u32 h, const std::string& t) : hash(h), text(t) { }

		// Fast name comparisons using the hash, assuming there are no collisions
		bool operator == (const Name& rhs) const
		{
			return hash == rhs.hash;
		}
		bool operator != (const Name& rhs) const
		{
			return hash != rhs.hash;
		}

		u32 hash;
		std::string text;
	};
	typedef std::map<u32, Name> NameMap;

	//
	// Rather than create a new Type for "X" vs "const X", bloating the database,
	// this stores the qualifier separately. Additionally, the concept of whether
	// a type is a pointer, reference or not is folded in here as well.
	//
	struct Qualifier
	{
		enum Operator
		{
			VALUE,
			POINTER,
			REFERENCE
		};

		Qualifier()
			: op(VALUE)
			, is_const(false)
		{
		}
		Qualifier(Operator op, bool is_const)
			: op(op)
			, is_const(is_const)
		{
		}

		bool operator == (const Qualifier& rhs) const
		{
			return op == rhs.op && is_const == rhs.is_const;
		}

		Operator op;
		bool is_const;
	};

	//
	// Base class for all types of C++ primitives that are reflected
	//
	struct Primitive
	{
		enum Kind
		{
			KIND_ATTRIBUTE,
			KIND_FLAG_ATTRIBUTE,
			KIND_INT_ATTRIBUTE,
			KIND_FLOAT_ATTRIBUTE,
			KIND_PRIMITIVE_ATTRIBUTE,
			KIND_TEXT_ATTRIBUTE,
			KIND_TYPE,
			KIND_ENUM_CONSTANT,
			KIND_ENUM,
			KIND_FIELD,
			KIND_FUNCTION,
			KIND_TEMPLATE_TYPE,
			KIND_TEMPLATE,
			KIND_CLASS,
			KIND_NAMESPACE,
		};

		// Constructors for default construction and complete construction
		Primitive(Kind k)
			: kind(k)
		{
		}
		Primitive(Kind k, Name n, Name p)
			: kind(k)
			, name(n)
			, parent(p)
		{
		}

		// Implemented with no operator overloading because chaining them is a pain
		bool Equals(const Primitive& rhs) const
		{
			return
				kind == rhs.kind &&
				name == rhs.name &&
				parent == rhs.parent;
		}

		Kind kind;
		Name name;

		// Parent scope primitive
		Name parent;
	};

	//
	// Base attribute type for collecting different attribute types together
	//
	struct Attribute : public Primitive
	{
		// Constructors for for derived types to call
		Attribute(Kind k)
			: Primitive(k)
		{
		}
		Attribute(Kind k, Name n, Name p)
			: Primitive(k, n, p)
		{
		}
		virtual ~Attribute()
		{
		}
	};

	//
	// Representations of the different types of attribute available. Each attribute has a single
	// value with constructors for default construction and complete construction. Some have
	// non-trivial destructors so all need to be deleted as their own type and not the based type
	// due to the absence of a virtual destructor.
	//
	struct FlagAttribute : public Attribute
	{
		FlagAttribute() : Attribute(Primitive::KIND_FLAG_ATTRIBUTE) { }
		FlagAttribute(Name n, Name p) : Attribute(Primitive::KIND_FLAG_ATTRIBUTE, n, p) { }
		virtual ~FlagAttribute() { }
	};
	struct IntAttribute : public Attribute
	{
		IntAttribute() : Attribute(Primitive::KIND_INT_ATTRIBUTE) { }
		IntAttribute(Name n, Name p, int v) : Attribute(Primitive::KIND_INT_ATTRIBUTE, n, p), value(v) { }
		virtual ~IntAttribute() { }
		bool Equals(const IntAttribute& rhs) const
		{
			return Primitive::Equals(rhs) && value == rhs.value;
		}
		int value;
	};
	struct FloatAttribute : public Attribute
	{
		FloatAttribute() : Attribute(Primitive::KIND_FLOAT_ATTRIBUTE) { }
		FloatAttribute(Name n, Name p, float v) : Attribute(Primitive::KIND_FLOAT_ATTRIBUTE, n, p), value(v) { }
		virtual ~FloatAttribute() { }
		bool Equals(const FloatAttribute& rhs) const
		{
			return Primitive::Equals(rhs) && value == rhs.value;
		}
		float value;
	};
	struct PrimitiveAttribute : public Attribute
	{
		PrimitiveAttribute() : Attribute(Primitive::KIND_PRIMITIVE_ATTRIBUTE) { }
		PrimitiveAttribute(Name n, Name p, Name v) : Attribute(Primitive::KIND_PRIMITIVE_ATTRIBUTE, n, p), value(v) { }
		virtual ~PrimitiveAttribute() { }
		bool Equals(const PrimitiveAttribute& rhs) const
		{
			return Primitive::Equals(rhs) && value == rhs.value;
		}
		Name value;
	};
	struct TextAttribute : public Attribute
	{
		TextAttribute() : Attribute(Primitive::KIND_TEXT_ATTRIBUTE) { }
		TextAttribute(Name n, Name p, const char* v) : Attribute(Primitive::KIND_TEXT_ATTRIBUTE, n, p), value(v) { }
		virtual ~TextAttribute() { }
		bool Equals(const TextAttribute& rhs) const
		{
			return Primitive::Equals(rhs) && value == rhs.value;
		}
		std::string value;
	};

	//
	// A basic built-in type that classes/structs can also inherit from
	//
	struct Type : public Primitive
	{
		// Constructors for default construction and complete construction, with variants for derived types to call
		Type()
			: Primitive(Primitive::KIND_TYPE)
			, size(0)
		{
		}
        Type(Name n, Name p, clcpp::size_type s)
			: Primitive(Primitive::KIND_TYPE, n, p)
			, size(s)
		{
		}
		Type(Kind k)
			: Primitive(k)
			, size(0)
		{
		}
		Type(Kind k, Name n, Name p, u32 s) : Primitive(k, n, p), size(s) { }

		bool Equals(const Type& rhs) const
		{
			return Primitive::Equals(rhs) && size == rhs.size;
		}

		// Total size of the type, including alignment
        clcpp::size_type size;

	};

	//
	// A name/value pair for enumeration constants
	//
	struct EnumConstant : public Primitive
	{
		// Constructors for default construction and complete construction
		EnumConstant()
			: Primitive(Primitive::KIND_ENUM_CONSTANT)
		{
		}
		EnumConstant(Name n, Name p, int v)
			: Primitive(Primitive::KIND_ENUM_CONSTANT, n, p)
			, value(v)
		{
		}

		bool Equals(const EnumConstant& rhs) const
		{
			return Primitive::Equals(rhs) && value == rhs.value;
		}

		// Enumeration constants can have values that are signed/unsigned and of arbitrary width in clang.
		// The standard assures that they're of integral size and is quite vague.
		// For now I'm just assuming they're 32-bit signed.
		int value;
	};

	//
	// A typed enumeration of name/value constant pairs
	//
	struct Enum : public Type
	{
		// Constructors for default construction and complete construction
		Enum()
			: Type(Primitive::KIND_ENUM)
		{
		}
		Enum(Name n, Name p)
			: Type(Primitive::KIND_ENUM, n, p, sizeof(int))
		{
		}
	};

	//
	// Can be either a class/struct field or a function parameter
	//
	struct Field : public Primitive
	{
		// Constructors for default construction and complete construction
		Field()
			: Primitive(Primitive::KIND_FIELD)
			, offset(-1)
			, parent_unique_id(0)
		{
		}
		Field(Name n, Name p, Name t, Qualifier q, int o, u32 uid = 0)
			: Primitive(Primitive::KIND_FIELD, n, p)
			, type(t)
			, qualifier(q)
			, offset(o)
			, parent_unique_id(uid)
		{
		}

		bool Equals(const Field& rhs) const
		{
			return
				Primitive::Equals(rhs) &&
				type == rhs.type &&
				qualifier == rhs.qualifier &&
				offset == rhs.offset &&
				parent_unique_id == rhs.parent_unique_id;
		}

		bool IsFunctionParameter() const
		{
			return parent_unique_id != 0;
		}

		//  Type info
		Name type;
		Qualifier qualifier;

		// Index of the field parameter within its parent function or byte offset within its parent class
		int offset;

		// If this is set then the field is a function parameter
		u32 parent_unique_id;

		// TODO: bit fields
	};

	//
	// A function or class method with a list of parameters and a return value. When this is a method
	// within a class with calling convention __thiscall, the this parameter is explicitly specified
	// as the first parameter.
	//
	struct Function : public Primitive
	{
		// Constructors for default construction and complete construction
		Function()
			: Primitive(Primitive::KIND_FUNCTION)
			, unique_id(0)
			, address(0)
		{
		}
		Function(Name n, Name p, u32 uid)
			: Primitive(Primitive::KIND_FUNCTION, n, p)
			, unique_id(uid)
			, address(0)
		{
		}

		bool Equals(const Function& rhs) const
		{
			return Primitive::Equals(rhs) && unique_id == rhs.unique_id;
		}

		// An ID unique to this function among other functions that have the same name
		// This allows the function to be referenced accurately by any children
		// All return values are named "return" so a parameter reference won't work here
		u32 unique_id;

		// The address of the function is only used during C++ export at the moment and
		// is not serialised to disk or involved in merging. If at a later date this becomes
		// more tightly integrated to clang/llvm then this will need to be serialised.
        clcpp::pointer_type address;
	};

	//
	// Template types are instantiations of templates with fully specified parameters.
	// They don't specify the primitives contained within as these can vary between instantiation,
	// leading to prohibitive memory requirements.
	//
	struct TemplateType : public Type
	{
		// Enough for std::map
		static const int MAX_NB_ARGS = 4;

		TemplateType()
			: Type(KIND_TEMPLATE_TYPE)
		{
			for (int i = 0; i < MAX_NB_ARGS; i++)
				parameter_ptrs[i] = false;
		}
		TemplateType(Name n, Name p, u32 size)
			: Type(KIND_TEMPLATE_TYPE, n, p, size)
		{
			for (int i = 0; i < MAX_NB_ARGS; i++)
				parameter_ptrs[i] = false;
		}

		bool Equals(const TemplateType& rhs) const
		{
			if (!Primitive::Equals(rhs))
			{
				return false;
			}

			for (int i = 0; i < MAX_NB_ARGS; i++)
			{
				if (parameter_types[i] != rhs.parameter_types[i] ||
					parameter_ptrs[i] != rhs.parameter_ptrs[i])
					return false;
			}

			return true;
		}

		// Currently only support parameter types that are values or pointers. Template arguments
		// can be anything from integers to function pointers and I really haven't got the time to
		// implement any of this because it will see very limited -- if any -- use from me.
		Name parameter_types[MAX_NB_ARGS];
		bool parameter_ptrs[MAX_NB_ARGS];
	};

	//
	// A template is not a type but a record of a template declaration without specified parameters
	// that instantiations can reference.
	//
	struct Template : public Primitive
	{
		Template()
			: Primitive(Primitive::KIND_TEMPLATE)
		{
		}
		Template(Name n, Name p)
			: Primitive(Primitive::KIND_TEMPLATE, n, p)
		{
		}
	};

	//
	// Description of a C++ struct or class with containing fields, functions, classes, etc.
	//
	struct Class : public Type
	{
		static const u32 FORWARD_DECL_SIZE = 0xFFFFFFFF;

		// Constructors for default construction and complete construction
		Class()
			: Type(Primitive::KIND_CLASS)
			, is_class(false)
		{
		}
		Class(Name n, Name p, bool ic)
			: Type(Primitive::KIND_CLASS, n, p, FORWARD_DECL_SIZE)
			, is_class(ic)
		{
		}
		Class(Name n, Name p, u32 s, bool ic)
			: Type(Primitive::KIND_CLASS, n, p, s)
			, is_class(ic)
		{
		}

		bool Equals(const Class& rhs) const
		{
			return Type::Equals(rhs);
		}

		// True for class, false for struct
		bool is_class;
	};

	//
	// A C++ namespace containing collections of various other reflected C++ primitives
	//
	struct Namespace : public Primitive
	{
		// Constructors for default construction and complete construction
		Namespace()
			: Primitive(Primitive::KIND_NAMESPACE)
		{
		}
		Namespace(Name n, Name p)
			: Primitive(Primitive::KIND_NAMESPACE, n, p)
		{
		}
	};

	//
	// The default DBMap allow multiple primitives of the same type to be stored and
	// quickly looked up, allowing symbol overloading.
	//
	template <typename TYPE>
	struct DBMap : public std::multimap<u32, TYPE>
	{
#ifdef __GNUC__
        typedef typename std::multimap<u32, TYPE>::iterator iterator;
        typedef typename std::multimap<u32, TYPE>::const_iterator const_iterator;
#endif  // __GNUC__

        typedef std::pair<iterator, iterator> range;
		typedef std::pair<const_iterator, const_iterator> const_range;
	};

	//
	// Point to the runtime addresses of the GetType family of functions so that
	// the values that they return can be patched at runtime.
	//
	struct GetTypeFunctions
	{
		typedef std::map<u32, GetTypeFunctions> MapType;
		u32 get_typename_address;
		u32 get_type_address;
	};

	//
	// Description of a reflected container
	//
	struct ContainerInfo
	{
		enum
		{
			HAS_KEY = 1,
			IS_C_ARRAY = 2
		};

		ContainerInfo()
			: flags(0)
			, count(0)
		{
		}

		// Name of the parent type or field
		Name name;

		// Names of the iterator types responsible for reading and writing elements of the container
		Name read_iterator_type;
		Name write_iterator_type;

		u32 flags;

		// In the case of a C-Array, the number of elements in the array
		u32 count;
	};

	//
	// Description of a relationship inheritance between two types
	//
	struct TypeInheritance
	{
		TypeInheritance()
		{
		}

		Name name;
		Name derived_type;
		Name base_type;
	};

	//
	// These types are uniquely named with a DBMap specialisation to ensure that requirement
	//
	template <>
	struct DBMap<ContainerInfo> : public std::map<u32, ContainerInfo>
	{
	};
	template<>
	struct DBMap<TypeInheritance> : public std::map<u32, TypeInheritance>
	{
	};

	class Database
	{
	public:
		Database();

		void AddBaseTypePrimitives();

		void AddContainerInfo(const std::string& container, const std::string& read_iterator, const std::string& write_iterator, bool has_key);
		void AddTypeInheritance(const Name& derived_type, const Name& base_type);

		const Name& GetName(const char* text);
		const Name& GetName(u32 hash) const;

		template <typename TYPE> void Add(const Name& name, const TYPE& object)
		{
			assert(name != Name() && "Unnamed objects not supported");
			DBMap<TYPE>& store = GetDBMap<TYPE>();
			store.insert(typename DBMap<TYPE>::value_type(name.hash, object));
		}
		template <typename TYPE> void AddPrimitive(const TYPE& prim)
		{
			Add(prim.name, prim);
		}

		template <typename TYPE> TYPE* GetFirstPrimitive(const char* name_string)
		{
			// Get the store associated with this type
			DBMap<TYPE>& store = GetDBMap<TYPE>();

			// Return the first instance of an object with this name
			u32 name = clcpp::internal::HashNameString(name_string);
			typename DBMap<TYPE>::iterator i = store.find(name);
			if (i != store.end())
				return &i->second;

			return 0;
		}
		template <typename TYPE> const TYPE* GetFirstPrimitive(const char* name_string) const
		{
			// Get the store associated with this type
			const DBMap<TYPE>& store = GetDBMap<TYPE>();

			// Return the first instance of an object with this name
			u32 name = clcpp::internal::HashNameString(name_string);
			typename DBMap<TYPE>::const_iterator i = store.find(name);
			if (i != store.end())
				return &i->second;

			return 0;
		}

		template <typename TYPE> DBMap<TYPE>& GetDBMap();

		// Single pass-through const retrieval of the primitive stores. This strips the const-ness
		// of the 'this' pointer to remove the need to copy-paste the GetPrimitiveStore implementations
		// with const added.
		template <typename TYPE> const DBMap<TYPE>& GetDBMap() const
		{
			return const_cast<Database*>(this)->GetDBMap<TYPE>();
		}

		// All unique, scope-qualified names
		NameMap m_Names;

		// Primitives are owned by the following maps depending upon their type
		DBMap<Namespace> m_Namespaces;
		DBMap<Type> m_Types;
		DBMap<Template> m_Templates;
		DBMap<TemplateType> m_TemplateTypes;
		DBMap<Class> m_Classes;
		DBMap<Enum> m_Enums;
		DBMap<EnumConstant> m_EnumConstants;
		DBMap<Function> m_Functions;
		DBMap<Field> m_Fields;

		// Storage for all attributes of different types
		DBMap<FlagAttribute> m_FlagAttributes;
		DBMap<IntAttribute> m_IntAttributes;
		DBMap<FloatAttribute> m_FloatAttributes;
		DBMap<PrimitiveAttribute> m_PrimitiveAttributes;
		DBMap<TextAttribute> m_TextAttributes;

		// Store for non-primitives
		DBMap<ContainerInfo> m_ContainerInfos;
		DBMap<TypeInheritance> m_TypeInheritances;

		// All referenced GetType functions per type
		// This is currently not serialised or merged as it's generated during the export
		// stage and discarded after export
		GetTypeFunctions::MapType m_GetTypeFunctions;
	};

    // A compile-time map to runtime data stores for each primitive type
    // This is moved out of class to obey C++ standard, MSVC allows this extention,
    // but g++ does not.
    template <typename TYPE> inline DBMap<TYPE>& Database::GetDBMap() { }
    template <> inline DBMap<Namespace>& Database::GetDBMap() { return m_Namespaces; }
    template <> inline DBMap<Type>& Database::GetDBMap() { return m_Types; }
    template <> inline DBMap<Template>& Database::GetDBMap() { return m_Templates; }
    template <> inline DBMap<TemplateType>& Database::GetDBMap() { return m_TemplateTypes; }
    template <> inline DBMap<Class>& Database::GetDBMap() { return m_Classes; }
    template <> inline DBMap<Enum>& Database::GetDBMap() { return m_Enums; }
    template <> inline DBMap<EnumConstant>& Database::GetDBMap() { return m_EnumConstants; }
    template <> inline DBMap<Function>& Database::GetDBMap() { return m_Functions; }
    template <> inline DBMap<Field>& Database::GetDBMap() { return m_Fields; }

    // Attribute maps
    template <> inline DBMap<FlagAttribute>& Database::GetDBMap() { return m_FlagAttributes; }
    template <> inline DBMap<IntAttribute>& Database::GetDBMap() { return m_IntAttributes; }
    template <> inline DBMap<FloatAttribute>& Database::GetDBMap() { return m_FloatAttributes; }
    template <> inline DBMap<PrimitiveAttribute>& Database::GetDBMap() { return m_PrimitiveAttributes; }
    template <> inline DBMap<TextAttribute>& Database::GetDBMap() { return m_TextAttributes; }

    // Non-primitives
    template <> inline DBMap<ContainerInfo>& Database::GetDBMap() { return m_ContainerInfos; }
    template <> inline DBMap<TypeInheritance>& Database::GetDBMap() { return m_TypeInheritances; }
}


text:
var pickup = function(game, type) {

	this.class = type;

	if(type == 0){
		type_img = 'health';
	}else{
		type_img = 'live';
	}

	Phaser.Sprite.call(this, game, game.world.randomX, 50, type_img);
	game.pickups.add(this);

	this.events.onRevived.add(function(){this.y = 50;}, this);

	this.anchor.setTo(0.5, 0.5);
	game.physics.enable(this, Phaser.Physics.ARCADE);

	this.outOfBoundsKill = true;
	this.checkWorldBounds = true;

	this.body.velocity.setTo(0, 100);
};

pickup.prototype = Object.create(Phaser.Sprite.prototype);
pickup.prototype.constructor = pickup;

pickup.prototype.update = function(game) {

};

module.exports = pickup;


text:
#ifndef _ES3FSHADERPACKINGFUNCTIONTESTS_HPP
#define _ES3FSHADERPACKINGFUNCTIONTESTS_HPP
/*!
 * \file
 * \brief Floating-point packing and unpacking function tests.
 *//*--------------------------------------------------------------------*/

#include "tes3TestCase.hpp"

namespace deqp
{
namespace gles3
{
namespace Functional
{

class ShaderPackingFunctionTests : public TestCaseGroup
{
public:
									ShaderPackingFunctionTests		(Context& context);
	virtual							~ShaderPackingFunctionTests		(void);

	virtual void					init							(void);

private:
									ShaderPackingFunctionTests		(const ShaderPackingFunctionTests&);		// not allowed!
	ShaderPackingFunctionTests&		operator=						(const ShaderPackingFunctionTests&);		// not allowed!
};

} // Functional
} // gles3
} // deqp

#endif // _ES3FSHADERPACKINGFUNCTIONTESTS_HPP


text:
subroutine sub
    use constants, only : pi
    a(2:4) = pi
end subroutine


text:
disambiguation-ruby
===================

ruby implementation of disambiguation module


text:
package com.maxcriser.cards.reader;

import java.util.ArrayList;
import java.util.List;

public class PreviewColorReader {

    private static PreviewColorReader sPreviewColorReader;

    private List<String> previewColors;

    PreviewColorReader() {

    }

    public void setPreviewColors() {
        previewColors = new ArrayList<>();
        previewColors.add("#0b8c8f");
        previewColors.add("#E91E63");
        previewColors.add("#F44336");
        previewColors.add("#E91E63");
        previewColors.add("#9C27B0");
        previewColors.add("#673AB7");
        previewColors.add("#3F51B5");
        previewColors.add("#2196F3");
        previewColors.add("#03A9F4");
        previewColors.add("#00BCD4");
        previewColors.add("#00BCD4");
        previewColors.add("#4CAF50");
        previewColors.add("#8BC34A");
        previewColors.add("#CDDC39");
        previewColors.add("#FFEB3B");
        previewColors.add("#FFC107");
        previewColors.add("#FF9800");
        previewColors.add("#FF5722");
        previewColors.add("#795548");
        previewColors.add("#9E9E9E");
        previewColors.add("#607D8B");
    }

    public List<String> getPreviewColors() {
        return previewColors;
    }

    public static PreviewColorReader getInstance() {
        if (sPreviewColorReader == null) {
            sPreviewColorReader = new PreviewColorReader();
        }
        return sPreviewColorReader;
    }

}


text:
@interface PopAnimationViewController ()

@end

@implementation PopAnimationViewController

#pragma mark - life cycle

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
}

#pragma mark - init subviews

#pragma mark - event

#pragma mark - network

#pragma mark - private

- (void)popBaseAnimation {

}

- (void)popSpringAnimation {

}

- (void)popDecayAnimation {

}

#pragma mark - getter & setter

@end