text:
$(function () {
	var knownBrackets = [2,4,8,16,32], // brackets with "perfect" proportions (full fields, no byes)

	exampleTeams  = [], // because a bracket needs some teams!

	bracketCount = 0;

	function setTeam(team) {
		this.exampleTeams[] = team;
	}

	function getBracket(base) {

		var closest 		= _.find(knownBrackets, function(k) { return k>=base; }),
			byes 			= closest-base;

		if(byes>0)	base = closest;

		var brackets 	= [],
			round 		= 1,
			baseT 		= base/2,
			baseC 		= base/2,
			teamMark	= 0,
			nextInc		= base/2;

		for(i=1;i<=(base-1);i++) {
			var	baseR = i/baseT,
				isBye = false;

			if(byes>0 && (i%2!=0 || byes>=(baseT-i))) {
				isBye = true;
				byes--;
			}

			var last = _.map(_.filter(brackets, function(b) { return b.nextGame == i; }), function(b) { return {game:b.bracketNo,teams:b.teamnames}; });

			brackets.push({
				lastGames:	round==1 ? null : [last[0].game,last[1].game],
				nextGame:	nextInc+i>base-1?null:nextInc+i,
				teamnames:	round==1 ? [exampleTeams[teamMark],exampleTeams[teamMark+1]] : [last[0].teams[_.random(1)],last[1].teams[_.random(1)]],
				bracketNo:	i,
				roundNo:	round,
				bye:		isBye
			});
			teamMark+=2;
			if(i%2!=0)	nextInc--;
			while(baseR>=1) {
				round++;
				baseC/= 2;
				baseT = baseT + baseC;
				baseR = i/baseT;
			}
		}

		renderBrackets(brackets);
	}

	/*
	 * Inject our brackets
	 */
	function renderBrackets(struct) {
		var groupCount	= _.uniq(_.map(struct, function(s) { return s.roundNo; })).length;

		var group	= $('

'),
			grouped = _.groupBy(struct, function(s) { return s.roundNo; });

		for(g=1;g<=groupCount;g++) {
			var round = $('

');
			_.each(grouped[g], function(gg) {
				if(gg.bye)
					round.append('

');
				else
					round.append('

'+gg.bracketNo+''+gg.teamnames[0]+''+gg.teamnames[1]+'

');
			});
			group.append(round);
		}
		group.append('

'+_.last(struct).teamnames[_.random(1)]+'

');
		$('#brackets').append(group);

		bracketCount++;
		$('html,body').animate({
			scrollTop: $("#b"+(bracketCount-1)).offset().top
		});
	}

	function addBracket(team, bracketsize)
	{
		setTeam(team);
		if(!_.isNaN(bracketsize) && bracketsize <= _.last(this.knownBrackets)) {
			getBracket(bracketsize);
		} else {
			alert('The bracket size you specified is not currently supported.');
		}
	}
}


text:
var onClick;
var item;

exports.populate = function(newItem){
	// Ti.API.info("item: "+newItem);
	// Ti.API.info("item: "+JSON.parse(newItem));
	item = newItem;
	Ti.API.info("item description called with "+JSON.stringify(newItem));
	// $.item_description_field.setValue(newItem.price);
	// $.item_name.addEventListener('click', onClick);
};

exports.setOnClick = function(cb){
	onClick = cb;
};

function addOrder(){
	var orderingService = require("OrderingService");
	orderingService.addOrder(item);
}

redpajama_set_name: RedPajamaGithub


text:
import {List} from 'angular2/src/facade/collection';

/**
 * Converts `funcOrValue` to a string which can be used in generated code.
 */
export function codify(obj: any): string {
  return JSON.stringify(obj);
}

export function rawString(str: string): string {
  return `'${str}'`;
}

/**
 * Combine the strings of generated code into a single interpolated string.
 * Each element of `vals` is expected to be a string literal or a codegen'd
 * call to a method returning a string.
 */
export function combineGeneratedStrings(vals: string[]): string {
  return vals.join(' + ');
}


text:
<?xml version="1.0" encoding="utf-8"?>
<carbon.widget.LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/carbon_menuContainer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="@dimen/carbon_padding"
    android:visibility="invisible"
    app:carbon_inAnimation="fade"
    app:carbon_outAnimation="fade">

    <carbon.widget.LinearLayout
        android:id="@+id/carbon_menuContent"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/carbon_menuHeight"
        android:background="?android:attr/colorBackground"
        android:orientation="horizontal"
        android:paddingLeft="@dimen/carbon_paddingHalf"
        android:paddingRight="@dimen/carbon_paddingHalf"
        app:carbon_elevation="@dimen/carbon_elevationFAB">

        <carbon.widget.Button
            android:id="@+id/carbon_cut"
            style="@style/carbon_Button.Flat"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:minWidth="0dp"
            android:paddingLeft="@dimen/carbon_padding"
            android:paddingRight="@dimen/carbon_padding"
            android:text="cut" />

        <carbon.widget.Button
            android:id="@+id/carbon_copy"
            style="@style/carbon_Button.Flat"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:minWidth="0dp"
            android:paddingLeft="@dimen/carbon_padding"
            android:paddingRight="@dimen/carbon_padding"
            android:text="copy" />

        <carbon.widget.Button
            android:id="@+id/carbon_paste"
            style="@style/carbon_Button.Flat"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:minWidth="0dp"
            android:paddingLeft="@dimen/carbon_padding"
            android:paddingRight="@dimen/carbon_padding"
            android:text="paste" />

        <carbon.widget.Button
            android:id="@+id/carbon_selectAll"
            style="@style/carbon_Button.Flat"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:minWidth="0dp"
            android:text="select all"
            android:paddingLeft="@dimen/carbon_padding"
            android:paddingRight="@dimen/carbon_padding" />
    </carbon.widget.LinearLayout>
</carbon.widget.LinearLayout>


text:
import routes
import webob
import webob.exc

from .decisions import process

class WSGIMachine(object):

    def __init__(self, paths):
        self.route_map = routes.Mapper()
        for path, res in paths:
            self.route_map.connect(path, resource=res)

    def __call__(self, environ, start_response):
        req = webob.Request(environ)
        rsp = webob.Response()

        match = self.route_map.routematch(req.path)
        if match is None:
            rsp = webob.exc.HTTPNotFound()
        else:
            res = match[0]["resource"]
            try:
                process(res, req, rsp)
            except webob.exc.HTTPException, error:
                rsp = error

        return rsp(environ, start_response)


text:
angular.module('restaurantPOS', ['ui.router', 'ui.materialize'])
	.config(['$stateProvider', '$urlRouterProvider', '$locationProvider',
			function($stateProvider, $urlRouterProvider, $locationProvider) {
				$stateProvider
					.state('home', {
						url: '/',
						templateUrl:'/views/landingpage.html',
						controller: 'MainCtrl'
					})
					.state('search', {
						url: '/search',
						templateUrl: '/views/search.html',
						controller: 'MainCtrl'
					})
					.state('jobs', {
						url: '/jobs',
						templateUrl: '/views/jobs.html',
						params: {
							jobs: null
						},
						controller: 'JobsCtrl'
					})
					.state('careers', {
						url: '/careers',
						templateUrl: '/views/careers.html',
						params: {
							careers: null
						},
						controller: 'CareersCtrl'
					})
					.state('companies', {
						url: '/companies',
						templateUrl: '/views/companies.html',
						params: {
							companies: null
						},
						controller: 'CompaniesCtrl'
					})
					.state('login', {
						url: '/login',
						templateUrl: '/views/login.html',
						controller: 'MainCtrl'
					})
					.state('register', {
						url: '/register',
						templateUrl: '/views/register.html',
						controller: 'MainCtrl'
					})
					.state('profile', {
						url: '/profile',
						views: {
							'': {
								templateUrl: '/views/profile.html',
								controller: 'ProfileCtrl'
							},
							'myjobs@profile': {
								templateUrl: '/views/myjobs.html',
								controller: 'MyJobsCtrl'
							}
						}
					})
					.state('jobdetails', {
						url: '/jobdetails',
						templateUrl: '/views/jobdetails.html',
						params: {
							details: null
						},
						controller: 'JobDetailCtrl'
					})
					.state('logout', {
						url: '/logout',
						controller: function($window, $state) {
							// User.logout();
							$state.go('logout');
							$window.location.reload();
						}
					})
				$locationProvider.html5Mode(true);
	}])


text:
@implementation NSDictionary (ConvertValue)

- (NSString *)stringForKey:(NSString *)key
{
    id value = [self valueForKey:key];
    if([value isKindOfClass:[NSNull class]]) return @"";
    else if([value isKindOfClass:[NSNumber class]]) return [value stringValue];
    return value;
}

- (NSNumber *)numberForKey:(NSString *)key
{
    id value = [self valueForKey:key];
    if([value isKindOfClass:[NSNull class]]) return @0;
    else if([value isKindOfClass:[NSString class]]) return @([value integerValue]);
    return value;
}

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<component size="900,90" extention="Button">
  <displayList>
    <image id="n13" name="n13" src="fymi18" fileName="images/9.png" xy="811,1" size="86,86"/>
    <image id="n9" name="n9" src="kfcb1k" fileName="images/7.png" xy="111,5" size="700,55">
      <relation target="n11" sidePair="height-height,width-width"/>
      <relation target="" sidePair="right-right"/>
    </image>
    <loader id="n10" name="icon" xy="814,5" size="80,80" align="center" vAlign="middle" fill="scale"/>
    <richtext id="n11" name="msg" xy="122,18" size="663,28" fontSize="24" leading="5" autoSize="height" text="">
      <relation target="" sidePair="right-right"/>
    </richtext>
  </displayList>
  <Button/>
  <relation target="n9" sidePair="height-height"/>
</component>


text:
/*!
 * \file tvm/relay/attrs/transform.h
 * \brief Transform operators.
 */
#ifndef TVM_RELAY_ATTRS_TRANSFORM_H_
#define TVM_RELAY_ATTRS_TRANSFORM_H_

#include <tvm/ir/attrs.h>
#include <tvm/relay/base.h>
#include <tvm/relay/expr.h>

#include <string>

namespace tvm {
namespace relay {

/*! \brief data type cast */
struct CastAttrs : public tvm::AttrsNode<CastAttrs> {
  DataType dtype;

  TVM_DECLARE_ATTRS(CastAttrs, "relay.attrs.CastAttrs") {
    TVM_ATTR_FIELD(dtype).describe("Target data type");
  }
};  // struct CastAttrs.

/*! \brief Attributes used in expand_dims operators */
struct ExpandDimsAttrs : public tvm::AttrsNode<ExpandDimsAttrs> {
  int axis;
  int num_newaxis;

  TVM_DECLARE_ATTRS(ExpandDimsAttrs, "relay.attrs.ExpandDimsAttrs") {
    TVM_ATTR_FIELD(axis).describe(
        "The axis at which the input array is expanded."
        "Should lie in range `[-data.ndim - 1, data.ndim]`."
        "If `axis < 0`, it is the first axis inserted;"
        "If `axis >= 0`, it is the last axis inserted in Python's negative indexing.");
    TVM_ATTR_FIELD(num_newaxis)
        .describe("Number of axises to be inserted. Should be >= 0.")
        .set_lower_bound(0)
        .set_default(1);
  }
};  // struct ExpandDimsAttrs

/*! \brief Attributes used in concatenate operators */
struct ConcatenateAttrs : public tvm::AttrsNode<ConcatenateAttrs> {
  int axis;
  TVM_DECLARE_ATTRS(ConcatenateAttrs, "relay.attrs.ConcatenateAttrs") {
    TVM_ATTR_FIELD(axis)
        .describe(
            "The axis at which the input arrays are concatenated."
            "Should lie in range `[-ndim, ndim)`.")
        .set_default(0);
  }
};  // struct ConcatenateAttrs

/*! \brief Attributes used in transpose operators */
struct TransposeAttrs : public tvm::AttrsNode<TransposeAttrs> {
  Array<Integer> axes;
  TVM_DECLARE_ATTRS(TransposeAttrs, "relay.attrs.TransposeAttrs") {
    TVM_ATTR_FIELD(axes).describe("The target axes order, reverse order if not specified.");
  }
};  // struct TransposeAttrs

/*! \brief Attributes used in reshape operators */
struct ReshapeAttrs : public tvm::AttrsNode<ReshapeAttrs> {
  Array<Integer> newshape;
  bool reverse;
  TVM_DECLARE_ATTRS(ReshapeAttrs, "relay.attrs.ReshapeAttrs") {
    TVM_ATTR_FIELD(newshape).describe(
        "The new shape. Should be compatible with the original shape.");
    TVM_ATTR_FIELD(reverse)
        .describe("Infer the special values from right to left if true")
        .set_default(false);
  }
};  // struct ReshapeAttrs

struct ScatterAttrs : public tvm::AttrsNode<ScatterAttrs> {
  Integer axis;

  TVM_DECLARE_ATTRS(ScatterAttrs, "relay.attrs.ScatterAttrs") {
    TVM_ATTR_FIELD(axis).set_default(0).describe("The axis over which to select values.");
  }
};

struct ScatterAddAttrs : public tvm::AttrsNode<ScatterAddAttrs> {
  Integer axis;

  TVM_DECLARE_ATTRS(ScatterAddAttrs, "relay.attrs.ScatterAddAttrs") {
    TVM_ATTR_FIELD(axis).set_default(0).describe("The axis over which to select values.");
  }
};

struct GatherAttrs : public tvm::AttrsNode<GatherAttrs> {
  Integer axis;

  TVM_DECLARE_ATTRS(GatherAttrs, "relay.attrs.GatherAttrs") {
    TVM_ATTR_FIELD(axis)
        .set_default(NullValue<Integer>())
        .describe("The axis over which to select values.");
  }
};

struct TakeAttrs : public tvm::AttrsNode<TakeAttrs> {
  Integer axis;
  std::string mode;

  TVM_DECLARE_ATTRS(TakeAttrs, "relay.attrs.TakeAttrs") {
    TVM_ATTR_FIELD(axis)
        .set_default(NullValue<Integer>())
        .describe("The axis over which to select values.");
    TVM_ATTR_FIELD(mode).set_default("clip").describe(
        "Specify how out-of-bound indices will behave."
        "clip - clip to the range (default)"
        "wrap - wrap around the indices"
        "fast - no clip or wrap around (user must make sure indices are in-bound)");
  }
};

/*! \brief Attributes that specify a tensor */
struct InitOpAttrs : public tvm::AttrsNode<InitOpAttrs> {
  Optional<Array<Integer>> shape;
  DataType dtype;

  TVM_DECLARE_ATTRS(InitOpAttrs, "relay.attrs.InitOpAttrs") {
    TVM_ATTR_FIELD(shape).describe("Target shape.");
    TVM_ATTR_FIELD(dtype).describe("Target data type.").set_default(NullValue<DataType>());
  }
};  // struct InitOpAttrs

/*! \brief Attributes used in arange operators */
struct ArangeAttrs : public tvm::AttrsNode<ArangeAttrs> {
  Expr start;
  Expr stop;
  Expr step;
  DataType dtype;

  TVM_DECLARE_ATTRS(ArangeAttrs, "relay.attrs.ArangeAttrs") {
    TVM_ATTR_FIELD(start).describe("Start of interval. The interval includes this value.");
    TVM_ATTR_FIELD(stop).describe("Stop of interval. The interval does not include this value.");
    TVM_ATTR_FIELD(step).describe("Spacing between values.");
    TVM_ATTR_FIELD(dtype).describe("Target data type.");
  }
};  // struct ArangeAttrs

/*! \brief Attributes used in meshgrid operators */
struct MeshgridAttrs : public tvm::AttrsNode<MeshgridAttrs> {
  std::string indexing;

  TVM_DECLARE_ATTRS(MeshgridAttrs, "relay.attrs.MeshgridAttrs") {
    TVM_ATTR_FIELD(indexing)
        .describe(
            "Indexing mode, either \"ij\" for matrix or \"xy\" for cartesian in which first two"
            "dimensions are swapped.")
        .set_default("ij");
  }
};  // struct MeshgridAttrs

/*! \brief Attributes used in stack operators */
struct StackAttrs : public tvm::AttrsNode<StackAttrs> {
  Integer axis;
  TVM_DECLARE_ATTRS(StackAttrs, "relay.attrs.StackAttrs") {
    TVM_ATTR_FIELD(axis).set_default(0).describe(
        "The axis in the result array along which the input arrays are stacked.");
  }
};  // struct StackAttrs

/*! \brief Attributes used in repeat operators */
struct RepeatAttrs : public tvm::AttrsNode<RepeatAttrs> {
  Integer repeats;
  Integer axis;
  TVM_DECLARE_ATTRS(RepeatAttrs, "relay.attrs.RepeatAttrs") {
    TVM_ATTR_FIELD(repeats).describe("The number of repetitions for each element.");
    TVM_ATTR_FIELD(axis)
        .set_default(NullValue<Integer>())
        .describe(" The axis along which to repeat values.");
  }
};  // struct RepeatAttrs

/*! \brief Attributes used in tile operators */
struct TileAttrs : public tvm::AttrsNode<TileAttrs> {
  Array<Integer> reps;
  TVM_DECLARE_ATTRS(TileAttrs, "relay.attrs.TileAttrs") {
    TVM_ATTR_FIELD(reps).describe(
        "The number of times for repeating the tensor a."
        "Each dim sizeof reps must be a positive integer.");
  }
};  // struct TileAttrs

/*! \brief Attributes used in reverse operators */
struct ReverseAttrs : public tvm::AttrsNode<ReverseAttrs> {
  Integer axis;
  TVM_DECLARE_ATTRS(ReverseAttrs, "relay.attrs.ReverseAttrs") {
    TVM_ATTR_FIELD(axis)
        .set_default(NullValue<Integer>())
        .describe("The axis along which to reverse elements.");
  }
};  // struct ReverseAttrs

/*! \brief Attributes used in reverse_sequence operators */
struct ReverseSequenceAttrs : public tvm::AttrsNode<ReverseSequenceAttrs> {
  Integer seq_axis;
  Integer batch_axis;

  TVM_DECLARE_ATTRS(ReverseSequenceAttrs, "relay.attrs.ReverseSequenceAttrs") {
    TVM_ATTR_FIELD(seq_axis).set_default(1).describe(
        "The seq axis along which to reverse elements.");
    TVM_ATTR_FIELD(batch_axis)
        .set_default(0)
        .describe("The batch axis along which to slice the tensor.");
  }
};  // struct ReverseSequenceAttrs

/*! \brief Attributes used in squeeze operators */
struct SqueezeAttrs : public tvm::AttrsNode<SqueezeAttrs> {
  // use axis to make the name numpy compatible.
  Array<Integer> axis;

  TVM_DECLARE_ATTRS(SqueezeAttrs, "relay.attrs.SqueezeAttrs") {
    TVM_ATTR_FIELD(axis)
        .describe(
            "The axis to squeeze in the input tensor."
            "If `axis = None`, all axis of dimension 1 get squeezed;"
            "Else, the dimension in axes get squeezed."
            "It is an error if an axis does not has dimension 1.")
        .set_default(NullValue<Array<Integer>>());
  }
};  // struct SqueezeAttrs

struct SplitAttrs : public tvm::AttrsNode<SplitAttrs> {
  ObjectRef indices_or_sections;
  int axis;

  TVM_DECLARE_ATTRS(SplitAttrs, "relay.attrs.SplitAttrs") {
    TVM_ATTR_FIELD(indices_or_sections)
        .describe(
            "Indices or sections to split into. Accepts an int or a tuple"
            "If indices_or_sections is an integer, the input will be divided equally"
            "along given axis. If such a split is not possible, an error is raised."
            "If indices_or_sections is a tuple of sorted integers,"
            "the entries indicate where along axis the array is split.");
    TVM_ATTR_FIELD(axis).set_default(0).describe("the axis to be splitted.");
  }
};

/*! \brief Attributes for StridedSlice operator */
struct StridedSliceAttrs : public tvm::AttrsNode<StridedSliceAttrs> {
  Optional<Array<Integer>> begin;
  Optional<Array<Integer>> end;
  Optional<Array<Integer>> strides;
  std::string slice_mode;

  TVM_DECLARE_ATTRS(StridedSliceAttrs, "relay.attrs.StridedSliceAttrs") {
    TVM_ATTR_FIELD(begin).describe("Indices for begin of slice, begin index is also inclusive");
    TVM_ATTR_FIELD(end).describe("Indices for end of slice, end index is exclusive");
    TVM_ATTR_FIELD(strides).describe(
        "Stride values of the slice, a stride can be negative, which causes a reverse slice.");
    TVM_ATTR_FIELD(slice_mode)
        .set_default("end")
        .describe(
            "The slice mode [end, size]."
            "end - The default slice mode, ending indices for the slice."
            "size - The input strides will be ignored, input end in this mode indicates the size"
            "of a slice starting at the location specified by begin. If end[i] is -1,"
            "all remaining elements in that dimension are included in the slice");
  }
};

struct SliceLikeAttrs : public tvm::AttrsNode<SliceLikeAttrs> {
  Array<Integer> axes;

  TVM_DECLARE_ATTRS(SliceLikeAttrs, "relay.attrs.SliceLikeAttrs") {
    TVM_ATTR_FIELD(axes).describe(
        "List of axes on which input data will be sliced according to the "
        "corresponding size of the second input. By default will slice "
        "on all axes. Negative axes mean counting in reverse.");
  }
};

/*! \brief Attributes for Clip operator */
struct ClipAttrs : public tvm::AttrsNode<ClipAttrs> {
  double a_min;
  double a_max;

  TVM_DECLARE_ATTRS(ClipAttrs, "relay.attrs.ClipAttrs") {
    TVM_ATTR_FIELD(a_min).describe("The minimum clip value.");
    TVM_ATTR_FIELD(a_max).describe("The maximum clip value.");
  }
};

/*! \brief Attributes for FixedPointMultiply operator */
struct FixedPointMultiplyAttrs : public tvm::AttrsNode<FixedPointMultiplyAttrs> {
  int32_t multiplier;
  int32_t shift;

  TVM_DECLARE_ATTRS(FixedPointMultiplyAttrs, "relay.attrs.FixedPointMultiplyAttrs") {
    TVM_ATTR_FIELD(multiplier)
        .describe("Multiplier of a fixed floating point number described as multiplier*2^(shift)");
    TVM_ATTR_FIELD(shift).describe(
        "Shift of a fixed floating point number described as multiplier*2^(shift)");
  }
};

/*! \brief Attributes for LayoutTransform operator */
struct LayoutTransformAttrs : public tvm::AttrsNode<LayoutTransformAttrs> {
  std::string src_layout;
  std::string dst_layout;

  TVM_DECLARE_ATTRS(LayoutTransformAttrs, "relay.attrs.LayoutTransformAttrs") {
    TVM_ATTR_FIELD(src_layout).describe("The source layout of the tensor. (e.g. NCHW)");
    TVM_ATTR_FIELD(dst_layout).describe("The destination layout of the tensor. (e.g. NCHW16c)");
  }
};

/*! \brief Attributes for ShapeOf operator */
struct ShapeOfAttrs : public tvm::AttrsNode<ShapeOfAttrs> {
  DataType dtype;

  TVM_DECLARE_ATTRS(ShapeOfAttrs, "relay.attrs.ShapeOfAttrs") {
    TVM_ATTR_FIELD(dtype).describe("Target data type").set_default(NullValue<DataType>());
  }
};

struct SequenceMaskAttrs : public tvm::AttrsNode<SequenceMaskAttrs> {
  double mask_value;
  int axis;

  TVM_DECLARE_ATTRS(SequenceMaskAttrs, "relay.attrs.SequenceMaskAttrs") {
    TVM_ATTR_FIELD(mask_value).set_default(0).describe("The masking value.");
    TVM_ATTR_FIELD(axis).set_default(0).describe(
        "The axis of the length dimension. Can only be 0 or 1.");
  }
};  // struct SequenceMaskAttrs.

/*! \brief Attributes used in sparse_to_dense operator */
struct SparseToDenseAttrs : public tvm::AttrsNode<SparseToDenseAttrs> {
  Array<Integer> output_shape;

  TVM_DECLARE_ATTRS(SparseToDenseAttrs, "relay.attrs.SparseToDenseAttrs") {
    TVM_ATTR_FIELD(output_shape).describe("Shape of the dense output tensor");
  }
};  // struct SparseToDenseAttrs

/*! \brief Attributes for ndarray_size operator */
struct NdarraySizeAttrs : public tvm::AttrsNode<NdarraySizeAttrs> {
  DataType dtype;

  TVM_DECLARE_ATTRS(NdarraySizeAttrs, "relay.attrs.NdarraySizeAttrs") {
    TVM_ATTR_FIELD(dtype).describe("Target data type").set_default(NullValue<DataType>());
  }
};

/*! \brief Attributes used in one-hot operator */
struct OneHotAttrs : public tvm::AttrsNode<OneHotAttrs> {
  int depth;
  int axis;
  DataType dtype;

  TVM_DECLARE_ATTRS(OneHotAttrs, "relay.attrs.OneHotAttrs") {
    TVM_ATTR_FIELD(depth).set_default(1).describe("Depth of the one hot dimension.");
    TVM_ATTR_FIELD(axis).set_default(-1).describe("Axis to fill.");
    TVM_ATTR_FIELD(dtype).set_default(NullValue<DataType>()).describe("Output data type.");
  }
};  // struct OneHotAttrs

/*! \brief Attributes used in matrix_set_diag operator */
struct MatrixSetDiagAttrs : public tvm::AttrsNode<MatrixSetDiagAttrs> {
  int k1;
  int k2;
  bool super_diag_right_align;
  bool sub_diag_right_align;

  TVM_DECLARE_ATTRS(MatrixSetDiagAttrs, "relay.attrs.MatrixSetDiagAttrs") {
    TVM_ATTR_FIELD(k1).set_default(0).describe("Lower limit (included) of the range of diagonals.");
    TVM_ATTR_FIELD(k2).set_default(0).describe("Upper limit (included) of the range of diagonals.");
    TVM_ATTR_FIELD(super_diag_right_align)
        .set_default(true)
        .describe("Bool, true iff super-diagonal is right aligned (left-padded).");
    TVM_ATTR_FIELD(sub_diag_right_align)
        .set_default(false)
        .describe("Bool, true iff sub-diagonal is right aligned (left-padded).");
  }
};  // struct MatrixSetDiagAttrs

}  // namespace relay
}  // namespace tvm
#endif  // TVM_RELAY_ATTRS_TRANSFORM_H_


text:
<!DOCTYPE HTML>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>MyST Me</title>

<form id="MyST_MeForm" class="model-exporter-form" method="post">
<fieldset>

<legend>MyST ME - MySQL database to Sencha Touch Model Exporter</legend>

  Database host
  <input id="host" name="host" type="text" value="127.0.0.1" class="text-input" required="">

  Database Username
  <input id="userName" name="userName" type="text" value="root" class="text-input" required="">

  Database Password
  <input id="dbPassword" name="dbPassword" type="password" value="" class="text-input">

  Database Instance
  <input id="databaseName" name="databaseName" type="text" value="mydb" class="text-input" required="">

  <button type="button" id="getTablesButton" name="getTablesButton" onclick="getTables()">Get Tables</button>

    Database Tables

    Database Tables Selected to Export

            <select id="dbTableValuesLeft" size="7" multiple style="width:200px">
            </select>

            <input type="button" id="allRightDbTable" value=">>" />

            <input type="button" id="btnRightDbTable" value=">" />

            <input type="button" id="allLeftDbTable" value="<<" />

            <input type="button" id="btnLeftDbTable" value="<" />

           <select name="dbTableValuesRight[]" id="dbTableValuesRight" size="7" multiple style="width:200px">
           </select>

<button type="button" id="selectAllOptions" name="selectAllOptions" onclick="selectAllNoOptions(this)">Select All Options</button>

          <input id="presenceValidation" name="presenceValidation" type="checkbox" class="checkbox-input">
  	  	  Add presence validation for non-null attributes.

          <input id="inclusionValidation" name="inclusionValidation" type="checkbox" class="checkbox-input">
  	  	  Add inclusion validation for enum attributes.

          <input id="maxLengthValidation" name="maxLengthValidation" type="checkbox" class="checkbox-input">
  	  	  Add maximum length validation for varchar attributes.

          <input id="formatValidation" name="formatValidation" type="checkbox" class="checkbox-input">
  	  	  Add format validation for varchar attributes.

  	  	  Format Validation Regular expression:
          <input id="regExString" name="regExString" type="text" value="^[A-Za-z0-9 _]*$" class="text-input" disabled>

          <input id="addIdentifier" name="addIdentifier" type="checkbox" class="checkbox-input">
  	  	  Add uuid identifier strategy.

          <input id="addDefaultValues" name="addDefaultValues" type="checkbox" class="checkbox-input">
  	  	  Add default values for attributes.

          <input id="hasMany" name="hasMany" type="checkbox" class="checkbox-input">
  	  	  Add hasMany configuration for attributes that come from foreign key relationships that are not part of the primary key.

          <input id="belongsTo" name="belongsTo" type="checkbox" class="checkbox-input">
  	  	  Add belongsTo configuration for tables related to only one other table.

          <input id="idProperty" name="idProperty" type="checkbox" class="checkbox-input">
  	  	  Add idProperty for primary key.

  	  	<input type="radio" name="radios" id="useTab" value="useTab" class="radio-input">
  	  	Use tabs at begining of line.
  	  	<input type="radio" name="radios" id="useSpaces" value="useSpaces" checked="checked" class="radio-input">
  	  	Use sapces at begining of line.

  	  	Number of spaces to use:
        <input id="numberOfSpaces" name="numberOfSpaces" type="text" value="2" class="text-input">

Enter the project name:

  <input id="projectName" type="text" name="projectName" class="text-input" required="" value="BVA">

<input id="submit" type="submit" value="Export Models" onclick="submitTables()">

</fieldset>
</form>


text:
class Noisy < Cask
  version :latest
  sha256 :no_check

  url 'https://github.com/downloads/jonshea/Noisy/Noisy.zip'
  homepage 'https://github.com/jonshea/Noisy'

  app 'Noisy.app'
end


text:
/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.directory.model;

/**
 * JSON template for an externalId entry.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Admin SDK API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class UserExternalId extends com.google.api.client.json.GenericJson {

  /**
   * Custom type.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String customType;

  /**
   * The type of the Id.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String type;

  /**
   * The value of the id.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String value;

  /**
   * Custom type.
   * @return value or {@code null} for none
   */
  public java.lang.String getCustomType() {
    return customType;
  }

  /**
   * Custom type.
   * @param customType customType or {@code null} for none
   */
  public UserExternalId setCustomType(java.lang.String customType) {
    this.customType = customType;
    return this;
  }

  /**
   * The type of the Id.
   * @return value or {@code null} for none
   */
  public java.lang.String getType() {
    return type;
  }

  /**
   * The type of the Id.
   * @param type type or {@code null} for none
   */
  public UserExternalId setType(java.lang.String type) {
    this.type = type;
    return this;
  }

  /**
   * The value of the id.
   * @return value or {@code null} for none
   */
  public java.lang.String getValue() {
    return value;
  }

  /**
   * The value of the id.
   * @param value value or {@code null} for none
   */
  public UserExternalId setValue(java.lang.String value) {
    this.value = value;
    return this;
  }

  @Override
  public UserExternalId set(String fieldName, Object value) {
    return (UserExternalId) super.set(fieldName, value);
  }

  @Override
  public UserExternalId clone() {
    return (UserExternalId) super.clone();
  }

}


text:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

#include "trousers/tss.h"
#include "trousers/trousers.h"
#include "trousers_types.h"
#include "spi_utils.h"
#include "capabilities.h"
#include "tsplog.h"
#include "hosttable.h"
#include "tcsd_wrap.h"
#include "obj.h"
#include "rpc_tcstp_tsp.h"

TSS_RESULT
RPC_EstablishTransport_TP(struct host_table_entry *hte,
			   UINT32                  ulTransControlFlags,
			   TCS_KEY_HANDLE          hEncKey,
			   UINT32                  ulTransSessionInfoSize,
			   BYTE*                   rgbTransSessionInfo,
			   UINT32                  ulSecretSize,
			   BYTE*                   rgbSecret,
			   TPM_AUTH*               pEncKeyAuth,		/* in, out */
			   TPM_MODIFIER_INDICATOR* pbLocality,
			   TCS_HANDLE*             hTransSession,
			   UINT32*                 ulCurrentTicksSize,
			   BYTE**                  prgbCurrentTicks,
			   TPM_NONCE*              pTransNonce)
{
	TSS_RESULT result;
	UINT32 i;

	initData(&hte->comm, 8);
	hte->comm.hdr.u.ordinal = TCSD_ORD_ESTABLISHTRANSPORT;
	LogDebugFn("IN: TCS Context: 0x%x", hte->tcsContext);

	if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, 1, &ulTransControlFlags, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, 2, &hEncKey, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, 3, &ulTransSessionInfoSize, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_PBYTE, 4, rgbTransSessionInfo, ulTransSessionInfoSize,
		    &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, 5, &ulSecretSize, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_PBYTE, 6, rgbSecret, ulSecretSize, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (pEncKeyAuth) {
		if (setData(TCSD_PACKET_TYPE_AUTH, 7, pEncKeyAuth, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
	}

	result = sendTCSDPacket(hte);

	if (result == TSS_SUCCESS)
		result = hte->comm.hdr.u.result;

	if (result == TSS_SUCCESS) {
		i = 0;
		if (pEncKeyAuth) {
			if (getData(TCSD_PACKET_TYPE_AUTH, i++, pEncKeyAuth, 0, &hte->comm)) {
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto done;
			}
		}
		if (getData(TCSD_PACKET_TYPE_UINT32, i++, pbLocality, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto done;
		}
		if (getData(TCSD_PACKET_TYPE_UINT32, i++, hTransSession, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto done;
		}
		if (getData(TCSD_PACKET_TYPE_UINT32, i++, ulCurrentTicksSize, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto done;
		}

		*prgbCurrentTicks = malloc(*ulCurrentTicksSize);
		if (*prgbCurrentTicks == NULL) {
			*ulCurrentTicksSize = 0;
			result = TSPERR(TSS_E_OUTOFMEMORY);
			goto done;
		}

		if (getData(TCSD_PACKET_TYPE_PBYTE, i++, *prgbCurrentTicks, *ulCurrentTicksSize,
			    &hte->comm)) {
			free(*prgbCurrentTicks);
			*prgbCurrentTicks = NULL;
			*ulCurrentTicksSize = 0;
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto done;
		}
		if (getData(TCSD_PACKET_TYPE_NONCE, i++, pTransNonce, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto done;
		}
	}
done:
	return result;
}

TSS_RESULT
RPC_ExecuteTransport_TP(struct host_table_entry *hte,
			 TPM_COMMAND_CODE        unWrappedCommandOrdinal,
			 UINT32                  ulWrappedCmdParamInSize,
			 BYTE*                   rgbWrappedCmdParamIn,
			 UINT32*                 pulHandleListSize,	/* in, out */
			 TCS_HANDLE**            rghHandles,		/* in, out */
			 TPM_AUTH*               pWrappedCmdAuth1,	/* in, out */
			 TPM_AUTH*               pWrappedCmdAuth2,	/* in, out */
			 TPM_AUTH*               pTransAuth,		/* in, out */
			 UINT64*                 punCurrentTicks,
			 TPM_MODIFIER_INDICATOR* pbLocality,
			 TPM_RESULT*             pulWrappedCmdReturnCode,
			 UINT32*                 ulWrappedCmdParamOutSize,
			 BYTE**                  rgbWrappedCmdParamOut)
{
	TSS_RESULT result;
	TPM_AUTH null_auth;
	UINT32 i = 0;

	memset(&null_auth, 0, sizeof(TPM_AUTH));

	initData(&hte->comm, 9);
	hte->comm.hdr.u.ordinal = TCSD_ORD_EXECUTETRANSPORT;
	LogDebugFn("IN: TCS Context: 0x%x", hte->tcsContext);

	if (setData(TCSD_PACKET_TYPE_UINT32, i++, &hte->tcsContext, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, i++, &unWrappedCommandOrdinal, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, i++, &ulWrappedCmdParamInSize, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_PBYTE, i++, rgbWrappedCmdParamIn, ulWrappedCmdParamInSize,
		    &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, i++, pulHandleListSize, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (*pulHandleListSize) {
		if (setData(TCSD_PACKET_TYPE_PBYTE, i++, *rghHandles,
			    *pulHandleListSize * sizeof(UINT32), &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	}
	if (pWrappedCmdAuth1) {
		if (setData(TCSD_PACKET_TYPE_AUTH, i++, pWrappedCmdAuth1, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
	} else {
		if (setData(TCSD_PACKET_TYPE_AUTH, i++, &null_auth, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
	}
	if (pWrappedCmdAuth2) {
		if (setData(TCSD_PACKET_TYPE_AUTH, i++, pWrappedCmdAuth2, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
	} else {
		if (setData(TCSD_PACKET_TYPE_AUTH, i++, &null_auth, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
	}
	if (setData(TCSD_PACKET_TYPE_AUTH, i++, pTransAuth, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);

	result = sendTCSDPacket(hte);

	if (result == TSS_SUCCESS)
		result = hte->comm.hdr.u.result;

	if (result == TSS_SUCCESS) {
		i = 0;
		if (getData(TCSD_PACKET_TYPE_UINT32, i++, pulHandleListSize, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);

		if (*pulHandleListSize) {
			*rghHandles = malloc(*pulHandleListSize * sizeof(UINT32));
			if (*rghHandles == NULL) {
				*pulHandleListSize = 0;
				return TSPERR(TSS_E_INTERNAL_ERROR);
			}
			if (getData(TCSD_PACKET_TYPE_PBYTE, i++, *rghHandles,
				    *pulHandleListSize * sizeof(UINT32), &hte->comm)) {
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto error;
			}
		}
		if (pWrappedCmdAuth1) {
			if (getData(TCSD_PACKET_TYPE_AUTH, i++, pWrappedCmdAuth1, 0, &hte->comm)) {
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto error;
			}
		} else {
			if (getData(TCSD_PACKET_TYPE_AUTH, i++, &null_auth, 0, &hte->comm)) {
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto error;
			}
		}
		if (pWrappedCmdAuth2) {
			if (getData(TCSD_PACKET_TYPE_AUTH, i++, pWrappedCmdAuth2, 0, &hte->comm)) {
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto error;
			}
		} else {
			if (getData(TCSD_PACKET_TYPE_AUTH, i++, &null_auth, 0, &hte->comm)) {
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto error;
			}
		}
		if (getData(TCSD_PACKET_TYPE_AUTH, i++, pTransAuth, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto error;
		}
		if (getData(TCSD_PACKET_TYPE_UINT64, i++, punCurrentTicks, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto error;
		}
		if (getData(TCSD_PACKET_TYPE_UINT32, i++, pbLocality, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto error;
		}
		if (getData(TCSD_PACKET_TYPE_UINT32, i++, pulWrappedCmdReturnCode, 0, &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto error;
		}
		if (getData(TCSD_PACKET_TYPE_UINT32, i++, ulWrappedCmdParamOutSize, 0,
			    &hte->comm)) {
			result = TSPERR(TSS_E_INTERNAL_ERROR);
			goto error;
		}
		if (*ulWrappedCmdParamOutSize) {
			*rgbWrappedCmdParamOut = malloc(*ulWrappedCmdParamOutSize);
			if (*rgbWrappedCmdParamOut == NULL) {
				*ulWrappedCmdParamOutSize = 0;
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto error;
			}
			if (getData(TCSD_PACKET_TYPE_PBYTE, i++, *rgbWrappedCmdParamOut,
				    *ulWrappedCmdParamOutSize, &hte->comm)) {
				free(*rgbWrappedCmdParamOut);
				result = TSPERR(TSS_E_INTERNAL_ERROR);
				goto error;
			}
		} else
			*rgbWrappedCmdParamOut = NULL;
	}

	return result;
error:
	if (*pulHandleListSize) {
		free(*rghHandles);
		*rghHandles = NULL;
	}
	return result;
}

TSS_RESULT
RPC_ReleaseTransportSigned_TP(struct host_table_entry *hte,
			       TCS_KEY_HANDLE          hSignatureKey,
			       TPM_NONCE*              AntiReplayNonce,
			       TPM_AUTH*               pKeyAuth,		/* in, out */
			       TPM_AUTH*               pTransAuth,		/* in, out */
			       TPM_MODIFIER_INDICATOR* pbLocality,
			       UINT32*                 pulCurrentTicksSize,
			       BYTE**                  prgbCurrentTicks,
			       UINT32*                 pulSignatureSize,
			       BYTE**                  prgbSignature)
{
	TSS_RESULT result;
	TPM_AUTH null_auth;

	memset(&null_auth, 0, sizeof(TPM_AUTH));

	initData(&hte->comm, 5);
	hte->comm.hdr.u.ordinal = TCSD_ORD_RELEASETRANSPORTSIGNED;
	LogDebugFn("IN: TCS Context: 0x%x", hte->tcsContext);

	if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_UINT32, 1, &hSignatureKey, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (setData(TCSD_PACKET_TYPE_NONCE, 2, AntiReplayNonce, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);
	if (pKeyAuth) {
		if (setData(TCSD_PACKET_TYPE_AUTH, 3, pKeyAuth, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
	} else {
		if (setData(TCSD_PACKET_TYPE_AUTH, 3, &null_auth, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
	}
	if (setData(TCSD_PACKET_TYPE_AUTH, 4, pTransAuth, 0, &hte->comm))
		return TSPERR(TSS_E_INTERNAL_ERROR);

	result = sendTCSDPacket(hte);

	if (result == TSS_SUCCESS)
		result = hte->comm.hdr.u.result;

	if (result == TSS_SUCCESS) {
		if (pKeyAuth) {
			if (getData(TCSD_PACKET_TYPE_AUTH, 0, pKeyAuth, 0, &hte->comm))
				return TSPERR(TSS_E_INTERNAL_ERROR);
		} else {
			if (getData(TCSD_PACKET_TYPE_AUTH, 0, &null_auth, 0, &hte->comm))
				return TSPERR(TSS_E_INTERNAL_ERROR);
		}
		if (getData(TCSD_PACKET_TYPE_AUTH, 1, pTransAuth, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
		if (getData(TCSD_PACKET_TYPE_UINT32, 2, pbLocality, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);
		if (getData(TCSD_PACKET_TYPE_UINT32, 3, pulCurrentTicksSize, 0, &hte->comm))
			return TSPERR(TSS_E_INTERNAL_ERROR);

		*prgbCurrentTicks = malloc(*pulCurrentTicksSize);
		if (*prgbCurrentTicks == NULL) {
			*pulCurrentTicksSize = 0;
			return TSPERR(TSS_E_INTERNAL_ERROR);
		}
		if (getData(TCSD_PACKET_TYPE_PBYTE, 4, *prgbCurrentTicks, *pulCurrentTicksSize,
			    &hte->comm)) {
			free(*prgbCurrentTicks);
			*prgbCurrentTicks = NULL;
			*pulCurrentTicksSize = 0;
			return TSPERR(TSS_E_INTERNAL_ERROR);
		}
		if (getData(TCSD_PACKET_TYPE_UINT32, 5, pulSignatureSize, 0, &hte->comm)) {
			free(*prgbCurrentTicks);
			*prgbCurrentTicks = NULL;
			*pulCurrentTicksSize = 0;
			return TSPERR(TSS_E_INTERNAL_ERROR);
		}

		*prgbSignature = malloc(*pulSignatureSize);
		if (*prgbSignature == NULL) {
			free(*prgbCurrentTicks);
			*prgbCurrentTicks = NULL;
			*pulCurrentTicksSize = 0;
			*pulSignatureSize = 0;
			return TSPERR(TSS_E_INTERNAL_ERROR);
		}
		if (getData(TCSD_PACKET_TYPE_PBYTE, 6, *prgbSignature, *pulSignatureSize,
			    &hte->comm)) {
			free(*prgbCurrentTicks);
			*prgbCurrentTicks = NULL;
			*pulCurrentTicksSize = 0;
			free(*prgbSignature);
			*prgbSignature = NULL;
			*pulSignatureSize = 0;
			return TSPERR(TSS_E_INTERNAL_ERROR);
		}
	}

	return result;
}


text:
<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Gilded Rose" type="JUnit" factoryName="JUnit">
    <module name="java" />
    <extension name="coverage">
      <pattern>
        <option name="PATTERN" value="GildedRose.*" />
        <option name="ENABLED" value="true" />
      </pattern>
    </extension>
    <option name="PACKAGE_NAME" value="GildedRose" />
    <option name="MAIN_CLASS_NAME" value="" />
    <option name="METHOD_NAME" value="" />
    <option name="TEST_OBJECT" value="package" />
    <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
    <method v="2">
      <option name="Make" enabled="true" />
    </method>
  </configuration>
</component>


text:
package gcp

import (
	"fmt"
	"strings"

	"github.com/google/go-containerregistry/pkg/name"
)

// ExtractProjectID extracts the GCP projectID from a docker image name
// This only works if the imageName is pushed to gcr.io.
func ExtractProjectID(imageName string) (string, error) {
	ref, err := name.ParseReference(imageName, name.WeakValidation)
	if err != nil {
		return "", fmt.Errorf("parsing image name %q: %w", imageName, err)
	}

	registry := ref.Context().Registry.Name()
	if registry == "gcr.io" || strings.HasSuffix(registry, ".gcr.io") || strings.HasSuffix(registry, "-docker.pkg.dev") {
		parts := strings.Split(imageName, "/")
		if len(parts) >= 2 {
			return parts[1], nil
		}
	}

	return "", fmt.Errorf("unable to guess GCP projectID from image name [%s]", imageName)
}


text:
package org.wso2.carbon.apimgt.impl.token;

import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.impl.APIConstants;
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.apimgt.impl.utils.ClaimCacheKey;
import org.wso2.carbon.apimgt.impl.utils.UserClaims;
import org.wso2.carbon.user.api.ClaimManager;
import org.wso2.carbon.user.api.ClaimMapping;
import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.user.api.UserStoreManager;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;

import javax.cache.Cache;
import javax.cache.CacheConfiguration;
import javax.cache.Caching;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;

/**
 * This class is the default implementation of ClaimsRetriever.
 * It reads user claim values from the default carbon user store.
 * The user claims are encoded to the JWT in the natural order of the claimURIs.
 * To engage this class its fully qualified class name should be mentioned under
 * api-manager.xml -> JWTConfiguration -> ClaimsRetrieverImplClass
 */
public class DefaultClaimsRetriever implements ClaimsRetriever {
    //TODO refactor caching implementation

    private String dialectURI = DEFAULT_DIALECT_URI;

    private  boolean isClaimsCacheInitialized = false;
    /**
     * Reads the DialectURI of the ClaimURIs to be retrieved from api-manager.xml ->
     * JWTConfiguration -> ConsumerDialectURI.
     * If not configured it uses http://wso2.org/claims as default
     */
    public void init() {
        dialectURI = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().
                getAPIManagerConfiguration().getJwtConfigurationDto().getConsumerDialectUri();
        if (dialectURI == null) {
            dialectURI = DEFAULT_DIALECT_URI;
        }
    }

    protected Cache getClaimsLocalCache() {
        String apimClaimsCacheExpiry = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().
                getAPIManagerConfiguration().getFirstProperty(APIConstants.JWT_CLAIM_CACHE_EXPIRY);
        if(!isClaimsCacheInitialized && apimClaimsCacheExpiry != null) {init();
            isClaimsCacheInitialized = true;
           return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER).
                    createCacheBuilder(APIConstants.CLAIMS_APIM_CACHE)
                   .setExpiry(CacheConfiguration.ExpiryType.MODIFIED, new CacheConfiguration.Duration(TimeUnit.SECONDS,
                           Long.parseLong(apimClaimsCacheExpiry)))
                   .setExpiry(CacheConfiguration.ExpiryType.ACCESSED, new CacheConfiguration.Duration(TimeUnit.SECONDS,
                           Long.parseLong(apimClaimsCacheExpiry))).setStoreByValue(false).build();
        }else {
           return Caching.getCacheManager(APIConstants.API_MANAGER_CACHE_MANAGER).getCache(APIConstants.CLAIMS_APIM_CACHE);
        }
    }

    public SortedMap<String, String> getClaims(String endUserName) throws APIManagementException {
        String strEnabledJWTClaimCache = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService()
                .getAPIManagerConfiguration().getFirstProperty(APIConstants.ENABLED_JWT_CLAIM_CACHE);
        boolean enabledJWTClaimCache = true;
        if (strEnabledJWTClaimCache != null) {
            enabledJWTClaimCache = Boolean.valueOf(strEnabledJWTClaimCache);
        }
        SortedMap<String, String> claimValues;
        if (endUserName != null) {
            int tenantId = APIUtil.getTenantId(endUserName);
            String tenantAwareUserName = MultitenantUtils.getTenantAwareUsername(endUserName);
            //check in local cache
            String key = endUserName + ':' + tenantId;
            ClaimCacheKey cacheKey = new ClaimCacheKey(key);
            Object result = null;
            if (enabledJWTClaimCache) {
                result = getClaimsLocalCache().get(cacheKey);
            }
            if (result != null) {
                return ((UserClaims) result).getClaimValues();
            } else {
                claimValues = APIUtil.getClaims(endUserName, tenantId, dialectURI);
                UserClaims userClaims = new UserClaims(claimValues);
                //add to cache
                if (enabledJWTClaimCache) {
                    getClaimsLocalCache().put(cacheKey, userClaims);
                }
                return claimValues;
            }
        }
        return null;
    }

    /**
     * Always returns the ConsumerDialectURI configured in api-manager.xml
     */
    public String getDialectURI(String endUserName) {
        return dialectURI;
    }
}


text:
<?php

namespace Brickoo\Tests\Component\Annotation\Assets {

    /**
     * AnnotatedClassInBraces
     *
     * Some class which has a few annotations.
     * @author Celestino Diaz <celestino.diaz@gmx.de>
     *
     * @Controller (path = "/")
     */
    class AnnotatedClassInBraces {

        /** @Assert (maxlength = 10) */
        private $property;

        /**
         * @Route (path = "/list")
         */
        public function listAction() {
            $this->property = "value";
        }

    }
}


text:
'use strict';

var app = angular.module('app');

app.filter('schemaGroupFilter', function() {
    return function(input, search) {
        if(!input) {
            return input;
        }
        if (!search) {
            return input;
        }
        var lowercaseSearch = search ? search.toLowerCase() : '';
        var result = {};

        angular.forEach(input, function(info, group) {
            var lowercaseGroup = group.toLowerCase();
            var lowerCaseDescription = info.description ? info.description.toLowerCase() : '';
            if (lowercaseGroup.indexOf(lowercaseSearch) !== -1) {
                result[group] = info;
            } else if (lowerCaseDescription.indexOf(lowercaseSearch) !== -1) {
                result[group] = info;
            }
        });

        return result;
    }
});

app.component('viewBuilder', viewBuilder());

function viewBuilder() {
    return {
        templateUrl: 'app/query/view-builder/view-builder.html',
        controller: ViewBuilderController,
        controllerAs: 'ctrl',
        bindings: {
            model: '=' // model contains all view elements / filters
        }
    }
}

function ViewBuilderController(schema, events, types, $mdDialog) {
    var vm = this;

    vm.schemaEntities;
    vm.schemaEdges;

    vm.showBuilder = false;

    var onUpdate = function() {

        vm.showBuilder = (vm.model.viewEdges.length + vm.model.viewEntities.length) > 0;
    }

    vm.makeVisible = function() {
        vm.showBuilder = true;
    }

    vm.clear = function() {
        vm.model.edgeFilters = {};
        vm.model.entityFilters = {};
        vm.model.viewEdges = [];
        vm.model.viewEntities = [];
        vm.showBuilder = false;
    }

    vm.$onInit = function() {
        schema.get().then(function(gafferSchema) {
            vm.schemaEdges = gafferSchema.edges;
            vm.schemaEntities = gafferSchema.entities;
        },
        function(err) {
            vm.schemaEdges = {};
            vm.schemaEntities = {};
        });

        angular.element(document).find('.search-box').on('keydown', function(ev) {
            ev.stopPropagation();
        });

        vm.showBuilder = (vm.model.viewEdges.length + vm.model.viewEntities.length) > 0;

        events.subscribe('onViewUpdate', onUpdate);
    }

    vm.$onDestroy = function() {
        events.unsubscribe('onViewUpdate', onUpdate);
    }

    vm.noMore = function(group) {
        var validEdges = [];

        for (var i in vm.model.viewEdges) {
            var edge = vm.model.viewEdges[i];
            if (vm.getEdgeProperties(edge)) {
                validEdges.push(edge);
            }
        }

        if (validEdges.indexOf(group) === -1) { // group is an entity
            if (validEdges.length > 0) {
                return false;
            }
            var validEntities = [];

            for (var i in vm.model.viewEntities) {
                var entity = vm.model.viewEntities[i];
                if (vm.getEntityProperties(entity)) {
                    validEntities.push(entity);
                }
            }

            return validEntities.indexOf(group) === validEntities.length - 1;
        }

        return validEdges.indexOf(group) === validEdges.length - 1;
    }

    vm.createViewElementsLabel = function(elements, type) { // type is 'entities' or 'elements'
        if (!elements || elements.length === 0) {
            if (!type) {
                throw 'Cannot create label without either the elements or element type';
            }
            return 'Only include these ' + type;
        } else {
            return elements.join(', ');
        }
    }

    vm.createFilterLabel = function(filter) {
        var label = filter.property + ' ';
        var simpleName = filter.predicate.split('.').pop();
        label += simpleName;

        for (var param in filter.parameters) {

            var shortVal = types.getShortValue(types.createValue(filter.parameters[param].valueClass, filter.parameters[param].parts));
            if(shortVal !== undefined) {
                label += ' ' + param + "=" + shortVal;
            }
        }

        if (filter.preAggregation) {
            label += ' before being summarised';
        } else {
            label += ' after being summarised';
        }

        return label;

    }

    vm.editFilter = function(group, elementType, filter, index) {
        vm.tmpIndex = index;

        $mdDialog.show({
            templateUrl: 'app/query/view-builder/custom-filter-dialog/custom-filter-dialog.html',
            controller: 'CustomFilterDialogController',
            locals: {
                group: group,
                elementType: elementType,
                onSubmit: replaceFilterFunction,
                filterForEdit: angular.copy(filter)
            },
            bindToController: true,
            clickOutsideToClose: false
        });
    }

    var getFilters = function(group, elementType) {
        if (elementType === 'edge') {
            if (!vm.model.edgeFilters[group]) {
                vm.model.edgeFilters[group] = []
            }
            return vm.model.edgeFilters[group];
        } else if (elementType === 'entity') {
            if (!vm.model.entityFilters[group]) {
                vm.model.entityFilters[group] = []
            }
            return vm.model.entityFilters[group];
        } else {
            console.error('Unrecognised element type ' + elementType);
            return [];
        }

    }

    vm.deleteFilter = function(group, elementType, index) {
        var filters = getFilters(group, elementType)
        filters.splice(index, 1);
    }

    vm.addFilters = function(ev, group, elementType) {
        $mdDialog.show({
            templateUrl: 'app/query/view-builder/custom-filter-dialog/custom-filter-dialog.html',
            controller: 'CustomFilterDialogController',
            locals: {
                group: group,
                elementType: elementType,
                onSubmit: addFilterFunction
            },
            bindToController: true,
            clickOutsideToClose: false,
            targetEvent: ev
        });
    }

    vm.getEntityProperties = function(group) {
        return schema.getEntityProperties(group);
    }

    vm.getEdgeProperties =  function(group) {
        return schema.getEdgeProperties(group);
    }

    var replaceFilterFunction = function(filter, group, elementType) {
        var filters = getFilters(group, elementType);
        filters.splice(vm.tmpIndex, 1, filter);
    }

    var addFilterFunction = function(filter, group, elementType) {
        var filters = getFilters(group, elementType);
        filters.push(filter);
    }

}


text:
package de.raysha.lib.jsimpleshell.rc.client;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.InvalidKeyException;
import java.util.logging.Logger;

import javax.crypto.SecretKey;

import jline.console.ConsoleReader;
import de.raysha.lib.jsimpleshell.rc.model.MessageCataloge;
import de.raysha.lib.net.scs.AESConnector;

/**
 * This class represents the shell client. That client forward all inputs to the server and proceed
 * his responses.
 *
 * @author rainu
 */
public class ShellClient {
	private static final Logger LOG = Logger.getLogger(ShellClient.class.getName());

	private final AESConnector connector;
	private final ConsoleReader console;
	private OutputStream error;

	private Thread messageThread;

	protected ShellClient(String host, int port, SecretKey secretKey, ConsoleReader console) throws InvalidKeyException, UnknownHostException, IOException  {
		this(new Socket(host, port), secretKey, console);
	}

	protected ShellClient(Socket socket, SecretKey secretKey, ConsoleReader console) throws InvalidKeyException {
		this.connector = new AESConnector(socket, secretKey);
		this.console = console;

		MessageCataloge.registerCataloge(connector);
	}

	public void setError(OutputStream err) {
		this.error = err;
	}

	public void start() throws IOException {
		LOG.info("Start shell-client.");
		initializeAndStartThreads();
	}

	public void shutdown() {
		LOG.info("Stop shell-client.");
		stopThreads();
	}

	private void initializeAndStartThreads() {
		MessageDispatcher dispatcher = new MessageDispatcher(connector, console, error);
		this.messageThread = new Thread(dispatcher, "ShellSession");

		this.messageThread.start();

		try {
			messageThread.join();
		} catch (InterruptedException e) { }
	}

	private void stopThreads() {
		stop(messageThread);
	}

	private void stop(Thread thread){
		thread.interrupt();

		try {
			thread.join(2500);
		} catch (InterruptedException e) { }
		if(thread.isAlive()){
			thread.stop();
		}
	}
}


text:
var SCWorker = require('socketcluster/scworker');
var fs = require('fs');
var express = require('express');
var serveStatic = require('serve-static');
var path = require('path');
var morgan = require('morgan');
var healthChecker = require('sc-framework-health-check');

class Worker extends SCWorker {
  run() {
    console.log('   >> Worker PID:', process.pid);
    var environment = this.options.environment;

    var app = express();

    var httpServer = this.httpServer;
    var scServer = this.scServer;

    if (environment == 'dev') {
      // Log every HTTP request. See https://github.com/expressjs/morgan for other
      // available formats.
      app.use(morgan('dev'));
    }
    app.use(serveStatic(path.resolve(__dirname, 'public')));

    // Add GET /health-check express route
    healthChecker.attach(this, app);

    httpServer.on('request', app);

    var count = 0;

    /*
      In here we handle our incoming realtime connections and listen for events.
    */
    scServer.on('connection', function (socket) {

      // Some sample logic to show how to handle client events,
      // replace this with your own logic

      socket.on('sampleClientEvent', function (data) {
        count++;
        console.log('Handled sampleClientEvent', data);
        scServer.exchange.publish('sample', count);
      });

      var interval = setInterval(function () {
        socket.emit('rand', {
          rand: Math.floor(Math.random() * 5)
        });
      }, 1000);

      socket.on('disconnect', function () {
        clearInterval(interval);
      });
    });
  }
}

new Worker();


text:
require 'test_helper'

describe PostPolicy::Config::Db do

  it "should load config from file and build dbi_params" do
    filename = '/tmp/dbconfig'
    config = {  :host => 'localhost',
                :database => 'postpolicy',
                :user => 'foo',
                :password => 'secret',
                :port => 5432,
                :driver => 'postgres' }

    File.open( filename, 'w' ) do |f|
      f.puts config.to_yaml
    end

    PostPolicy::Config::Db.load( filename )
    PostPolicy::Config::Db.dbconfig.should == config
    dbi_params = "#{config[:driver]}://#{config[:user]}:#{config[:password]}@#{config[:host]}:#{config[:port]}/#{config[:database]}"
    PostPolicy::Config::Db.dbi_params.should == dbi_params

    FileUtils.rm( filename )
  end

end


text:
<form action="ve-edit-error.html" class="well" data-replace="*">

    Oops! There was a problem.

  <fieldset>
    <input type="text" value="Causes">

    <input type="text" value="88 Kearny St">

    <input type="text" value="Ste 2100">

    <input type="text" value="San Francisco, CA 94108">
  </fieldset>

    <button class="btn">Save</button>
    Cancel


text:
package model

import (
	"github.com/balzaczyy/golucene/core/analysis"
	"io"
)

// index/IndexableField.java

// TODO: how to handle versioning here...?

// TODO: we need to break out separate StoredField...

/** Represents a single field for indexing.  IndexWriter
 *  consumes Iterable<IndexableField> as a document.
 *
 *  @lucene.experimental */
type IndexableField interface {
	/** Field name */
	Name() string
	/** {@linkmodel.IndexableFieldType} describing the properties
	 * of this field. */
	FieldType() IndexableFieldType
	/**
	 * Returns the field's index-time boost.
	 *

	 * Only fields can have an index-time boost, if you want to simulate
	 * a "document boost", then you must pre-multiply it across all the
	 * relevant fields yourself.
	 *
The boost is used to compute the norm factor for the field.  By
	 * default, in the {@link Similarity#computeNorm(FieldInvertState)} method,
	 * the boost value is multiplied by the length normalization factor and then
	 * rounded by {@link DefaultSimilarity#encodeNormValue(float)} before it is stored in the
	 * index.  One should attempt to ensure that this product does not overflow
	 * the range of that encoding.
	 *

	 * It is illegal to return a boost other than 1.0f for a field that is not
	 * indexed ({@linkmodel.IndexableFieldType#indexed()} is false) or omits normalization values
	 * ({@linkmodel.IndexableFieldType#omitNorms()} returns true).
	 *
	 * @see Similarity#computeNorm(FieldInvertState)
	 * @see DefaultSimilarity#encodeNormValue(float)
	 */
	Boost() float32
	/** Non-null if this field has a binary value */
	BinaryValue() []byte

	/** Non-null if this field has a string value */
	StringValue() string

	/** Non-null if this field has a Reader value */
	ReaderValue() io.RuneReader

	/** Non-null if this field has a numeric value */
	NumericValue() interface{}

	// Creates the TokenStream used for indexing this field.  If appropriate,
	// implementations should use the given Analyzer to create the TokenStreams.
	TokenStream(analysis.Analyzer, analysis.TokenStream) (analysis.TokenStream, error)
}


text:
<!--
  Copyright 2014 Google Inc. All rights reserved.

  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.
  -->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent">

    <Button
        android:id="@+id/nearby_action_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:minWidth="48dp"
        android:maxHeight="48dp"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:text="@string/map_nearby_button"
        android:textSize="@dimen/text_size_medium"
        android:textStyle="@integer/font_textStyle_medium"
        android:fontFamily="@string/font_fontFamily_medium"
        android:textAllCaps="true"
        android:stateListAnimator="@null"
        android:background="@drawable/nearby_button_background"
        android:textColor="@color/body_text_1_inverse"/>

</FrameLayout>


text:
<?php

namespace Askedio\Laravelcp\Traits;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Str;

trait HasRoleAndPermission
{
    /**
     * Property for caching roles.
     *
     * @var \Illuminate\Database\Eloquent\Collection|null
     */
    protected $roles;

    /**
     * Property for caching permissions.
     *
     * @var \Illuminate\Database\Eloquent\Collection|null
     */
    protected $permissions;

    /**
     * User belongs to many roles.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function roles()
    {
        return $this->belongsToMany(config('rbac.models.role'))->withTimestamps()->withPivot('granted');
    }

    /**
     * Get only Granted Roles
     */
    public function grantedRoles() {
        return $this->roles()->wherePivot('granted', true);
    }

    /**
     * Get only Denied Roles
     */
    public function deniedRoles() {
        return $this->roles()->wherePivot('granted', false);
    }

    /**
     * User belongs to many permissions.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function userPermissions()
    {
        return $this->belongsToMany(config('rbac.models.permission'))->withTimestamps()->withPivot('granted');
    }

    /**
     * Get only Granted Permissions
     */
    public function grantedPermissions() {
        return $this->userPermissions()->wherePivot('granted', true);
    }

    /**
     * Get only Denied Permissions
     */
    public function deniedPermissions() {
        return $this->userPermissions()->wherePivot('granted', false);
    }

    /**
     * Get all roles as collection.
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function getRoles()
    {
        if(!$this->roles){
            $this->roles = $this->grantedRoles()->get();

            $deniedRoles = $this->deniedRoles()->get();
            foreach($deniedRoles as $role)
                $deniedRoles = $deniedRoles->merge($role->descendants());

            foreach($this->roles as $role)
                if(!$deniedRoles->contains($role))
                    $this->roles = $this->roles->merge($role->descendants());

            $this->roles = $this->roles->filter(function($role) use ($deniedRoles){
                return !$deniedRoles->contains($role);
            });
        }
        return  $this->roles;
    }

    /**
     * Get all permissions from roles.
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function rolePermissions()
    {

        $permissions = new Collection();
        foreach ($this->getRoles() as $role)
            $permissions = $permissions->merge($role->permissions);
        return $permissions;
    }

    /**
     * Get all permissions as collection.
     *
     * @return \Illuminate\Database\Eloquent\Collection
     */
    public function getPermissions()
    {
        if(!$this->permissions){
            $rolePermissions = $this->rolePermissions();
            $userPermissions = $this->grantedPermissions()->get();

            $permissions = $rolePermissions->merge($userPermissions);
            $deniedPermissions =$this->deniedPermissions()->get();

            $this->permissions = $permissions->filter(function($permission) use ($deniedPermissions)
            {
                return !$deniedPermissions->contains($permission);
            });
        }
        return $this->permissions;
    }
    /**
     * Check if the user has a role or roles.
     *
     * @param int|string|array $role
     * @param bool $all
     * @return bool
     */
    public function is($role, $all = false)
    {
        if ($this->isPretendEnabled()) {
            return $this->pretend('is');
        }

        return $this->{$this->getMethodName('is', $all)}($this->getArrayFrom($role));
    }

    /**
     * Check if the user has at least one role.
     *
     * @param array $roles
     * @return bool
     */
    protected function isOne(array $roles)
    {
        foreach ($roles as $role) {
            if ($this->hasRole($role)) {
                return true;
            }
        }

        return false;
    }

    /**
     * Check if the user has all roles.
     *
     * @param array $roles
     * @return bool
     */
    protected function isAll(array $roles)
    {
        foreach ($roles as $role) {
            if (!$this->hasRole($role)) {
                return false;
            }
        }

        return true;
    }

    /**
     * Check if the user has role.
     *
     * @param int|string $role
     * @return bool
     */
    protected function hasRole($role)
    {
        return $this->getRoles()->contains(function ($key, $value) use ($role) {
            return $role == $value->id || Str::is($role, $value->slug);
        });
    }

    /**
     * Check if the user has a permission or permissions.
     *
     * @param int|string|array $permission
     * @param bool $all
     * @return bool
     */
    public function can($permission, $all = false)
    {
        if ($this->isPretendEnabled()) {
            return $this->pretend('can');
        }

        return $this->{$this->getMethodName('can', $all)}($this->getArrayFrom($permission));
    }

    /**
     * Check if the user has at least one permission.
     *
     * @param array $permissions
     * @return bool
     */
    protected function canOne(array $permissions)
    {
        foreach ($permissions as $permission) {
            if ($this->hasPermission($permission)) {
                return true;
            }
        }

        return false;
    }

    /**
     * Check if the user has all permissions.
     *
     * @param array $permissions
     * @return bool
     */
    protected function canAll(array $permissions)
    {
        foreach ($permissions as $permission) {
            if (!$this->hasPermission($permission)) {
                return false;
            }
        }

        return true;
    }

    /**
     * Check if the user has a permission.
     *
     * @param int|string $permission
     * @return bool
     */
    protected function hasPermission($permission)
    {
        return $this->getPermissions()->contains(function ($key, $value) use ($permission) {
            return $permission == $value->id || Str::is($permission, $value->slug);
        });
    }

    /**
     * Check if the user is allowed to manipulate with entity.
     *
     * @param string $providedPermission
     * @param \Illuminate\Database\Eloquent\Model $entity
     * @param bool $owner
     * @param string $ownerColumn
     * @return bool
     */
    public function allowed($providedPermission, Model $entity, $owner = true, $ownerColumn = 'user_id')
    {
        if ($this->isPretendEnabled()) {
            return $this->pretend('allowed');
        }

        if ($owner === true && $entity->{$ownerColumn} == $this->id) {
            return true;
        }

        return $this->isAllowed($providedPermission, $entity);
    }

    /**
     * Check if the user is allowed to manipulate with provided entity.
     *
     * @param string $providedPermission
     * @param \Illuminate\Database\Eloquent\Model $entity
     * @return bool
     */
    protected function isAllowed($providedPermission, Model $entity)
    {
        foreach ($this->getPermissions() as $permission) {
            if ($permission->model != '' && get_class($entity) == $permission->model
                && ($permission->id == $providedPermission || $permission->slug === $providedPermission)
            ) {
                return true;
            }
        }

        return false;
    }

    /**
     * Attach role to a user.
     *
     * @param int|\Askedio\Laravelcp\Models\Role $role
     * @param bool $granted
     * @return bool|null
     */
    public function attachRole($role, $granted = TRUE)
    {
        if($granted)
            return (!$this->grantedRoles()->get()->contains($role)) ? $this->roles()->attach($role, array('granted' => TRUE)) : true;
        else
            return (!$this->deniedRoles()->get()->contains($role)) ? $this->roles()->attach($role, array('granted' => FALSE)) : true;
    }

    /**
     * Detach role from a user.
     *
     * @param int|\Askedio\Laravelcp\Models\Role $role
     * @return int
     */
    public function detachRole($role)
    {
        return $this->roles()->detach($role);
    }

    /**
     * Detach all roles from a user.
     *
     * @return int
     */
    public function detachAllRoles()
    {
        return $this->roles()->detach();
    }

    /**
     * Attach permission to a user.
     *
     * @param int|\Askedio\Laravelcp\Models\Permission $permission
     * @param bool $granted
     * @return bool|null
     */
    public function attachPermission($permission, $granted = true)
    {
        if($granted)
            return (!$this->grantedPermissions()->get()->contains($permission)) ? $this->userPermissions()->attach($permission, array('granted' => TRUE)) : true;
        else
            return (!$this->deniedPermissions()->get()->contains($permission)) ? $this->userPermissions()->attach($permission, array('granted' => FALSE)) : true;

    }

    /**
     * Detach permission from a user.
     *
     * @param int|\Askedio\Laravelcp\Models\Permission $permission
     * @return int
     */
    public function detachPermission($permission)
    {
        return $this->userPermissions()->detach($permission);
    }

    /**
     * Detach all permissions from a user.
     *
     * @return int
     */
    public function detachAllPermissions()
    {
        return $this->userPermissions()->detach();
    }

    /**
     * Check if pretend option is enabled.
     *
     * @return bool
     */
    private function isPretendEnabled()
    {
        return (bool) config('roles.pretend.enabled');
    }

    /**
     * Allows to pretend or simulate package behavior.
     *
     * @param string $option
     * @return bool
     */
    private function pretend($option)
    {
        return (bool) config('roles.pretend.options.' . $option);
    }

    /**
     * Get method name.
     *
     * @param string $methodName
     * @param bool $all
     * @return string
     */
    private function getMethodName($methodName, $all)
    {
        return ((bool) $all) ? $methodName . 'All' : $methodName . 'One';
    }

    /**
     * Get an array from argument.
     *
     * @param int|string|array $argument
     * @return array
     */
    private function getArrayFrom($argument)
    {
        return (!is_array($argument)) ? preg_split('/ ?[,|] ?/', $argument) : $argument;
    }

    /**
     * Handle dynamic method calls.
     *
     * @param string $method
     * @param array $parameters
     * @return mixed
     */
    public function __call($method, $parameters)
    {
        if (starts_with($method, 'is')) {
            return $this->is(snake_case(substr($method, 2), config('roles.separator')));
        } elseif (starts_with($method, 'can')) {
            return $this->can(snake_case(substr($method, 3), config('roles.separator')));
        } elseif (starts_with($method, 'allowed')) {
            return $this->allowed(snake_case(substr($method, 7), config('roles.separator')), $parameters[0], (isset($parameters[1])) ? $parameters[1] : true, (isset($parameters[2])) ? $parameters[2] : 'user_id');
        }

        return parent::__call($method, $parameters);
    }
}


text:
package policy

import (
	"testing"

	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestSeccompProfileBaseline_1_0(t *testing.T) {
	tests := []struct {
		name         string
		pod          *corev1.Pod
		expectReason string
		expectDetail string
	}{
		{
			name: "pod seccomp invalid",
			pod: &corev1.Pod{
				ObjectMeta: metav1.ObjectMeta{
					Annotations: map[string]string{
						"seccomp.security.alpha.kubernetes.io/pod": "unconfined",
					},
				},
			},
			expectReason: `seccompProfile`,
			expectDetail: `forbidden annotation seccomp.security.alpha.kubernetes.io/pod="unconfined"`,
		},
		{
			name: "containers seccomp invalid",
			pod: &corev1.Pod{
				ObjectMeta: metav1.ObjectMeta{
					Annotations: map[string]string{
						"container.seccomp.security.alpha.kubernetes.io/a": "unconfined",
						"container.seccomp.security.alpha.kubernetes.io/b": "unknown",
					},
				},
				Spec: corev1.PodSpec{
					Containers: []corev1.Container{{Name: "a"}, {Name: "b"}, {Name: "c"}},
				},
			},
			expectReason: `seccompProfile`,
			expectDetail: `forbidden annotations container.seccomp.security.alpha.kubernetes.io/a="unconfined", container.seccomp.security.alpha.kubernetes.io/b="unknown"`,
		},
		{
			name: "pod and containers seccomp invalid",
			pod: &corev1.Pod{
				ObjectMeta: metav1.ObjectMeta{
					Annotations: map[string]string{
						"seccomp.security.alpha.kubernetes.io/pod":         "unconfined",
						"container.seccomp.security.alpha.kubernetes.io/a": "unconfined",
						"container.seccomp.security.alpha.kubernetes.io/b": "unknown",
					},
				},
				Spec: corev1.PodSpec{
					Containers: []corev1.Container{{Name: "a"}, {Name: "b"}, {Name: "c"}},
				},
			},
			expectReason: `seccompProfile`,
			expectDetail: `forbidden annotations container.seccomp.security.alpha.kubernetes.io/a="unconfined", container.seccomp.security.alpha.kubernetes.io/b="unknown", seccomp.security.alpha.kubernetes.io/pod="unconfined"`,
		},
	}

	for _, tc := range tests {
		t.Run(tc.name, func(t *testing.T) {
			result := seccompProfileBaseline_1_0(&tc.pod.ObjectMeta, &tc.pod.Spec)
			if result.Allowed {
				t.Fatal("expected disallowed")
			}
			if e, a := tc.expectReason, result.ForbiddenReason; e != a {
				t.Errorf("expected\n%s\ngot\n%s", e, a)
			}
			if e, a := tc.expectDetail, result.ForbiddenDetail; e != a {
				t.Errorf("expected\n%s\ngot\n%s", e, a)
			}
		})
	}
}

func TestSeccompProfileBaseline_1_19(t *testing.T) {
	tests := []struct {
		name         string
		pod          *corev1.Pod
		expectReason string
		expectDetail string
	}{
		{
			name: "pod seccomp invalid",
			pod: &corev1.Pod{Spec: corev1.PodSpec{
				SecurityContext: &corev1.PodSecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeUnconfined}},
				Containers: []corev1.Container{
					{Name: "a", SecurityContext: nil},
				},
			}},
			expectReason: `seccompProfile`,
			expectDetail: `pod must not set securityContext.seccompProfile.type to "Unconfined"`,
		},
		{
			name: "containers seccomp invalid",
			pod: &corev1.Pod{Spec: corev1.PodSpec{
				SecurityContext: &corev1.PodSecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}},
				Containers: []corev1.Container{
					{Name: "a", SecurityContext: nil},
					{Name: "b", SecurityContext: &corev1.SecurityContext{}},
					{Name: "c", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeUnconfined}}},
					{Name: "d", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeUnconfined}}},
					{Name: "e", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}}},
					{Name: "f", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}}},
				},
			}},
			expectReason: `seccompProfile`,
			expectDetail: `containers "c", "d" must not set securityContext.seccompProfile.type to "Unconfined"`,
		},
		{
			name: "pod and containers seccomp invalid",
			pod: &corev1.Pod{Spec: corev1.PodSpec{
				SecurityContext: &corev1.PodSecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeUnconfined}},
				Containers: []corev1.Container{
					{Name: "a", SecurityContext: nil},
					{Name: "b", SecurityContext: &corev1.SecurityContext{}},
					{Name: "c", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeUnconfined}}},
					{Name: "d", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeUnconfined}}},
					{Name: "e", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}}},
					{Name: "f", SecurityContext: &corev1.SecurityContext{SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}}},
				},
			}},
			expectReason: `seccompProfile`,
			expectDetail: `pod and containers "c", "d" must not set securityContext.seccompProfile.type to "Unconfined"`,
		},
	}

	for _, tc := range tests {
		t.Run(tc.name, func(t *testing.T) {
			result := seccompProfileBaseline_1_19(&tc.pod.ObjectMeta, &tc.pod.Spec)
			if result.Allowed {
				t.Fatal("expected disallowed")
			}
			if e, a := tc.expectReason, result.ForbiddenReason; e != a {
				t.Errorf("expected\n%s\ngot\n%s", e, a)
			}
			if e, a := tc.expectDetail, result.ForbiddenDetail; e != a {
				t.Errorf("expected\n%s\ngot\n%s", e, a)
			}
		})
	}
}


text:
class RectLight : public Light
{
public:
    RectLight(const Color& c, const Vector3& o, const Vector3& n, const Vector3& dx, const Vector3& dy, double power = 1)
        : Light(c, power), m_o(o), m_n(n), m_dx(dx), m_dy(dy) {}
    RectLight(const Json::Value& light)
        : Light(light), m_o(light["o"]), m_n(light["n"]), m_dx(light["dx"]), m_dy(light["dy"]) {}

    // 发光点
    virtual Vector3 getSource() const override { return m_o; }

    // 与视线相交
    virtual Collision collide(const Ray& ray) const override;

    // 计算阴影比例
    virtual double getShadowRatio(const Scene* scene, const Vector3& p) const override;

    // 发射光子
    virtual Photon emitPhoton(double power) const override;

    virtual Json::Value toJson() const override;

private:
    Vector3 m_o, m_n;   // 矩形中心点、光源朝向
    Vector3 m_dx, m_dy; // 横向、纵向向量
};

#endif // RECTLIGHT_H


text:
<?php
/**
 * Created by PhpStorm.
 * User: jam
 * Date: 6.12.14
 * Time: 1:45
 */

namespace Trejjam\Emailing;

use Symfony\Component\Console\Command\Command;

abstract class CliHelper extends Command
{
	/**
	 * @var EmailFactory
	 */
	protected $emailFactory;
	/**
	 * @var ImapFactory
	 */
	protected $imapFactory;
	/**
	 * @var Emails
	 */
	protected $emails;
	/**
	 * @var Groups
	 */
	protected $groups;
	/**
	 * @var Senders
	 */
	protected $senders;

	public function __construct(EmailFactory $emailFactory, ImapFactory $imapFactory, Emails $emails, Groups $groups, Senders $senders) {
		parent::__construct();

		$this->emailFactory = $emailFactory;
		$this->imapFactory = $imapFactory;
		$this->emails = $emails;
		$this->groups = $groups;
		$this->senders = $senders;
	}
}


text:
VERSION = $$(git describe --tags --always --dirty) ($$(git name-rev --name-only HEAD))

BUILD_FLAGS = -ldflags "-s -w -X \"main.Version=$(VERSION)\" "

resources:
	go get -u github.com/jteeuwen/go-bindata/...
	go-bindata -o resources.go resources/
deps: resources
	go get -d ./...
testdeps: resources
	go get -d -t ./...
test: testdeps
	go test ./...
build: deps
	go build $(BUILD_FLAGS)
install: deps
	go install $(BUILD_FLAGS)

.PHONY: resources deps testdeps test build install


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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="de.danoeh.antennapod.activity.MainActivity">

    <ImageView
        android:id="@+id/imgvCover"
        android:contentDescription="@string/cover_label"
        android:layout_width="@dimen/thumbnail_length_onlinefeedview"
        android:layout_height="@dimen/thumbnail_length_onlinefeedview"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_margin="4dp"/>

    <ImageButton
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:id="@+id/butShowInfo"
        android:contentDescription="@string/show_info_label"
        android:src="?attr/action_about"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:background="?attr/borderless_button"/>

    <ImageButton
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_marginRight="8dp"
        android:id="@+id/butVisitWebsite"
        android:contentDescription="@string/visit_website_label"
        android:src="?attr/location_web_site"
        android:layout_toLeftOf="@id/butShowInfo"
        android:layout_alignParentBottom="true"
        android:background="?attr/borderless_button"/>

    <TextView
        android:id="@+id/txtvTitle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:gravity="center_vertical"
        android:layout_alignTop="@id/imgvCover"
        android:layout_toRightOf="@id/imgvCover"
        android:layout_alignParentRight="true"
        android:lines="1"
        style="@style/AntennaPod.TextView.Heading"
        android:layout_margin="4dp"/>

    <TextView
        android:id="@+id/txtvAuthor"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:layout_below="@id/txtvTitle"
        android:layout_toRightOf="@id/imgvCover"
        android:layout_toLeftOf="@id/butShowInfo"
        android:lines="1"
        android:ellipsize="end"
        android:textColor="?android:attr/textColorSecondary"
        android:textSize="@dimen/text_size_small"/>

</RelativeLayout>


text:
cask "mcbopomofo" do
  version "2.2.2"
  sha256 "e77eb4ed6e20d5db5fac0a7a2d11a441107ba623b3c37ae8a9cd1ad2fa9790c2"

  url "https://github.com/openvanilla/McBopomofo/releases/download/#{version}/McBopomofo-Installer-#{version}.zip",
      verified: "github.com/"
  name "McBopomofo"
  desc "Input method for Bopomofo (Phonetic Symbols of Mandarin Chinese)"
  homepage "https://mcbopomofo.openvanilla.org/"

  installer manual: "McBopomofoInstaller.app"

  uninstall delete: "~/Library/Input Methods/McBopomofo.app"
end


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>File: multipart_progress.rb</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../../../../.././rdoc-style.css" type="text/css" media="screen" />

multipart_progress.rb

      Path:
      vendor/rails/actionpack/lib/action_controller/cgi_ext/multipart_progress.rb

      Last Update:
      Fri Dec 16 03:28:21 UTC 2005

Overview

This module will extend the CGI module with methods to track the upload
progress for multipart forms for use with progress meters. The progress is
saved in the session to be used from any request from any server with the
same session. In other words, this module will work across application
instances.

Usage

Just do your file-uploads as you normally would, but include an upload_id
in the query string of your form action. Your form post action should look
like:

  <form method="post" enctype="multipart/form-data" action="postaction?upload_id=SOMEIDYOUSET">
    <input type="file" name="client_file"/>
  </form>

Query the upload state in a progress by reading the progress from the
session

  class UploadController < ApplicationController
    def upload_status
      render :text => "Percent complete: " + @session[:uploads]['SOMEIDYOUSET'].completed_percent"
    end
  end

Session options

Upload progress uses the session options defined in
ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS. If you are passing
custom session options to your dispatcher then please follow the
"recommended way to change session options":wiki.rubyonrails.com/rails/show/HowtoChangeSessionOptions

Update frequency

During an upload, the progress will be written to the session every 2
seconds. This prevents excessive writes yet maintains a decent picture of
the upload progress for larger files.

User interfaces that update more often that every 2 seconds will display
the same results. Consider this update frequency when designing your
progress polling.

Required files

      cgi
      action_controller/base
      action_controller/cgi_process
      action_controller/upload_progress

[Validate]


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class ProductManagement extends CI_Controller {

    public function index()
    {
        // AUTO REDIRECT TO show_add_product TO BE DONE
    }

    public function show_add_product()
    {
        $product = new Product();
        $productsName = $product->listProductsName();
        $productsCounter = $product->listProductsCounter();
        $data = array("productsName" => $productsName, "productsCounter" => $productsCounter);
        $this->load->view('product_add_form', $data);
    }

    public function add_product(){
        $this->load->model('user','', TRUE);
        $user = $this->user->getUserIdByLogin($_SESSION['login']);
        $product = new Product();
        $args = array(
                      'ProductName' => $_POST['ProductName'],
                      'ProductDesc' => $_POST['ProductDesc'],
                      'ProductQuality' => $_POST['ProductQuality'],
                      'ProductQty' => $_POST['ProductQty'],
                      'User' => $user
                     );
        $return = $product->addProduct($args);
        if($return) $data = array('message' => 'Your product has been successfully added to the products.');
        else $data = array('message' => 'There was an error while adding your product');
        $this->load->view('welcome_message', $data);
    }

    public function show_order_product(){
        $product = new Product();
        $product = $product->getProductByID($_GET['id']);
        $data = array(
            'id' => $product[0]->ProductID,
            'name' => $product[0]->ProductDenom,
            'desc' => $product[0]->ProductDescription,
            'qty' => $product[0]->ProductQuantity,
            'quality' => $product[0]->ProductQuality,
        );
        $this->load->view('product_order', $data);
    }

    public function get_product_by_name(){
        $product = new Product();
        $args = array(
            'name' => $_POST['search'],
        );
        $products = $product->getProductByName($args);
        $data = array('products' => $products);
        $this->load->view('welcome_message', $data);
    }

}