text:
from keras.applications.vgg16 import VGG16
from keras.engine.topology import Input
from keras.engine.training import Model
from keras.layers.convolutional import Conv2D, UpSampling2D, Conv2DTranspose
from keras.layers.core import Activation, SpatialDropout2D
from keras.layers.merge import concatenate
from keras.layers.normalization import BatchNormalization
from keras.layers.pooling import MaxPooling2D

from inception_resnet_v2 import InceptionResNetV2
from mobile_net_fixed import MobileNet
from resnet50_fixed import ResNet50
from params import args

def conv_block_simple(prevlayer, filters, prefix, strides=(1, 1)):
    conv = Conv2D(filters, (3, 3), padding="same", kernel_initializer="he_normal", strides=strides, name=prefix + "_conv")(prevlayer)
    conv = BatchNormalization(name=prefix + "_bn")(conv)
    conv = Activation('relu', name=prefix + "_activation")(conv)
    return conv

def conv_block_simple_no_bn(prevlayer, filters, prefix, strides=(1, 1)):
    conv = Conv2D(filters, (3, 3), padding="same", kernel_initializer="he_normal", strides=strides, name=prefix + "_conv")(prevlayer)
    conv = Activation('relu', name=prefix + "_activation")(conv)
    return conv

"""
Unet with Mobile net encoder
Uses caffe preprocessing function
"""

def get_unet_resnet(input_shape):
    resnet_base = ResNet50(input_shape=input_shape, include_top=False)

    if args.show_summary:
        resnet_base.summary()

    for l in resnet_base.layers:
        l.trainable = True
    conv1 = resnet_base.get_layer("activation_1").output
    conv2 = resnet_base.get_layer("activation_10").output
    conv3 = resnet_base.get_layer("activation_22").output
    conv4 = resnet_base.get_layer("activation_40").output
    conv5 = resnet_base.get_layer("activation_49").output

    up6 = concatenate([UpSampling2D()(conv5), conv4], axis=-1)
    conv6 = conv_block_simple(up6, 256, "conv6_1")
    conv6 = conv_block_simple(conv6, 256, "conv6_2")

    up7 = concatenate([UpSampling2D()(conv6), conv3], axis=-1)
    conv7 = conv_block_simple(up7, 192, "conv7_1")
    conv7 = conv_block_simple(conv7, 192, "conv7_2")

    up8 = concatenate([UpSampling2D()(conv7), conv2], axis=-1)
    conv8 = conv_block_simple(up8, 128, "conv8_1")
    conv8 = conv_block_simple(conv8, 128, "conv8_2")

    up9 = concatenate([UpSampling2D()(conv8), conv1], axis=-1)
    conv9 = conv_block_simple(up9, 64, "conv9_1")
    conv9 = conv_block_simple(conv9, 64, "conv9_2")

    vgg = VGG16(input_shape=input_shape, input_tensor=resnet_base.input, include_top=False)
    for l in vgg.layers:
        l.trainable = False
    vgg_first_conv = vgg.get_layer("block1_conv2").output
    up10 = concatenate([UpSampling2D()(conv9), resnet_base.input, vgg_first_conv], axis=-1)
    conv10 = conv_block_simple(up10, 32, "conv10_1")
    conv10 = conv_block_simple(conv10, 32, "conv10_2")
    conv10 = SpatialDropout2D(0.2)(conv10)
    x = Conv2D(1, (1, 1), activation="sigmoid", name="prediction")(conv10)
    model = Model(resnet_base.input, x)
    return model

def get_simple_unet(input_shape):
    img_input = Input(input_shape)
    conv1 = conv_block_simple(img_input, 32, "conv1_1")
    conv1 = conv_block_simple(conv1, 32, "conv1_2")
    pool1 = MaxPooling2D((2, 2), strides=(2, 2), padding="same", name="pool1")(conv1)

    conv2 = conv_block_simple(pool1, 64, "conv2_1")
    conv2 = conv_block_simple(conv2, 64, "conv2_2")
    pool2 = MaxPooling2D((2, 2), strides=(2, 2), padding="same", name="pool2")(conv2)

    conv3 = conv_block_simple(pool2, 128, "conv3_1")
    conv3 = conv_block_simple(conv3, 128, "conv3_2")
    pool3 = MaxPooling2D((2, 2), strides=(2, 2), padding="same", name="pool3")(conv3)

    conv4 = conv_block_simple(pool3, 256, "conv4_1")
    conv4 = conv_block_simple(conv4, 256, "conv4_2")
    conv4 = conv_block_simple(conv4, 256, "conv4_3")

    up5 = concatenate([UpSampling2D()(conv4), conv3], axis=-1)
    conv5 = conv_block_simple(up5, 128, "conv5_1")
    conv5 = conv_block_simple(conv5, 128, "conv5_2")

    up6 = concatenate([UpSampling2D()(conv5), conv2], axis=-1)
    conv6 = conv_block_simple(up6, 64, "conv6_1")
    conv6 = conv_block_simple(conv6, 64, "conv6_2")

    up7 = concatenate([UpSampling2D()(conv6), conv1], axis=-1)
    conv7 = conv_block_simple(up7, 32, "conv7_1")
    conv7 = conv_block_simple(conv7, 32, "conv7_2")

    conv7 = SpatialDropout2D(0.2)(conv7)

    prediction = Conv2D(1, (1, 1), activation="sigmoid", name="prediction")(conv7)
    model = Model(img_input, prediction)
    return model

"""
Unet with Mobile net encoder
Uses the same preprocessing as in Inception, Xception etc. (imagenet_utils.preprocess_input with mode 'tf' in new Keras version)
"""

def get_unet_mobilenet(input_shape):
    base_model = MobileNet(include_top=False, input_shape=input_shape)

    conv1 = base_model.get_layer('conv_pw_1_relu').output
    conv2 = base_model.get_layer('conv_pw_3_relu').output
    conv3 = base_model.get_layer('conv_pw_5_relu').output
    conv4 = base_model.get_layer('conv_pw_11_relu').output
    conv5 = base_model.get_layer('conv_pw_13_relu').output
    up6 = concatenate([UpSampling2D()(conv5), conv4], axis=-1)
    conv6 = conv_block_simple(up6, 256, "conv6_1")
    conv6 = conv_block_simple(conv6, 256, "conv6_2")

    up7 = concatenate([UpSampling2D()(conv6), conv3], axis=-1)
    conv7 = conv_block_simple(up7, 256, "conv7_1")
    conv7 = conv_block_simple(conv7, 256, "conv7_2")

    up8 = concatenate([UpSampling2D()(conv7), conv2], axis=-1)
    conv8 = conv_block_simple(up8, 192, "conv8_1")
    conv8 = conv_block_simple(conv8, 128, "conv8_2")

    up9 = concatenate([UpSampling2D()(conv8), conv1], axis=-1)
    conv9 = conv_block_simple(up9, 96, "conv9_1")
    conv9 = conv_block_simple(conv9, 64, "conv9_2")

    up10 = concatenate([UpSampling2D()(conv9), base_model.input], axis=-1)
    conv10 = conv_block_simple(up10, 48, "conv10_1")
    conv10 = conv_block_simple(conv10, 32, "conv10_2")
    conv10 = SpatialDropout2D(0.2)(conv10)
    x = Conv2D(1, (1, 1), activation="sigmoid", name="prediction")(conv10)
    model = Model(base_model.input, x)
    return model

"""
Unet with Inception Resnet V2 encoder
Uses the same preprocessing as in Inception, Xception etc. (imagenet_utils.preprocess_input with mode 'tf' in new Keras version)
"""

def get_unet_inception_resnet_v2(input_shape):
    base_model = InceptionResNetV2(include_top=False, input_shape=input_shape)
    conv1 = base_model.get_layer('activation_3').output
    conv2 = base_model.get_layer('activation_5').output
    conv3 = base_model.get_layer('block35_10_ac').output
    conv4 = base_model.get_layer('block17_20_ac').output
    conv5 = base_model.get_layer('conv_7b_ac').output
    up6 = concatenate([UpSampling2D()(conv5), conv4], axis=-1)
    conv6 = conv_block_simple(up6, 256, "conv6_1")
    conv6 = conv_block_simple(conv6, 256, "conv6_2")

    up7 = concatenate([UpSampling2D()(conv6), conv3], axis=-1)
    conv7 = conv_block_simple(up7, 256, "conv7_1")
    conv7 = conv_block_simple(conv7, 256, "conv7_2")

    up8 = concatenate([UpSampling2D()(conv7), conv2], axis=-1)
    conv8 = conv_block_simple(up8, 128, "conv8_1")
    conv8 = conv_block_simple(conv8, 128, "conv8_2")

    up9 = concatenate([UpSampling2D()(conv8), conv1], axis=-1)
    conv9 = conv_block_simple(up9, 64, "conv9_1")
    conv9 = conv_block_simple(conv9, 64, "conv9_2")

    up10 = concatenate([UpSampling2D()(conv9), base_model.input], axis=-1)
    conv10 = conv_block_simple(up10, 48, "conv10_1")
    conv10 = conv_block_simple(conv10, 32, "conv10_2")
    conv10 = SpatialDropout2D(0.4)(conv10)
    x = Conv2D(1, (1, 1), activation="sigmoid", name="prediction")(conv10)
    model = Model(base_model.input, x)
    return model

def get_vgg_7conv(input_shape):
    img_input = Input(input_shape)
    vgg16_base = VGG16(input_tensor=img_input, include_top=False)
    for l in vgg16_base.layers:
        l.trainable = True
    conv1 = vgg16_base.get_layer("block1_conv2").output
    conv2 = vgg16_base.get_layer("block2_conv2").output
    conv3 = vgg16_base.get_layer("block3_conv3").output
    pool3 = vgg16_base.get_layer("block3_pool").output

    conv4 = Conv2D(384, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block4_conv1")(pool3)
    conv4 = Conv2D(384, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block4_conv2")(conv4)
    pool4 = MaxPooling2D((2, 2), strides=(2, 2), name='block4_pool')(conv4)

    conv5 = Conv2D(512, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block5_conv1")(pool4)
    conv5 = Conv2D(512, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block5_conv2")(conv5)
    pool5 = MaxPooling2D((2, 2), strides=(2, 2), name='block5_pool')(conv5)

    conv6 = Conv2D(512, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block6_conv1")(pool5)
    conv6 = Conv2D(512, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block6_conv2")(conv6)
    pool6 = MaxPooling2D((2, 2), strides=(2, 2), name='block6_pool')(conv6)

    conv7 = Conv2D(512, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block7_conv1")(pool6)
    conv7 = Conv2D(512, (3, 3), activation="relu", padding='same', kernel_initializer="he_normal", name="block7_conv2")(conv7)

    up8 = concatenate([Conv2DTranspose(384, (3, 3), activation="relu", kernel_initializer="he_normal", strides=(2, 2), padding='same')(conv7), conv6], axis=3)
    conv8 = Conv2D(384, (3, 3), activation="relu", kernel_initializer="he_normal", padding='same')(up8)

    up9 = concatenate([Conv2DTranspose(256, (3, 3), activation="relu", kernel_initializer="he_normal", strides=(2, 2), padding='same')(conv8), conv5], axis=3)
    conv9 = Conv2D(256, (3, 3), activation="relu", kernel_initializer="he_normal", padding='same')(up9)

    up10 = concatenate([Conv2DTranspose(192, (3, 3), activation="relu", kernel_initializer="he_normal", strides=(2, 2), padding='same')(conv9), conv4], axis=3)
    conv10 = Conv2D(192, (3, 3), activation="relu", kernel_initializer="he_normal", padding='same')(up10)

    up11 = concatenate([Conv2DTranspose(128, (3, 3), activation="relu", kernel_initializer="he_normal", strides=(2, 2), padding='same')(conv10), conv3], axis=3)
    conv11 = Conv2D(128, (3, 3), activation="relu", kernel_initializer="he_normal", padding='same')(up11)

    up12 = concatenate([Conv2DTranspose(64, (3, 3), activation="relu", kernel_initializer="he_normal", strides=(2, 2), padding='same')(conv11), conv2], axis=3)
    conv12 = Conv2D(64, (3, 3), activation="relu", kernel_initializer="he_normal", padding='same')(up12)

    up13 = concatenate([Conv2DTranspose(32, (3, 3), activation="relu", kernel_initializer="he_normal", strides=(2, 2), padding='same')(conv12), conv1], axis=3)
    conv13 = Conv2D(32, (3, 3), activation="relu", kernel_initializer="he_normal", padding='same')(up13)

    conv13 = Conv2D(1, (1, 1))(conv13)
    conv13 = Activation("sigmoid")(conv13)
    model = Model(img_input, conv13)
    return model

def make_model(input_shape):
    network = args.network
    if network == 'resnet50':
        return get_unet_resnet(input_shape)
    if network == 'inception_resnet_v2':
        return get_unet_inception_resnet_v2(input_shape)
    elif network == 'mobilenet':
        return get_unet_mobilenet(input_shape)
    elif network == 'vgg':
        return get_vgg_7conv(input_shape)
    elif network == 'simple_unet':
        return get_simple_unet(input_shape)
    else:
        raise ValueError("Unknown network")


text:
/*! Spectre.css Experimentals | MIT License | github.com/picturepan2/spectre */
.progress {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 0;
  color: #5764c6;
  height: .4rem;
  width: 100%;
}
.progress::-webkit-progress-bar {
  background: #efefef;
  border-radius: .2rem;
}
.progress::-webkit-progress-value {
  background: #5764c6;
  border-radius: .2rem;
}
.progress::-moz-progress-bar {
  background: #5764c6;
  border-radius: .2rem;
}
.slider {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent;
  display: block;
  height: 2.4rem;
  width: 100%;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  background: #5764c6;
  border-radius: 50%;
  height: 1.4rem;
  margin-top: -.5rem;
  transition: transform .2s ease, -webkit-transform .2s ease;
  transition: transform .2s ease;
  transition: -webkit-transform .2s ease;
  width: 1.4rem;
}
.slider::-moz-range-thumb {
  background: #5764c6;
  border: 0;
  border-radius: 50%;
  height: 1.4rem;
  transition: transform .2s ease, -webkit-transform .2s ease;
  transition: transform .2s ease;
  transition: -webkit-transform .2s ease;
  width: 1.4rem;
}
.slider::-ms-thumb {
  background: #5764c6;
  border: 0;
  border-radius: 50%;
  height: 1.4rem;
  transition: transform .2s ease, -webkit-transform .2s ease;
  transition: transform .2s ease;
  transition: -webkit-transform .2s ease;
  width: 1.4rem;
}
.slider:active::-webkit-slider-thumb {
  -webkit-transform: scale(1.25);
  transform: scale(1.25);
}
.slider:active::-moz-range-thumb {
  transform: scale(1.25);
}
.slider:active::-ms-thumb {
  -ms-transform: scale(1.25);
  transform: scale(1.25);
}
.slider::-webkit-slider-runnable-track {
  background: #efefef;
  border-radius: .2rem;
  height: .4rem;
  width: 100%;
}
.slider::-moz-range-track {
  background: #efefef;
  border-radius: .2rem;
  height: .4rem;
  width: 100%;
}
.slider::-ms-track {
  background: #efefef;
  border-radius: .2rem;
  height: .4rem;
  width: 100%;
}
.slider::-ms-fill-lower {
  background: #5764c6;
}

redpajama_set_name: RedPajamaGithub


text:
Small Example of D3 Reusable Charts

v0.1


text:
class AddCommentsToProject < ActiveRecord::Migration
  def change
    add_column :projects, :comments, :text
  end
end


text:
import java.util.*;

public class FindUniqueAndDups {
    public static void main(String[] args) {
        Set<String> uniques = new HashSet<String>();
        Set<String> dups    = new HashSet<String>();

        for (String a : args)
            if (!uniques.add(a))
                dups.add(a);

        // Destructive set-difference
        uniques.removeAll(dups);

        System.out.println("Unique words:    " + uniques);
        System.out.println("Duplicate words: " + dups);
    }
}


text:
package org.apache.hadoop.hbase.client;

import static org.junit.Assert.assertNotEquals;

import java.io.IOException;
import java.util.concurrent.ExecutionException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;

// Categorized as a large test so not run as part of general 'test' suite (which is small
// and mediums). This test fails if networking is odd -- say if you are connected to a
// VPN... See HBASE-23850
@Category({ LargeTests.class, ClientTests.class })
public class TestAsyncTableRSCrashPublish {

  @ClassRule
  public static final HBaseClassTestRule CLASS_RULE =
    HBaseClassTestRule.forClass(TestAsyncTableRSCrashPublish.class);

  private static final HBaseTestingUtil UTIL = new HBaseTestingUtil();

  private static TableName TABLE_NAME = TableName.valueOf("Publish");

  private static byte[] FAMILY = Bytes.toBytes("family");

  @BeforeClass
  public static void beforeClass() throws Exception {
    UTIL.getConfiguration().setBoolean(HConstants.STATUS_PUBLISHED, true);
    /*
     * Below is code for choosing a NetworkInterface and then setting it into configs so can be
     * picked up by the client and server. String niName =
     * UTIL.getConfiguration().get(HConstants.STATUS_MULTICAST_NI_NAME); NetworkInterface ni; if
     * (niName != null) { ni = NetworkInterface.getByName(niName); } else { String mcAddress =
     * UTIL.getConfiguration().get(HConstants.STATUS_MULTICAST_ADDRESS,
     * HConstants.DEFAULT_STATUS_MULTICAST_ADDRESS); InetAddress ina =
     * InetAddress.getByName(mcAddress); boolean inet6Address = ina instanceof Inet6Address; ni =
     * NetworkInterface.getByInetAddress(inet6Address? Addressing.getIp6Address():
     * Addressing.getIp4Address()); }
     * UTIL.getConfiguration().set(HConstants.STATUS_MULTICAST_NI_NAME, ni.getName());
     */
    UTIL.startMiniCluster(2);
    UTIL.createTable(TABLE_NAME, FAMILY);
    UTIL.waitTableAvailable(TABLE_NAME);
  }

  @AfterClass
  public static void afterClass() throws Exception {
    UTIL.shutdownMiniCluster();
  }

  @Test
  public void test() throws IOException, ExecutionException, InterruptedException {
    Configuration conf = UTIL.getHBaseCluster().getMaster().getConfiguration();
    try (AsyncConnection connection = ConnectionFactory.createAsyncConnection(conf).get()) {
      AsyncNonMetaRegionLocator locator =
        ((AsyncConnectionImpl) connection).getLocator().getNonMetaRegionLocator();
      connection.getTable(TABLE_NAME).get(new Get(Bytes.toBytes(0))).join();
      ServerName serverName =
        locator.getRegionLocationInCache(TABLE_NAME, HConstants.EMPTY_START_ROW)
          .getDefaultRegionLocation().getServerName();
      UTIL.getMiniHBaseCluster().stopRegionServer(serverName);
      UTIL.waitFor(60000,
        () -> locator.getRegionLocationInCache(TABLE_NAME, HConstants.EMPTY_START_ROW) == null);
      connection.getTable(TABLE_NAME).get(new Get(Bytes.toBytes(0))).join();
      assertNotEquals(serverName,
        locator.getRegionLocationInCache(TABLE_NAME, HConstants.EMPTY_START_ROW)
          .getDefaultRegionLocation().getServerName());
    }
  }
}


text:
import React from 'react';
import { findDOMNode } from 'react-dom';
import { DragSource, DropTarget } from 'react-dnd';
import { getEmptyImage } from 'react-dnd-html5-backend';
import itemTypes from './itemTypes';
import { getValuesByKey, hoverAboveItself } from './utils';
import { NestableListContext } from './NestableListContext';
import classNames from 'classnames';
// keep track of horizontal mouse movement
const mouse = {
  lastX: 0,
};

function increaseHorizontalLevel(prevPosition, prevIndex) {
  const nextPosition = prevPosition.slice(0, -1);
  // append to prevSibling's children
  nextPosition.push(prevIndex - 1, -1);
  return nextPosition;
}

function decreaseHorizontalLevel(prevPosition) {
  const nextPosition = prevPosition.slice(0, -1);
  nextPosition[nextPosition.length - 1] += 1;
  return nextPosition;
}

function calculateHandleOffset(handleRect, containerRect) {
  return {
    x: handleRect.x - containerRect.x,
    y: handleRect.y - containerRect.y,
  };
}

const cardSource = {
  isDragging(props, monitor) {
    const ids = getValuesByKey(monitor.getItem().data, 'id', 'children');
    return ids.indexOf(props.id) > -1;
  },
  beginDrag(props, monitor, component) {
    props.onDragStart && props.onDragStart(props);

    const node = findDOMNode(component);

    const clientRect = node.getBoundingClientRect();
    let handleOffset = { x: 0, y: 0 };
    // needed to fix dnd drag offset data
    if (component.handleNode) {
      handleOffset = calculateHandleOffset(
        component.handleNode.getBoundingClientRect(),
        clientRect,
      );
    }

    return {
      id: props.id,
      dragged: false, // needed for workaround of immediately fired dragend event after dragstart
      index: props.index,
      position: props.position,
      data: props.item,
      groupName: props.groupName,
      depth: props.depth,
      // rect for entire component including children
      clientRect,
      handleOffset,
    };
  },
  endDrag: (props, monitor) => {
    mouse.lastX = 0;
    props.dropItem(monitor.getItem());
    props.onDragEnd && props.onDragEnd(props);
  },
};

const determineHorizontalPosition = ({ monitor, props, hoverNode }) => {
  const item = monitor.getItem();

  // the item being dragged
  const { position: prevPosition, depth: dragDepth, index: prevIndex } = item;

  // props for component underneath drag
  const {
    position: hoverPosition,
    siblings: hoverSiblings,
    maxDepth,
    threshold,
  } = props;

  // determine mouse position
  const clientOffset = monitor.getClientOffset() || { x: 0, y: 0 };
  const initialClientOffset = monitor.getInitialClientOffset() || {
    x: 0,
    y: 0,
  };

  // rect for entire component including children
  const hoverClientRect = hoverNode.getBoundingClientRect();

  const isOverSelf = hoverAboveItself(prevPosition, hoverPosition);

  // set mouse.lastX if it isn't set yet (first hover event)
  mouse.lastX = mouse.lastX || initialClientOffset.x;

  const currMouseX = clientOffset.x;
  const mouseDistanceX = currMouseX - mouse.lastX;
  const nearLeftEdge = currMouseX < hoverClientRect.left + 10;

  // nextPosition will be overwritten when moving horizontally
  let nextPosition = hoverPosition;

  // moving horizontally
  if (isOverSelf && (nearLeftEdge || Math.abs(mouseDistanceX) >= threshold)) {
    // reset lastX for new phase
    mouse.lastX = currMouseX;

    // increase horizontal level
    if (
      mouseDistanceX > 0 &&
      // has previous sibling
      prevIndex - 1 >= 0 &&
      // isn't at max depth
      prevPosition.length + dragDepth - 1 !== maxDepth
    ) {
      nextPosition = increaseHorizontalLevel(prevPosition, prevIndex);
    }

    // decrease horizontal level
    if (
      mouseDistanceX < 0 &&
      // is nested
      prevPosition.length > 1 &&
      // is last item in array
      prevIndex === hoverSiblings.length - 1
    ) {
      nextPosition = decreaseHorizontalLevel(prevPosition);
    }
  }

  if (
    props.preventChangeDepth &&
    nextPosition.length - prevPosition.length === -1 // means that new parent is suitable for current dragged item
  ) {
    const isSameParent = nextPosition.every((position, depth) => {
      return prevPosition[depth] === position;
    });
    if (!isSameParent) {
      nextPosition = prevPosition.map((position, depth) => {
        return nextPosition[depth] !== undefined ? nextPosition[depth] : 0;
      });
    }
  }

  return nextPosition;
};

const allowItemMove = ({
  prevPosition,
  nextPosition,
  monitor,
  hoverNode,
  props,
}) => {
  // don't replace items with themselves
  if (hoverAboveItself(prevPosition, nextPosition)) {
    return;
  }

  // prevent drop if preventChangeDepth and depth is changed
  if (props.preventChangeDepth && nextPosition.length !== prevPosition.length) {
    return;
  }

  const { position: hoverPosition } = props;

  const isOverSelf = hoverAboveItself(prevPosition, hoverPosition);

  const clientOffset = monitor.getClientOffset() || { x: 0, y: 0 };

  // rect for entire component including children
  const hoverClientRect = hoverNode.getBoundingClientRect();

  // rect for item without children
  const hoverItemClientRect = hoverNode.children[0].getBoundingClientRect();

  // get vertical middle
  const hoverMiddleY = (hoverClientRect.bottom - hoverClientRect.top) / 2;

  // get pixels to the top
  const hoverClientY = clientOffset.y - hoverClientRect.top;

  // dragging child item to another position with same parent
  if (nextPosition.length === prevPosition.length) {
    const last = nextPosition.length - 1;
    const previousIndex = prevPosition[last];
    const nextIndex = nextPosition[last];

    // only perform the move when the mouse has crossed half of the items height
    // when dragging downwards, only move when the cursor is below 50%
    // when dragging upwards, only move when the cursor is above 50%

    // dragging downwards
    if (previousIndex < nextIndex && hoverClientY < hoverMiddleY) {
      return;
    }

    // dragging upwards
    if (previousIndex > nextIndex && hoverClientY > hoverMiddleY) {
      return;
    }
  } else if (
    // dragging child item over parent item
    nextPosition.length < prevPosition.length &&
    nextPosition[nextPosition.length - 1] ===
      prevPosition[prevPosition.length - 2]
  ) {
    const hoverItemMiddleY =
      (hoverItemClientRect.bottom - hoverItemClientRect.top) / 2;

    // cancel if hovering in lower half of parent item
    if (hoverClientY > hoverItemMiddleY) {
      return;
    }
  } else if (!isOverSelf && clientOffset.y > hoverItemClientRect.bottom) {
    // cancel if over a nested target that isn't its own child
    return;
  }

  return true;
};

const cardTarget = {
  hover(props, monitor, component) {
    // prevent drag and drop between different groups.
    // currently drag and drop between multiple nestable lists is not supported
    if (monitor.getItem().groupName !== props.groupName) {
      return;
    }

    const item = monitor.getItem();

    // the item being dragged
    const { position: prevPosition, data: dragItem, depth: dragDepth } = item;

    // props for component underneath drag
    const { position: hoverPosition, maxDepth } = props;

    const hoverDepth = hoverPosition.length - 1;
    const totalDepth = hoverDepth + dragDepth;

    // don't exceed max depth
    if (totalDepth > maxDepth) {
      return;
    }

    const hoverNode = findDOMNode(component);
    const nextPosition = determineHorizontalPosition({
      monitor,
      props,
      hoverNode,
    });

    if (
      !allowItemMove({ prevPosition, nextPosition, monitor, hoverNode, props })
    ) {
      return;
    }

    // this is where the actual move happens
    const nextPos = props.moveItem({
      dragItem,
      prevPosition,
      nextPosition,
    });

    item.prevPosition = prevPosition;
    item.prevIndex = item.index;
    item.dragged = true;
    // note: we're mutating the monitor item here!
    // generally it's better to avoid mutations,
    // but it's good here for the sake of performance
    // to avoid expensive index searches
    item.position = nextPos;
    item.index = nextPos[nextPos.length - 1];
  },
};

class Item extends React.PureComponent {
  state = {
    shouldRenderChildren: true,
  };

  unmounted = false;

  componentWillUnmount() {
    this.unmounted = true;
  }

  componentDidMount() {
    // use empty image as a drag preview so browsers don't draw it
    // and we can draw whatever we want on the custom drag layer instead.
    this.props.connectDragPreview(getEmptyImage(), {
      // IE fallback: specify that we'd rather screenshot the node
      // when it already knows it's being dragged so we can hide it with CSS.
      captureDraggingState: true,
    });
    this.updateShouldRenderChildren();
  }

  componentDidUpdate() {
    this.updateShouldRenderChildren();
  }

  updateShouldRenderChildren() {
    const { isPlaceholder, isRenderDraggingChildren } = this.props;
    const shouldRenderChildren = !isPlaceholder || isRenderDraggingChildren;
    // start workaround of immediately fired dragend event after dragstart
    // https://github.com/react-dnd/react-dnd/issues/766#issuecomment-748255082
    if (shouldRenderChildren !== this.state.shouldRenderChildren) {
      if (
        !this.props.dragged &&
        this.state.shouldRenderChildren !== shouldRenderChildren
      ) {
        setTimeout(() => {
          if (!this.unmounted) {
            this.setState({
              shouldRenderChildren: shouldRenderChildren,
            });
          }
        }, 0);
      } else {
        this.setState({
          shouldRenderChildren: shouldRenderChildren,
        });
      }
    }
    // end workaround of immediately fired dragend event after dragstart
  }

  render() {
    const {
      item,
      position,
      children,
      isPlaceholder,
      connectDragSource,
      connectDropTarget,
      useDragHandle,
      renderItem,
      renderPrefix,
      theme,
      readOnly,
      isVeryLastItem,
      siblings,
    } = this.props;

    // params passed to renderItem callback
    const renderParams = {
      item,
      siblings,
      isVeryLastItem,
      isPlaceholder,
      isPreview: false,
      connectDragSource: () => {},
      depth: position.length,
    };

    const classes = classNames('nestable-item', theme && theme.item);
    const { draggable = true } = item;

    if (!draggable || readOnly) {
      return connectDropTarget(

          {renderPrefix(renderParams)}
          {renderItem(renderParams)}
          {this.state.shouldRenderChildren && children}

,
      );
    }

    if (useDragHandle) {
      renderParams.connectDragSource = handle => {
        const handleWithRef = React.cloneElement(handle, {
          ref: node => (this.handleNode = findDOMNode(node)),
        });
        return connectDragSource(handleWithRef);
      };

      return connectDropTarget(

          {renderPrefix(renderParams)}
          {renderItem(renderParams)}
          {this.state.shouldRenderChildren && children}

,
      );
    }

    return connectDropTarget(
      connectDragSource(

          {renderPrefix(renderParams)}
          {renderItem(renderParams)}
          {this.state.shouldRenderChildren && children}

,
      ),
    );
  }
}

export const DragItemSource = DragSource(
  itemTypes.nestedItem,
  cardSource,
  (connect, monitor) => ({
    connectDragSource: connect.dragSource(),
    connectDragPreview: connect.dragPreview(),
    isPlaceholder: monitor.isDragging(),
    dragged: monitor.getItem() && monitor.getItem().dragged,
  }),
)(Item);

export const DropItemTarget = DropTarget(
  itemTypes.nestedItem,
  cardTarget,
  connect => ({
    connectDropTarget: connect.dropTarget(),
  }),
)(DragItemSource);

class ItemWithContext extends React.PureComponent {
  render() {
    return (
      <NestableListContext.Consumer>
        {context => <DropItemTarget {...this.props} {...context} />}
      </NestableListContext.Consumer>
    );
  }
}

export default ItemWithContext;


text:
package org.drools.compiler.compiler.xml.rules;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;

import org.assertj.core.api.Assertions;
import org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl;
import org.drools.compiler.compiler.DrlParser;
import org.drools.compiler.compiler.xml.XmlDumper;
import org.drools.compiler.compiler.xml.XmlPackageReader;
import org.drools.compiler.lang.DrlDumper;
import org.drools.compiler.lang.descr.PackageDescr;
import org.kie.internal.builder.conf.LanguageLevelOption;

import static org.junit.Assert.*;

/**
 * Helper Class for both xml and drl Dump Tests
 */
public class DumperTestHelper {

    public static void XmlFile(String filename) throws Exception {
        KnowledgeBuilderConfigurationImpl conf = new KnowledgeBuilderConfigurationImpl();

        XmlPackageReader xmlPackageReader = new XmlPackageReader( conf.getSemanticModules() );
        xmlPackageReader.getParser().setClassLoader( DumperTestHelper.class.getClassLoader() );
        xmlPackageReader.read( new InputStreamReader( DumperTestHelper.class.getResourceAsStream( filename ) ) );
        final PackageDescr pkgOriginal = xmlPackageReader.getPackageDescr();

        final XmlDumper dumper = new XmlDumper();
        final String result = dumper.dump( pkgOriginal );

        String buffer = readFile( filename );

        System.out.println(buffer);
        System.out.println(result);

        Assertions.assertThat(buffer).isEqualToIgnoringWhitespace(result);
        assertNotNull( result );
    }

    public static void DrlFile(String filename) throws Exception {

        DrlParser parser = new DrlParser(LanguageLevelOption.DRL5);
        final PackageDescr pkgOriginal = parser.parse( new InputStreamReader( DumperTestHelper.class.getResourceAsStream( filename ) ) );
        final DrlDumper dumper = new DrlDumper();
        String result1 = dumper.dump( pkgOriginal );
        final PackageDescr pkgDerivated = parser.parse( new StringReader( result1 ) );
        String result2 = dumper.dump( pkgDerivated );
        System.out.println( result1 );

        Assertions.assertThat(result1).isEqualToIgnoringWhitespace(result2);
    }

    public static String dump(String filename) throws Exception {
        DrlParser parser = new DrlParser(LanguageLevelOption.DRL6);
        final PackageDescr pkgOriginal = parser.parse( new InputStreamReader( DumperTestHelper.class.getResourceAsStream( filename ) ) );
        final DrlDumper dumper = new DrlDumper();
        return dumper.dump( pkgOriginal );
    }

    private static String readFile(final String file) throws IOException {
        final InputStreamReader reader = new InputStreamReader( DumperTestHelper.class.getResourceAsStream( file ) );
        final StringBuilder text = new StringBuilder();
        final char[] buf = new char[1024];
        int len = 0;

        while ( (len = reader.read( buf )) >= 0 ) {
            text.append( buf,
                         0,
                         len );
        }
        return text.toString();
    }
}


text:
// Disable autolinking for unit tests.
#if !defined(BOOST_ALL_NO_LIB)
#define BOOST_ALL_NO_LIB 1
#endif // !defined(BOOST_ALL_NO_LIB)

// Test that header file is self-contained.
#include <boost/asio/generic/raw_protocol.hpp>

#include <cstring>
#include <boost/asio/io_service.hpp>
#include <boost/asio/ip/icmp.hpp>
#include "../unit_test.hpp"

#if defined(__cplusplus_cli) || defined(__cplusplus_winrt)
# define generic cpp_generic
#endif

//------------------------------------------------------------------------------

// generic_raw_protocol_socket_compile test
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// The following test checks that all public member functions on the class
// generic::raw_socket::socket compile and link correctly. Runtime failures
// are ignored.

namespace generic_raw_protocol_socket_compile {

void connect_handler(const boost::system::error_code&)
{
}

void send_handler(const boost::system::error_code&, std::size_t)
{
}

void receive_handler(const boost::system::error_code&, std::size_t)
{
}

void test()
{
  using namespace boost::asio;
  namespace generic = boost::asio::generic;
  typedef generic::raw_protocol rp;

  const int af_inet = BOOST_ASIO_OS_DEF(AF_INET);
  const int ipproto_icmp = BOOST_ASIO_OS_DEF(IPPROTO_ICMP);
  const int sock_raw = BOOST_ASIO_OS_DEF(SOCK_RAW);

  try
  {
    io_service ios;
    char mutable_char_buffer[128] = "";
    const char const_char_buffer[128] = "";
    socket_base::message_flags in_flags = 0;
    socket_base::send_buffer_size socket_option;
    socket_base::bytes_readable io_control_command;
    boost::system::error_code ec;

    // basic_raw_socket constructors.

    rp::socket socket1(ios);
    rp::socket socket2(ios, rp(af_inet, ipproto_icmp));
    rp::socket socket3(ios, rp::endpoint());
#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
    int native_socket1 = ::socket(af_inet, sock_raw, 0);
    rp::socket socket4(ios, rp(af_inet, ipproto_icmp), native_socket1);
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)

#if defined(BOOST_ASIO_HAS_MOVE)
    rp::socket socket5(std::move(socket4));
    boost::asio::ip::icmp::socket icmp_socket(ios);
    rp::socket socket6(std::move(icmp_socket));
#endif // defined(BOOST_ASIO_HAS_MOVE)

    // basic_datagram_socket operators.

#if defined(BOOST_ASIO_HAS_MOVE)
    socket1 = rp::socket(ios);
    socket1 = std::move(socket2);
    socket1 = boost::asio::ip::icmp::socket(ios);
#endif // defined(BOOST_ASIO_HAS_MOVE)

    // basic_io_object functions.

    io_service& ios_ref = socket1.get_io_service();
    (void)ios_ref;

    // basic_socket functions.

    rp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
    (void)lowest_layer;

    socket1.open(rp(af_inet, ipproto_icmp));
    socket1.open(rp(af_inet, ipproto_icmp), ec);

#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
    int native_socket2 = ::socket(af_inet, sock_raw, 0);
    socket1.assign(rp(af_inet, ipproto_icmp), native_socket2);
    int native_socket3 = ::socket(af_inet, sock_raw, 0);
    socket1.assign(rp(af_inet, ipproto_icmp), native_socket3, ec);
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)

    bool is_open = socket1.is_open();
    (void)is_open;

    socket1.close();
    socket1.close(ec);

    rp::socket::native_type native_socket4 = socket1.native();
    (void)native_socket4;

    socket1.cancel();
    socket1.cancel(ec);

    bool at_mark1 = socket1.at_mark();
    (void)at_mark1;
    bool at_mark2 = socket1.at_mark(ec);
    (void)at_mark2;

    std::size_t available1 = socket1.available();
    (void)available1;
    std::size_t available2 = socket1.available(ec);
    (void)available2;

    socket1.bind(rp::endpoint());
    socket1.bind(rp::endpoint(), ec);

    socket1.connect(rp::endpoint());
    socket1.connect(rp::endpoint(), ec);

    socket1.async_connect(rp::endpoint(), connect_handler);

    socket1.set_option(socket_option);
    socket1.set_option(socket_option, ec);

    socket1.get_option(socket_option);
    socket1.get_option(socket_option, ec);

    socket1.io_control(io_control_command);
    socket1.io_control(io_control_command, ec);

    rp::endpoint endpoint1 = socket1.local_endpoint();
    rp::endpoint endpoint2 = socket1.local_endpoint(ec);

    rp::endpoint endpoint3 = socket1.remote_endpoint();
    rp::endpoint endpoint4 = socket1.remote_endpoint(ec);

    socket1.shutdown(socket_base::shutdown_both);
    socket1.shutdown(socket_base::shutdown_both, ec);

    // basic_raw_socket functions.

    socket1.send(buffer(mutable_char_buffer));
    socket1.send(buffer(const_char_buffer));
    socket1.send(null_buffers());
    socket1.send(buffer(mutable_char_buffer), in_flags);
    socket1.send(buffer(const_char_buffer), in_flags);
    socket1.send(null_buffers(), in_flags);
    socket1.send(buffer(mutable_char_buffer), in_flags, ec);
    socket1.send(buffer(const_char_buffer), in_flags, ec);
    socket1.send(null_buffers(), in_flags, ec);

    socket1.async_send(buffer(mutable_char_buffer), send_handler);
    socket1.async_send(buffer(const_char_buffer), send_handler);
    socket1.async_send(null_buffers(), send_handler);
    socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler);
    socket1.async_send(buffer(const_char_buffer), in_flags, send_handler);
    socket1.async_send(null_buffers(), in_flags, send_handler);

    socket1.send_to(buffer(mutable_char_buffer),
        rp::endpoint());
    socket1.send_to(buffer(const_char_buffer),
        rp::endpoint());
    socket1.send_to(null_buffers(),
        rp::endpoint());
    socket1.send_to(buffer(mutable_char_buffer),
        rp::endpoint(), in_flags);
    socket1.send_to(buffer(const_char_buffer),
        rp::endpoint(), in_flags);
    socket1.send_to(null_buffers(),
        rp::endpoint(), in_flags);
    socket1.send_to(buffer(mutable_char_buffer),
        rp::endpoint(), in_flags, ec);
    socket1.send_to(buffer(const_char_buffer),
        rp::endpoint(), in_flags, ec);
    socket1.send_to(null_buffers(),
        rp::endpoint(), in_flags, ec);

    socket1.async_send_to(buffer(mutable_char_buffer),
        rp::endpoint(), send_handler);
    socket1.async_send_to(buffer(const_char_buffer),
        rp::endpoint(), send_handler);
    socket1.async_send_to(null_buffers(),
        rp::endpoint(), send_handler);
    socket1.async_send_to(buffer(mutable_char_buffer),
        rp::endpoint(), in_flags, send_handler);
    socket1.async_send_to(buffer(const_char_buffer),
        rp::endpoint(), in_flags, send_handler);
    socket1.async_send_to(null_buffers(),
        rp::endpoint(), in_flags, send_handler);

    socket1.receive(buffer(mutable_char_buffer));
    socket1.receive(null_buffers());
    socket1.receive(buffer(mutable_char_buffer), in_flags);
    socket1.receive(null_buffers(), in_flags);
    socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
    socket1.receive(null_buffers(), in_flags, ec);

    socket1.async_receive(buffer(mutable_char_buffer), receive_handler);
    socket1.async_receive(null_buffers(), receive_handler);
    socket1.async_receive(buffer(mutable_char_buffer), in_flags,
        receive_handler);
    socket1.async_receive(null_buffers(), in_flags, receive_handler);

    rp::endpoint endpoint;
    socket1.receive_from(buffer(mutable_char_buffer), endpoint);
    socket1.receive_from(null_buffers(), endpoint);
    socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags);
    socket1.receive_from(null_buffers(), endpoint, in_flags);
    socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec);
    socket1.receive_from(null_buffers(), endpoint, in_flags, ec);

    socket1.async_receive_from(buffer(mutable_char_buffer),
        endpoint, receive_handler);
    socket1.async_receive_from(null_buffers(),
        endpoint, receive_handler);
    socket1.async_receive_from(buffer(mutable_char_buffer),
        endpoint, in_flags, receive_handler);
    socket1.async_receive_from(null_buffers(),
        endpoint, in_flags, receive_handler);
  }
  catch (std::exception&)
  {
  }
}

} // namespace generic_raw_protocol_socket_compile

//------------------------------------------------------------------------------

BOOST_ASIO_TEST_SUITE
(
  "generic/raw_protocol",
  BOOST_ASIO_TEST_CASE(generic_raw_protocol_socket_compile::test)
)


text:
from pull_data import HistoricDataSession
import pandas as pd
import os

class Analysis(HistoricDataSession):
    """
    Represents an object of covariance analysis. Given a portfolio, you can pull various metrics.

    Attributes:
        portfolio (:obj:`list` of :obj:`str`): a list of the ticker names

    """

    def __init__(self, portfolio = None):
        super(Analysis, self).__init__(portfolio = portfolio)
        portfolio = self.portfolio
        self.inquiry()
        cwd = os.getcwd()
        self.data = []
        for ticker in portfolio:
            items = pd.read_csv(cwd+'/saved_data/'+ticker+'.csv')
            self.data.append(items)

    def calculate_interday_difference(self):
        """
        Takes raw csv data from Google and calculates interday percentage difference

        Returns:
            change_data (:obj:`panda.Dataframe`): Percentage change interday data matrix

        """
        percent_change = []
        for items in self.data:
            items['Close'] = pd.to_numeric(items['Close'], errors='coerce')
            items['Open'] = pd.to_numeric(items['Open'], errors='coerce')
            items['Change'] = 100*(items['Close'] - items['Open']) / items['Open']
            addition = items.loc[:,['Date', 'Change']]
            addition.set_index('Date', inplace = True)
            percent_change.append(addition)

        change_data= percent_change[0]
        percent_change.pop(0)
        index = 1
        for item in percent_change:
            change_data = change_data.join(item, how='left', rsuffix=' ' + self.portfolio[index])
            index += 1
        change_data.rename(columns = {'Change': 'Change '+self.portfolio[0]}, inplace = True)
        return change_data

    def covariance_analysis(self, days):
        """
        Runs covariance analysis on a portfolio based on interday
        percent changes

        Args:
            days (:obj:`int`): Number of days to use for the data

        Returns:
            covariance_matrix (:obj:`panda.Dataframe`): Covariance Matrix of given portfolio
            normalized_covariance_matrix_to_index (:obj:`panda.Series`): Covariance compared to an index
        """

        change_data = self.calculate_interday_difference()
        covariance_matrix = change_data[0:days].cov()

        index_cov = covariance_matrix['Change '+ self.portfolio[0]]
        normalized_covariance_matrix_to_index = index_cov.divide(index_cov[0])

        return covariance_matrix, normalized_covariance_matrix_to_index

    def beta_slippage_analysis(self,days,multipliers):
        """
        Runs beta_slippage analysis on a portfolio based on interday
        percent changes for leveraged ETFs

        First entry in the portfolio is the asset the leveraged fund is compared too
        Ex. VXX and TVIX

        Args:
            days (:obj:`int`): Number of days to use for the data
            multipliers(:obj:`list`): List of the leverages in the same order of the portfolio

        Returns:
            beta_slippage_matrix (:obj:`panda.Dataframe`): Matrix of the given slippage compared to the underlying asset

        """
        change_data = self.calculate_interday_difference()

        index = 1
        slippage = pd.DataFrame()
        for mult in multipliers:
            slippage['Beta Slippage '+self.portfolio[index]] = mult*change_data['Change '+ self.portfolio[0]] - change_data['Change '+ self.portfolio[index]]
            index += 1
        return slippage

    def volitility_analysis(self,days):
        """
        Measures the volitility of each stock based on specified day amounts

        Args:
            days (:obj:`int`): Number of days to use for the data

        Returns:
            average_change(:obj:`panda.Series`): Average percentage change per day
            volitlity(:obj:`panda.Series`): Deviation percentage change per day

        """
        change_data = self.calculate_interday_difference()
        return change_data.mean(), change_data.std()

    def moving_average_analysis(self):
        """
        Measures the 50 and 200 day moving average of the stock

        Returns:
            moving_average_50(:obj:`panda.Series`): 50 day moving average
            moving_average_200(:obj:`panda.Series`): 200 day moving average
        """

        closing = pd.DataFrame()
        index = 0
        for items in self.data:
            items['Close'] = pd.to_numeric(items['Close'], errors='coerce')
            closing['Close ' + self.portfolio[index]] = items['Close']
            index += 1

        return closing.iloc[0:200].mean(), closing.iloc[0:50].mean()

    def moving_percent_change(self):
        change_data = self.calculate_interday_difference()

        return change_data.pct_change(10), change_data.pct_change(25)


text:
set -o errexit
set -o nounset
set -o pipefail
set -o xtrace

if [[ "${CIRCLECI:-}" == "true" ]]; then
    JOB_NAME="circleci-${CIRCLE_PROJECT_USERNAME}-${CIRCLE_PROJECT_REPONAME}"
    BUILD_NUMBER=${CIRCLE_BUILD_NUM}
    WORKSPACE=`pwd`
else
    # Jenkins?
    export HOME=${WORKSPACE} # Nothing should want Jenkins $HOME
fi

# Additional parameters that are passed to ginkgo runner.
GINKGO_TEST_ARGS=""

if [[ "${PERFORMANCE:-}" == "true" ]]; then
    if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
      export MASTER_SIZE="m3.xlarge"
    else
      export MASTER_SIZE="n1-standard-4"
    fi
    export NUM_MINIONS="100"
    GINKGO_TEST_ARGS="--ginkgo.focus=\[Performance suite\] "
else
    if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then
      export MASTER_SIZE="t2.small"
    else
      export MASTER_SIZE="g1-small"
    fi
    export NUM_MINIONS="2"
fi

# Unlike the kubernetes-build script, we expect some environment
# variables to be set. We echo these immediately and presume "set -o
# nounset" will force the caller to set them: (The first several are
# Jenkins variables.)

echo "JOB_NAME: ${JOB_NAME}"
echo "BUILD_NUMBER: ${BUILD_NUMBER}"
echo "WORKSPACE: ${WORKSPACE}"
echo "KUBERNETES_PROVIDER: ${KUBERNETES_PROVIDER}" # Cloud provider
echo "E2E_CLUSTER_NAME: ${E2E_CLUSTER_NAME}"       # Name of the cluster (e.g. "e2e-test-jenkins")
echo "E2E_NETWORK: ${E2E_NETWORK}"                 # Name of the network (e.g. "e2e")
echo "E2E_ZONE: ${E2E_ZONE}"                       # Name of the GCE zone (e.g. "us-central1-f")
echo "E2E_OPT: ${E2E_OPT}"                         # hack/e2e.go options
echo "E2E_SET_CLUSTER_API_VERSION: ${E2E_SET_CLUSTER_API_VERSION:-<not set>}" # optional, for GKE, set CLUSTER_API_VERSION to git hash
echo "--------------------------------------------------------------------------------"

# AWS variables
export KUBE_AWS_INSTANCE_PREFIX=${E2E_CLUSTER_NAME}
export KUBE_AWS_ZONE=${E2E_ZONE}

# GCE variables
export INSTANCE_PREFIX=${E2E_CLUSTER_NAME}
export KUBE_GCE_ZONE=${E2E_ZONE}
export KUBE_GCE_NETWORK=${E2E_NETWORK}

# GKE variables
export CLUSTER_NAME=${E2E_CLUSTER_NAME}
export ZONE=${E2E_ZONE}
export KUBE_GKE_NETWORK=${E2E_NETWORK}

export PATH=${PATH}:/usr/local/go/bin
export KUBE_SKIP_CONFIRMATIONS=y

if [[ ${KUBE_RUN_FROM_OUTPUT:-} =~ ^[yY]$ ]]; then
    echo "Found KUBE_RUN_FROM_OUTPUT=y; will use binaries from _output"
    cp _output/release-tars/kubernetes*.tar.gz .
else
    echo "Pulling binaries from GCS"
    if [[ $(find . | wc -l) != 1 ]]; then
        echo $PWD not empty, bailing!
        exit 1
    fi

    sudo gcloud components update -q

    GITHASH=$(gsutil cat gs://kubernetes-release/ci/latest.txt)
    gsutil -m cp gs://kubernetes-release/ci/${GITHASH}/kubernetes.tar.gz gs://kubernetes-release/ci/${GITHASH}/kubernetes-test.tar.gz .
fi

md5sum kubernetes*.tar.gz
tar -xzf kubernetes.tar.gz
tar -xzf kubernetes-test.tar.gz
cd kubernetes

# Set by GKE-CI to change the CLUSTER_API_VERSION to the git version
if [[ ! -z ${E2E_SET_CLUSTER_API_VERSION:-} ]]; then
    export CLUSTER_API_VERSION=$(echo ${GITHASH} | cut -c 2-)
elif [[ ! -z ${E2E_USE_LATEST_RELEASE_VERSION:-} ]]; then
    release=$(gsutil cat gs://kubernetes-release/release/latest.txt | cut -c 2-)
    export CLUSTER_API_VERSION=${release}
fi

# Have cmd/e2e run by goe2e.sh generate JUnit report in ${WORKSPACE}/junit*.xml
export E2E_REPORT_DIR=${WORKSPACE}

### Set up ###
go run ./hack/e2e.go ${E2E_OPT} -v --down
go run ./hack/e2e.go ${E2E_OPT} -v --up
go run ./hack/e2e.go -v --ctl="version --match-server-version=false"

### Run tests ###
# Jenkins will look at the junit*.xml files for test failures, so don't exit
# with a nonzero error code if it was only tests that failed.
go run ./hack/e2e.go ${E2E_OPT} -v --test --test_args="${GINKGO_TEST_ARGS}--ginkgo.noColor" || true

### Clean up ###
go run ./hack/e2e.go ${E2E_OPT} -v --down


text:
@interface ABI44_0_0AIRMapOverlayManager () <MKMapViewDelegate>

@end

@implementation ABI44_0_0AIRMapOverlayManager

ABI44_0_0RCT_EXPORT_MODULE()

- (UIView *)view
{
    ABI44_0_0AIRMapOverlay *overlay = [ABI44_0_0AIRMapOverlay new];
    overlay.bridge = self.bridge;
    return overlay;
}

ABI44_0_0RCT_REMAP_VIEW_PROPERTY(bounds, boundsRect, NSArray)
ABI44_0_0RCT_REMAP_VIEW_PROPERTY(image, imageSrc, NSString)

@end


text:
import { JoinedRoom as JoinedRoomEvent } from "@matrix-org/analytics-events/types/typescript/JoinedRoom";

import { ActionPayload } from "../payloads";
import { Action } from "../actions";

/* eslint-disable camelcase */
export interface JoinRoomReadyPayload extends Pick<ActionPayload, "action"> {
    action: Action.JoinRoomReady;
    roomId: string;

    // additional parameters for the purpose of metrics & instrumentation
    metricsTrigger: JoinedRoomEvent["trigger"];
}
/* eslint-enable camelcase */


text:
"use strict";

exports.compile = function(source) {
    var template = require('handlebars').compile(source);
    return function(context) {
        return template(context);
    };
};


text:
/**
 * Created by joehua on 6/27/15.
 */

'use strict';
var mongoose = require('mongoose');
var config = require('../../config/config');

var Schema = mongoose.Schema;
var baseModelPlugin = require('./../../utilities/base-model-plugin');

var KeywordSchema = require('./keyword.model.js').Schema;

var NicheSchema = new Schema({
    name: {type: String, required: true},
    code: {type: String, required: true},
    description: String,
    keywords: [KeywordSchema],
    _creatorId: {type: Schema.ObjectId, ref: 'User'}
}, {autoIndex: config.ensureIndex});

NicheSchema.index({name: "text", description: "text"});

NicheSchema.plugin(baseModelPlugin);
var Niche = mongoose.model('Niche', NicheSchema);

module.exports = Niche;


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

using UnityEngine;

public abstract class dfTouchInputSourceComponent : MonoBehaviour
{

	public int Priority;

	public abstract IDFTouchInputSource Source { get; }

}


text:
require "obix"
require "minitest/unit"
require "minitest/autorun"

require "test_helper"

class IntegerTest < MiniTest::Unit::TestCase

  def test_parses_integers
    object = OBIX.parse string: fixture("objects/integer.xml")

    assert_instance_of OBIX::Objects::Integer, object
    assert_equal 52, object.val
  end

end


text:
Acceptance tests
================

See the documentation in the [Wiki](https://github.com/nemerosa/ontrack/wiki/Testing).


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Popups;
using PlayStation.Entities.Web;

namespace PlayStation_App.Tools.Debug
{
    public static class ResultChecker
    {
        public async static Task SendMessageDialogAsync(string message, bool isSuccess)
        {
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
            var title = isSuccess ? loader.GetString("SuccessText/Text") : loader.GetString("ErrorText/Text");
            var dialog = new MessageDialog((string.Concat(title, Environment.NewLine, Environment.NewLine, message)));
            await dialog.ShowAsync();
        }

        public async static Task<bool> CheckSuccess(Result result, bool showMessage = true)
        {
            if (result.IsSuccess)
                return true;
            if(showMessage)
            await SendMessageDialogAsync(result.Error + result.ResultJson, false);
            return false;
        }
    }
}


text:
from datetime import datetime
from datetime import date
from datetime import timedelta
import re
import Entity.User as User
import Entity.Event as Event
import Entity.RepeatingEvent as RepeatingEvent
import Responder

def createSingleEvent(name, place, date):
    event = Event.getByDate(date)
    if event:
        return u'Am gegebenen Datum existiert bereits ein Event: \n' + event.toString()
    event = Event.create(name, place, date)
    return u'Event erstellt: \n' + event.toString()

def createRepeatingEvent(name, place , day, time, endDate):
    rep = RepeatingEvent.create(name, place, day, time, endDate)
    events = rep.createEvents()
    answer = u'Events an diesen Daten erstellt:'
    for created in events[0]:
        answer = answer + u'\n' + created.strftime("%d.%m.%Y")
    if events[1]:
        answer = answer + u'\nFolgende Daten übersprungen, da an diesen schon ein Event existiert:'
        for skipped in events[1]:
            answer = answer + u'\n' + skipped.strftime("%d.%m.%Y")
    return answer

def updateRepeating(user, additional):
    rep = RepeatingEvent.get(int(additional.split()[0]))
    events = Event.getByRepeating(rep.key)
    i = 0
    for event in events:
        event.date = event.date + timedelta(minutes=int(additional.split()[1]))
        event.put()
        i = i +1
    return str(i) + ' events updated'

def create(user, additional):
    if not additional:
        return u'Um ein Event zu erstellen müssen entsprechende Angaben gemacht werden: Name;[Ort];Datum/Tag;Zeit;[EndDatum])'

    split = additional.split(';')
    if (len(split) != 4) and (len(split) != 5):
        return u'Anzahl der Argumente ist Falsch! Es müssen 4 oder 5 sein. (erstelle Name;[Ort];Datum/Tag;Zeit;[EndDatum])'

    if not split[0]:
        return u'Es muss ein Name angegeben werden'
    name = split[0].strip()
    place = split[1].strip()
    timeString = split[3].strip()
    time = None
    try:
        time = datetime.strptime(timeString, "%H:%M").time()
    except ValueError as err:
        return u'Die Zeitangabe ' + timeString + u'hat das falsche Format (HH:MM).'
    dateOrDayString = split[2].strip()
    try:
        date = datetime.strptime(dateOrDayString, "%d.%m.%Y").date()
        return createSingleEvent(name, place, datetime.combine(date, time))
    except ValueError as err:
        try:
            if dateOrDayString:
                dateOrDayString = dateOrDayString.lower()
            day = Event.DAY_DICT[dateOrDayString]
            try:
                endDateString = split[4]
                if endDateString:
                    endDate = datetime.strptime(endDateString, "%d.%m.%Y").date()
                    return createRepeatingEvent(name, place, day, time, endDate)
            except ValueError as err2:
                return u'EndDatum hat falsches Format.'
        except KeyError:
            return u'Als drittes Argument muss entweder ein Datum(TT.MM.JJJJ) oder ein Wochentag eingegeben werden'

def delete(user, additional):
    result = Responder.parseEvent(user, additional)
    if isinstance(result,Event.Event):
            date = result.date
            name = result.name
            result.key.delete()
            return u' Event ' + name + u' am ' + date.strftime("%d.%m.%Y %H:%M") + u' gelöscht.'
    if isinstance(result,basestring):
        return result


text:
[![Swift 5](https://img.shields.io/badge/swift-5-blue.svg)](https://swift.org)
[![MIT LiCENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![build status](https://secure.travis-ci.org/dankogai/swift-complex.png)](http://travis-ci.org/dankogai/swift-complex)

# CAVEAT: Swift Numerics vs. this module

With [apple/swift-numerics] complex number support on swift is [official at last].  You should consider using `ComplexModule` of `Numerics` instead of this.  I am switching to `swift-numerics` myself whereever I can. But there are still a few things that make you want to use this module in spite of that.

* `swift-numerics` relies 100% on swift package manager.  You cannot use it on Swift Playgrounds.
* `ComplexModule` may be too swifty on some respects.
  * `ComplexModule` adopts [point at infinity].  While this is mathmatically more correct, technically it may cause unexpected results because real operation on complex numbers is no longer isomorphic to real operations on real numbers.  For instance, `Complex(-1.0, 0.0) / Complex(0.0, 0.0)` is `Complex(+infinity, 0.0)`, not `Complex(-infinity, nan)` like many other platforms.

[apple/swift-numerics]: https://github.com/apple/swift-numerics
[official at last]: https://swift.org/blog/numerics/
[point at infinity]: https://en.wikipedia.org/wiki/Point_at_infinity

# swift-complex

Complex numbers in Swift and Swift Package Manager.

## Synopsis

````swift
import Complex
let z0 = 1.0 + 1.0.i    // (1.0+1.0.i)
let z1 = 1.0 - 1.0.i    // (1.0-1.0.i)
z0.conj // (1.0-1.0.i)
z0.i    // (-1.0+1.0.i)
z0.norm // 2
z0 + z1 // (2.0+0.0.i)
z0 - z1 // (0.0+2.0.i)
z0 * z1 // (2.0+0.0.i)
z0 / z1 // (0.0+1.0.i)
````

## Description

complex.swift implements all the functionality of [std::complex in c++11], arguably more intuitively.

[std::complex in c++11]: http://www.cplusplus.com/reference/complex/

### like C++11

* Protocol-Oriented  * Complex numbers are `Complex<R>` where `R` is a type of `.real` and `.imag` that conforms to the `ComplexElement` protocol or `GaussianIntElement` protocol.
  * In addition to basic arithmetic operations like `+`, `-`, `*`, `/` and `abs()`, `Complex<T:RealType>` gets `libm` functions like `exp()`, `log()`, `sin()`, `cos()`.

### unlike C++11

* Instead of defining the constant `i`, `Double` and `Complex` have a property `.i` which returns `self * Complex(0,1)` so it does not pollute the identifier `i`, too popularly used for iteration to make it a constant.
* Following functions are provided as compouted properties:
  * `z.abs` for `abs(z)`
  * `z.arg` for `arg(z)`
  * `z.norm` for `norm(z)`
  * `z.conj` for `conj(z)`
  * `z.proj` for `proj(z)`
* Construct a complex number via polar notation as:
  * `Complex(abs:magnitude, arg:argument)`

## Usage

### build

```sh
$ git clone https://github.com/dankogai/swift-complex.git
$ cd swift-complex # the following assumes your $PWD is here
$ swift build
```

### REPL

Simply

```sh
$ swift run --repl
```

or

```sh
$ scripts/run-repl.sh
```

or

```sh
$ swift build && swift -I.build/debug -L.build/debug -lComplex

```

and in your repl,

```sh
Welcome to Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1). Type :help for assistance.
  1> import Complex
  2> Complex.sqrt(1.i)
$R0: Complex.Complex<Double> = {
  real = 0.70710678118654757
  imag = 0.70710678118654757
}
````

### Xcode

Xcode project is deliberately excluded from the repository because it should be generated via `swift package generate-xcodeproj` . For convenience, you can

```
$ scripts/prep-xcode
```

And the Workspace opens up for you with Playground on top.  The playground is written as a manual.

### iOS and Swift Playground

Unfortunately Swift Package Manager does not support iOS.  To make matters worse Swift Playgrounds does not support modules.

Fortunately Playgrounds allow you to include swift source codes under `Sources` directory.  Just run:

```shell
$ scripts/ios-prep.sh
```

and you are all set.  `iOS/Complex.playground` now runs on Xcode and Playgrounds on macOS, and Playgrounds on iOS (Well, it is supposed to iPadOS but it is still labeled iOS).

![](img/playground.png)

### From Your SwiftPM-Managed Projects

Add the following to the `dependencies` section:

```swift
.package(
  url: "https://github.com/dankogai/swift-complex.git", from: "5.0.0"
)
```

and the following to the `.target` argument:

```swift
.target(
  name: "YourSwiftyPackage",
  dependencies: ["Complex"])
```

Now all you have to do is:

```swift
import Complex
```

in your code.  Enjoy!

### Prerequisite

Swift 5 or better, OS X or Linux to build.


text:
using namespace GafferScene;
using namespace GafferRenderMan;

IE_CORE_DEFINERUNTIMETYPED( InteractiveRenderManRender );

InteractiveRenderManRender::InteractiveRenderManRender( const std::string &name )
	:	InteractiveRender( name )
{
}

InteractiveRenderManRender::~InteractiveRenderManRender()
{
}

IECore::RendererPtr InteractiveRenderManRender::createRenderer() const
{
	return new IECoreRI::Renderer( "" );
}


text:
(function() {
  var socket = io.connect();

  socket.on('baseFeed', function(data) {
     $('
<button class="delete-post" data-id="' +
      data.key.time +
      '">Delete post</button><button class="edit-post" data-id="' +
      data.key.time +
      '">Edit post</button>
' +
      data.key.title +
      '

' +
      data.value.text +
      '

'
     ).appendTo('section.content');

    $('.delete-post').unbind('click');
    $('.delete-post').click(function(e) {
      var id = $(this).data('id');
      var title = $(this).siblings('h4').text();
      console.log(id);
      socket.emit('deletePost', {
        postTitle: title,
        postId: id
      });
      $(this).parent().fadeOut(500, function() {
        $(this).remove();
      });
    });

    $('.edit-post').unbind('click');
    $('.edit-post').click(function(e) {
      var id = $(this).data('id');
      var title = $(this).siblings('h4').text();
      var oldText = $(this).siblings('p').text();
      console.log(id);

      $('.editor').remove();
      $(this).parent().append(
        '
' +
        '<textarea>' +
        oldText +
        '</textarea>
' +
        '<button class="save-button">Save post</button>' +
        '<button class="cancel-button">Cancel</button>' +
        '
'
      );

      $('.cancel-button').unbind('click');
      $('.cancel-button').click(function(e) {
        $(this).parent().fadeOut(500, function() {
          $(this).remove();
        });
      });

      $('.save-button').unbind('click');
      $('.save-button').click(function(e) {
        var newText = $(this).siblings('textarea').val();
        var updateObj = {
          postTitle: title,
          postId: id,
          postContent: newText
        };
        socket.emit('updatePost', updateObj);

        $(this).parent().siblings('h4').text(title);
        $(this).parent().siblings('p').text(newText);

        $(this).parent().fadeOut(500, function() {
          $(this).remove();
        });
      });
    });

    socket.removeListener('baseFeed');
  });

})();


text:
<?php

use Aviator\Html\Tag;

if (!function_exists('toSlug')) {
    /**
     * Generate a url-friendly slug from a string.
     * @param  string  $string
     * @return string
     */
    function toSlug($string)
    {
        return (new \Cocur\Slugify\Slugify())->slugify($string);
    }
}

if (!function_exists('tag')) {
    /**
     * Get a tag instance.
     * @param string $name
     * @param array $classes
     * @param array $attributes
     * @return \Aviator\Html\Tag
     * @throws \Aviator\Html\Exceptions\ValidationException
     */
    function tag ($name, $classes = [], $attributes = [])
    {
        return new Tag($name, $classes, $attributes);
    }
}


text:
#region License

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

#endregion

using Tinkoff.Acquiring.Sdk.Requests;

namespace Tinkoff.Acquiring.Sdk.Builders
{
    class GetStateRequestBuilder : AcquiringRequestBuilder<GetStateRequest>
    {
        #region Ctor

        public GetStateRequestBuilder(string password, string terminalKey, Journal journal)
            : base(password, terminalKey, journal)
        { }

        #endregion

        #region Base Members

        protected override void Validate()
        {
            Assert.IsNonNullOrEmpty(Request.PaymentId, Fields.PAYMENTID);
        }

        #endregion

        #region Public Members

        /// <summary>
        /// Устанавливает уникальный идентификатор транзакции в системе Банка.
        /// </summary>
        public GetStateRequestBuilder SetPaymentId(string value)
        {
            Request.PaymentId = value;
            return this;
        }

        #endregion
    }
}


text:
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

function thinking(description) {
    var header = '
' + description + '
',
        spinner = '';

    // clear out old items
    $("#learning-pane-term, #learning-pane-predictor").empty();

    // add spinner
    $("#learning-pane-" + wordtype).html(header + spinner);

    // add overlays
    var otherterm = wordtype == 'term' ? 'predictor' : 'term';
    $("." + otherterm + "-pane").append(overlay);
}

function stopThinking() {
    if (wordtype == 'term') {
        $("#learning-pane-" + wordtype).html(term_div);
    } else {
        $("#learning-pane-" + wordtype).html(pred_div);
    }
}

function writeExisting(wordlist) {
    var outtext = '';
    for (i=0; i<wordlist.length; i++) {
        outtext += '
' + wordlist[i] + '
';
    }
    return outtext;
}

// global variables to keep track of things
var idx = 0,
    totalaccepts = 0,
    accepts = [],
    rejects = [],
    wordtype = 'term',
    thislist = [],
    thisround = 0;

// warning text for when a lot of terms and predictors are rejects
var term_rejects_warning = "
You are rejecting a lot of suggestions, so it's possible you have exhausted the " +
                           "list of terms for this concept. Press \"Stop\" at any time to end the term discovery " +
                           "process and submit the concept for review.
",
    pred_rejects_warning = "
Please keep in mind that predictors are only used to find new terms. They will not be used " +
                           "to identify trials associated with this concept, so do not need to be closely related to the concept itself.
" +
                           "
If it's possible a word or phrase may appear in the same sentence as this concept, you may " +
                           "want to accept it so the algorithm can find new terms to suggest.
",
    term_div = "
" +
               "A term is a word or phrase that is related to the concept.
" +
               "

",
    pred_div = "
" +
               "A predictor is a word or phrase that often co-occurs with the concept, e.g. "+
               ""hypertension" is often preceded by "chronic".
" +
               "

",
    overlay = "

";

// when document is ready...
$(function() {
    var concept_id = getParameterByName('cid'),
        initial_term = getParameterByName('term'),
        criteria_text_id = getParameterByName('id');

    thinking("Loading model...");

    $.getJSON($SCRIPT_ROOT + "_learning_startup", {
            concept_id: concept_id,
            criteria_text_id: criteria_text_id,
            initial_term: initial_term
        }, function( data ) {
            if (data.new_concept == 0) {
                $("#term-include").append(writeExisting(data.term));
                $("#term-exclude").append(writeExisting(data.term_exc));
                $("#predictor-include").append(writeExisting(data.predictor));
                $("#predictor-include").append(writeExisting(data.predictor_exc));
            };
            $.getJSON($SCRIPT_ROOT + "_learning_terms_w2v", {
                initial_term: initial_term,
                num: 20
                }, function( data ) {
                        stopThinking();
                        if (data.new_vals.length == 1) {
                            console.log('no word2vec for ' + initial_term);
                            startProcess();
                        } else {
                            thislist = data.new_vals;
                            learnWords();
                        }
                    });
    });

})

// decide what to do (main loop function)
function startProcess() {
    thisround++;
    $(".overlay-box").remove();

    // check if rejecting more than 75% of stuff...
    var thiscount = accepts.length + rejects.length,
        rejcount = rejects.length;
    if (thiscount >= 8 && rejcount / thiscount >= 0.75) {
        if (wordtype == 'term') {
            $("#rejects-warning-modal .modal-body").html(term_rejects_warning);
        } else {
            $("#rejects-warning-modal .modal-body").html(pred_rejects_warning);
        }
        $("#rejects-warning-modal").modal("show");
    }

    // decide what to do based on the existing word type
    if (wordtype == 'term') {
        wordtype = 'predictor';
        thinking("Loading new predictors...");
        idx = 0,
        accepts = [],
        rejects = [],
        getPredictors();
    } else {
        wordtype = 'term';
        thinking("Loading new terms...");
        idx = 0,
        accepts = [],
        rejects = [],
        getTerms();
    }
}

// writing data to database
function writeData() {
    $.getJSON($SCRIPT_ROOT + "_write_data", {
        acc: JSON.stringify(accepts),
        rej: JSON.stringify(rejects),
        wt: wordtype
    }, function(data) {
        return true;
    });
}

// getting predictors
function getPredictors() {
    $.getJSON($SCRIPT_ROOT + "_learning_preds", {}, function(data) {
        stopThinking();
        if (data.new_vals.length == 0) {
            startProcess();
        } else {
            thislist = data.new_vals;
            learnWords();
        }
    })
}

// getting terms
function getTerms() {
    $.getJSON($SCRIPT_ROOT + "_learning_terms_basic", {}, function(data) {
        stopThinking();
        if (data.new_vals.length == 0) {
            startProcess();
        } else {
            thislist = data.new_vals;
            learnWords();
        }
    })
}

// looping through terms/predictors in a single round
$("body").delegate("#accept-word", 'click', function(e) {
    var w = this.getAttribute('word');
    cycleWord(w, 'include', accepts);
});
$("body").delegate("#reject-word", 'click', function(e) {
    var w = this.getAttribute('word');
    cycleWord(w, 'exclude', rejects);
});
$("body").delegate("#quit-word", 'click', function(e) {
    $("#quit-warning-modal").modal('show');
});

function learnWords() {
    if (idx < thislist.length) {
        $("#learning-" + wordtype).empty();
        var this_word = thislist[idx].name;
        var word_attrs = 'word="' + this_word + '" ';
        var headertext = '';
        if (wordtype == 'term') {
            headertext = '
<col width="100%">' +
                         '

Is the term ' + this_word + ' related to this concept?

';
        } else {
            headertext = '
<col width="100%">' +
                         '

Does ' + this_word + ' sometimes appear with this concept?

';
        }
        var this_progress = Math.round((idx + 1) / thislist.length * 100);
        $("#learning-" + wordtype).html(headertext +
                                   '

' +
                                     '<button id="accept-word" ' + word_attrs + ' class="btn btn-success btn-sm word-btn">Yes</button> ' +
                                     '<button id="reject-word" ' + word_attrs + ' class="btn btn-danger btn-sm word-btn">No</button> ' +
                                     '<button id="quit-word" class="btn btn-default btn-sm word-btn">Stop</button> ' +
                                   '

' +
                                   '
Progress:  ' +
                                    (idx + 1) + ' / ' + thislist.length + ' ' + wordtype + (thislist.length > 1 ? 's' : '') +
                                    ' until ' + (wordtype == 'term' ? 'predictor' : 'term') + ' step' +
                                     '
' +
                                       '
' +
                                       '' + this_progress + '% Complete (success)' +
                                       '
' +
                                     '

');
    } else if (thisround < 10) {
        writeData();
        startProcess();
    } else {
        $("#rounds-10-modal").modal('show');
        $("#rounds-10-submit").on('click', function(e) {
            writeData();
            $.getJSON($SCRIPT_ROOT + '_clear_session', {}, function(data) {
                closeWindow();
            });
        });
    }

}

function cycleWord(w, incexc, arr) {
    arr.push(w);
    if (incexc == 'include' && wordtype == 'term') {
        totalaccepts++;
        if (totalaccepts == 20) {
            $("#terms-20-modal").modal("show");
        }
    }
    var thisid = thisround*100 + idx;
    $("#" + wordtype + "-" + incexc).prepend("
" + w + "
");
    $("#t-" + thisid).effect("highlight", {}, 1000);
    idx++;
    learnWords();
}

// modal interaction

function closeWindow() {
  if (confirm("Close Window?")) {
    close();
  }
}

$("body").delegate("#quit-warning-cancel", 'click', function(e) {
    $("#learning-" + wordtype).empty();
    startProcess();
});

$("body").delegate("#quit-warning-submit", 'click', function(e) {
    writeData();
    $.getJSON($SCRIPT_ROOT + '_clear_session', {}, function(data) {
        $("#quit-warning-modal").modal('hide');
        $("#close-window-modal").modal('show');
    });
});

$("body").delegate("#close-window-submit", 'click', function(e) {
    window.open($SCRIPT_ROOT, "_self");
});

// rename concept
$("#rename-concept").on('click', function(e) {
    $.getJSON($SCRIPT_ROOT + "_concept_terms", {
        acc: JSON.stringify(accepts)
    }, function(data) {
        var new_html = "
Please select one of the following terms to be the name of this concept:
" +
                        "
" +
                         "<button class='btn btn-default dropdown-toggle dropdown-wide' type='button' id='all-term-dropdown' data-toggle='dropdown' aria-expanded='true'>" +
                         "" +
                         "</button>" +
                        "
";
        for (i=0; i<data.all_terms.length; i++) {
            new_html += "
" + data.all_terms[i] + "
";
        }
        new_html += "

";
        $("#rename-concept-modal .modal-body").html(new_html);
        $("#rename-concept-modal").modal('show');
        $(".dropdown-menu li a").on('click', function(e) {
            var new_name = $(this).text();
            $.getJSON($SCRIPT_ROOT + '_rename_concept', {
                new_name: new_name
            }, function(data) {
                if (data.done) {
                    $("#concept-name").text(new_name);
                } else {
                    alert("Sorry, there was a problem. Please try again later.");
                }
                $("#rename-concept-modal").modal('hide');
            })
        });
    });
});


text:
package org.onosproject.net.resource;

import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onlab.packet.VlanId;
import org.onlab.util.Identifier;
import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.intent.IntentId;

public class ResourceAllocationTest {

    private static final DeviceId D1 = DeviceId.deviceId("of:001");
    private static final DeviceId D2 = DeviceId.deviceId("of:002");
    private static final PortNumber P1 = PortNumber.portNumber(1);
    private static final PortNumber P2 = PortNumber.portNumber(2);
    private static final VlanId VLAN1 = VlanId.vlanId((short) 100);
    private static final VlanId VLAN2 = VlanId.vlanId((short) 200);
    private static final TestResourceConsumer RC2 = new TestResourceConsumer(2L);

    // ResourceConsumerId generated by specifying ID and class name
    private static final ResourceConsumerId RCID1 = ResourceConsumerId.of(30L, IntentId.class);

    // ResourceConsumerId generated from Identifier<Long> class
    private static final ResourceConsumerId RCID2 = ResourceConsumerId.of(RC2);

    @Test
    public void testEquals() {
        ResourceAllocation alloc1 = new ResourceAllocation(Resources.discrete(D1, P1, VLAN1).resource(), RCID1);
        ResourceAllocation sameAsAlloc1 = new ResourceAllocation(Resources.discrete(D1, P1, VLAN1).resource(), RCID1);
        ResourceAllocation alloc2 = new ResourceAllocation(Resources.discrete(D2, P2, VLAN2).resource(), RCID2);
        ResourceAllocation sameAsAlloc2 = new ResourceAllocation(Resources.discrete(D2, P2, VLAN2).resource(), RCID2);

        new EqualsTester()
                .addEqualityGroup(alloc1, sameAsAlloc1)
                .addEqualityGroup(alloc2, sameAsAlloc2)
                .testEquals();
    }

    private static class TestResourceConsumer extends Identifier<Long> implements ResourceConsumer {
        public TestResourceConsumer(long idValue) {
            super(idValue);
        }

        @Override
        public ResourceConsumerId consumerId() {
            return ResourceConsumerId.of(this);
        }
    }
}


text:
'use strict'

const path = require('path')

module.exports = function standardNamingStrategy(filename) {
  /*
   * TODO we may want to do some normalization for filenames that are not legal
   * JavaScript names. For instance, we may want to convert `html-case.js`
   * to `htmlCase` since such files would otherwise be un-injectable.
   *
   * We may also want to convert `snake_case.js` to
   * `snakeCase` to better fit with JavaScript naming conventions, but this is
   * less critical since these are legal JavaScript variable names.
   */
  const extension = path.extname(filename)
  const basename = path.basename(filename, extension)
  return basename
}


text:
package cubicchunks.world.dependency;

import cubicchunks.world.cube.Cube;
import cubicchunks.worldgen.GeneratorStage;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.HashSet;

/**
 * Keeps track of Dependents of a given Cube and provides encapsulation for adding, removing and updating the
 * Dependents.
 */
public class RequiredCube {

	/**
	 * The Cube whose Dependents this RequiredCube manages. Null if the Cube has not yet been loaded.
	 */
	private Cube cube;

	/**
	 * A Collection containing all Dependents requiring this Cube to remain loaded.
	 */
	private Collection<Dependent> dependents;

	/**
	 * Creates a new instance of RequiredCube for a Cube that has not yet been loaded.
	 */
	public RequiredCube() {
		this.cube = null;
		this.dependents = new HashSet<>();
	}

	/**
	 * Creates a new instance of RequiredCube for a given Cube.
	 *
	 * @param cube The Cube for which this instance will keep track of its Dependents.
	 */
	public RequiredCube(@Nonnull Cube cube) {
		this.cube = cube;
		this.dependents = new HashSet<>();
	}

	/**
	 * Returns the Cube whose Dependents this RequiredCube manages.
	 *
	 * @return The Cube whose Dependents this RequiredCube manages.
	 */
	@Nullable
	public Cube getCube() {
		return this.cube;
	}

	/**
	 * Sets the Cube whose Dependents this RequiredCube manages.
	 *
	 * @param cube The Cube whose Dependents this RequiredCube manages
	 */
	public void setCube(@Nonnull Cube cube) {
		this.cube = cube;
	}

	/**
	 * Sets the GeneratorStage at which this Cube must be for all of its Dependents to be satisfied. If the current
	 * targetStage precedes the given stage, sets the new stage. Otherwise, does nothing.
	 *
	 * @param requiredStage The stage to be set.
	 */
	public void setTargetStage(@Nonnull GeneratorStage requiredStage) {
		if (this.cube.getTargetStage().precedes(requiredStage)) {
			this.cube.setTargetStage(requiredStage);
		}
	}

	/**
	 * Returns true iff this Cube is currently loaded on the server.
	 *
	 * @return True iff this Cube is currently available.
	 */
	public boolean isAvailable() {
		return this.cube != null;
	}

	/**
	 * Adds a Dependent of this RequiredCube.
	 *
	 * @param dependent The Dependent to be added.
	 * @return True iff the dependent was added.
	 */
	public boolean addDependent(@Nonnull Dependent dependent) {
		return this.dependents.add(dependent);
	}

	/**
	 * Removes a Dependent of this RequiredCube.
	 *
	 * @param dependent The Dependent to be removed.
	 * @return True iff the Dependent was removed.
	 */
	public boolean removeDependent(@Nonnull Dependent dependent) {
		return this.dependents.remove(dependent);
	}

	/**
	 * Returns true iff there is at least one Cube requiring this Cube to be loaded.
	 * @return
	 */
	public boolean isRequired() {
		return this.dependents.size() > 0;
	}

	/**
	 * Notifies all of the Cube's dependents about the Cube's current status.
	 */
	public void updateDependents(@Nonnull DependencyManager manager) {
		for (Dependent dependent : this.dependents) {
			dependent.update(manager, this.cube);
		}
	}

}


text:
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;

/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
    funcTag = '[object Function]',
    genTag = '[object GeneratorFunction]',
    stringTag = '[object String]';

/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;

/**
 * The base implementation of `_.times` without support for iteratee shorthands
 * or max array length checks.
 *
 * @private
 * @param {number} n The number of times to invoke `iteratee`.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array} Returns the array of results.
 */
function baseTimes(n, iteratee) {
  var index = -1,
      result = Array(n);

  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}

/**
 * Checks if `value` is a valid array-like index.
 *
 * @private
 * @param {*} value The value to check.
 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
 */
function isIndex(value, length) {
  value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
  length = length == null ? MAX_SAFE_INTEGER : length;
  return value > -1 && value % 1 == 0 && value < length;
}

/** Used for built-in method references. */
var objectProto = Object.prototype;

/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;

/**
 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
 * of values.
 */
var objectToString = objectProto.toString;

/** Built-in value references. */
var getPrototypeOf = Object.getPrototypeOf,
    propertyIsEnumerable = objectProto.propertyIsEnumerable;

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = Object.keys;

/**
 * The base implementation of `_.forEach` without support for iteratee shorthands.
 *
 * @private
 * @param {Array|Object} collection The collection to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Array|Object} Returns `collection`.
 */
var baseEach = createBaseEach(baseForOwn);

/**
 * The base implementation of `baseForIn` and `baseForOwn` which iterates
 * over `object` properties returned by `keysFunc` invoking `iteratee` for
 * each property. Iteratee functions may exit iteration early by explicitly
 * returning `false`.
 *
 * @private
 * @param {Object} object The object to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @param {Function} keysFunc The function to get the keys of `object`.
 * @returns {Object} Returns `object`.
 */
var baseFor = createBaseFor();

/**
 * The base implementation of `_.forOwn` without support for iteratee shorthands.
 *
 * @private
 * @param {Object} object The object to iterate over.
 * @param {Function} iteratee The function invoked per iteration.
 * @returns {Object} Returns `object`.
 */
function baseForOwn(object, iteratee) {
  return object && baseFor(object, iteratee, keys);
}

/**
 * The base implementation of `_.has` without support for deep paths.
 *
 * @private
 * @param {Object} object The object to query.
 * @param {Array|string} key The key to check.
 * @returns {boolean} Returns `true` if `key` exists, else `false`.
 */
function baseHas(object, key) {
  // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
  // that are composed entirely of index properties, return `false` for
  // `hasOwnProperty` checks of them.
  return hasOwnProperty.call(object, key) ||
    (typeof object == 'object' && key in object && getPrototypeOf(object) === null);
}

/**
 * The base implementation of `_.keys` which doesn't skip the constructor
 * property of prototypes or treat sparse arrays as dense.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 */
function baseKeys(object) {
  return nativeKeys(Object(object));
}

/**
 * The base implementation of `_.property` without support for deep paths.
 *
 * @private
 * @param {string} key The key of the property to get.
 * @returns {Function} Returns the new function.
 */
function baseProperty(key) {
  return function(object) {
    return object == null ? undefined : object[key];
  };
}

/**
 * Creates a `baseEach` or `baseEachRight` function.
 *
 * @private
 * @param {Function} eachFunc The function to iterate over a collection.
 * @param {boolean} [fromRight] Specify iterating from right to left.
 * @returns {Function} Returns the new base function.
 */
function createBaseEach(eachFunc, fromRight) {
  return function(collection, iteratee) {
    if (collection == null) {
      return collection;
    }
    if (!isArrayLike(collection)) {
      return eachFunc(collection, iteratee);
    }
    var length = collection.length,
        index = fromRight ? length : -1,
        iterable = Object(collection);

    while ((fromRight ? index-- : ++index < length)) {
      if (iteratee(iterable[index], index, iterable) === false) {
        break;
      }
    }
    return collection;
  };
}

/**
 * Creates a base function for methods like `_.forIn`.
 *
 * @private
 * @param {boolean} [fromRight] Specify iterating from right to left.
 * @returns {Function} Returns the new base function.
 */
function createBaseFor(fromRight) {
  return function(object, iteratee, keysFunc) {
    var index = -1,
        iterable = Object(object),
        props = keysFunc(object),
        length = props.length;

    while (length--) {
      var key = props[fromRight ? length : ++index];
      if (iteratee(iterable[key], key, iterable) === false) {
        break;
      }
    }
    return object;
  };
}

/**
 * Gets the "length" property value of `object`.
 *
 * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
 * that affects Safari on at least iOS 8.1-8.3 ARM64.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {*} Returns the "length" value.
 */
var getLength = baseProperty('length');

/**
 * Creates an array of index keys for `object` values of arrays,
 * `arguments` objects, and strings, otherwise `null` is returned.
 *
 * @private
 * @param {Object} object The object to query.
 * @returns {Array|null} Returns index keys, else `null`.
 */
function indexKeys(object) {
  var length = object ? object.length : undefined;
  if (isLength(length) &&
      (isArray(object) || isString(object) || isArguments(object))) {
    return baseTimes(length, String);
  }
  return null;
}

/**
 * Checks if `value` is likely a prototype object.
 *
 * @private
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
 */
function isPrototype(value) {
  var Ctor = value && value.constructor,
      proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;

  return value === proto;
}

/**
 * Checks if `value` is likely an `arguments` object.
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
 * @example
 *
 * _.isArguments(function() { return arguments; }());
 * // => true
 *
 * _.isArguments([1, 2, 3]);
 * // => false
 */
function isArguments(value) {
  // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
  return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
    (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}

/**
 * Checks if `value` is classified as an `Array` object.
 *
 * @static
 * @memberOf _
 * @type {Function}
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
 * @example
 *
 * _.isArray([1, 2, 3]);
 * // => true
 *
 * _.isArray(document.body.children);
 * // => false
 *
 * _.isArray('abc');
 * // => false
 *
 * _.isArray(_.noop);
 * // => false
 */
var isArray = Array.isArray;

/**
 * Checks if `value` is array-like. A value is considered array-like if it's
 * not a function and has a `value.length` that's an integer greater than or
 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
 * @example
 *
 * _.isArrayLike([1, 2, 3]);
 * // => true
 *
 * _.isArrayLike(document.body.children);
 * // => true
 *
 * _.isArrayLike('abc');
 * // => true
 *
 * _.isArrayLike(_.noop);
 * // => false
 */
function isArrayLike(value) {
  return value != null && isLength(getLength(value)) && !isFunction(value);
}

/**
 * This method is like `_.isArrayLike` except that it also checks if `value`
 * is an object.
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
 * @example
 *
 * _.isArrayLikeObject([1, 2, 3]);
 * // => true
 *
 * _.isArrayLikeObject(document.body.children);
 * // => true
 *
 * _.isArrayLikeObject('abc');
 * // => false
 *
 * _.isArrayLikeObject(_.noop);
 * // => false
 */
function isArrayLikeObject(value) {
  return isObjectLike(value) && isArrayLike(value);
}

/**
 * Checks if `value` is classified as a `Function` object.
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
 * @example
 *
 * _.isFunction(_);
 * // => true
 *
 * _.isFunction(/abc/);
 * // => false
 */
function isFunction(value) {
  // The use of `Object#toString` avoids issues with the `typeof` operator
  // in Safari 8 which returns 'object' for typed array and weak map constructors,
  // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
  var tag = isObject(value) ? objectToString.call(value) : '';
  return tag == funcTag || tag == genTag;
}

/**
 * Checks if `value` is a valid array-like length.
 *
 * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
 * @example
 *
 * _.isLength(3);
 * // => true
 *
 * _.isLength(Number.MIN_VALUE);
 * // => false
 *
 * _.isLength(Infinity);
 * // => false
 *
 * _.isLength('3');
 * // => false
 */
function isLength(value) {
  return typeof value == 'number' &&
    value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}

/**
 * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
 * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
 * @example
 *
 * _.isObject({});
 * // => true
 *
 * _.isObject([1, 2, 3]);
 * // => true
 *
 * _.isObject(_.noop);
 * // => true
 *
 * _.isObject(null);
 * // => false
 */
function isObject(value) {
  var type = typeof value;
  return !!value && (type == 'object' || type == 'function');
}

/**
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 * and has a `typeof` result of "object".
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 * @example
 *
 * _.isObjectLike({});
 * // => true
 *
 * _.isObjectLike([1, 2, 3]);
 * // => true
 *
 * _.isObjectLike(_.noop);
 * // => false
 *
 * _.isObjectLike(null);
 * // => false
 */
function isObjectLike(value) {
  return !!value && typeof value == 'object';
}

/**
 * Checks if `value` is classified as a `String` primitive or object.
 *
 * @static
 * @memberOf _
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
 * @example
 *
 * _.isString('abc');
 * // => true
 *
 * _.isString(1);
 * // => false
 */
function isString(value) {
  return typeof value == 'string' ||
    (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);
}

/**
 * Creates an array of the own enumerable property names of `object`.
 *
 * **Note:** Non-object values are coerced to objects. See the
 * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
 * for more details.
 *
 * @static
 * @memberOf _
 * @category Object
 * @param {Object} object The object to query.
 * @returns {Array} Returns the array of property names.
 * @example
 *
 * function Foo() {
 *   this.a = 1;
 *   this.b = 2;
 * }
 *
 * Foo.prototype.c = 3;
 *
 * _.keys(new Foo);
 * // => ['a', 'b'] (iteration order is not guaranteed)
 *
 * _.keys('hi');
 * // => ['0', '1']
 */
function keys(object) {
  var isProto = isPrototype(object);
  if (!(isProto || isArrayLike(object))) {
    return baseKeys(object);
  }
  var indexes = indexKeys(object),
      skipIndexes = !!indexes,
      result = indexes || [],
      length = result.length;

  for (var key in object) {
    if (baseHas(object, key) &&
        !(skipIndexes && (key == 'length' || isIndex(key, length))) &&
        !(isProto && key == 'constructor')) {
      result.push(key);
    }
  }
  return result;
}

module.exports = baseEach;