text:
.quickdate{display:inline-block;vertical-align:bottom;font-size:15px;font-family:'Helvetica Neue',Helvetica,Ariel,sans-serif;}
.quickdate input,.quickdate select{font-size:13px}
.quickdate-button{background:#fff;color:#333;border:solid 1px #ccc;box-shadow:outset 0 1px 1px rgba(0,0,0,0.075);border-radius:4px;padding:4px 8px;display:inline-block;text-decoration:none;}
.quickdate-button:hover{text-decoration:underline;}
.quickdate-button:hover i{text-decoration:none}
.quickdate-button i{padding-right:4px}
.quickdate-popup{color:#333;font-size:15px;background-color:#fafafa;border:solid 1px #ddd;border-radius:3px;-webkit-box-shadow:0 10px 30px rgba(25,25,25,0.92);-moz-box-shadow:0 10px 30px rgba(25,25,25,0.92);box-shadow:0 10px 30px rgba(25,25,25,0.92)}
.quickdate-action-link:visited,.quickdate-action-link:hover{color:#333}
.quickdate-next-month i{padding-left:10px}
.quickdate-prev-month i{padding-right:10px}
table.quickdate-calendar{border:solid 1px #ccc;background-color:#fff;}
table.quickdate-calendar th,table.quickdate-calendar td{border-right:1px solid #ccc;border-bottom:1px solid #ccc}
table.quickdate-calendar td:hover{background-color:#e6e6e6}
table.quickdate-calendar td.other-month{background-color:#dcdcdc;color:#707070;}
table.quickdate-calendar td.other-month:hover{background-color:#c8c8c8}
table.quickdate-calendar td.disabled-date{background-color:inherit;color:#d6d6d6;}
table.quickdate-calendar td.disabled-date:hover{background-color:inherit;cursor:default}
table.quickdate-calendar td.selected{background-color:#b0ccde;font-weight:bold}
table.quickdate-calendar td.is-today{color:#b58922;font-weight:bold;}
table.quickdate-calendar td.is-today.disabled-date{color:#978a6c;font-weight:normal}
.quickdate-popup-footer{margin:3px 1px 0}
.quickdate-clear{display:inline-block;padding:2px 4px;background-color:#fff;color:#333;border:solid 1px #ccc;box-shadow:outset 0 1px 1px rgba(0,0,0,0.075);border-radius:4px;text-decoration:none;}
.quickdate-clear:hover{background-color:#f2f2f2}

redpajama_set_name: RedPajamaGithub


text:
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var BUILD_DIR = path.resolve(__dirname, 'build');
var APP_DIR = path.resolve(__dirname, 'src/app');

var htmlConfig = new HtmlWebpackPlugin({
	template: APP_DIR + '/index.html',
	filename: 'index.html',
	inject: 'body'
});

var copyConfig = new CopyWebpackPlugin([
	{from: APP_DIR+'/extension', to: './', force: false}
])

module.exports = {
	entry:  APP_DIR + '/index.jsx',

	output: {
		path: BUILD_DIR,
		filename: 'bundle.js'
	},

	module: {
		loaders: [
		  { test: /\.jsx?$/, include: APP_DIR, loader: 'babel-loader?presets[]=es2015&presets[]=react' },
		]
	},

  	plugins: [htmlConfig, copyConfig]
}


text:
namespace llvm {

class raw_ostream;
namespace pdb {

class PDBSymbolTypePointer : public PDBSymbol {
public:
  PDBSymbolTypePointer(const IPDBSession &PDBSession,
                       std::unique_ptr<IPDBRawSymbol> Symbol);

  DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::PointerType)

  void dump(PDBSymDumper &Dumper) const override;
  void dumpRight(PDBSymDumper &Dumper) const override;

  FORWARD_SYMBOL_METHOD(isConstType)
  FORWARD_SYMBOL_METHOD(getLength)
  FORWARD_SYMBOL_ID_METHOD(getLexicalParent)
  FORWARD_SYMBOL_METHOD(isReference)
  FORWARD_SYMBOL_METHOD(isRValueReference)
  FORWARD_SYMBOL_METHOD(isPointerToDataMember)
  FORWARD_SYMBOL_METHOD(isPointerToMemberFunction)
  FORWARD_SYMBOL_ID_METHOD_WITH_NAME(getType, getPointeeType)
  FORWARD_SYMBOL_METHOD(isRestrictedType)
  FORWARD_SYMBOL_METHOD(isUnalignedType)
  FORWARD_SYMBOL_METHOD(isVolatileType)
};

} // namespace llvm
}

#endif // LLVM_DEBUGINFO_PDB_PDBSYMBOLTYPEPOINTER_H


text:
 package com.indeed.imhotep.local;

import java.util.Arrays;

import com.indeed.util.core.threads.ThreadSafeBitSet;
import com.indeed.flamdex.datastruct.FastBitSet;
import com.indeed.imhotep.BitTree;
import com.indeed.imhotep.GroupRemapRule;

final class CharGroupLookup extends GroupLookup {
    /**
     *
     */
    private final ImhotepLocalSession session;
    private final char[] docIdToGroup;

    CharGroupLookup(ImhotepLocalSession imhotepLocalSession, int size) {
        session = imhotepLocalSession;
        docIdToGroup = new char[size];
    }

    @Override
    public void nextGroupCallback(int n, long[][] termGrpStats, BitTree groupsSeen) {
        int rewriteHead = 0;
        // remap groups and filter out useless docids (ones with group = 0), keep track of groups that were found
        for (int i = 0; i < n; i++) {
            final int docId = session.docIdBuf[i];
            final int group = docIdToGroup[docId];
            if (group == 0) continue;

            session.docGroupBuffer[rewriteHead] = group;
            session.docIdBuf[rewriteHead] = docId;
            rewriteHead++;
        }
        groupsSeen.set(session.docGroupBuffer, rewriteHead);

        if (rewriteHead > 0) {
            for (int statIndex = 0; statIndex < session.numStats; statIndex++) {
                ImhotepLocalSession.updateGroupStatsDocIdBuf(session.statLookup[statIndex], termGrpStats[statIndex], session.docGroupBuffer, session.docIdBuf, session.valBuf, rewriteHead);
            }
        }
    }

    @Override
    public void applyIntConditionsCallback(int n, ThreadSafeBitSet docRemapped, GroupRemapRule[] remapRules, String intField, long itrTerm) {
        for (int i = 0; i < n; i++) {
            final int docId = session.docIdBuf[i];
            if (docRemapped.get(docId)) continue;
            final int group = docIdToGroup[docId];
            if (remapRules[group] == null) continue;
            if (ImhotepLocalSession.checkIntCondition(remapRules[group].condition, intField, itrTerm)) continue;
            docIdToGroup[docId] = (char)remapRules[group].positiveGroup;
            docRemapped.set(docId);
        }
    }

    @Override
    public void applyStringConditionsCallback(int n, ThreadSafeBitSet docRemapped, GroupRemapRule[] remapRules, String stringField, String itrTerm) {
        for (int i = 0; i < n; i++) {
            final int docId = session.docIdBuf[i];
            if (docRemapped.get(docId)) continue;
            final int group = docIdToGroup[docId];
            if (remapRules[group] == null) continue;
            if (ImhotepLocalSession.checkStringCondition(remapRules[group].condition, stringField, itrTerm)) continue;
            docIdToGroup[docId] = (char)remapRules[group].positiveGroup;
            docRemapped.set(docId);
        }
    }

    @Override
    public int get(int doc) {
        return docIdToGroup[doc];
    }

    @Override
    public void set(int doc, int group) {
        docIdToGroup[doc] = (char)group;
    }

    @Override
    public void batchSet(int[] docIdBuf, int[] docGrpBuffer, int n) {
        for (int i = 0; i < n; ++i) {
            docIdToGroup[docIdBuf[i]] = (char)docGrpBuffer[i];
        }
    }

    @Override
    public void fill(int group) {
        if (group > Character.MAX_VALUE) {
            throw new IllegalArgumentException("group is too big: group="+group+", max="+Character.MAX_VALUE);
        }

        Arrays.fill(docIdToGroup, (char)group);
    }

    @Override
    public void copyInto(GroupLookup other) {
        if (docIdToGroup.length != other.size()) {
            throw new IllegalArgumentException("size != other.size: size="+docIdToGroup.length+", other.size="+other.size());
        }

        for (int i = 0; i < docIdToGroup.length; ++i) {
            other.set(i, docIdToGroup[i]);
        }
        other.numGroups = this.numGroups;
    }

    @Override
    public int size() {
        return docIdToGroup.length;
    }

    @Override
    public int maxGroup() {
        return 65535;
    }

    @Override
    public long memoryUsed() {
        return 2L*docIdToGroup.length;
    }

    @Override
    public void fillDocGrpBuffer(int[] docIdBuf, int[] docGrpBuffer, int n) {
        for (int i = 0; i < n; ++i) {
            docGrpBuffer[i] = docIdToGroup[docIdBuf[i]];
        }
    }

    @Override
    public void fillDocGrpBufferSequential(final int start, final int[] docGrpBuffer, final int n) {
        for (int i = 0; i < n; i++) {
            docGrpBuffer[i] = docIdToGroup[start+i];
        }
    }

    @Override
    public void bitSetRegroup(FastBitSet bitSet, int targetGroup, int negativeGroup, int positiveGroup) {
        for (int i = 0; i < docIdToGroup.length; ++i) {
            if (docIdToGroup[i] == targetGroup) {
                docIdToGroup[i] = (char) (bitSet.get(i) ? positiveGroup : negativeGroup);
            }
        }
    }

    @Override
    protected void recalculateNumGroups() {
        int max = 0;
        for (final char group : docIdToGroup) {
            max = Math.max(max, group + 1);
        }
        this.numGroups = max;
        return;
    }

    public static long calcMemUsageForSize(int sz) {
        return sz * 2;
    }

    @Override
    public ImhotepLocalSession getSession() {
        return this.session;
    }
}


text:
package com.taoswork.tallycheck.datadomain.onmongo;

import com.taoswork.tallycheck.datadomain.base.entity.Persistable;
import org.bson.types.ObjectId;

/**
 * Created by Gao Yuan on 2016/02/8.
 */
public interface PersistableDocument extends Persistable {
    ObjectId getId();

    void setId(ObjectId id);
}


text:
require 'spec_helper'

describe Seth::Resource::Subversion do

  before do
    @svn = Seth::Resource::Subversion.new("ohai, svn project!")
  end

  it "is a subclass of Resource::Scm" do
    @svn.should be_an_instance_of(Seth::Resource::Subversion)
    @svn.should be_a_kind_of(Seth::Resource::Scm)
  end

  it "uses the subversion provider" do
    @svn.provider.should eql(Seth::Provider::Subversion)
  end

  it "allows the force_export action" do
    @svn.allowed_actions.should include(:force_export)
  end

  it "sets svn info arguments to --no-auth-cache by default" do
    @svn.svn_info_args.should == '--no-auth-cache'
  end

  it "resets svn info arguments to nil when given false in the setter" do
    @svn.svn_info_args(false)
    @svn.svn_info_args.should be_nil
  end

  it "sets svn arguments to --no-auth-cache by default" do
    @svn.svn_arguments.should == '--no-auth-cache'
  end

  it "resets svn arguments to nil when given false in the setter" do
    @svn.svn_arguments(false)
    @svn.svn_arguments.should be_nil
  end

  it "hides password from custom exception message" do
    @svn.svn_password "l33th4x0rpa$$w0rd"
    e = @svn.customize_exception(Seth::Exceptions::Exec.new "Exception with password #{@svn.svn_password}")
    e.message.include?(@svn.svn_password).should be_false
  end
end


text:
package com.swfarm.biz.chain.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import com.swfarm.biz.chain.bo.ReturnPurchaseTask;
import com.swfarm.biz.chain.srv.PurchaseService;

public class SaveReturnPurchaseTaskController extends AbstractController {

	private PurchaseService purchaseService;

	public void setPurchaseService(PurchaseService purchaseService) {
		this.purchaseService = purchaseService;
	}

	@Override
    protected ModelAndView handleRequestInternal(HttpServletRequest req,
            HttpServletResponse res) throws Exception {
        String returnPurchaseTaskIdStr = req.getParameter("id");
        String comments = req.getParameter("comments");
        if (StringUtils.isNotEmpty(returnPurchaseTaskIdStr)) {
            Long returnPurchaseTaskId = new Long(returnPurchaseTaskIdStr);
            ReturnPurchaseTask returnPurchaseTask = this.purchaseService
                    .findReturnPurchaseTask(returnPurchaseTaskId);
            if (returnPurchaseTask != null) {
            	if (StringUtils.isNotEmpty(comments))
            		returnPurchaseTask.setComments(comments);
        		this.purchaseService.saveReturnPurchaseTask(returnPurchaseTask);
            }
        }
        return new ModelAndView("redirect:/chain/returnpurchasetask.shtml", "id",
        		returnPurchaseTaskIdStr);
    }

}


text:
FROM colinrhodes/base

MAINTAINER Colin Rhodes <colin@colin-rhodes.com>

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68854915
ADD pypy.list /etc/apt/sources.list.d/pypy.list
RUN apt-get -yq update
RUN apt-get -yq install pypy

ADD https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py pip.py
RUN pypy pip.py
RUN rm pip.py


text:
package org.xbib.metrics;

public interface Metric {
}


text:
package org.apache.camel.component.telegram.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Contains information about a sticker.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class IncomingSticker {

    @JsonProperty("file_id")
    private String fileId;

    private Integer width;

    private Integer height;

    @JsonProperty("is_animated")
    private Boolean isAnimated;

    private IncomingPhotoSize thumb;

    private String emoji;

    @JsonProperty("set_name")
    private String setName;

    @JsonProperty("mask_position")
    private IncomingMaskPosition maskPosition;

    public IncomingSticker() {
    }

    public String getFileId() {
        return fileId;
    }

    public void setFileId(String fileId) {
        this.fileId = fileId;
    }

    public Integer getWidth() {
        return width;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public Boolean getAnimated() {
        return isAnimated;
    }

    public void setAnimated(Boolean animated) {
        isAnimated = animated;
    }

    public IncomingPhotoSize getThumb() {
        return thumb;
    }

    public void setThumb(IncomingPhotoSize thumb) {
        this.thumb = thumb;
    }

    public String getEmoji() {
        return emoji;
    }

    public void setEmoji(String emoji) {
        this.emoji = emoji;
    }

    public String getSetName() {
        return setName;
    }

    public void setSetName(String setName) {
        this.setName = setName;
    }

    public IncomingMaskPosition getMaskPosition() {
        return maskPosition;
    }

    public void setMaskPosition(IncomingMaskPosition maskPosition) {
        this.maskPosition = maskPosition;
    }

    @Override
    public String toString() {
        return "IncomingSticker{"
            + "fileId='" + fileId + '\''
            + ", width=" + width
            + ", height=" + height
            + ", isAnimated=" + isAnimated
            + ", thumb=" + thumb
            + ", emoji='" + emoji + '\''
            + ", setName='" + setName + '\''
            + ", maskPosition=" + maskPosition
            + '}';
    }
}


text:
/*
 * Program options.
 * https://k6.io/docs/using-k6/options
 */

import { CipherSuite } from './http';

/**
 * Program options.
 * https://k6.io/docs/using-k6/options
 */
export interface Options {
    /** Maximum parallel `http.batch()` connections per VU. */
    batch?: number;

    /** Maximum parallel `http.batch()` host connections per VU. */
    batchPerHost?: number;

    /** Blacklist IP ranges from being called. */
    blacklistIPs?: string[];

    /** Discard response bodies. */
    discardResponseBodies?: boolean;

    /** Test duration. */
    duration?: string;

    /** Third party collector configuration. */
    ext?: { [name: string]: CollectorOptions };

    /** Static hostname mapping. */
    hosts?: { [name: string]: string };

    /** Log all HTTP requests and responses. */
    httpDebug?: string;

    /** Disable TLS verification. Insecure. */
    insecureSkipTLSVerify?: boolean;

    /** Iterations to execute. */
    iterations?: number;

    /** Persist the k6 process after test completion. */
    linger?: boolean;

    /** Maximum HTTP redirects to follow. */
    maxRedirects?: number;

    /** Minimum test iteration duration. */
    minIterationDuration?: string;

    /** Disable keepalive connections. */
    noConnectionReuse?: boolean;

    /** Disable usage reports. */
    noUsageReport?: boolean;

    /** Disable cross-VU TCP connection reuse. */
    noVUConnectionReuse?: boolean;

    /** Start test in paused state. */
    paused?: boolean;

    /** Maximum requests per second across all VUs. */
    rps?: number;

    /** Setup function timeout. */
    setupTimeout?: string;

    /** Test stage specifications. Program of target VU stages. */
    stages?: Stage[];

    /** Define stats for trend metrics. */
    summaryTrendStats?: string[];

    /** Which system tags to include in collected metrics. */
    systemTags?: string[];

    /** Tags to set test wide across all metrics. */
    tags?: { [name: string]: string };

    /** Teardown function timeout. */
    teardownTimeout?: string;

    /** Threshold specifications. Defines pass and fail conditions. */
    thresholds?: { [name: string]: Threshold[] };

    /** Throw error on failed HTTP request. */
    throw?: boolean;

    /** TLS client certificates. */
    tlsAuth?: Certificate[];

    /** Allowed TLS cipher suites. */
    tlsCipherSuites?: CipherSuite[];

    /** Allowed TLS version. Use `http.SSL_*` `http.TLS_*` constants. */
    tlsVersion?: string | { min: string; max: string };

    /** User agent string to include in HTTP requests. */
    userAgent?: string;

    /** Number of VUs to run concurrently. */
    vus?: number;

    /** Maximum VUs. Preallocates VUs to enable faster scaling. */
    vusMax?: number;
}

/**
 * Third party collector configuration.
 */
export interface CollectorOptions {
    [name: string]: any;
}

/**
 * Test stage.
 */
export interface Stage {
    /** Stage duration. */
    duration: string;

    /** Target number of VUs. */
    target: number;
}

/**
 * Threshold specification.
 * https://k6.io/docs/using-k6/thresholds
 */
export type Threshold = string | ObjectThreshold;

/**
 * Object form threshold specification.
 * https://k6.io/docs/using-k6/thresholds
 */
export interface ObjectThreshold {
    /** Abort test if threshold violated. */
    abortOnFail?: boolean;

    /** Duration to delay evaluation. Enables collecting additional metrics. */
    delayAbortEval?: string;

    /** Threshold expression. */
    threshold: string;
}

/**
 * TLS client certificate.
 */
export interface Certificate {
    /** PEM encoded certificate. */
    cert: string;

    /** Domains certificate is valid for. */
    domains: string[];

    /** PEM encoded certificate key. */
    key: string;
}


text:
title: art
is-active: false
---


text:
export function createAppUser(email: string, appId?: string) {
  if (!appId || appId === 'rogerthat') {
    return email;
  }
  return `${email}:${appId}`;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. trimest. Soc. mycol. Fr. 89(3-4): 318 (1973)

#### Original name
Puccinia remireae J.M. Yen

### Remarks
null


text:
package etcd

import (
	"fmt"

	"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/minion"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
	"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"

	"github.com/golang/glog"
)

// TODO: Need to add a reconciler loop that makes sure that things in pods are reflected into
//       kubelet (and vice versa)

// Registry implements PodRegistry, ControllerRegistry and ServiceRegistry
// with backed by etcd.
type Registry struct {
	tools.EtcdHelper
	manifestFactory ManifestFactory
}

// NewRegistry creates an etcd registry.
func NewRegistry(client tools.EtcdClient, machines minion.Registry) *Registry {
	registry := &Registry{
		EtcdHelper: tools.EtcdHelper{
			client,
			api.Codec,
			api.ResourceVersioner,
		},
	}
	registry.manifestFactory = &BasicManifestFactory{
		serviceRegistry: registry,
	}
	return registry
}

func makePodKey(podID string) string {
	return "/registry/pods/" + podID
}

// ListPods obtains a list of pods that match selector.
func (r *Registry) ListPods(selector labels.Selector) ([]api.Pod, error) {
	allPods := []api.Pod{}
	filteredPods := []api.Pod{}
	if err := r.ExtractList("/registry/pods", &allPods); err != nil {
		return nil, err
	}
	for _, pod := range allPods {
		if selector.Matches(labels.Set(pod.Labels)) {
			// TODO: Currently nothing sets CurrentState.Host. We need a feedback loop that sets
			// the CurrentState.Host and Status fields. Here we pretend that reality perfectly
			// matches our desires.
			pod.CurrentState.Host = pod.DesiredState.Host
			filteredPods = append(filteredPods, pod)
		}
	}
	return filteredPods, nil
}

// WatchPods begins watching for new, changed, or deleted pods.
func (r *Registry) WatchPods(resourceVersion uint64) (watch.Interface, error) {
	return r.WatchList("/registry/pods", resourceVersion, tools.Everything)
}

// GetPod gets a specific pod specified by its ID.
func (r *Registry) GetPod(podID string) (*api.Pod, error) {
	var pod api.Pod
	if err := r.ExtractObj(makePodKey(podID), &pod, false); err != nil {
		return nil, err
	}
	// TODO: Currently nothing sets CurrentState.Host. We need a feedback loop that sets
	// the CurrentState.Host and Status fields. Here we pretend that reality perfectly
	// matches our desires.
	pod.CurrentState.Host = pod.DesiredState.Host
	return &pod, nil
}

func makeContainerKey(machine string) string {
	return "/registry/hosts/" + machine + "/kubelet"
}

// CreatePod creates a pod based on a specification, schedule it onto a specific machine.
func (r *Registry) CreatePod(machine string, pod api.Pod) error {
	// Set current status to "Waiting".
	pod.CurrentState.Status = api.PodWaiting
	pod.CurrentState.Host = ""
	// DesiredState.Host == "" is a signal to the scheduler that this pod needs scheduling.
	pod.DesiredState.Status = api.PodRunning
	pod.DesiredState.Host = ""
	if err := r.CreateObj(makePodKey(pod.ID), &pod); err != nil {
		return err
	}
	// TODO: Until scheduler separation is completed, just assign here.
	return r.assignPod(pod.ID, machine)
}

// ApplyBinding implements binding's registry
func (r *Registry) ApplyBinding(binding *api.Binding) error {
	return r.assignPod(binding.PodID, binding.Host)
}

// assignPod assigns the given pod to the given machine.
// TODO: hook this up via apiserver, not by calling it from CreatePod().
func (r *Registry) assignPod(podID string, machine string) error {
	podKey := makePodKey(podID)
	var finalPod *api.Pod
	err := r.AtomicUpdate(podKey, &api.Pod{}, func(obj interface{}) (interface{}, error) {
		pod, ok := obj.(*api.Pod)
		if !ok {
			return nil, fmt.Errorf("unexpected object: %#v", obj)
		}
		if pod.DesiredState.Host != "" {
			return nil, fmt.Errorf("pod %v is already assigned to host %v", pod.ID, pod.DesiredState.Host)
		}
		pod.DesiredState.Host = machine
		finalPod = pod
		return pod, nil
	})
	if err != nil {
		return err
	}
	// TODO: move this to a watch/rectification loop.
	manifest, err := r.manifestFactory.MakeManifest(machine, *finalPod)
	if err != nil {
		return err
	}
	contKey := makeContainerKey(machine)
	err = r.AtomicUpdate(contKey, &api.ContainerManifestList{}, func(in interface{}) (interface{}, error) {
		manifests := *in.(*api.ContainerManifestList)
		manifests.Items = append(manifests.Items, manifest)
		return manifests, nil
	})
	if err != nil {
		// Don't strand stuff. This is a terrible hack that won't be needed
		// when the above TODO is fixed.
		err2 := r.Delete(podKey, false)
		if err2 != nil {
			glog.Errorf("Probably stranding a pod, couldn't delete %v: %#v", podKey, err2)
		}
	}
	return err
}

func (r *Registry) UpdatePod(pod api.Pod) error {
	return fmt.Errorf("unimplemented!")
}

// DeletePod deletes an existing pod specified by its ID.
func (r *Registry) DeletePod(podID string) error {
	var pod api.Pod
	podKey := makePodKey(podID)
	err := r.ExtractObj(podKey, &pod, false)
	if tools.IsEtcdNotFound(err) {
		return apiserver.NewNotFoundErr("pod", podID)
	}
	if err != nil {
		return err
	}
	// First delete the pod, so a scheduler doesn't notice it getting removed from the
	// machine and attempt to put it somewhere.
	err = r.Delete(podKey, true)
	if tools.IsEtcdNotFound(err) {
		return apiserver.NewNotFoundErr("pod", podID)
	}
	if err != nil {
		return err
	}
	machine := pod.DesiredState.Host
	if machine == "" {
		// Pod was never scheduled anywhere, just return.
		return nil
	}
	// Next, remove the pod from the machine atomically.
	contKey := makeContainerKey(machine)
	return r.AtomicUpdate(contKey, &api.ContainerManifestList{}, func(in interface{}) (interface{}, error) {
		manifests := in.(*api.ContainerManifestList)
		newManifests := make([]api.ContainerManifest, 0, len(manifests.Items))
		found := false
		for _, manifest := range manifests.Items {
			if manifest.ID != podID {
				newManifests = append(newManifests, manifest)
			} else {
				found = true
			}
		}
		if !found {
			// This really shouldn't happen, it indicates something is broken, and likely
			// there is a lost pod somewhere.
			// However it is "deleted" so log it and move on
			glog.Infof("Couldn't find: %s in %#v", podID, manifests)
		}
		manifests.Items = newManifests
		return manifests, nil
	})
}

// ListControllers obtains a list of ReplicationControllers.
func (r *Registry) ListControllers() ([]api.ReplicationController, error) {
	var controllers []api.ReplicationController
	err := r.ExtractList("/registry/controllers", &controllers)
	return controllers, err
}

// WatchControllers begins watching for new, changed, or deleted controllers.
func (r *Registry) WatchControllers(resourceVersion uint64) (watch.Interface, error) {
	return r.WatchList("/registry/controllers", resourceVersion, tools.Everything)
}

func makeControllerKey(id string) string {
	return "/registry/controllers/" + id
}

// GetController gets a specific ReplicationController specified by its ID.
func (r *Registry) GetController(controllerID string) (*api.ReplicationController, error) {
	var controller api.ReplicationController
	key := makeControllerKey(controllerID)
	err := r.ExtractObj(key, &controller, false)
	if tools.IsEtcdNotFound(err) {
		return nil, apiserver.NewNotFoundErr("replicationController", controllerID)
	}
	if err != nil {
		return nil, err
	}
	return &controller, nil
}

// CreateController creates a new ReplicationController.
func (r *Registry) CreateController(controller api.ReplicationController) error {
	err := r.CreateObj(makeControllerKey(controller.ID), controller)
	if tools.IsEtcdNodeExist(err) {
		return apiserver.NewAlreadyExistsErr("replicationController", controller.ID)
	}
	return err
}

// UpdateController replaces an existing ReplicationController.
func (r *Registry) UpdateController(controller api.ReplicationController) error {
	return r.SetObj(makeControllerKey(controller.ID), controller)
}

// DeleteController deletes a ReplicationController specified by its ID.
func (r *Registry) DeleteController(controllerID string) error {
	key := makeControllerKey(controllerID)
	err := r.Delete(key, false)
	if tools.IsEtcdNotFound(err) {
		return apiserver.NewNotFoundErr("replicationController", controllerID)
	}
	return err
}

func makeServiceKey(name string) string {
	return "/registry/services/specs/" + name
}

// ListServices obtains a list of Services.
func (r *Registry) ListServices() (api.ServiceList, error) {
	var list api.ServiceList
	err := r.ExtractList("/registry/services/specs", &list.Items)
	return list, err
}

// CreateService creates a new Service.
func (r *Registry) CreateService(svc api.Service) error {
	err := r.CreateObj(makeServiceKey(svc.ID), svc)
	if tools.IsEtcdNodeExist(err) {
		return apiserver.NewAlreadyExistsErr("service", svc.ID)
	}
	return err
}

// GetService obtains a Service specified by its name.
func (r *Registry) GetService(name string) (*api.Service, error) {
	key := makeServiceKey(name)
	var svc api.Service
	err := r.ExtractObj(key, &svc, false)
	if tools.IsEtcdNotFound(err) {
		return nil, apiserver.NewNotFoundErr("service", name)
	}
	if err != nil {
		return nil, err
	}
	return &svc, nil
}

func makeServiceEndpointsKey(name string) string {
	return "/registry/services/endpoints/" + name
}

// DeleteService deletes a Service specified by its name.
func (r *Registry) DeleteService(name string) error {
	key := makeServiceKey(name)
	err := r.Delete(key, true)
	if tools.IsEtcdNotFound(err) {
		return apiserver.NewNotFoundErr("service", name)
	}
	if err != nil {
		return err
	}
	key = makeServiceEndpointsKey(name)
	err = r.Delete(key, true)
	if !tools.IsEtcdNotFound(err) {
		return err
	}
	return nil
}

// UpdateService replaces an existing Service.
func (r *Registry) UpdateService(svc api.Service) error {
	return r.SetObj(makeServiceKey(svc.ID), svc)
}

// UpdateEndpoints update Endpoints of a Service.
func (r *Registry) UpdateEndpoints(e api.Endpoints) error {
	return r.AtomicUpdate(makeServiceEndpointsKey(e.ID), &api.Endpoints{},
		func(interface{}) (interface{}, error) {
			return e, nil
		})
}


text:
module Lua

  # Generate lua exposing code for C++ enums
  class EnumGenerator
    def initialize(lineStart)
      @lineStart = lineStart
    end

    attr_reader :enums

    def reset
      @enums = []
    end

    def generate(owner, exposer)
      reset()

      owner.enums.each do |name, enum|
        if (name.empty? ||
          !exposer.allMetaData.isExposedEnum?(enum.fullyQualifiedName))
          next
        end

        str = "{\n"
        enum.members.each do |k, v|
          str << "#{@lineStart}  #{k} = #{v},\n"
        end
        str << "#{@lineStart}}"

        @enums << "#{@lineStart}#{name} = #{str}"
      end
    end

  end

end


text:
A function that retrives the next chunk.
All readable streams (sources, and throughs)
must return a `read` function.

## reader (read,...)

A function to create a reader. It takes a `read` function
as the first argument, and any other options after that.

When passed to `pipeable` or `pipeableSource`,
a new function is created that adds `.pipe(dest)`

## Lazy vs Eager

Lazy means to avoid doing something until you know you have
to do it.

Eager means to do something early, so you have it ready
immediately when you need it.

## [Source](sources/index.md)

The first stream in the pipeline. The Source is not a reader (not writable).

## [Sink](sinks/index.md)

The last stream in the pipeline. The Sink is not readable.

## [Through](throughs/index.md)

The stream (or streams) in the middle of the pipeline, between your source and sink.  A through is a reader and readable.

## Push vs Pull

A pull-stream is a stream where the movement of data
is initiated by the sink, and a push-stream
is a stream where the movement of data is initiated
by the source.

## Reader vs Writable

In push streams, destination streams (Through and Sink),
are _writable_. They are written to by the source streams.

In pull streams, destination streams _read_ from the source
streams. They are the active participant, so they are called
_readers_ rather than _writables_.


text:
{% extends "zerver/portico_signup.html" %}

{% block portico_content %}

{{ _("We've reset your password!") }}

{% trans login_url=url('login') %}Please log in with your new password.{% endtrans %}

{% endblock %}


text:
@interface CPDStockPriceStore : NSObject

+ (CPDStockPriceStore *)sharedInstance;

- (NSArray *)tickerSymbols;

- (NSArray *)dailyPortfolioPrices;

- (NSArray *)datesInWeek;
- (NSArray *)weeklyPrices:(NSString *)tickerSymbol;

- (NSArray *)datesInMonth;
- (NSArray *)monthlyPrices:(NSString *)tickerSymbol;

@end


text:
package com.fireflysource.net.http.common.v2.decoder;

import com.fireflysource.net.http.common.v2.frame.Frame;
import com.fireflysource.net.http.common.v2.frame.FrameType;

import java.nio.ByteBuffer;

/**
 *
The parser for the frame header of HTTP/2 frames.

 *
 * @see Parser
 */
public class HeaderParser {
    private State state = State.LENGTH;
    private int cursor;

    private int length;
    private int type;
    private int flags;
    private int streamId;

    protected void reset() {
        state = State.LENGTH;
        cursor = 0;

        length = 0;
        type = 0;
        flags = 0;
        streamId = 0;
    }

    /**
     *
Parses the header bytes in the given {@code buffer}; only the header
     * bytes are consumed, therefore when this method returns, the buffer may
     * contain unconsumed bytes.

     *
     * @param buffer the buffer to parse
     * @return true if the whole header bytes were parsed, false if not enough
     * header bytes were present in the buffer
     */
    public boolean parse(ByteBuffer buffer) {
        while (buffer.hasRemaining()) {
            switch (state) {
                case LENGTH: {
                    int octet = buffer.get() & 0xFF;
                    length = (length << 8) + octet;
                    if (++cursor == 3) {
                        length &= Frame.MAX_MAX_LENGTH;
                        state = State.TYPE;
                    }
                    break;
                }
                case TYPE: {
                    type = buffer.get() & 0xFF;
                    state = State.FLAGS;
                    break;
                }
                case FLAGS: {
                    flags = buffer.get() & 0xFF;
                    state = State.STREAM_ID;
                    break;
                }
                case STREAM_ID: {
                    if (buffer.remaining() >= 4) {
                        streamId = buffer.getInt();
                        // Most significant bit MUST be ignored as per specification.
                        streamId &= 0x7F_FF_FF_FF;
                        return true;
                    } else {
                        state = State.STREAM_ID_BYTES;
                        cursor = 4;
                    }
                    break;
                }
                case STREAM_ID_BYTES: {
                    int currByte = buffer.get() & 0xFF;
                    --cursor;
                    streamId += currByte << (8 * cursor);
                    if (cursor == 0) {
                        // Most significant bit MUST be ignored as per specification.
                        streamId &= 0x7F_FF_FF_FF;
                        return true;
                    }
                    break;
                }
                default: {
                    throw new IllegalStateException();
                }
            }
        }
        return false;
    }

    public int getLength() {
        return length;
    }

    public int getFrameType() {
        return type;
    }

    public boolean hasFlag(int bit) {
        return (flags & bit) == bit;
    }

    public int getStreamId() {
        return streamId;
    }

    @Override
    public String toString() {
        return String.format("[%s|%d|%d|%d]", FrameType.from(getFrameType()), getLength(), flags, getStreamId());
    }

    private enum State {
        LENGTH, TYPE, FLAGS, STREAM_ID, STREAM_ID_BYTES
    }
}


text: * Fix an import path error for the Date component introduced in v8.1.4


text:
// Accord Statistics Library
// The Accord.NET Framework
// http://accord-framework.net
//
// Copyright © César Souza, 2009-2015
// cesarsouza at gmail.com
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Lesser General Public
//    License as published by the Free Software Foundation; either
//    version 2.1 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

namespace Accord.Statistics.Distributions.Univariate
{
    using System;
    using Accord.Math;
    using Accord.Statistics.Distributions.Fitting;
    using AForge;

    ///
    ///   Weibull distribution.
    ///
    ///
    /// <remarks>
    /// <para>
    ///   In probability theory and statistics, the Weibull distribution is a
    ///   continuous probability distribution. It is named after Waloddi Weibull,
    ///   who described it in detail in 1951, although it was first identified by
    ///   Fréchet (1927) and first applied by Rosin and Rammler (1933) to describe a
    ///   particle size distribution.</para>
    ///
    /// <para>
    /// The Weibull distribution is related to a number of other probability distributions;
    /// in particular, it interpolates between the <see cref="ExponentialDistribution">
    /// exponential distribution</see> (for k = 1) and the <see cref="RayleighDistribution">
    /// Rayleigh distribution</see> (when k = 2). </para>
    ///
    /// <para>
    /// If the quantity x is a "time-to-failure", the Weibull distribution gives a
    /// distribution for which the failure rate is proportional to a power of time.
    /// The shape parameter, k, is that power plus one, and so this parameter can be
    /// interpreted directly as follows:</para>
    ///
    /// <list type="bullet">
    ///   <item><description>
    ///     A value of k < 1 indicates that the failure rate decreases over time. This
    ///     happens if there is significant "infant mortality", or defective items failing
    ///     early and the failure rate decreasing over time as the defective items are
    ///     weeded out of the population.</description></item>
    ///   <item><description>
    ///     A value of k = 1 indicates that the failure rate is constant over time. This
    ///     might suggest random external events are causing mortality, or failure.</description></item>
    ///   <item><description>
    ///     A value of k > 1 indicates that the failure rate increases with time. This
    ///     happens if there is an "aging" process, or parts that are more likely to fail
    ///     as time goes on.</description></item>
    /// </list>
    /// <para>
    /// In the field of materials science, the shape parameter <c>k</c> of a distribution
    /// of strengths is known as the Weibull modulus.</para>
    ///
    /// <para>
    ///   References:
    ///   <list type="bullet">
    ///     <item><description>
    ///       Wikipedia, The Free Encyclopedia. Weibull distribution. Available on:
    ///       http://en.wikipedia.org/wiki/Weibull_distribution </description></item>
    ///   </list></para>
    /// </remarks>
    ///
    /// <example>
    ///
    ///    // Create a new Weibull distribution with λ = 0.42 and k = 1.2
    ///    var weilbull = new WeibullDistribution(scale: 0.42, shape: 1.2);
    ///
    ///    // Common measures
    ///    double mean = weilbull.Mean;     // 0.39507546046784414
    ///    double median = weilbull.Median; // 0.30945951550913292
    ///    double var = weilbull.Variance;  // 0.10932249666369542
    ///    double mode = weilbull.Mode;     // 0.094360430821809421
    ///
    ///    // Cumulative distribution functions
    ///    double cdf = weilbull.DistributionFunction(x: 1.4);           //  0.98560487188700052
    ///    double pdf = weilbull.ProbabilityDensityFunction(x: 1.4);     //  0.052326687031379278
    ///    double lpdf = weilbull.LogProbabilityDensityFunction(x: 1.4); // -2.9502487697674415
    ///
    ///    // Probability density functions
    ///    double ccdf = weilbull.ComplementaryDistributionFunction(x: 1.4); // 0.22369885565908001
    ///    double icdf = weilbull.InverseDistributionFunction(p: cdf);       // 1.400000001051205
    ///
    ///    // Hazard (failure rate) functions
    ///    double hf = weilbull.HazardFunction(x: 1.4);            // 1.1093328057258516
    ///    double chf = weilbull.CumulativeHazardFunction(x: 1.4); // 1.4974545260150962
    ///
    ///    // String representation
    ///    string str = weilbull.ToString(CultureInfo.InvariantCulture); // Weibull(x; λ = 0.42, k = 1.2)
    ///
    /// </example>
    ///
    [Serializable]
    public class WeibullDistribution : UnivariateContinuousDistribution,
        ISampleableDistribution<double>, IFormattable
    {

        // Distribution parameters
        private double k;      //  k > 0
        private double lambda; //  λ > 0 (lambda)

        ///
        ///   Initializes a new instance of the <see cref="WeibullDistribution"/> class.
        ///
        ///
        /// <param name="scale">The scale parameter λ (lambda).</param>
        /// <param name="shape">The shape parameter k.</param>
        ///
        public WeibullDistribution([Positive] double shape, [Positive] double scale)
        {
            if (shape <= 0) // k
                throw new ArgumentOutOfRangeException("shape", "Shape (k) must be greater than zero.");

            if (scale <= 0) // lambda
                throw new ArgumentOutOfRangeException("shape", "Scale (lambda) must be greater than zero.");

            this.k = shape;
            this.lambda = scale;
        }

        ///
        ///   Gets the mean for this distribution.
        ///
        ///
        /// <value>The distribution's mean value.</value>
        ///
        public override double Mean
        {
            get { return lambda * Gamma.Function(1 + 1 / k); }
        }

        ///
        ///   Gets the variance for this distribution.
        ///
        ///
        /// <value>The distribution's variance.</value>
        ///
        public override double Variance
        {
            get { return lambda * lambda * Gamma.Function(1 + 2 / k) - Mean * Mean; }
        }

        ///
        ///   Gets the median for this distribution.
        ///
        ///
        /// <value>
        ///   The distribution's median value.
        /// </value>
        ///
        public override double Median
        {
            get { return lambda * Math.Pow(Math.Log(2.0), 1.0 / k); }
        }

        ///
        ///   Gets the mode for this distribution.
        ///
        ///
        /// <value>
        ///   The distribution's mode value.
        /// </value>
        ///
        public override double Mode
        {
            get { return k > 1 ? lambda * Math.Pow((k - 1) / k, 1 / k) : 0; }
        }

        ///
        ///   Gets the support interval for this distribution.
        ///
        ///
        /// <value>
        ///   A <see cref="AForge.DoubleRange" /> containing
        ///   the support interval for this distribution.
        /// </value>
        ///
        public override DoubleRange Support
        {
            get { return new DoubleRange(0, Double.PositiveInfinity); }
        }

        ///
        ///   Gets the entropy for this distribution.
        ///
        ///
        /// <value>The distribution's entropy.</value>
        ///
        public override double Entropy
        {
            get { return Constants.EulerGamma * (1 - 1 / k) + Math.Log(lambda / k) + 1; }
        }

        ///
        ///   Gets the cumulative distribution function (cdf) for
        ///   this distribution evaluated at point <c>x</c>.
        ///
        ///
        /// <param name="x">A single point in the distribution range.</param>
        ///
        /// <remarks>
        ///   The Cumulative Distribution Function (CDF) describes the cumulative
        ///   probability that a given value or any value smaller than it will occur.
        /// </remarks>
        ///
        public override double DistributionFunction(double x)
        {
            if (x < 0) return 0;

            return 1.0 - Math.Exp(-Math.Pow(x / lambda, k));
        }

        ///
        ///   Gets the probability density function (pdf) for
        ///   this distribution evaluated at point <c>x</c>.
        ///
        ///
        /// <param name="x">A single point in the distribution range.</param>
        ///
        /// <returns>
        ///   The probability of <c>x</c> occurring
        ///   in the current distribution.
        /// </returns>
        ///
        /// <remarks>
        ///   The Probability Density Function (PDF) describes the
        ///   probability that a given value <c>x</c> will occur.
        /// </remarks>
        ///
        public override double ProbabilityDensityFunction(double x)
        {
            if (x <= 0) return 0;

            double a = Math.Pow(x / lambda, k - 1);
            double b = Math.Exp(-Math.Pow(x / lambda, k));
            return (k / lambda) * a * b;
        }

        ///
        ///   Gets the log-probability density function (pdf) for
        ///   this distribution evaluated at point <c>x</c>.
        ///
        ///
        /// <param name="x">A single point in the distribution range.</param>
        ///
        /// <returns>
        ///   The logarithm of the probability of <c>x</c>
        ///   occurring in the current distribution.
        /// </returns>
        ///
        /// <remarks>
        ///   The Probability Density Function (PDF) describes the
        ///   probability that a given value <c>x</c> will occur.
        /// </remarks>
        ///
        public override double LogProbabilityDensityFunction(double x)
        {
            if (x <= 0) return Double.NegativeInfinity;

            return Math.Log(k / lambda) + (k - 1) * Math.Log(x / lambda) - Math.Pow(x / lambda, k);
        }

        ///
        ///   Gets the hazard function, also known as the failure rate or
        ///   the conditional failure density function for this distribution
        ///   evaluated at point <c>x</c>.
        ///
        ///
        /// <param name="x">A single point in the distribution range.</param>
        ///
        /// <returns>
        ///   The conditional failure density function <c>h(x)</c>
        ///   evaluated at <c>x</c> in the current distribution.
        /// </returns>
        ///
        public override double HazardFunction(double x)
        {
            return Math.Pow(k * x, k - 1);
        }

        ///
        ///   Gets the cumulative hazard function for this
        ///   distribution evaluated at point <c>x</c>.
        ///
        ///
        /// <param name="x">A single point in the distribution range.</param>
        ///
        /// <returns>
        ///   The cumulative hazard function <c>H(x)</c>
        ///   evaluated at <c>x</c> in the current distribution.
        /// </returns>
        ///
        public override double CumulativeHazardFunction(double x)
        {
            return Math.Pow(x, k);
        }

        ///
        ///   Gets the complementary cumulative distribution function
        ///   (ccdf) for this distribution evaluated at point <c>x</c>.
        ///   This function is also known as the Survival function.
        ///
        ///
        /// <param name="x">A single point in the distribution range.</param>
        ///
        public override double ComplementaryDistributionFunction(double x)
        {
            return Math.Exp(-Math.Pow(x, k));
        }

        ///
        ///   Gets the inverse of the <see cref="ComplementaryDistributionFunction"/>.
        ///   The inverse complementary distribution function is also known as the
        ///   inverse survival Function.
        ///
        ///
        public double InverseComplementaryDistributionFunction(double p)
        {
            return Math.Pow(-Math.Log(p), 1 / k);
        }

        ///
        ///   Fits the underlying distribution to a given set of observations.
        ///
        ///
        /// <param name="observations">The array of observations to fit the model against. The array
        ///   elements can be either of type double (for univariate data) or
        ///   type double[] (for multivariate data).</param>
        /// <param name="weights">The weight vector containing the weight for each of the samples.</param>
        /// <param name="options">Optional arguments which may be used during fitting, such
        ///   as regularization constants and additional parameters.</param>
        ///
        /// <remarks>
        ///   Although both double[] and double[][] arrays are supported,
        ///   providing a double[] for a multivariate distribution or a
        ///   double[][] for a univariate distribution may have a negative
        ///   impact in performance.
        /// </remarks>
        ///
        public override void Fit(double[] observations, double[] weights, IFittingOptions options)
        {
            throw new NotImplementedException();
        }

        ///
        ///   Creates a new object that is a copy of the current instance.
        ///
        ///
        /// <returns>
        ///   A new object that is a copy of this instance.
        /// </returns>
        ///
        public override object Clone()
        {
            return new WeibullDistribution(lambda, k);
        }

        #region ISampleableDistribution<double> Members

        ///
        ///   Generates a random vector of observations from the current distribution.
        ///
        ///
        /// <param name="samples">The number of samples to generate.</param>
        /// <returns>A random vector of observations drawn from this distribution.</returns>
        ///
        public override double[] Generate(int samples)
        {
            return Random(k, lambda, samples);
        }

        ///
        ///   Generates a random observation from the current distribution.
        ///
        ///
        /// <returns>A random observations drawn from this distribution.</returns>
        ///
        public override double Generate()
        {
            return Random(k, lambda);
        }

        ///
        ///   Generates a random vector of observations from the
        ///   Weibull distribution with the given parameters.
        ///
        ///
        /// <param name="scale">The scale parameter lambda.</param>
        /// <param name="shape">The shape parameter k.</param>
        /// <param name="samples">The number of samples to generate.</param>
        ///
        /// <returns>An array of double values sampled from the specified Weibull distribution.</returns>
        ///
        public static double[] Random(double shape, double scale, int samples)
        {
            double[] r = new double[samples];
            for (int i = 0; i < r.Length; i++)
            {
                double u = Accord.Math.Tools.Random.NextDouble();
                r[i] = scale * Math.Pow(-Math.Log(u), 1 / shape);
            }

            return r;
        }

        ///
        ///   Generates a random observation from the
        ///   Weibull distribution with the given parameters.
        ///
        ///
        /// <param name="scale">The scale parameter lambda.</param>
        /// <param name="shape">The shape parameter k.</param>
        ///
        /// <returns>A random double value sampled from the specified Weibull distribution.</returns>
        ///
        public static double Random(double shape, double scale)
        {
            double u = Accord.Math.Tools.Random.NextDouble();
            return scale * Math.Pow(-Math.Log(u), 1 / shape);
        }
        #endregion

        ///
        ///   Returns a <see cref="System.String"/> that represents this instance.
        ///
        ///
        /// <returns>
        ///   A <see cref="System.String"/> that represents this instance.
        /// </returns>
        ///
        public override string ToString()
        {
            return String.Format("Weibull(x; λ = {0}, k = {1})", lambda, k);
        }

        ///
        ///   Returns a <see cref="System.String"/> that represents this instance.
        ///
        ///
        /// <returns>
        ///   A <see cref="System.String"/> that represents this instance.
        /// </returns>
        ///
        public string ToString(IFormatProvider formatProvider)
        {
            return String.Format(formatProvider, "Weibull(x; λ = {0}, k = {1})", lambda, k);
        }

        ///
        ///   Returns a <see cref="System.String"/> that represents this instance.
        ///
        ///
        /// <returns>
        ///   A <see cref="System.String"/> that represents this instance.
        /// </returns>
        ///
        public string ToString(string format, IFormatProvider formatProvider)
        {
            return String.Format(formatProvider, "Weibull(x; λ = {0}, k = {1})",
                lambda.ToString(format, formatProvider),
                k.ToString(format, formatProvider));
        }

        ///
        ///   Returns a <see cref="System.String"/> that represents this instance.
        ///
        ///
        /// <returns>
        ///   A <see cref="System.String"/> that represents this instance.
        /// </returns>
        ///
        public string ToString(string format)
        {
            return String.Format("Weibull(x; λ = {0}, k = {1})",
                lambda.ToString(format), k.ToString(format));
        }

    }
}


text:
namespace network {

class PendingSharedURLLoaderFactory;

// This is a ref-counted C++ interface to replace raw mojom::URLLoaderFactory
// pointers and various factory getters.
// A SharedURLLoaderFactory instance is supposed to be used on a single
// sequence. To use it on a different sequence, use Clone() and pass the
// resulting PendingSharedURLLoaderFactory instance to the target sequence. On
// the target sequence, call SharedURLLoaderFactory::Create() to convert it to a
// new SharedURLLoaderFactory.
class COMPONENT_EXPORT(NETWORK_CPP) SharedURLLoaderFactory
    : public base::RefCounted<SharedURLLoaderFactory>,
      public mojom::URLLoaderFactory {
 public:
  static scoped_refptr<SharedURLLoaderFactory> Create(
      std::unique_ptr<PendingSharedURLLoaderFactory> pending_factory);

  // From mojom::URLLoaderFactory:
  void Clone(mojo::PendingReceiver<mojom::URLLoaderFactory> receiver) override =
      0;

  // If implemented, creates a PendingSharedURLLoaderFactory that can be used on
  // any thread to create a SharedURLLoaderFactory that works there.
  //
  // A simple way of providing this API is to use
  // CrossThreadPendingSharedURLLoaderFactory; which will implement it at cost
  // of a single thread hop on any different-thread fetch.
  virtual std::unique_ptr<PendingSharedURLLoaderFactory> Clone() = 0;

  // If this returns true, any redirect safety checks should be bypassed.
  virtual bool BypassRedirectChecks() const;

 protected:
  friend class base::RefCounted<SharedURLLoaderFactory>;
  ~SharedURLLoaderFactory() override;
};

// PendingSharedURLLoaderFactory contains necessary information to construct a
// SharedURLLoaderFactory. It is not sequence safe but can be passed across
// sequences. Please see the comments of SharedURLLoaderFactory for how this
// class is used.
class COMPONENT_EXPORT(NETWORK_CPP) PendingSharedURLLoaderFactory {
 public:
  PendingSharedURLLoaderFactory();

  PendingSharedURLLoaderFactory(const PendingSharedURLLoaderFactory&) = delete;
  PendingSharedURLLoaderFactory& operator=(
      const PendingSharedURLLoaderFactory&) = delete;

  virtual ~PendingSharedURLLoaderFactory();

 protected:
  friend class SharedURLLoaderFactory;

  // Creates a SharedURLLoaderFactory. It should only be called by
  // SharedURLLoaderFactory::Create(), which makes sense that CreateFactory() is
  // never called multiple times for each PendingSharedURLLoaderFactory
  // instance.
  virtual scoped_refptr<SharedURLLoaderFactory> CreateFactory() = 0;
};

}  // namespace network

#endif  // SERVICES_NETWORK_PUBLIC_CPP_SHARED_URL_LOADER_FACTORY_H_


text:
app.directive('animationFlipbook', function($resource, $q) {
	return {
        restrict: 'E',
        replace: true,
        scope: {
        	title: '@',
        	nSlides: '@',
        	folderUrl: '@'
        },
        templateUrl: 'js/directives/AnimationFlipbook.html',
        link: function(scope, elem, attrs) {
			scope.nSlides = parseInt(scope.nSlides);
			scope.animationSlides = [];
			scope.currentSlide = 0;
			scope.allSlidesLoaded = false;
			scope.showLoadingGif = false;

			scope.slideLoaded = function(slideIdx){
				scope.animationSlides[slideIdx].loaded = true;

				var allLoaded = true;
				for(var j = 0; j < scope.nSlides; ++j){
					if(!scope.animationSlides[j].loaded){
						allLoaded = false;
						break;
					}
				}
				if(allLoaded){
					scope.allSlidesLoaded = true;
				}

				if(slideIdx == 0){
					scope.centerLoadingGif(scope.title);
				}
			}

			scope.centerLoadingGif = function(title){
				var elt = $(".animationLoadingGif#"+title);
				var img = $("."+title+"_img.firstFrame");

				elt.css("top", ((img.offset().top - img.parent().offset().top) + (img.height()-elt.width())/2.0).toString()+'px');
				elt.css("left", ((img.offset().left - img.parent().offset().left) + (img.width()-elt.width())/2.0).toString()+'px');

				scope.showLoadingGif = true;
			}

			for(var i = 0; i < scope.nSlides; ++i){
				scope.animationSlides[i] = {
					src: scope.folderUrl+(i+1)+'.png',
					loaded: false
				};
			}
        }
    };
});

app.directive('onloadFunction', function() {
    return {
        restrict: 'A',
        link: function(scope, element, attrs) {
            element.bind('load', function() {
                scope.$apply(attrs.onloadFunction);
            });
        }
    };
});


text:
@class RXSeckillMenuMode;
@interface RXMenuControllerCell : UICollectionViewCell
@property (nonatomic, copy) RXSeckillMenuMode * seckillMenumodel;
@end


text:
 function [ log ] = cropLog( log, startTime, endTime )
%CROPLOG trims a log based on a starting and end time in seconds.
%
% log = cropLog( log, startTime, endTime)
%
% If you hand in empty [] for either time it will trim to the end of the
% log.  For example, CROPLOG( log, [], 10 ) will return a log of all the
% data from the first 10 seconds of the log.
%
% Dave Rollinson
% Feb 2015

    logFields = fields(log);

    if ~isempty(startTime)
        startIndex = find(log.time>startTime,1,'first');
    else
        startIndex = 1;
    end

    if ~isempty(endTime)
        endIndex = find(log.time<endTime,1,'last');
    else
        endIndex = length(log.time);
    end

    for i=1:length(logFields)
        log.(logFields{i}) = log.(logFields{i})(startIndex:endIndex,:);
    end

end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Ned. kruidk. Archf 5: 173 (1888)

#### Original name
Ovularia buxi Oudem.

### Remarks
null


text:
/**
 * @file 开发服务器总入口封装
 * @author dongkunshan(windwithfo@yeah.net)
 */

import 'babel-polyfill';
import path       from 'path';
import nodecp     from 'child_process';
import Isomorphic from 'webpack-isomorphic-tools';
import isoConfig  from '../config/isomorphic.config';

/* for antd-mobile ssr */
// import Hacker from 'require-hacker';

// Hacker.resolver((filename, module) => {
//   if (filename.endsWith('/style/css')) {
//     return Hacker.resolve(`${filename}.web.js`, module);
//   }
//   if (filename.match(/antd-mobile\/lib\/(\S*)/)) {
//     return Hacker.resolve(`${filename}/index.web.js`, module);
//   }
// });

// this must be equal to your Webpack configuration "context" parameter
const basePath = path.join(__dirname, '../');

// this global variable will be used later in express middleware
global.webpack_isomorphic_tools = new Isomorphic(isoConfig)
.server(basePath, () => {
  nodecp.exec('npm run lint', (err) => {
    if (err) {
      console.log(err);
    }
    else {
      require('./server.js');
    }
  });
});


text:
Inspired by [jed/cookies](https://github.com/jed/cookies), but simpler (no signatures).
This refactor has no dependencies and different defaults.

* Install it at the command line:

```bash
npm install git://github.com/chbrown/cookies.git
```

* Or put it in your `package.json`:

```json
{
  ...,
  "dependencies": {
    "cookies": "git://github.com/chbrown/cookies.git",
    ...
  }
}
```

### Features

* Somewhat lazy: All cookies are read into an object/hash, but only if one is requested. So you can attach a `cookies` object to the request / response in your main router, but if you never `.get()` or `.set()` a cookie,
* Insecure: Cookies are neither `httponly` nor `secure` by default.
* Defaults: The only out-of-the-box default is `path=/`.

## API

### new Cookies([request], [response])

* `request` IncomingMessage | null The first argument from an `http` server's `request` event
* `response` ServerResponse | null The second argument from an `http` server's `request` event

Create new `cookies` object, which provides `get`, `set`, and `del` methods.

    req.cookies = new Cookies(req, res)

### Cookies.attach([request], [response])

Simply attaches a new `cookies` object to `request` (or `response`, if `request` is null).

### cookies.get(name)

* `name` String Name of the cookie

Returns the string value of the cookie. Also triggers `cookies.initialize()` if this is the first time a cookie has been accessed since `cookies` was created.

Does not require that `response` was set in the `new Cookies(request, ...)` constructor.

### cookies.set(name, value, [options])

* `name` String Name of the cookie
* `value` String Value of the cookie
* `options` Object | null Cookie settings

Adds a cookie to the queued 'Set-Cookie' headers for the current response.
Can be called multiple times; it will not clear cookies previously added to the response.
(Use `response.removeHeader('Set-Cookie')` if you want to remove pending cookies.)

Obeys [RFC 2109](http://www.ietf.org/rfc/rfc2109.txt) (mostly) when formatting the string.

This will only set the cookie if `response.headersSent` is false.

Possible options:

```javascript
{
  comment: String,
  domain: String,
  max_age: String | Number,
  path: String,               // defaults to '/'
  secure: Boolean,            // defaults to false
  version: Boolean,           // defaults to false, contrary to RFC 2109
  http_only: Boolean,         // defaults to false, not in RFC 2109
  expires: Date               // not in RFC 2109
}
```

Does not require that `request` was set in the `new Cookies(..., response)` constructor.

### cookies.del(name, [options])

* `name` String Name of the cookie
* `options` Object | null Cookie settings

Set cookie's value to `''`, and it's expire date to the beginning of epoch time, i.e., `new Date(0)`, using the same mechanism as `cookies.set`.

### Cookies.prototype.defaults = default_options

* `default_options` Object | Function Base used for all `set()` calls.

Set this to an object, or function that returns an object, using the possible options from the [`set()` section](#cookiessetname-value-options).

### Cookies.serialize(name, value, options)

* `name` String Name of the cookie
* `value` String Value of the cookie
* `options` Object | null Cookie settings

Serialize a cookie name, value, and options into the string representation that the 'Set-cookie' http header requires.

## Demo [`server.js`](server.js)

```javascript
var Cookies = require('cookies')
var http = require('http')

Cookies.prototype.defaults = function() {
  // expire 1 month in the future
  var one_month_from_now = new Date(Date.now() + (31 * 24 * 60 * 60 * 1000))
  return {
    expires: one_month_from_now, // <-- a Date object
    path: '/'
  }
}

http.createServer(function(req, res) {
  req.cookies = new Cookies(req, res)

  var history = {}
  var history_json = req.cookies.get('history')
  try {
    history = JSON.parse(history_json)
  }
  catch (exc) {
    console.error(exc)
  }
  history[req.url] = (history[req.url] || 0) + 1

  var new_history_json = JSON.stringify(history)
  req.cookies.set('history', new_history_json)

  res.writeHead(200)
  for (var page in history) {
    res.write('You have been to ' + page + ' ' + history[page] + ' times.\n')
  }
  res.end()
}).listen(8383, '127.0.0.1', function() {
  console.log('Serving example cookies server at localhost:8383')
})
```

## License

Copyright © 2012-2013 Christopher Brown.
[MIT Licensed](https://chbrown.github.io/licenses/MIT/#2012-2013).


text:
#include <stdio.h>

/* make a file named lcqh01.c */
/* write a C program to compute the following */
/* the result of b squared - 4 times a times c */
/* where a is 5, b is 4, c is 3 */
/* print out the answer */
/* use variables named a, band c and a variable to hold the result */
/* C does not have a built in square function nor does it have a "to the power of❠operator*/

int main()
{
	int a=5, b=4, c=3;
	int result;

	result = b*b - 4*a*c;
	printf("Result %i^2 - 4*%i*%i = %i\n",b,a,c,result);

	return 0;
}


text:
// <copyright file="ProgressEventArgs.cs" company="Email Hippo Ltd">
// (c) 2018, Email Hippo Ltd
// </copyright>

// Copyright 2018 Email Hippo Ltd
// 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.
namespace EmailHippo.EmailVerify.Api.V3.Client.Services.EmailHippo.V3
{
    using System;
    using Api.V3.Entities.V_3_0_0;
    using JetBrains.Annotations;

    /// <summary>
    /// Progress event args.
    /// </summary>
    /// <seealso cref="System.EventArgs" />
    public sealed class ProgressEventArgs : EventArgs
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgressEventArgs"/> class.
        /// </summary>
        /// <param name="totalCountInList">
        /// The total count in list.
        /// </param>
        /// <param name="percentageDone">
        /// The percentage done.
        /// </param>
        /// <param name="currentVerificationResponse">
        /// The current verification response.
        /// </param>
        public ProgressEventArgs(
            int totalCountInList,
            int percentageDone,
            [NotNull] Result currentVerificationResponse)
        {
            this.TotalCountInList = totalCountInList;
            this.PercentageDone = percentageDone;
            this.CurrentVerificationResponse = currentVerificationResponse;
        }

        /// <summary>
        ///     Gets the current verification response.
        /// </summary>
        /// <value>
        ///     The current verification response.
        /// </value>
        [NotNull]
        public Result CurrentVerificationResponse { get; }

        /// <summary>
        ///     Gets the percentage done.
        /// </summary>
        /// <value>
        ///     The percentage done.
        /// </value>
        public int PercentageDone { get; }

        /// <summary>
        ///     Gets the total count in list.
        /// </summary>
        /// <value>
        ///     The total count in list.
        /// </value>
        public int TotalCountInList { get; }
    }
}


text:
class IIndexFile {
public:
    virtual ~IIndexFile() {}

#ifdef _WIN32
    virtual bool load(const std::wstring &filepath, bool is64bitOffset, unsigned int wordCount, size_t fileSize) = 0;
#else
    virtual bool load(const std::string &filepath, bool is64bitOffset, unsigned int wordCount, size_t fileSize) = 0;
#endif
    virtual bool findBounds(const std::string &word, uint64_t &offset, uint32_t &size) = 0;
    virtual std::string retrieveKey(int index, uint64_t &offset, uint32_t &size) = 0;
};

class OrdinaryIndexFile: public IIndexFile {
public:
    OrdinaryIndexFile();
    virtual ~OrdinaryIndexFile();

private:
    static const int ENTR_PER_PAGE = 32;
    static const char *CACHE_MAGIC;

    struct IndexEntry {
        int m_Index;
        std::string m_Key;
        void assign(int index, const std::string& key) {
            m_Index = index;
            m_Key.assign(key);
        }
    };

    struct PageEntry {
        char *KeyString;
        uint64_t m_Offset;
        uint32_t m_Size;
    };

    struct CachedPage {
        int m_Index = -1;
        PageEntry m_Entries[ENTR_PER_PAGE];

        CachedPage(): m_Index(-1) {}
        void parseIndexData(char *data, int nent, long index, bool is64Offset);
    };

public:
#ifdef _WIN32
    virtual bool load(const std::wstring &filepath, bool is64bitOffset, unsigned int wordCount, size_t fileSize);
#else
    virtual bool load(const std::string &filepath, bool is64bitOffset, unsigned int wordCount, size_t fileSize);
#endif
    virtual bool findBounds(const std::string &word, uint64_t &offset, uint32_t &size);

private:
#ifdef _WIN32
    bool createCache(const std::wstring &idxfilepath, size_t fileSize);
    bool loadCache(const std::wstring &idxfilepath);
    void saveCache(const std::wstring &idxfilepath);
#else
    bool createCache(const std::string &idxfilepath, size_t fileSize);
    bool loadCache(const std::string &idxfilepath);
    void saveCache(const std::string &idxfilepath);
#endif
    int loadPage(int index);
    char *readFirstKeyOnPage(int pageIndex);
    const char *retrieveFirstKeyOnPage(int pageIndex);
    virtual std::string retrieveKey(int index, uint64_t &offset, uint32_t &size);
    std::string retrieveKey(int index);
    bool findThroughPages(const char *key, int &index);
    bool findInPage(const char *key, int &index);

private:
    std::vector<uint64_t> m_WordOffset;
    FILE *m_IndexFile;
    unsigned int m_WordCount;
    char m_WordEntryBuffer[256+sizeof(uint32_t)*3]; // The length of "word_str" should be less than 256. See src/tools/DICTFILE_FORMAT.
    IndexEntry m_First, m_Last, m_Middle, m_RealLast;
    std::vector<char> m_PageData;
    CachedPage m_Page;
    bool m_Is64BitOffset;
};

class CompressedIndexFile: public IIndexFile {
public:
    CompressedIndexFile();

public:
#ifdef _WIN32
    virtual bool load(const std::wstring &filepath, bool is64bitOffset, unsigned int wordCount, size_t fileSize);
#else
    virtual bool load(const std::string &filepath, bool is64bitOffset, unsigned int wordCount, size_t fileSize);
#endif
    virtual bool findBounds(const std::string &word, uint64_t &offset, uint32_t &size);
    virtual std::string retrieveKey(int index, uint64_t &offset, uint32_t &size);

private:
    bool findInWords(const char *key, int &index);

private:
    std::vector<char> m_IdxDataBuffer;
    std::vector<char *> m_WordList;
    bool m_Is64BitOffset;
};

#endif // INDEXFILE_H


text:
require 'test/spec'
require 'rack/mock'
require 'rack/builder'
require 'rack/content_length'
require 'rack/config'

context "Rack::Config" do

  specify "should accept a block that modifies the environment" do
    app = Rack::Builder.new do
      use Rack::Lint
      use Rack::ContentLength
      use Rack::Config do |env|
        env['greeting'] = 'hello'
      end
      run lambda { |env|
        [200, {'Content-Type' => 'text/plain'}, [env['greeting'] || '']]
      }
    end
    response = Rack::MockRequest.new(app).get('/')
    response.body.should.equal('hello')
  end

end


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

namespace XunitShould
{
    public static partial class Should
    {
        public static void ShouldBeGreaterThan<T>(this T actual, T expected) where T : IComparable<T> {
            if (actual.CompareTo(expected) <= 0) {
                throw new InRangeException(actual, expected, false, null, false);
            }
        }

        public static void ShouldBeGreaterThan<T>(this T actual, T expected, IComparer<T> comparer) {
            if (comparer.Compare(actual, expected) <= 0) {
                throw new InRangeException(actual, expected, false, null, false);
            }
        }

        public static void ShouldBeGreaterThanOrEqualTo<T>(this T actual, T expected) where T : IComparable<T> {
            if (actual.CompareTo(expected) < 0) {
                throw new InRangeException(actual, expected, true, null, false);
            }
        }

        public static void ShouldBeGreaterThanOrEqualTo<T>(this T actual, T expected, IComparer<T> comparer) {
            if (comparer.Compare(actual, expected) < 0) {
                throw new InRangeException(actual, expected, true, null, false);
            }
        }

        public static void ShouldBeInRange<T>(this T actual, T low, T high) where T : IComparable<T> {
            ShouldBeInRange(actual, low, true, high, true);
        }

        public static void ShouldBeInRange<T>(this T actual, T low, T high, IComparer<T> comparer) {
            ShouldBeInRange(actual, low, true, high, true, comparer);
        }

        public static void ShouldBeInRange<T>(this T actual, T low, bool lowInclusive, T high, bool highInclusive) where T : IComparable<T> {
            int compareLow = actual.CompareTo(low);
            int compareHigh = actual.CompareTo(high);
            if ((lowInclusive && compareLow < 0) || (!lowInclusive && compareLow <= 0) || (highInclusive && compareHigh > 0)
                || (!highInclusive && compareHigh >= 0)) {
                throw new InRangeException(actual, low, lowInclusive, high, highInclusive);
            }
        }

        public static void ShouldBeInRange<T>(this T actual, T low, bool lowInclusive, T high, bool highInclusive, IComparer<T> comparer) {
            int compareLow = comparer.Compare(actual, low);
            int compareHigh = comparer.Compare(actual, high);
            if ((lowInclusive && compareLow < 0) || (!lowInclusive && compareLow <= 0) || (highInclusive && compareHigh > 0)
                || (!highInclusive && compareHigh >= 0)) {
                throw new InRangeException(actual, low, lowInclusive, high, highInclusive);
            }
        }

        public static void ShouldBeLessThan<T>(this T actual, T expected) where T : IComparable<T> {
            if (actual.CompareTo(expected) >= 0) {
                throw new InRangeException(actual, null, false, expected, false);
            }
        }

        public static void ShouldBeLessThan<T>(this T actual, T expected, IComparer<T> comparer) {
            if (comparer.Compare(actual, expected) >= 0) {
                throw new InRangeException(actual, null, false, expected, false);
            }
        }

        public static void ShouldBeLessThanOrEqualTo<T>(this T actual, T expected) where T : IComparable<T> {
            if (actual.CompareTo(expected) > 0) {
                throw new InRangeException(actual, null, false, expected, true);
            }
        }

        public static void ShouldBeLessThanOrEqualTo<T>(this T actual, T expected, IComparer<T> comparer) {
            if (comparer.Compare(actual, expected) > 0) {
                throw new InRangeException(actual, null, false, expected, true);
            }
        }

        public static void ShouldNotBeInRange<T>(this T actual, T low, T high) where T : IComparable<T> {
            ShouldNotBeInRange(actual, low, true, high, true);
        }

        public static void ShouldNotBeInRange<T>(this T actual, T low, T high, IComparer<T> comparer) {
            ShouldNotBeInRange(actual, low, true, high, true, comparer);
        }

        public static void ShouldNotBeInRange<T>(this T actual, T low, bool lowInclusive, T high, bool highInclusive) where T : IComparable<T> {
            int compareLow = actual.CompareTo(low);
            int compareHigh = actual.CompareTo(high);
            if (((lowInclusive && compareLow >= 0) || (!lowInclusive && compareLow > 0))
                && ((highInclusive && compareHigh <= 0) || (!highInclusive && compareHigh < 0))) {
                throw new NotInRangeException(actual, low, lowInclusive, high, highInclusive);
            }
        }

        public static void ShouldNotBeInRange<T>(this T actual, T low, bool lowInclusive, T high, bool highInclusive, IComparer<T> comparer) {
            int compareLow = comparer.Compare(actual, low);
            int compareHigh = comparer.Compare(actual, high);
            if (((lowInclusive && compareLow >= 0) || (!lowInclusive && compareLow > 0))
                && ((highInclusive && compareHigh <= 0) || (!highInclusive && compareHigh < 0))) {
                throw new NotInRangeException(actual, low, lowInclusive, high, highInclusive);
            }
        }
    }
}


text:
import unittest
import sys

sys.path.append('..')

from troup.testtools import expect_content
from troup.store import InMemorySyncedStore
from troup.apps import App

class InMemorySyncStoreTest(unittest.TestCase):

    def setUp(self):
        self.store = InMemorySyncedStore(root_path='tests/resources/store', \
                                        apps_file='test_add_app.json',\
                                        settings_file='test_add_app.settings.json')

    @expect_content(file='tests/resources/store/test_add_app.json', \
                    expect_file='tests/resources/store/test_add_app.expected.json', \
                    content_type='json')
    def test_add_app(self):
        app = App(name='test-app', description='description', command='run test-app',\
                 params={'p1':'v1', 'p2':'v2'},\
                 needs={'cpu': 0, 'memory': 1, 'network': 2, 'disk': 3})
        self.store.add_app(app)


text:
<?php

namespace Symfony\Component\DependencyInjection\Dumper;

/**
 * @author Nicolas Grekas <p@tchwork.com>
 *
 * @internal
 */
class Preloader
{
    public static function preload(array $classes)
    {
        set_error_handler(function ($t, $m, $f, $l) {
            if (error_reporting() & $t) {
                if (__FILE__ !== $f) {
                    throw new \ErrorException($m, 0, $t, $f, $l);
                }

                throw new \ReflectionException($m);
            }
        });

        $prev = [];
        $preloaded = [];

        try {
            while ($prev !== $classes) {
                $prev = $classes;
                foreach ($classes as $c) {
                    if (!isset($preloaded[$c])) {
                        self::doPreload($c, $preloaded);
                    }
                }
                $classes = array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits());
            }
        } finally {
            restore_error_handler();
        }
    }

    private static function doPreload(string $class, array &$preloaded)
    {
        if (isset($preloaded[$class]) || \in_array($class, ['self', 'static', 'parent'], true)) {
            return;
        }

        $preloaded[$class] = true;

        try {
            $r = new \ReflectionClass($class);

            if ($r->isInternal()) {
                return;
            }

            $r->getConstants();
            $r->getDefaultProperties();

            if (\PHP_VERSION_ID >= 70400) {
                foreach ($r->getProperties(\ReflectionProperty::IS_PUBLIC) as $p) {
                    if (($t = $p->getType()) && !$t->isBuiltin()) {
                        self::doPreload($t->getName(), $preloaded);
                    }
                }
            }

            foreach ($r->getMethods(\ReflectionMethod::IS_PUBLIC) as $m) {
                foreach ($m->getParameters() as $p) {
                    if ($p->isDefaultValueAvailable() && $p->isDefaultValueConstant()) {
                        $c = $p->getDefaultValueConstantName();

                        if ($i = strpos($c, '::')) {
                            self::doPreload(substr($c, 0, $i), $preloaded);
                        }
                    }

                    if (($t = $p->getType()) && !$t->isBuiltin()) {
                        self::doPreload($t->getName(), $preloaded);
                    }
                }

                if (($t = $m->getReturnType()) && !$t->isBuiltin()) {
                    self::doPreload($t->getName(), $preloaded);
                }
            }
        } catch (\ReflectionException $e) {
            // ignore missing classes
        }
    }
}


text:
    <?php if(!isset($tiene_evaluacion_norma)):?>

            <button class="btn btn-info btn-xs asea_agregar_row_tabla"
                    id="btnAgregarPreguntaUO"
                    data-row_destino="#tbodyRespuestaPreguntaUO"
                    data-row_origen="#newRowRespuestaPreguntaUO">
                Agregar respuesta
            </button>

    <?php endif; ?>

                Opción
                Respuesta

            <?php if(isset($opcion_pregunta_norma_asea)): ?>
                <?php foreach($opcion_pregunta_norma_asea as $op): ?>

                            <input class="form-control" name="opcion_pregunta_norma_asea[<?=$op->id_opcion_pregunta?>][descripcion]" <?=isset($tiene_evaluacion_norma) && $tiene_evaluacion_norma  ? 'disabled="disabled"' : '' ?>
                                   data-rule-required="true" placeholder="Describa la repuesta a la pregunta" value="<?=$op->descripcion?>" >

                                    <input type="radio" name="opcion_pregunta_norma_asea[<?=$op->id_opcion_pregunta?>][tipo_respuesta]" <?=isset($tiene_evaluacion_norma) && $tiene_evaluacion_norma  ? 'disabled="disabled"' : '' ?>
                                           data-rule-required="true" value="correcta" <?=$op->tipo_respuesta == 'correcta' ? 'checked="checked"':''?> >

                                Correcta

                                    <input type="radio" name="opcion_pregunta_norma_asea[<?=$op->id_opcion_pregunta?>][tipo_respuesta]" <?=isset($tiene_evaluacion_norma) && $tiene_evaluacion_norma  ? 'disabled="disabled"' : '' ?>
                                           data-rule-required="true" value="incorrecta" <?=$op->tipo_respuesta == 'incorrecta' ? 'checked="checked"':''?>>

                                Incorrecta

                            <?php if(!$tiene_evaluacion_norma): ?>
                                <button class="btn btn-danger btn-xs eliminar_reglon_tabla" data-toggle="tooltip"
                                        data-placement="bottom" title="Eliminar respuesta" type="button">

                                </button>
                            <?php endif; ?>

                <?php endforeach; ?>
            <?php endif; ?>


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Code Coverage for C:\xampp\htdocs\tp_lyricsbox\application/controllers/Welcome.php</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="../css/bootstrap.min.css" rel="stylesheet">
  <link href="../css/style.css" rel="stylesheet">

C:\xampp\htdocs\tp_lyricsbox\application

controllers

Welcome.php

Code Coverage

Classes and Traits

Functions and Methods

Lines

      Total

           0.00% covered (danger)

0.00%

0 / 1

           0.00% covered (danger)

0.00%

0 / 1

      CRAP

           0.00% covered (danger)

0.00%

0 / 2

      Welcome

           0.00% covered (danger)

0.00%

0 / 1

           0.00% covered (danger)

0.00%

0 / 1

      2

           0.00% covered (danger)

0.00%

0 / 2

       index

           0.00% covered (danger)

0.00%

0 / 1

      2

           0.00% covered (danger)

0.00%

0 / 2

1
	<?php

2
	defined('BASEPATH') OR exit('No direct script access allowed');

3

4
	class Welcome extends CI_Controller {

5

6
	    /**

7
	     * Index Page for this controller.

8
	     *

9
	     * Maps to the following URL

10
	     *         http://example.com/index.php/welcome

11
	     *    - or -

12
	     *         http://example.com/index.php/welcome/index

13
	     *    - or -

14
	     * Since this controller is set as the default controller in

15
	     * config/routes.php, it's displayed at http://example.com/

16
	     *

17
	     * So any other public methods not prefixed with an underscore will

18
	     * map to /index.php/welcome/<method_name>

19
	     * @see https://codeigniter.com/user_guide/general/urls.html

20
	     */

21
	    public function index()

22
	    {

23
	        $this->load->view('welcome_message');

24
	    }

25
	}

Legend

     Executed
     Not Executed
     Dead Code

     Generated by PHP_CodeCoverage 2.2.3 using PHP 5.5.11 and PHPUnit 4.8.9 at Fri Jun 24 4:46:01 CEST 2016.


text:
.share_url_16 img{border:0;padding-right:4px;vertical-align:bottom}
.share_url_16 a{color:#000;text-decoration:none;margin-right:4px;}
.share_url_16 a:hover{background:none;color:#000;text-decoration:none}
.share_url_32 img{border:0;padding-right:4px;vertical-align:middle}
.share_url_32 a{color:#000;text-decoration:none;margin-right:4px;}
.share_url_32 a:hover{background:none;color:#000;text-decoration:none}


text:
import base64
from Crypto import Random
from Crypto.Cipher import AES

BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[:-ord(s[len(s)-1:])]

class AesEncryptor:

    @staticmethod
    def try_decrypt(text, encryption_key):
        try:
            decrypted = AesEncryptor.decrypt(text, encryption_key)
            if not decrypted:
                return False, decrypted
            return True, decrypted
        except Exception:
            pass
        return False, None

    @staticmethod
    def encrypt(text, encryption_key):
        text = pad(text)
        encryption_key = AesEncryptor.normalize_key(encryption_key)
        #SHA256.new(encryption_key).digest()
        iv = Random.new().read(BS)
        aes = AES.new(encryption_key, AES.MODE_CBC, iv)
        return base64.b64encode(iv + aes.encrypt(text))

    @staticmethod
    def decrypt(encrypted, encryption_key):
        # normalize key
        encryption_key = AesEncryptor.normalize_key(encryption_key)
        encrypted = base64.b64decode(encrypted)
        iv = encrypted[:16]
        aes = AES.new(encryption_key, AES.MODE_CBC, iv)
        dec = aes.decrypt(encrypted[16:])
        return unpad(dec).decode("utf-8")

    @staticmethod
    def normalize_key(encryption_key):
        if len(encryption_key) >= 32:
            return encryption_key[:32]
        return pad(encryption_key)


text:
package com.example.DataCaptureApp.transforms;

import com.example.DataCaptureApp.data.Data;
import com.example.DataCaptureApp.data.DataTransform;

/**
 * Created by Tom on 28/10/2014.
 */
public class FieldCopyDataTransform extends DataTransform
{
    private String mFromField;
    private String mToField;

    public FieldCopyDataTransform(String from, String to)
    {
        mFromField = from;
        mToField = to;
    }

    public FieldCopyDataTransform(FieldCopyDataTransform other)
    {
        mFromField = other.mFromField;
        mToField = other.mToField;
    }

    @Override
    public Data transform(Data data)
    {
        Object val = data.get(mFromField);
        if(val != null)
            data.set(mToField, val);
        return data;
    }
}


text:
'use strict';

angular.
    module('propertyCrossWebApp').
    config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
        $locationProvider.hashPrefix('!');
        $urlRouterProvider.otherwise('/initial-state');
        $stateProvider
            .state('initialState', {
                    url: '/initial-state',
                    views: {
                        '': {
                            template: '<initial-state></initial-state>'
                        },
                        'header@initialState': {
                            templateUrl: 'initial-state/initial-state-partials/initial-state-header.template.html'
                        },
                        'title@initialState': {
                            templateUrl: 'initial-state/initial-state-partials/initial-state-title.template.html'
                        },
                        'searching@initialState': {
                            templateUrl: 'initial-state/initial-state-partials/initial-state-searching.template.html'
                        },
                        'recentResults@initialState': {
                            templateUrl: 'initial-state/initial-state-partials/initial-state-recent-results.template.html'
                        },
                        'popupOpen@initialState': {
                            templateUrl: 'initial-state/popups-partials/initial-state-popup-open.template.html'
                        },
                        'popupMap@initialState': {
                            templateUrl: 'initial-state/popups-partials/initial-state-popup-map.template.html'
                        }
                    }
                }
            )
            .state('searchResults', {
                url: '/search-results',
                views: {
                    '': {
                        template: '<search-results></search-results>'
                    },
                    'headerNavigation@searchResults': {
                        templateUrl: 'common-partials/header-navigation-partial.html'
                    },
                    'pageNavigation@searchResults': {
                        templateUrl: 'search-results/search-results-partials/search-results-page-navigation.template.html'
                    },
                    'pagination@searchResults': {
                        templateUrl: 'search-results/search-results-partials/search-results-pages.template.html'
                    },
                }
            })
            .state('favouritesList', {
                url: '/favourites-list',
                views: {
                    '': {
                        template: '<favourites-list></favourites-list>'
                    },
                    'headerNavigation@favouritesList': {
                        templateUrl: 'common-partials/header-navigation-partial.html'
                    },
                    'title@favouritesList': {
                        templateUrl: 'favourites-list/favourites-list-partials/favourites-list-header.template.html'
                    },
                    'emptyList@favouritesList': {
                        templateUrl: 'favourites-list/favourites-list-partials/favourites-list-empty.template.html'
                    },
                    'faveResults@favouritesList': {
                        templateUrl: 'favourites-list/favourites-list-partials/favourites-list-results.template.html'
                    }
                }
            })
            .state('resultDetails', {
                url: '/result-details/:index',
                views: {
                    '': {
                        template: '<result-details></result-details>'
                    },
                    'headerNavigation@resultDetails': {
                        templateUrl: 'common-partials/header-navigation-partial.html'
                    },
                    'title@resultDetails': {
                        templateUrl: 'common-partials/result-details/result-details-partials/result-details-title.template.html'
                    },
                    'information@resultDetails': {
                        templateUrl: 'common-partials/result-details/result-details-partials/result-details-information.template.html'
                    }
                },
                resolve: {
                    PreviousState: [
                        "$state",
                        function ($state) {
                            var currentStateData = {
                                Name: $state.current.name,
                                Params: $state.params,
                                URL: $state.href($state.current.name, $state.params)
                            };
                            return currentStateData;
                        }
                    ]
                }
            });
    });


text:
<?xml version="1.0" encoding="UTF-8"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<artifactId>folder-classpath-container.update</artifactId>
	<packaging>eclipse-update-site</packaging>
	<version>1.0.0-SNAPSHOT</version>
	<parent>
		<artifactId>folder-classpath-container.parent</artifactId>
		<groupId>com.github.mdr</groupId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>
</project>


text:
import { setupHexagonClick } from './eventListeners/units';
import { hexagonMath } from './utils/';

/*-----------------------
-------- PUBLIC ---------
-----------------------*/
/**
 * Handles the selection of hexagons on the map
 *
 * @namespace flatworld.extensions.hexagons
 * @class selectHexagonObject
 * @return {Object}       Return methods inside object
 */
const selectHexagonObject = {
  pluginName: 'selectHexagonObject',
  init,
}

/**
 * @method  init
 * @param {Map} givenMap                  Instantiated Map class object
 * @param {Object} protectedProperties    Holds all the non-public properties to use
 * @param {Array} params                  Rest of the parameters. Like pathWeight (function), getTerrainLayerName(() => string),
 * getData(function)
 */
function init(params) {
  if (!params.pathWeight || typeof params.pathWeight !== 'function') {
    const error = new Error(`Hexagon plugin requires parameters property! This parameter must have "pathWeight"-property
      that is a callback, which returns the weight of the path for path finder. So it must be callback that return
      integer`, params);
    throw error;
  }

  this.mapInstance.hexagonIndexes = createHexagonDataStructure(() => this.mapInstance.allMapObjects[params.getTerrainLayerName()]);

  setupHexagonClick(this.mapInstance, params.pathWeight, params.getData);

  return Promise.resolve();
}

function createHexagonDataStructure(getLayers) {
  const hexagonIndexes = {};
  const objArray = getLayers();
  let indexes;

  objArray.forEach(obj => {
    const correctCoords = obj.getMapCoordinates();

    indexes = hexagonMath.coordinatesToIndexes(correctCoords);

    hexagonIndexes[indexes.x] = hexagonIndexes[indexes.x] || {};
    hexagonIndexes[indexes.x][indexes.y] = obj;
  })

  return hexagonIndexes;
}

/*-----------------------
---------- API ----------
-----------------------*/
const _tests = {
  createHexagonDataStructure
};
export {
  selectHexagonObject,
  _tests
};