text:
<?php

namespace libphonenumber;

class DefaultMetadataLoader implements MetadataLoader
{
    public function loadMetadata($metadataFileName)
    {
        return include $metadataFileName;
    }
}

/* EOF */

redpajama_set_name: RedPajamaGithub


text:
/* Base Font Size */
@media only screen {html, body {font-size: 14px;}}
@media only screen and (min-width: 40.0625em) {html, body {font-size: 16px;}}
@media only screen and (min-width: 64.0625em) {html, body {font-size: 18px;}}
@media only print {html, body {font-size: 11pt;}}

/* Baseline Grid */
@media only screen {body.baselineon {background-image: url(http://basehold.it/i/21/808080);}}
@media only screen and (min-width: 40.0625em) {body.baselineon {background-image: url(http://basehold.it/i/24/808080);}}
@media only screen and (min-width: 64.0625em) {body.baselineon {background-image: url(http://basehold.it/i/27/808080);}}

/* Global Style */
body {
	font-family:
		"chaparral-pro",
		Georgia,
		serif;
	font-style: normal;
	font-weight: 400;
	line-height: 1.5;
	color:#444;
	text-rendering: optimizeLegibility;
	font-variant-ligatures: common-ligatures;
	-moz-font-feature-settings: "liga", "clig";
	-ms-font-feature-settings: "liga", "clig";
	-webkit-font-feature-settings: "liga", "clig";
	font-feature-settings: "liga", "clig";
	}
@media only print {body {line-height: 1.3}}
/* Header/NAV */
header{
	-webkit-box-shadow: 0px 1px 0px 0px rgba(221,221,221,1);
	-moz-box-shadow: 0px 1px 0px 0px rgba(221,221,221,1);
	box-shadow: 0px 1px 0px 0px rgba(221,221,221,1);
	margin:1.5em auto;
	display:block;
	position:relative;}
	header h1 {
		font-size:2.618em;
		line-height:1.718869365928189em;
		text-align:center;
		font-weight:400;
		margin:0;
		-webkit-font-kerning: none;
		font-kerning:none;}
		header .icon {
			border: 2px solid #007468;
			color: #007468;
			display: inline-block;
			font-family:
				"chaparral-pro",
				Georgia,
				serif;
			font-weight: 600;
			line-height: 1;
			margin-right: 0.15em;
			padding: 5px 5px 1px 4px;}
	nav {
		font-size:0;
		vertical-align:top;}
		nav ul.inline-list {
			margin: 0 auto;
			display:table;
			float:none; }
			nav ul.inline-list li {
				line-height:4.5em;
				text-align:center;
				min-width:44px;}
				nav ul.inline-list li.active,
				nav ul.inline-list li:hover {
					box-shadow: 0 -1px #444 inset;}
				nav ul.inline-list li a { text-decoration:none;}
	@media only screen and (min-width: 40.0625em) {
		header h1 { text-align:left;}
		nav ul.inline-list{float: right !important;}
	}

/* Footer */
footer { padding:3rem 0 6rem 0; }
@media only print {footer{padding:2.6rem 0 5.2rem 0;}}
/* Articles / Sections */
article {}
	article.print {
		background-image: url(../img/groovepaper.png);
		background-repeat:repeat;
		margin-top:3rem;
		padding-bottom:1.5rem;
		border-top: 1px solid #d8d8d8;
		border-bottom: 1px solid #d8d8d8;}
@media only print {article.print {padding-bottom:1.3rem;}}
/* Typography reset */
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
form,
p,
blockquote,
th,
td {
  margin: 0;
  padding: 0; }
/* Paragraphs */
p {
	font-family:
		"chaparral-pro",
		Georgia,
		serif;
    font-style: normal;
    font-weight: 400;
    orphans: 3;
	widows: 3;
    font-size: 16px;
	font-size: 1em;
	letter-spacing:normal;
    hyphens: auto;
    margin: 0;
		font-kerning: normal;
	-webkit-font-kerning: normal;
	font-variant-numeric: oldstyle-nums;
	-moz-font-feature-settings: "onum", "kern";
	-ms-font-feature-settings: "onum", "kern";
	-webkit-font-feature-settings: "onum", "kern";
	font-feature-settings: "onum", "kern";}
	@media only print {p {line-height: 1.3;}}
	/* Sans Serif */
	#sans p,
	.text-sans {
		font-family:
			"myriad-pro",
			Verdana,
			sans-serif;}
	/* Indents */
	p+p {text-indent:1.5em;}
	@media only print {p+p {text-indent:1.3em;}}
	p.noindent {text-indent:0;}
	p+p.no-indent { text-indent:0; margin-top:1.5rem;}
	@media only print {p+p.no-indent {margin-top:1.3rem;}}
	/* Captions */
	p.caption {
		color:#555;
		font-size:13.3328px;
		font-size:0.8333rem;
		line-height:1.5rem;
		font-style:italic;
		margin-bottom:1.5rem;}
		@media only print {p.caption {margin-bottom:1.3rem;}}
		img+p {margin-top:0;}
		p.caption + p { text-indent:0;}
	/* Justification */
	.justify p {text-align:justify;}
	/* Hyphenation */
	.hyphens p, .hyphens {
		-webkit-hyphens: auto;
		-moz-hyphens: auto;
		-ms-hyphens: auto;
		hyphens: auto;
		word-break: normal;
		direction: ltr;}
	/* Drop Caps */
	.dropcap {
		initial-letter: 3;
		font-family: Georgia, serif;
		color:#444;
		margin-right: 0.1em;}
	/* Examples */
	.example {
		margin:6rem 0 1.5rem;
		text-align:center;
		-webkit-hyphens: auto;
		-moz-hyphens: auto;
		-ms-hyphens: auto;
		hyphens: auto;
		word-break: normal;
		word-wrap:break-word;
		direction: ltr;
		}
		@media only print {.example {margin:2.6rem 0 1.3rem;}}
		p.example {color:#007468;}
		p.example + p {text-indent:0;}
		@media only screen {.example {font-size:3em; line-height:1.5rem;}}
		@media only screen and (min-width: 40.0625em) {.example {font-size:4.5em; line-height:1.5rem;}}
		@media only screen and (min-width: 64.0625em) {.example {font-size:4.5em; line-height:1.5rem;}}
		img + p:not(.caption) { margin-top:1.5rem;}
		@media only print {img + p:not(.caption) { margin-top:1.3rem;}}
/* Code */
code,
.code {
	background:none;
	white-space:pre;
	color:#369;
	border-width: 0;
	font-family:"myriad-pro", Verdana, sans-serif;
	font-weight: normal;
	padding:0;
	text-indent:0;
	padding-left:3rem;}
	@media only print {.code {padding-left:2.6rem;}}
	.code.html { color: #00928B;}
	.code + p { text-indent:0;}

/* Headings */
h1, h2, h3, h4, h5, h6 {
	color: #444;
	font-weight: 700;}
	h1, h2 {text-overflow:ellipsis;}
	@media only print {h1, h2 {text-overflow:inherit;}}
	h1, h2, h3, h4 {
		font-family: "chaparral-pro-display", Georgia, serif;}
	h5, h6 {
		font-family: "chaparral-pro", Georgia, serif;}
	/* Rhythem */

	h1 {
		font-size:3em;
		line-height:0.5em;
		margin:1em 0 1em 0;}
	h2 {
		font-size:2.168em;
		line-height:1.383763837638376em;
		margin:1.383763837638376em 0 0.6918819188191882em 0;}
	h3 {
		font-size:1.854em;
		line-height:1.618122977346278em;
		margin:1.618122977346278em 0 0.8090614886731392em 0;}
	h4 {
		font-size:1.618em;
		line-height:1.854140914709518em;
		margin:1.854140914709518em 0 0.927070457354759em 0}
	h5 {
		font-size:1.146em;
		line-height:1.528392592592593em;
		margin:2.617801047120418em 0 1.308900523560209em 0}
	h6 {
		font-size:1em;
		line-height:1.5em;
		margin:3em 0 1.5em 0}
		h6+ul { margin-top:0;}

	/* Better Support for browsers supporting rems */
	h1 {margin:3rem 0 3rem; line-height:3rem;}
	h2, h3, h4, h5, h6 {margin:3rem 0 1.5rem; line-height:1.5rem;}
@media only print {
	h1 {margin:0 0 2.6rem !important; line-height: normal;}
	h2, h3, h4, h5, h6 {margin:2.6rem 0 1.3rem !important;line-height: normal;}
	}
/* Lists */
ul, ol {
	margin: 1.5rem 0;
	padding: 0;}
@media only print {ul, ol {margin: 1.3rem 0;}}
	li {
		font-style: normal;
		color: #333;
		font-size: 1rem;
		margin: 0;
		padding: 0;}
		li a {font-weight:400;}
		ol li { }
	/* Inline Lists */
	.inline-list {
		list-style: none;
		margin-left: -1.5rem;
		margin-right: 0;
		margin: 1.5rem auto;
		overflow: hidden;
		padding: 0;}
		@media only print {.inline-list { margin-left: -1.3rem; margin: 1.3rem auto;}}
		.inline-list > li {
			display: block;
			float: left;
			list-style: none;
			margin-left: 1.5rem;}
			@media only print {.inline-list > li {margin-left: 1.3rem;}}
			.inline-list > li > * {display: block;}
			.inline-list li:first-child { margin-left:0;}
		/* List Spacing */
		li + li { margin-top:1.5rem;} /* Double Spaced List */
		@media only print {li + li { margin-top:1.3rem;} }
		#toc li + li, .panel li +li, .single-space-list li+li, header li+li { margin-top:0;} /* Single Space List */

/* OPEN TYPE font-feature-settings */
abbr, .scaps {
	font-variant-caps: all-small-caps;
	-moz-font-feature-settings: "c2sc", "smcp";
	-ms-font-feature-settings: "c2sc", "smcp";
	-webkit-font-feature-settings: "c2sc", "smcp";
	font-feature-settings: "c2sc", "smcp";}
	abbr[title] {border-bottom: 1px dotted #DDDDDD; }
.subs {
	font-variant-position: sub;
	-moz-font-feature-settings: "subs";
	-ms-font-feature-settings: "subs";
	-webkit-font-feature-settings: "subs";
	font-feature-settings: "subs";}
.sups {
	font-variant-position: super;
	-moz-font-feature-settings: "sups";
	-ms-font-feature-settings: "sups";
	-webkit-font-feature-settings: "sups";
	font-feature-settings: "sups";}
.frac {
	font-variant-numeric: diagonal-fractions;
	-moz-font-feature-settings: "frac";
	-ms-font-feature-settings: "frac";
	-webkit-font-feature-settings: "frac";
	font-feature-settings: "frac";}
.ordn {
	font-variant-numeric: ordinal;
	-moz-font-feature-settings: "ordn";
	-ms-font-feature-settings: "ordn";
	-webkit-font-feature-settings: "ordn";
	font-feature-settings: "ordn";}
.lining {
	font-variant-numeric: lining-nums;
	-moz-font-feature-settings: "lnum";
	-ms-font-feature-settings: "lnum";
	-webkit-font-feature-settings: "lnum";
	font-feature-settings: "lnum";}
.oldstyle {
	font-variant-numeric: oldstyle-nums;
	-moz-font-feature-settings: "onum";
	-ms-font-feature-settings: "onum";
	-webkit-font-feature-settings: "onum";
	font-feature-settings: "onum";}
.proportional {
	font-variant-numeric: proportional-nums;
	-moz-font-feature-settings: "pnum";
	-ms-font-feature-settings: "pnum";
	-webkit-font-feature-settings: "pnum";
	font-feature-settings: "pnum";
}
.tabular {
	font-variant-numeric: tabular-nums;
	-moz-font-feature-settings: "tnum";
	-ms-font-feature-settings: "tnum";
	-webkit-font-feature-settings: "tnum";
	font-feature-settings: "tnum";}

/* Blockquotes */
figure.quote {
	font-family: "chaparral-pro", Georgia, serif;
    font-style: normal;
    color: #444;
    font-weight: 400;
    font-size: 1rem;
	margin:1.5em;}
	@media only print {figure.quote { margin:1.3em;}}
	blockquote {quotes: '\201c' '\201d';  text-indent:-0.35333em !important;}
		blockquote::before {content: open-quote; font-kerning: none; letter-spacing: 0.02em;}
		blockquote::after {content: close-quote;}
	figcaption {}
		figcaption::before {content: "— ";}
		figcaption cite { font-style:italic;}
p.quote {quotes: '\201c' '\201d'; text-indent:-0.35333em !important;}
p.quote::before {content: open-quote; font-kerning: none; letter-spacing: 0.02em;}
p.quote::after {content: close-quote;}
/* Horizontal Rule */
hr {
	margin:3rem 0 1.5rem 0;
	text-align: center;
	height:3rem;
	background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAFElEQVQImWNgIBrcvXv3PzomXjcArOYR7wZPf6MAAAAASUVORK5CYII=);
	background-position:center;
	background-repeat:repeat-x;
	background-color:transparent;
	border:0;
	line-height: 0px;
	font-size: 1rem;
	overflow: visible;
	max-height:3rem;}
	@media only print {hr {margin:2.6em 0 1.3em 0; height:2.6em;}}
	hr:after {
		content:attr(title);
		color: 	#444;
		display: inline;
		position:relative;
		top:1.5rem;
		background: #fff;
		padding: 0 0.5em;
		text-transform: uppercase;
		letter-spacing: 0.15099em;}
  @media only print {hr:after {top:1.3rem;}}

/* Emphasis */
em,
i,
.italic {
  font-style: italic;}
strong {
  font-weight: bold;
  font-weight: 700;}
small {
  font-size: .7862em;
  letter-spacing:0.01em;
  line-height: inherit; }
.bold, b {font-weight: 600;}
.light { font-weight:300;}
.text-strike { text-decoration:line-through;}
.allcaps { text-transform: uppercase;}

/* Alignment */
.text-left {text-align: left !important; }
.text-right {text-align: right !important; }
.text-center {text-align: center !important; }
.text-justify {text-align: justify !important; }

/* Rendering */

.antialiased {-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
.manualkern {-webkit-font-kerning: none;
		font-kerning:none;}
/* Float */
.left {float: left !important; }
.right {float: right !important; }

/* Visibility */
.hide {display: none; }
.invisible {visibility: hidden;}

/* Baseline Helpers */
.base-reset {margin:0;}
.base-space {margin:1.5rem 0;}

.push-top {margin-top:1.5rem !important;}
.push-bottom {margin-bottom:1.5rem !important;}

.pull-top {margin-top:0;}
.pull-bottom {margin-bottom:0;}

.single-space {height:1.5rem;}
.double-space {height:3rem;}

	@media only screen { /* Small <640 */
		.push-top-small { margin-top:1.5rem !important;}
		.push-bottom-small { margin-bottom:1.5rem;}
		.push-top-medium { margin-top: inherit;}
		.push-bottom-medium { margin-bottom:inherit;}
		.pull-top-small { margin-top:0;}
	}
	@media only screen and (min-width: 40.0625em) { /* Medium 641 */
		.push-top-small { margin-top: inherit !important;}
		.push-bottom-small { margin-bottom:inherit !important;}
		.push-top-medium { margin-top: 1.5rem !important;}
		.push-bottom-medium { margin-bottom:1.5rem !important;}
		.pull-top-medium { margin-top:0;}
	}
	@media only screen and (min-width: 64.0625em) { /* Large 1025 */
		.push-top-small { margin-top: inherit !important;}
		.push-bottom-small { margin-bottom:inherit !important;}
		.double-push-bottom {margin-bottom:3rem;}
		.double-pad-top {padding-top:3rem;}
		.double-pad-bottom {padding-bottom:3rem;}
		.pull-top-large { margin-top:0 !important;}
	}
@media only print {
	.base-reset {margin:0;}
.base-space {margin:1.3rem 0;}

.push-top {margin-top:1.3rem !important;}
.push-bottom {margin-bottom:1.3rem !important;}

.pull-top {margin-top:0;}
.pull-bottom {margin-bottom:0;}

.single-space {height:1.3rem;}
.double-space {height:2.6rem;}
}
/* Links */
a {
  color: #007468;
  text-decoration:underline;}
  a:hover {color: #004039; }
  a img {
    border: none; }
  a.active, .active a { color:#004039;}
  .invert a.active {color: #fff;}

/* Panels */
.panel {
	outline-style: solid;
	outline-width: 1px;
	outline-color: #d8d8d8;
	margin: 1.5rem 0;
	padding: 1.5rem;
	background: #F7F7F7;}
	@media only print {.panel { margin:1.3rem 0; padding:1.3rem;}}
	.panel > :first-child {margin-top: 0; }
	.panel > :last-child {margin-bottom: 0; }
	/* Panel Type */
	.panel h1, .panel h2, .panel h3, .panel h4, .panel h5, .panel h6, .panel li, .panel dl {color: #222; }
	.panel p { color:#444;}
	.panel p+p {
		margin-top:1.5rem;
		text-indent:0;}
		@media only print {.panel p+p { margin-top:1.3rem;}}
	.panel.radius {border-radius: 3px; }
	/* Faux Screen */
	.panel.screen {
		background: #45484d;
		background: -moz-linear-gradient(-45deg,  #45484d 0%, #000000 100%);
		background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#45484d), color-stop(100%,#000000));
		background: -webkit-linear-gradient(-45deg,  #45484d 0%,#000000 100%);
		background: -o-linear-gradient(-45deg,  #45484d 0%,#000000 100%);
		background: -ms-linear-gradient(-45deg,  #45484d 0%,#000000 100%);
		background: linear-gradient(135deg,  #45484d 0%,#000000 100%);
		filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#45484d', endColorstr='#000000',GradientType=1 );
		outline-width: 0;
		border:0.25rem solid hsla(0,0%,75%, 1);
		padding:1.25rem;
		-webkit-border-radius: 10px;
		border-radius: 10px;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;}
		.screensurface {
			background: #ffffff;
			background: -moz-linear-gradient(-45deg,  #ffffff 0%, #f3f3f3 50%, #ededed 51%, #ffffff 100%);
			background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#ffffff), color-stop(50%,#f3f3f3), color-stop(51%,#ededed), color-stop(100%,#ffffff));
			background: -webkit-linear-gradient(-45deg,  #ffffff 0%,#f3f3f3 50%,#ededed 51%,#ffffff 100%);
			background: -o-linear-gradient(-45deg,  #ffffff 0%,#f3f3f3 50%,#ededed 51%,#ffffff 100%);
			background: -ms-linear-gradient(-45deg,  #ffffff 0%,#f3f3f3 50%,#ededed 51%,#ffffff 100%);
			background: linear-gradient(135deg,  #ffffff 0%,#f3f3f3 50%,#ededed 51%,#ffffff 100%);
			filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=1 );
			width:100%;
			-webkit-border-radius: 3px;
			border-radius: 3px;
			padding:1.5rem;
			overflow-y:scroll;}
			@media only print {.screensurface {padding:1.3rem; }}
	/* Panel Examples */
	.panel.yes {outline-color: #cae3ca;}
	.panel.no {outline-color: #e3caca;}
	.icon-checkmark {color: #cae3ca;}
	.icon-blocked2 {color: #e3caca;}
	/* Panel Captions */
	.panel.hascap {
		margin-bottom:0;}
	.panelcap {
		margin-bottom:1.5rem;
		text-align:right;}
		@media only print {.panelcap { margin-bottom:1.3rem}}
		.panelcap a {font-style:italic;}

/* Font Classifications */
.pre-venetian {
	font-family:
		'UnifrakturMaguntia',
		cursive;}
.grotesque {
	font-family:
		"franklin-gothic-urw",
		"Akzidenz-Grotesk",
		"Franklin Gothic Medium",
		"News Gothic",
		sans-serif !important;}
.neo-grotesque {
	font-family:
		Univers,
		Helvetica,
		"Helvetica Neue",
		Impact,
		Arial,
		sans-serif !important;}
.geometric {
	font-family:
		"futura-pt",
		"Futura",
		Gotham,
		"Century Gothic",
		sans-serif !important;}
.humanist {
	font-family:
		"Frutiger",
		"Myriad Pro",
		"Trebuchet MS",
		Calibri,
		"FF Meta",
		Verdana,
		sans-serif !important;}
.venetian {
	font-family:
		"arno-pro",
		Centaur,
		Perpetua,
		"Hoefler Text",
		serif;}
.garalde {
	font-family:
		Garamond,
		"Adobe Garamond Pro",
		"Hoefler Text",
		Palatino,
		Linotype,
		"Book Antiqua",
		serif;}
.transitional {
	font-family:
		Baskerville,
		"Baskerville Old Face",
		"New Baskerville",
		Cambria,
		"Times New Roman",
		Georgia,
		serif;}
.didone {
	font-family:
		"ltc-bodoni-175",
		Didot,
		Bodoni,
		serif;}
.slab {
	font-family:
		Rockwell,
		Courier,
		"Courier New",
		Consolas,
		"Andale Mono",
		"Lucida Console",
		"Lucida Sans Typewriter",
		Monaco,
		monospace;}

/* Typekit Loading */
.wf-loading {
    opacity: 0;}
.wf-active, .wf-inactive {
    -webkit-transition: opacity 500ms ease-out;
    -moz-transition: opacity 500ms ease-out;
    -o-transition: opacity 500ms ease-out;
    transition: opacity 500ms ease-out;}


text:
package com.projecttango.experiments.nativemotiontracking;

/**
 * Interfaces between C and Java.
 */
public class TangoJNINative {
    static {
        System.loadLibrary("starter_jni_example");
    }

    public static native int tangoInitialize(MotionTrackingActivity activity);

    public static native void tangoSetupConfig();

    public static native int tangoConnect();

    public static native int tangoConnectCallbacks();

    public static native void tangoDisconnect();

    public static native void initGLContent();

    public static native void deleteResources();

    public static native void setupGraphic(int width, int height);

    public static native void render();
}


text:
<?php

include 'autoload.php';

class Gateway
{

    private $_config;
    private $_module;
    private $_basket;
    private $_result_message;

    public function __construct($module = false, $basket = false)
    {
        $this->_db =& $GLOBALS['db'];
        $this->_config =& $GLOBALS['config'];
        $this->_module = $module;
        $this->_basket =& $GLOBALS['cart']->basket;
    }

    ##################################################

    public function transfer()
    {
        $transfer = array(
            'action' => currentPage(),
            'method' => 'post',
            'target' => '_self',
            'submit' => 'manual',
        );
        return $transfer;
    }

    public function getInstance()
    {
        if ($this->_module['type'] == 'pci') {

            $instance = CheckoutApi_Lib_Factory::getInstance('methods_creditcardpci');
        } else {

            $instance = CheckoutApi_Lib_Factory::getInstance('methods_creditcard');
        }

        return $instance;
    }

    ##################################################

    public function process()
    {
        $instance = $this->getInstance()->process();
        return $instance;
    }

    ##################################################

    private function formatMonth($val)
    {
        return $val . " - " . strftime("%b", mktime(0, 0, 0, $val, 1, 2009));
    }

    public function form()
    {

        if ($this->_module['type'] == 'pci') {
           ## Process transaction
            if (isset($_POST['cardNumber'])) {
                $return = $this->process();
            }

            $this->_result_message = $GLOBALS['smarty']->tpl_vars['ErrorMessage']->value;

            // Display payment result message
            if (!empty($this->_result_message)) {
                $GLOBALS['gui']->setError($this->_result_message);
            }

            //Show Expire Months
            $selectedMonth = (isset($_POST['expirationMonth'])) ? $_POST['expirationMonth'] : date('m');
            for ($i = 1; $i <= 12; ++$i) {
                $val = sprintf('%02d', $i);
                $smarty_data['card']['months'][] = array(
                    'selected' => ($val == $selectedMonth) ? 'selected="selected"' : '',
                    'value'    => $val,
                    'display'  => $this->formatMonth($val),
                );
            }

            ## Show Expire Years
            $thisYear = date("Y");
            $maxYear = $thisYear + 10;
            $selectedYear = isset($_POST['expirationYear']) ? $_POST['expirationYear'] : ($thisYear + 2);
            for ($i = $thisYear; $i <= $maxYear; ++$i) {
                $smarty_data['card']['years'][] = array(
                    'selected' => ($i == $selectedYear) ? 'selected="selected"' : '',
                    'value'    => $i,
                );
            }
            $GLOBALS['smarty']->assign('CARD', $smarty_data['card']);

            $smarty_data['customer'] = array(
                'first_name' => isset($_POST['firstName']) ? $_POST['firstName'] : $this->_basket['billing_address']['first_name'],
                'last_name'  => isset($_POST['lastName']) ? $_POST['lastName'] : $this->_basket['billing_address']['last_name'],
            );

            $GLOBALS['smarty']->assign('CUSTOMER', $smarty_data['customer']);

            ## Check for custom template for module in skin folder
            $file_name = 'creditcardpci.tpl';
            $form_file = $GLOBALS['gui']->getCustomModuleSkin('gateway', dirname(__FILE__), $file_name);
            $GLOBALS['gui']->changeTemplateDir($form_file);
            $ret = $GLOBALS['smarty']->fetch($file_name);
            $GLOBALS['gui']->changeTemplateDir();

        } else {

            ## Process transaction
            if (isset($_POST['cko-cc-paymenToken'])) {
                $return = $this->process();
            }

            // Display payment result message
            if (!empty($this->_result_message)) {
                $GLOBALS['gui']->setError($this->_result_message);
            }

            $paymentToken = $this->getInstance()->generatePaymentToken();
            $smarty_data['checkoutapiData'] = array(
                'public_key'   => $this->_module['publickey'],
                'paymentToken' => $paymentToken['token'],
                'value'        => (int) ($this->_basket['total'] * 100),
                'currency'     => $GLOBALS['config']->get('config', 'default_currency'),
                'email'        => $this->_basket['billing_address']['email'],
                'name'         => $this->_basket['billing_address']['first_name'] . ' ' . $this->_basket['billing_address']['last_name'],
                'mode'         => $this->_module['mode']
            );

            $GLOBALS['smarty']->assign('CheckoutapiData', $smarty_data['checkoutapiData']);

            ## Check for custom template for module in skin folder
            $file_name = 'creditcardjs.tpl';
            $form_file = $GLOBALS['gui']->getCustomModuleSkin('gateway', dirname(__FILE__), $file_name);
            $GLOBALS['gui']->changeTemplateDir($form_file);
            $ret = $GLOBALS['smarty']->fetch($file_name);
            $GLOBALS['gui']->changeTemplateDir();
        }
        return $ret;
    }

    public function repeatVariables()
    {
        return (isset($hidden)) ? $hidden : false;
    }

    public function fixedVariables()
    {
        $default_currency = $GLOBALS['config']->get('config', 'default_currency');

        $hidden = array(
            'gateway'       => $this->_basket['gateway'],
            'cart_order_id' => $this->_basket['cart_order_id'],
            'currency_code' => $default_currency,
            'mode'          => $this->_module['mode'],
            'autocaptime'   => $this->_module['autocaptime'],
            'payment_type'  => $this->_module['payment_type'],
            'timeout'       => $this->_module['timeout'],
            'total'         => $this->_basket['total'],
            'customer_id'   => $this->_basket['billing_address']['customer_id'],

        );

        return (isset($hidden)) ? $hidden : false;
    }

    public function call()
    {
        $post_data = file_get_contents('php://input');

        if ($post_data) {
            $Api = CheckoutApi_Api::getApi(array('mode' => $this->_module['mode']));
            $objectCharge = $Api->chargeToObj($post_data);

            if ($objectCharge->isValid()) {

                /*
                 * Need to get track id
                 */
                $cart_order_id = $objectCharge->getTrackId();

                if ($cart_order_id) {

                    $order = Order::getInstance();
                    $order->getOrderDetails($cart_order_id);
                    $order_summary = $order->getSummary($cart_order_id);

                    if ($objectCharge->getCaptured()) {

                        $status = 'Captured';
                        $transData['notes'] = "Payment captured successfully.";
                        $order->orderStatus(Order::ORDER_COMPLETE, $cart_order_id);
                        $order->paymentStatus(Order::PAYMENT_SUCCESS, $cart_order_id);

                    }   elseif ($objectCharge->getRefunded()) {

                            $status = 'Refunded';
                            $transData['notes'] = "Payment has been refunded";
                            $order->paymentStatus(Order::PAYMENT_CANCEL, $cart_order_id);
                            $order->orderStatus(Order::ORDER_CANCELLED, $cart_order_id);

                    }   elseif (!$objectCharge->getAuthorised()) {

                            $status = 'Cancelled';
                            $transData['notes'] = "Payment cancelled";
                            $order->paymentStatus(Order::PAYMENT_CANCEL, $cart_order_id);
                            $order->orderStatus(Order::ORDER_CANCELLED, $cart_order_id);
                    }
                }
            }

            ## Build the transaction log data
            $transData['gateway'] = $_GET['module'];
            $transData['trans_id'] = $cart_order_id;
            $transData['amount'] = $order_summary['total'];
            $transData['status'] = $status;

            $order->logTransaction($transData);
        }
    }
}


text:
<?php

declare (strict_types=1);
namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;
class Method extends \PhpParser\Node\Scalar\MagicConst
{
    public function getName() : string
    {
        return '__METHOD__';
    }
    public function getType() : string
    {
        return 'Scalar_MagicConst_Method';
    }
}


text:
package com.appdirect.sdk.security.openid;

import org.junit.Test;
import org.springframework.security.openid.OpenIDAttribute;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

public class CustomAxFetchListFactoryTest {

    private static final String EMAIL = "email";
    private static final String ROLES = "roles";
    private static final String FULLNAME = "fullname";
    private static final String OPENID_TYPE_EMAIL = "http://axschema.org/contact/email";
    private static final String OPENID_TYPE_ROLES = "https://www.appdirect.com/schema/user/roles";
    private static final String OPENID_TYPE_FULLNAME = "http://axschema.org/namePerson";
    // Cannot use 0 for unlimited roles because of a bug in the OpenID4Java so using 50 as an alternative
    private static final Integer UNLIMITED_ROLES = 50;

    @Test
    public void testCreateAttributeList() throws Exception {
        CustomAxFetchListFactory customAxFetchListFactory = new CustomAxFetchListFactory();
        List<OpenIDAttribute> attributeList = customAxFetchListFactory.createAttributeList("anything");

        assertThat(attributeList).hasSize(3);
        assertThat(attributeList).extracting(OpenIDAttribute::getName).containsOnly(EMAIL, ROLES, FULLNAME);
        assertThat(attributeList).extracting(OpenIDAttribute::getType).containsOnly(OPENID_TYPE_EMAIL, OPENID_TYPE_FULLNAME, OPENID_TYPE_ROLES);
        assertThat(attributeList).extracting(OpenIDAttribute::isRequired).containsOnly(true);
        assertAttributeCountEqualsTo(attributeList, ROLES, UNLIMITED_ROLES);
    }

    private void assertAttributeCountEqualsTo(List<OpenIDAttribute> attributeList, String attributeName, int expectedCount) {
        assertThat(attributeList.stream().filter(attribute -> attribute.getName().equals(attributeName))
                .map(OpenIDAttribute::getCount)
                .findFirst())
                .contains(expectedCount);
    }
}


text:
import epidag as dag
import complexism as cx
from complexism.misc import start_counting, stop_counting, get_counting_results
import complexism.agentbased.statespace as ss

__author__ = 'TimeWz667'

director = cx.Director()

director.load_bayes_net('../scripts/pDzAB.txt')
director.load_state_space_model('../scripts/DzAB.txt')

mbp = ss.BlueprintStSpABM('abm')
mbp.set_agent(prefix='Ag', group='agent', dynamics='DzAB')
mbp.set_observations(states=['ab', 'aB', 'Ab', 'AB'])

# Initialise parameters
bn = director.get_bayes_net('pDzAB')

hie = {
    'city': ['abm'],
    'abm': ['agent'],
    'agent': ['TrA', 'TrB', 'TrA_B']
}

sm = dag.as_simulation_core(bn, hie=hie)

# Create a multi-model, and defined initial value
model_name = 'MultiModel'

pc = sm.generate(model_name)

model = cx.MultiModel(model_name, pc)

y0s = cx.BranchY0()
for i in range(1, 3):
    name = 'A{}'.format(i)
    m_abm = mbp.generate(name, pc=pc.breed(name, 'abm'), ss=director.get_state_space_model('DzAB'))
    model.append_child(m_abm, True)
    y0 = cx.LeafY0()
    y0.define(n=300, attributes={'st': 'ab'})
    y0s.append_child(name, y0)

start_counting('MM')
output = cx.simulate(model, y0s, 0, 10, 1)
stop_counting()
print(output)
print()
print(get_counting_results('MM'))


text:
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
                        unicode_literals, with_statement)

import os

from pants.base.workunit import WorkUnit

from pants.contrib.cpp.tasks.cpp_task import CppTask

class CppLibraryCreate(CppTask):
  """Builds a static library from C++ sources."""

  @classmethod
  def product_types(cls):
    return ['lib']

  @classmethod
  def prepare(cls, options, round_manager):
    super(CppLibraryCreate, cls).prepare(options, round_manager)
    round_manager.require('objs')

  def __init__(self, *args, **kwargs):
    super(CppLibraryCreate, self).__init__(*args, **kwargs)

  @property
  def cache_target_dirs(self):
    return True

  def execute(self):
    with self.context.new_workunit(name='cpp-library', labels=[WorkUnit.TASK]):
      targets = self.context.targets(self.is_library)
      with self.invalidated(targets, invalidate_dependents=True) as invalidation_check:
        lib_mapping = self.context.products.get('lib')
        for vt in invalidation_check.all_vts:
          if not vt.valid:
            self._create_library(vt.target, vt.results_dir)
          lib_mapping.add(vt.target, vt.results_dir).append(self._libpath(vt.target, vt.results_dir))

  def _create_library(self, target, results_dir):
    objects = []
    for basedir, objs in self.context.products.get('objs').get(target).items():
      objects = [os.path.join(basedir, obj) for obj in objs]
    # TODO: copy public headers to work dir.
    output = self._link_library(target, results_dir, objects)
    self.context.log.info('Built c++ library: {0}'.format(output))
    return output

  def _libpath(self, target, results_dir):
    return os.path.join(results_dir, 'lib' + target.name + '.a')

  def _link_library(self, target, results_dir, objects):
    output = self._libpath(target, results_dir)

    cmd = [self.cpp_toolchain.register_tool('ar')]
    cmd.extend(['rcs'])
    cmd.extend([output])
    cmd.extend(objects)

    with self.context.new_workunit(name='cpp-link', labels=[WorkUnit.COMPILER]) as workunit:
      self.run_command(cmd, workunit)

    return output


text:
This repository provides the source code for the Cloud Spanner Ticketshop Demo
shown first at Google Cloud NEXT 2017. It consists of 4 main applications:
(1) A tool for DB creation, schema creation and data loading found in the
[dataloadgenerator](dataloadgenerator/README.md) folder, (2) a Ticketshop
Backend serving a RESTful api found in the [backend](backend/README.md)
folder, (3) a Ticketshop BuyBot to simulate ticket purchasing found in the
[buybots](buybots/README.md) folder, and (4) the Ticketshop Dashboard
application to show ticket selling statistics found in the
[dashboard](dashboard/README.md) folder.

All 4 apps can be packaged in containers and run / managed in
[Kubernetes](https://kubernetes.io). Instructions how to run them can be found
in the README's in the respective folders.

## Architecture & Database Schema

High level architecture:
![high-level-architecture.png](images/high-level-architecture.png)

The DB schema used for this demo can be found in
[dataloadgenerator/schema](dataloadgenerator/schema/ticketshop-schema.sql):
![DBSchema.png](images/DBSchema.png)

## One script setup

A one-script setup is provided for this demo. The prerequisites are an Ubuntu
Google Compute Engine (GCE) instance with the following packages pre-installed
(see instructions below for a quick way to setup up a controller instance):

* apt-transport-https
* ca-certificates
* curl
* software-properties-common
* build-essential
* tmux
* git
* docker-engine

### Setting up the demo controller instance

To create an instance in your account and pre-install all required packages you
can run the commands below.

**Important**: Make sure your gcloud auth & project set correctly. You can
adjust the zone to create the GCE instance in with your preference.

**WARNING**: The below instructions create a service account with IAM permission
admin rights. If you don't want this, you can't use the one-script demo setup
and need to set it up manually. Please refer to the setup.sh for guidance.
You can remove the projectIamAdmin role from the service account after running
the setup script.

```bash
gcloud services enable container.googleapis.com
gcloud services enable compute.googleapis.com
gcloud services enable spanner.googleapis.com
gcloud services enable containerregistry.googleapis.com
gcloud services enable cloudresourcemanager.googleapis.com
gcloud services enable iam.googleapis.com

gcloud iam service-accounts create spanner-demo-gce-svc-acc \
--display-name "Cloud Spanner Demo GCE Service Account"

PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud projects \
add-iam-policy-binding $PROJECT --member \
serviceAccount:spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com \
--role roles/resourcemanager.projectIamAdmin

PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud compute \
instances create demo-controller-01 --zone europe-west1-c --machine-type \
n1-standard-1 --scopes "https://www.googleapis.com/auth/cloud-platform" \
--image-project ubuntu-os-cloud --image-family ubuntu-1804-lts --service-account \
spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com

gcloud compute scp scripts/setup-demo-controller.sh \
demo-controller-01:setup-demo-controller.sh --zone europe-west1-c

gcloud compute ssh demo-controller-01 --zone europe-west1-c \
--command "sudo sh setup-demo-controller.sh"
```

### Running the demo setup script

After setting up your instance you can ssh into your instance through
`SSH-in-the-browser` or with `gcloud`. **Elevate to sudo** with `sudo su -`
after successfully connecting to your instance.

Since the dataload is a long running process we run the script in `tmux`, you
can also use `screen`, to avoid having the process killed after an accidental
disconnect from your ssh session.

To create a tmux session run `tmux`. You can reconnect to your running tmux
session with `tmux a`.

```bash
sudo su -
tmux
```

In tmux you can now move into the repository folder
`cloudspanner-ticketshop-demo` and run `.scripts/setup.sh`.
Follow the instructions of the setup script.

Example Answers:

```bash
...
Please select a config for the Spanner instance.
1) regional-asia-east1
2) regional-europe-west1
3) regional-us-central1
Your choice: 2
Spanner Instance config set to 'regional-europe-west1'

Spanner Instance Name (min 6 chars): spanner-eu
Spanner Instance name set to 'spanner-eu'

DB Name: demo
Database name set to 'demo'

Please select a size for the demo DB.
1) 100GB
2) 1TB
3) 10TB
4) 20TB
Your choice: 1
```

You can run the demo after the dataload + setup of kubernetes clusters has
finished.

### Optional - remove admin and editor rights from service account

```bash
PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud projects \
remove-iam-policy-binding $PROJECT --member \
serviceAccount:spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com \
--role roles/resourcemanager.projectIamAdmin
PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud projects \
remove-iam-policy-binding $PROJECT --member \
serviceAccount:spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com \
--role roles/spanner.admin
PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud projects \
remove-iam-policy-binding $PROJECT --member \
serviceAccount:spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com \
--role roles/container.admin
PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud projects \
remove-iam-policy-binding $PROJECT --member \
serviceAccount:spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com \
--role roles/iam.serviceAccountAdmin
PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud projects \
remove-iam-policy-binding $PROJECT --member \
serviceAccount:spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com \
--role roles/iam.serviceAccountKeyAdmin
PROJECT=`gcloud config get-value project 2> /dev/null`; gcloud projects \
remove-iam-policy-binding $PROJECT --member \
serviceAccount:spanner-demo-gce-svc-acc@$PROJECT.iam.gserviceaccount.com \
--role roles/storage.admin
```

## Controlling the demo

To control the demo you use the [buybots_scale.sh](scripts/buybots_scale.sh)
script.

To scale to 5 buybots per region run:

```bash
scripts/buybots_scale.sh 1 5
```

To stop the demo, run:

```bash
scripts/buybots_scale.sh 1 0
```

## Accessing the dashboard

The dashboard is exposed via a kubernetes service with an external IP.
To find the external ip you need to check the services in your main cluster.
The main cluster depends on the region you deployed your Cloud Spanner instance
to.
If you deployed to Europe, your main cluster context is `spannerdemo-europe-01`,
if you deployed to Asia, your main cluster context is `spannerdemo-asia-01`,
if you deployed to US, your main cluster context is `spannerdemo-us-01`.

To get the external ip for the dashboard service run:

```bash
kubectl --context {{MAIN_CLUSTER_CONTEXT}} get svc
```

For Europe:

```bash
kubectl --context spannerdemo-europe-01 get svc
```

The dashboard is hosted via HTTP. Navigate your browser to
`http://{{IP_OF_SPANNERDEMO_DASHBOARD_SERVICE}}`.

## Resetting sold tickets

To reset sold tickets you can run the reset job. Run this from the primary
region you selected in the setup script. Stop all buybots first.

Look for the latest generated reset job config in `k8sgenerated`, e.g.
`2018-02-27_1922-spannerdemo-reset-job-spanner-eu-demo-9b50595.yaml`.

```bash
kubectl --context spannerdemo-europe-01  create -f \
k8sgenerated/2018-02-27_1922-spannerdemo-reset-job-spanner-eu-demo-9b50595.yaml
```

After the job has finished, you can check with
`kubectl --context spannerdemo-europe-01 get jobs`, you need to delete the
job and reset the dashboard.

```bash
kubectl --context spannerdemo-europe-01 delete job spannerdemo-reset
kubectl --context spannerdemo-europe-01 delete pod \
spannerdemo-backend-influxdb-...
kubectl --context spannerdemo-europe-01 delete pod spannerdemo-dashboard-...
```

Deleting the influxdb and dashboard pods resets the metrics. They get
automatically restarted by their respective replicasets.

## Troubleshooting

If something goes wrong the best is to start from fresh.

 1. Remove the generated service account and assigned IAM permissions
 (`serviceAccount:$instancename-$db@$project.iam.gserviceaccount.com`)
 1. delete the created Kubernetes Clusters
 1. delete the Cloud Spanner Instance

## Development

## Prerequisite to run a container on GCE

Build the container and push to
[Google Cloud Container Registry](https://cloud.google.com/container-registry/)
with `make push-gcr`.

Create a GCE instance selecting CoreOS stable.
Make sure to give the instance API access to the required APIs.
Required APIs: Cloud Spanner API

Login to the GCE instance and authenticate docker to access the private
registry:

```bash
gcloud auth application-default print-access-token
docker login -u oauth2accesstoken -p "<TOKEN_OUTPUT_OF_PREVIOUS_CMD>" \
https://gcr.io
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md)

## License

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

*This is not an official Google product*