text:
package io.insideout.stanbol.enhancer.nlp.freeling.impl;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FreelingProperties {

    private Logger logger = LoggerFactory.getLogger(getClass());

    private String freelingSharePath;
    private String propertiesFilePath;

    private String language;
    private String locale;

    private int traceLevel;
    private String traceModule;

    private String inputFormat;
    private String outputFormat;

    private boolean alwaysFlush;

    private String tokenizerFile;

    private String splitterFile;

    private boolean affixAnalysis;
    private boolean multiwordsDetection;
    private boolean numbersDetection;
    private boolean punctuationDetection;
    private boolean datesDetection;
    private boolean quantitiesDetection;
    private boolean dictionarySearch;
    private boolean probabilityAssignment;
    private boolean ortographicCorrection;
    private String decimalPoint;
    private String thousandPoint;
    private String locutionsFile;
    private String quantitiesFile;
    private String affixFile;
    private String probabilityFile;
    private String npDataFile;
    private String punctuationFile;
    private Double probabilityThreshold;

    private boolean neRecognition;
    private String dictionaryFile;

    private String correctorFile;

    private boolean phonetics;
    private String phoneticsFile;

    private boolean neClassification;
    private String necFile;

    private String senseAnnotation;
    private String senseConfigFile;
    private String ukbConfigFile;

    private String tagger;
    private String taggerHMMFile;
    private String taggerRelaxFile;
    private int taggerRelaxMaxIter;
    private Double taggerRelaxScaleFactor;
    private Double taggerRelaxEpsilon;
    private boolean taggerRetokenize;
    private int taggerForceSelect;

    private String grammarFile;

    private String depTxalaFile;

    private boolean coreferenceResolution;
    private String corefFile;

    public FreelingProperties(String propertiesFilePath, String freelingSharePath) {
        this.propertiesFilePath = propertiesFilePath;
        this.freelingSharePath = freelingSharePath;

        readProperties();
    }

    public void readProperties() {
        // Read properties file.
        Properties properties = new Properties();
        try {
            properties.load(new FileInputStream(propertiesFilePath));
        } catch (IOException e) {}

        language = getProperty(properties, "Lang", "none");
        locale = getProperty(properties, "Locale", "default");

        traceLevel = getProperty(properties, "TraceLevel", 3);
        traceModule = getProperty(properties, "TraceModule", "0x0000");

        inputFormat = getProperty(properties, "InputFormat", "plain");
        outputFormat = getProperty(properties, "OutputFormat", "tagged");

        alwaysFlush = ("yes".equals(getProperty(properties, "locale", "no")));

        tokenizerFile = getProperty(properties, "TokenizerFile", "");

        splitterFile = getProperty(properties, "SplitterFile", "");

        affixAnalysis = ("yes".equals(getProperty(properties, "AffixAnalysis", "no")));
        multiwordsDetection = ("yes".equals(getProperty(properties, "MultiwordsDetection", "no")));
        numbersDetection = ("yes".equals(getProperty(properties, "NumbersDetection", "no")));
        punctuationDetection = ("yes".equals(getProperty(properties, "PunctuationDetection", "no")));
        datesDetection = ("yes".equals(getProperty(properties, "DatesDetection", "no")));
        quantitiesDetection = ("yes".equals(getProperty(properties, "QuantitiesDetection", "no")));
        dictionarySearch = ("yes".equals(getProperty(properties, "DictionarySearch", "no")));
        probabilityAssignment = ("yes".equals(getProperty(properties, "ProbabilityAssignment", "no")));
        ortographicCorrection = ("yes".equals(getProperty(properties, "OrtographicCorrection", "no")));
        decimalPoint = getProperty(properties, "DecimalPoint", ",");
        thousandPoint = getProperty(properties, "ThousandPoint", ".");
        locutionsFile = getProperty(properties, "LocutionsFile", "").trim();
        quantitiesFile = getProperty(properties, "QuantitiesFile", "").trim();
        affixFile = getProperty(properties, "AffixFile", "").trim();
        probabilityFile = getProperty(properties, "ProbabilityFile", "").trim();
        npDataFile = getProperty(properties, "NPDataFile", "").trim();
        punctuationFile = getProperty(properties, "PunctuationFile", "").trim();
        probabilityThreshold = getProperty(properties, "ProbabilityThreshold", (Double) 0.001);

        neRecognition = ("yes".equals(getProperty(properties, "NERecognition", "no")));
        dictionaryFile = getProperty(properties, "DictionaryFile", "").trim();

        correctorFile = getProperty(properties, "CorrectorFile", "").trim();

        phonetics = ("yes".equals(getProperty(properties, "Phonetics", "")));
        phoneticsFile = getProperty(properties, "PhoneticsFile", "");

        neClassification = ("yes".equals(getProperty(properties, "NEClassification", "no")));
        necFile = getProperty(properties, "NECFile", "");

        senseAnnotation = getProperty(properties, "SenseAnnotation", "none");
        senseConfigFile = getProperty(properties, "SenseConfigFile", "");
        ukbConfigFile = getProperty(properties, "UKBConfigFile", "");

        tagger = getProperty(properties, "Tagger", "hmm");
        taggerHMMFile = getProperty(properties, "TaggerHMMFile", "");
        taggerRelaxFile = getProperty(properties, "TaggerRelaxFile", "");
        taggerRelaxMaxIter = getProperty(properties, "TaggerRelaxMaxIter", (int) 500);
        taggerRelaxScaleFactor = getProperty(properties, "TaggerRelaxScaleFactor", (Double) 670.0);
        taggerRelaxEpsilon = getProperty(properties, "TaggerRelaxEpsilon", (Double) 0.001);
        taggerRetokenize = ("yes".equals(getProperty(properties, "TaggerRetokenize", "no")));

        String taggerForceSelectStringValue = getProperty(properties, "TaggerForceSelect", "tagger");

        if ("retokenize".equals(taggerForceSelectStringValue)) {
            taggerForceSelect = 2;
        } else if ("tagger".equals(taggerForceSelectStringValue)) {
            taggerForceSelect = 1;
        } else {
            taggerForceSelect = 0;
        }

        grammarFile = getProperty(properties, "GrammarFile", "");

        depTxalaFile = getProperty(properties, "DepTxalaFile", "");

        coreferenceResolution = ("yes".equals(getProperty(properties, "CoreferenceResolution", "no")));
        corefFile = getProperty(properties, "CorefFile", "");

    }

    @SuppressWarnings("unchecked")
    private <T> T getProperty(Properties properties, String propertyName, T defaultValue) {

        // get the value.
        String value = properties.getProperty(propertyName);

        // set the default value, if the value is empty.
        if (null == value || "".equals(value)) return defaultValue;

        // replace the freeling share placeholder.
        value = value.replace("$FREELINGSHARE", freelingSharePath);

        // return an integer.
        if (Integer.class.equals(defaultValue.getClass())) return (T) Integer.valueOf(value, 10);

        // return a double.
        if (Double.class.equals(defaultValue.getClass())) return (T) Double.valueOf(value);

        // return a boolean.
        if (Boolean.class.equals(defaultValue.getClass())) return (T) Boolean.valueOf(value);

        // return a string equivalent.
        return (T) value;
    }

    public Logger getLogger() {
        return logger;
    }

    public String getPropertiesFilePath() {
        return propertiesFilePath;
    }

    public String getLanguage() {
        return language;
    }

    public String getLocale() {
        return locale;
    }

    public int getTraceLevel() {
        return traceLevel;
    }

    public String getTraceModule() {
        return traceModule;
    }

    public String getInputFormat() {
        return inputFormat;
    }

    public String getOutputFormat() {
        return outputFormat;
    }

    public boolean isAlwaysFlush() {
        return alwaysFlush;
    }

    public String getTokenizerFile() {
        return tokenizerFile;
    }

    public String getSplitterFile() {
        return splitterFile;
    }

    public boolean isAffixAnalysis() {
        return affixAnalysis;
    }

    public boolean isMultiwordsDetection() {
        return multiwordsDetection;
    }

    public boolean isNumbersDetection() {
        return numbersDetection;
    }

    public boolean isPunctuationDetection() {
        return punctuationDetection;
    }

    public boolean isDatesDetection() {
        return datesDetection;
    }

    public boolean isQuantitiesDetection() {
        return quantitiesDetection;
    }

    public boolean isDictionarySearch() {
        return dictionarySearch;
    }

    public boolean isProbabilityAssignment() {
        return probabilityAssignment;
    }

    public boolean isOrtographicCorrection() {
        return ortographicCorrection;
    }

    public String getDecimalPoint() {
        return decimalPoint;
    }

    public String getThousandPoint() {
        return thousandPoint;
    }

    public String getLocutionsFile() {
        return locutionsFile;
    }

    public String getQuantitiesFile() {
        return quantitiesFile;
    }

    public String getAffixFile() {
        return affixFile;
    }

    public String getProbabilityFile() {
        return probabilityFile;
    }

    public String getNpDataFile() {
        return npDataFile;
    }

    public String getPunctuationFile() {
        return punctuationFile;
    }

    public Double getProbabilityThreshold() {
        return probabilityThreshold;
    }

    public boolean isNeRecognition() {
        return neRecognition;
    }

    public String getDictionaryFile() {
        return dictionaryFile;
    }

    public String getCorrectorFile() {
        return correctorFile;
    }

    public boolean isPhonetics() {
        return phonetics;
    }

    public String getPhoneticsFile() {
        return phoneticsFile;
    }

    public boolean isNeClassification() {
        return neClassification;
    }

    public String getNecFile() {
        return necFile;
    }

    public String getSenseAnnotation() {
        return senseAnnotation;
    }

    public String getSenseConfigFile() {
        return senseConfigFile;
    }

    public String getUkbConfigFile() {
        return ukbConfigFile;
    }

    public String getTagger() {
        return tagger;
    }

    public String getTaggerHMMFile() {
        return taggerHMMFile;
    }

    public String getTaggerRelaxFile() {
        return taggerRelaxFile;
    }

    public int getTaggerRelaxMaxIter() {
        return taggerRelaxMaxIter;
    }

    public Double getTaggerRelaxScaleFactor() {
        return taggerRelaxScaleFactor;
    }

    public Double getTaggerRelaxEpsilon() {
        return taggerRelaxEpsilon;
    }

    public boolean isTaggerRetokenize() {
        return taggerRetokenize;
    }

    public int getTaggerForceSelect() {
        return taggerForceSelect;
    }

    public String getGrammarFile() {
        return grammarFile;
    }

    public String getDepTxalaFile() {
        return depTxalaFile;
    }

    public boolean isCoreferenceResolution() {
        return coreferenceResolution;
    }

    public String getCorefFile() {
        return corefFile;
    }

}


text:
module Compiler.GCC.JIT.Foreign (module X) where

import Compiler.GCC.JIT.Foreign.Types as X
import Compiler.GCC.JIT.Foreign.Expression as X
import Compiler.GCC.JIT.Foreign.Context as X
import Compiler.GCC.JIT.Foreign.Block as X
import Compiler.GCC.JIT.Foreign.Timer as X

redpajama_set_name: RedPajamaGithub


text:
package org.summerb.webappboilerplate.security.dto;

public class Registration {
	public static final String FN_DISPLAY_NAME = "displayName";

	private String email;
	private String displayName;
	private String password;
	private String captcha;

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getDisplayName() {
		return displayName;
	}

	public void setDisplayName(String name) {
		this.displayName = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getCaptcha() {
		return captcha;
	}

	public void setCaptcha(String captcha) {
		this.captcha = captcha;
	}
}


text:
import { Component } from 'react';
import Typography from '@material-ui/core/Typography';

export default class ErrorBoundary extends Component {
    state = { error: null };

    static defaultProps = {
        visible: true,
    };

    componentDidCatch(error, info) {
        console.error(error, info);
        this.setState({ error, info });
    }

    render() {
        const { error } = this.state;
        const { visible, children } = this.props;

        if (error) {
            if (visible) {
                return <Typography color="error">{error.message}</Typography>;
            } else {
                return null;
            }
        }

        return children;
    }
}


text:
package routers

import (
	"github.com/astaxie/beego"
	"github.com/mark-greene/go-blackjack/controllers"
)

func init() {
	beego.Router("/", &controllers.MainController{})
	beego.Router("/new_player", &controllers.MainController{}, "get,post:NewPlayer")
	beego.Router("/bet", &controllers.MainController{}, "get,post:Bet")
	beego.Router("/game", &controllers.MainController{}, "get:Game")
	beego.Router("/game/player/hit", &controllers.MainController{}, "post:PlayerHit")
	beego.Router("/game/player/stay", &controllers.MainController{}, "post:PlayerStay")
	beego.Router("/game/player/double", &controllers.MainController{}, "post:PlayerDouble")
	beego.Router("/game/dealer", &controllers.MainController{}, "get:Dealer")
	beego.Router("/game/dealer/hit", &controllers.MainController{}, "post:DealerHit")
	beego.Router("/game/dealer/blackjack", &controllers.MainController{}, "get:DealerBlackjack")
	beego.Router("/game/compare", &controllers.MainController{}, "get:Compare")
	beego.Router("/game/over", &controllers.MainController{}, "get:Over")
}


text:
//
//  ViewController.m
//  MPTransition (v 1.1.4)
//
//  Created by Mark Pospesel on 4/20/12.
//  Copyright (c) 2012 Mark Pospesel. All rights reserved.
//

#import "ViewController.h"
#import "MPFoldTransition.h"
#import "MPFlipTransition.h"
#import "AppDelegate.h"
#import "MPFoldSegue.h"
#import "DetailsViewController.h"
#import <QuartzCore/QuartzCore.h>

#define ABOUT_IDENTIFIER		@"AboutID"
#define DETAILS_IDENTIFIER		@"DetailsID"
#define ABOUT_SEGUE_IDENTIFIER		@"segueToAbout"
#define DETAILS_SEGUE_IDENTIFIER	@"segueToDetails"
#define STYLE_TABLE_IDENTIFIER	@"StyleTableID"
#define FOLD_STYLE_TABLE_IDENTIFIER	@"FoldStyleTableID"
#define FLIP_STYLE_TABLE_IDENTIFIER	@"FlipStyleTableID"

@interface ViewController ()

@property (strong, nonatomic) UIPopoverController *popover;

@end

@implementation ViewController

@synthesize mode = _mode;
@synthesize foldStyle = _foldStyle;
@synthesize flipStyle = _flipStyle;
@synthesize contentView = _contentView;
@synthesize modeSegment = _modeSegment;
@synthesize popover = _popover;

- (id)init
{
	self = [super init];
	if (self)
	{
		[self doInit];
	}

	return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
	self = [super initWithCoder:aDecoder];
	if (self)
	{
		[self doInit];
	}

	return self;

}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
	self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
	if (self)
	{
		[self doInit];
	}

	return self;

}

- (void)doInit
{
	_mode = MPTransitionModeFold;
	_foldStyle = MPFoldStyleCubic;
	_flipStyle = MPFlipStyleDefault;
}

#pragma mark - Properties

- (NSUInteger)style
{
	switch ([self mode]) {
		case MPTransitionModeFold:
			return [self foldStyle];

		case MPTransitionModeFlip:
			return [self flipStyle];
	}
}

- (void)setStyle:(NSUInteger)style
{
	switch ([self mode]) {
		case MPTransitionModeFold:
			[self setFoldStyle:style];
			break;

		case MPTransitionModeFlip:
			[self setFlipStyle:style];
			break;
	}
}

- (BOOL)isFold
{
	return [self mode] == MPTransitionModeFold;
}

#pragma mark - View Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
	[self.modeSegment setSelectedSegmentIndex:(int)[self mode]];
	[self.contentView addSubview:[self getLabelForIndex:0]];
}

- (void)viewDidUnload
{
    [self setContentView:nil];
	[self setModeSegment:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
	    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
	} else {
	    return YES;
	}
}

#pragma mark - Instance methods

- (UIView *)getLabelForIndex:(NSUInteger)index
{
	UIView *container = [[UIView alloc] initWithFrame:self.contentView.bounds];
	container.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
	[container setBackgroundColor:[UIColor whiteColor]];

	UILabel *label = [[UILabel alloc] initWithFrame:CGRectInset(container.bounds, 10, 10)];
	label.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
	[label setFont:[UIFont boldSystemFontOfSize:84]];
	[label setTextAlignment:UITextAlignmentCenter];
	[label setTextColor:[UIColor lightTextColor]];
	label.text = [NSString stringWithFormat:@"%d", index + 1];

	switch (index % 6) {
		case 0:
			[label setBackgroundColor:[UIColor redColor]];
			break;

		case 1:
			[label setBackgroundColor:[UIColor orangeColor]];
			break;

		case 2:
			[label setBackgroundColor:[UIColor yellowColor]];
			[label setTextColor:[UIColor darkTextColor]];
			break;

		case 3:
			[label setBackgroundColor:[UIColor greenColor]];
			[label setTextColor:[UIColor darkTextColor]];
			break;

		case 4:
			[label setBackgroundColor:[UIColor blueColor]];
			break;

		case 5:
			[label setBackgroundColor:[UIColor purpleColor]];
			break;

		default:
			break;
	}

	[container addSubview:label];
	container.tag = index;
	[container.layer setBorderColor:[[UIColor colorWithWhite:0.85 alpha:1] CGColor]];
	[container.layer setBorderWidth:2];

	return container;
}

- (void)updateClipsToBounds
{
	// We want clipsToBounds == YES on the central contentView when fold style mode bit is not cubic
	// Otherwise you see the top & bottom panels sliding out and looks weird
	[self.contentView setClipsToBounds:[self isFold] && (([self foldStyle] & MPFoldStyleCubic) != MPFoldStyleCubic)];
}

#pragma mark - Touch handlers

- (IBAction)stepperValueChanged:(id)sender {
	UIStepper *stepper = sender;
	[stepper setUserInteractionEnabled:NO];
	UIView *previousView = [[self.contentView subviews] objectAtIndex:0];
	UIView *nextView = [self getLabelForIndex:stepper.value];
	BOOL forwards = nextView.tag > previousView.tag;
	// handle wrap around
	if (nextView.tag == stepper.maximumValue && previousView.tag == stepper.minimumValue)
		forwards = NO;
	else if (nextView.tag == stepper.minimumValue && previousView.tag == stepper.maximumValue)
		forwards = YES;

	// execute the transition
	if ([self isFold])
	{
		[MPFoldTransition transitionFromView:previousView
									  toView:nextView
									duration:[MPFoldTransition defaultDuration]
									   style:forwards? [self foldStyle]	: MPFoldStyleFlipFoldBit([self foldStyle])
							transitionAction:MPTransitionActionAddRemove
								  completion:^(BOOL finished) {
									  [stepper setUserInteractionEnabled:YES];
								  }
		 ];
	}
	else
	{
		[MPFlipTransition transitionFromView:previousView
									  toView:nextView
									duration:[MPTransition defaultDuration]
									   style:forwards? [self flipStyle]	: MPFlipStyleFlipDirectionBit([self flipStyle])
							transitionAction:MPTransitionActionAddRemove
								  completion:^(BOOL finished) {
									  [stepper setUserInteractionEnabled:YES];
								  }
		 ];
	}
}

- (IBAction)infoPressed:(UIBarButtonItem *)sender {
	UIStoryboard *storyboard = [UIStoryboard storyboardWithName:[AppDelegate storyboardName] bundle:nil];
	AboutViewController *about = [storyboard instantiateViewControllerWithIdentifier:ABOUT_IDENTIFIER];
	[about setModalDelegate:self];
	about.title = @"About";
	UIViewController *presented = about;

	/*int i = arc4random_uniform(3);
	switch (i) {
		case 1:
			// Embed in nav controller
			presented = [[UINavigationController alloc] initWithRootViewController:about];
			break;

		case 2:
		{
			// Embed in tab controller along with Details screen
			DetailsViewController *details = [storyboard instantiateViewControllerWithIdentifier:DETAILS_IDENTIFIER];
			[details setFold:[self isFold]];
			[details setStyle:[self style]];
			details.title = @"Details";
			UITabBarController *tab = [[UITabBarController alloc] init];
			[tab setViewControllers:[NSArray arrayWithObjects:about, details, nil] animated:NO];
			[tab setSelectedIndex:arc4random_uniform(2)];
			presented = tab;
		}
			break;
	}*/

	if ([self isFold])
		[self presentViewController:presented foldStyle:[self foldStyle] completion:nil];
	else
		[self presentViewController:presented flipStyle:[self flipStyle] completion:nil];
}

- (IBAction)stylePressed:(id)sender {
	BOOL isPad = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
	// for iPad present Style table as a popover
	if (isPad && [self.popover isPopoverVisible])
	{
		[self.popover dismissPopoverAnimated:YES];
		[self setPopover:nil];
		return;
	}

	BOOL isFold = [self isFold];
	UIStoryboard *storyboard = [UIStoryboard storyboardWithName:[AppDelegate storyboardName] bundle:nil];
	StyleTable *styleTable = [storyboard instantiateViewControllerWithIdentifier:isFold? FOLD_STYLE_TABLE_IDENTIFIER : FLIP_STYLE_TABLE_IDENTIFIER];
	[styleTable setFold:isFold];
	[styleTable setStyle:[self style]];
	[styleTable setStyleDelegate:self];

	if (!isPad)
	{
		// for iPhone push Style table onto navigation stack (using a fold transition in our current style!)
		if (isFold)
			[self.navigationController pushViewController:styleTable foldStyle:[self foldStyle]];
		else
			[self.navigationController pushViewController:styleTable flipStyle:[self flipStyle]];
	}
	else
	{
		// for iPad, just use a popover
		UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:styleTable];
		[self setPopover:[[UIPopoverController alloc] initWithContentViewController:navController]];

		[self.popover setDelegate:self];
		[self.popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
	}
}

- (IBAction)modeValueChanged:(id)sender {
	// switch between fold & flip transitions
	[self setMode:[sender selectedSegmentIndex]];
	[self updateClipsToBounds];
}

- (IBAction)detailPressed:(id)sender {
	BOOL isFold = [self isFold];
	UIStoryboard *storyboard = [UIStoryboard storyboardWithName:[AppDelegate storyboardName] bundle:nil];
	DetailsViewController *details = [storyboard instantiateViewControllerWithIdentifier:DETAILS_IDENTIFIER];
	[details setFold:isFold];
	[details setStyle:[self style]];

	// push Details view controller onto navigation stack (using a fold or flip transition in our current style!)
	if (isFold)
		[self.navigationController pushViewController:details foldStyle:[self foldStyle]];
	else
		[self.navigationController pushViewController:details flipStyle:[self flipStyle]];
}

#pragma mark - Storyboards

// I removed the segues from the storyboards so that I could switch between flip and fold segue classes
/*- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
	// set the selected fold style to our segues
	if ([[segue identifier] isEqualToString:DETAILS_SEGUE_IDENTIFIER])
	{
		DetailsViewController *details = [segue destinationViewController];
		[details setStyle:[self foldStyle]];

		MPFoldSegue *foldSegue = (MPFoldSegue *)segue;
		[foldSegue setStyle:[self foldStyle]];
	}
	else if ([[segue identifier] isEqualToString:ABOUT_SEGUE_IDENTIFIER])
	{
		AboutViewController *about = [segue destinationViewController];
		[about setModalDelegate:self];

		MPFoldSegue *foldSegue = (MPFoldSegue *)segue;
		[foldSegue setStyle:[self foldStyle]];
	}
}*/

#pragma mark - MPModalViewControllerDelegate

- (void)dismiss
{
	// use the opposite fold style from the transition that presented the modal view
	if ([self isFold])
	{
		MPFoldStyle dismissStyle = MPFoldStyleFlipFoldBit([self foldStyle]);

		[self dismissViewControllerWithFoldStyle:dismissStyle completion:nil];
	}
	else
	{
		MPFlipStyle dismissStyle = MPFlipStyleFlipDirectionBit([self flipStyle]);
		[self dismissViewControllerWithFlipStyle:dismissStyle completion:nil];
	}
}

#pragma mark - UIPopoverControllerDelegate

- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController
{
	[self setPopover:nil];
}

#pragma mark - StyleDelegate

- (void)styleDidChange:(NSUInteger)newStyle
{
	[self setStyle:newStyle];
	[self updateClipsToBounds];
}

@end


text:
	<?php

require_once 'OffAmazonPaymentsService.config.inc.php';
require_once 'Client.php';

/**
 * Encapsulation of properties that are tied to a region/environment pairing
 *
 * Provides mappings for:
 *   - widget url
 *   - mws service url
 *   - currency code
 */
class OffAmazonPaymentsService_RegionSpecificProperties
{
	private $_widgetUrls = array(
		'eu' => 'https://static-eu.payments-amazon.com',
		'na' => 'https://static-na.payments-amazon.com'
	);

	private $_serviceUrls = array(
		'eu' => 'https://mws-eu.amazonservices.com',
		'na' => 'https://mws.amazonservices.com'
	);

	private $_currencyCodes = array(
		'de' => 'EUR',
		'uk' => 'GBP',
		'us' => 'USD',
		'na' => 'USD'
	);

	private $_regionMappings = array(
		'de' => 'eu',
		'na' => 'na',
		'uk' => 'eu',
		'us' => 'na'
	);

	const WIDGET_FORMAT_STRING = '%s/OffAmazonPayments/%s%s/js/Widgets.js?sellerId=%s';
	const SERVICE_FORMAT_STRING = '%s/OffAmazonPayments%s/%s';

	//const WIDGET_FORMAT_STRING = '%s/OffAmazonPayments/%s%s/js/Widgets.js';
	//const SERVICE_FORMAT_STRING = '%s/OffAmazonPayments%s/%s';

	/**
	 * Return the correct widget url for the javascript widget
	 *
	 * @param string $region
	 * @param string $environment
	 * @param string $merchantId
	 * @param string $overrideUrl
	 *
	 * @return string widgetUrl
	 */
	public function getWidgetUrlFor($region, $environment, $merchantId, $overrideUrl)
	{
		$u = sprintf(self::WIDGET_FORMAT_STRING,
					$this->_getWidgetHostFor($region, $overrideUrl),
					$this->_getWidgetRegionFor($region),
			    	$this->_getWidgetEnvironmentFor($environment, $region),
					urlencode($merchantId));
					$x = $this->_getWidgetRegionFor($region);
		$y = $this->_getWidgetEnvironmentFor($environment, $region);
		//vmdebug('getWidgetUrlFor',$u,$x,$y);
		return $u;
	}

	/**
	 * Return the mws service for this region
	 *
	 * @param string $region       merchant region - us, na, uk, de
	 * @param string $environment  service - live, sandbox
	 * @param string $overrideUrl  override url
	 *
	 * @return string mws service url
	 */
	public function getServiceUrlFor($region, $environment, $overrideUrl)
	{
		return sprintf(self::SERVICE_FORMAT_STRING,
					$this->_getServiceHostFor($region, $overrideUrl),
					$this->_getSectionNameFor($environment),
					OffAmazonPaymentsService_Client::SERVICE_VERSION);
	}

	/**
	 * Get the currency code for the given region
	 *
	 * @param string $region us,uk,de,na
	 *
	 * @return string currency code
	 */
	public function getCurrencyFor($region)
	{
		$this->_validateRegionIsDefined($region, $this->_currencyCodes);
		return $this->_currencyCodes[$region];
	}

	/**
	 * Return the correct host for the widget url based on the region
	 *
	 * @param string $region 		us,uk,de,na
	 * @param string $overrideUrl	override string for widget host
	 *
	 * @return string widget host
	 */
	private function _getWidgetHostFor($region, $overrideUrl)
	{
		if (empty($overrideUrl)) {
			return $this->_getRegionPropertyFor($region, $this->_widgetUrls);
		}

		return $overrideUrl;
	}

	/**
	 * Return the correct host for the service url based on the region
	 *
	 * @param string $region 		us,uk,de,na
	 * @param string $overrideUrl   override string for service host
	 *
	 * @return string mws host
	 */
	private function _getServiceHostFor($region, $overrideUrl)
	{
		if (empty($overrideUrl)) {
			return $this->_getRegionPropertyFor($region, $this->_serviceUrls);
		}

		return $overrideUrl;
	}

	/**
	 * Return the correct value for this region from an
	 * associate array keyed by realms
	 *
	 * @param string $region us,uk,de,na
	 * @param array $properties associate array of realms to property values
	 *
	 * @return string property for region
	 */
	private function _getRegionPropertyFor($region, $properties)
	{
		$this->_validateRegionIsDefined($region, $this->_regionMappings);
		return $properties[$this->_regionMappings[$region]];
	}

	/**
	 * Throw an exception if the region does not hold a valid mapping
	 * in an array
	 *
	 * @param string $region defined region - us,na,uk,de
	 * @param array $array array to validate
	 *
	 * @return void
	 */
	private function _validateRegionIsDefined($region, $array)
	{
		if (array_key_exists($region, $array) == FALSE) {
			throw new InvalidArgumentException("No region mapping defined for region " . $region);
		}
	}

	/**
	 * Return the correct region if it requires additional mapping
	 *
	 * @param string $region configured region
	 *
	 * @return string url region param
	 */
	private function _getWidgetRegionFor($region)
	{
		// Since na was a go live region, we maintain special handling so that compatablity is not broken
		if (strcasecmp($region, 'na') == 0) {
			return 'us';
		}

		return strtolower($region);
	}

	/**
	 * Generate the correct widget environment string, based on the environement
	 *
	 * @param string $environment currently configured environment
	 *
	 * @return string postfix for widget url string
	 */
	private function _getWidgetEnvironmentFor($environment, $region)
	{
		/*if(strcasecmp($region, 'us') != 0 && strcasecmp($region, 'na') != 0) {
			return ( $this->_isSandbox($environment) ? '/sandbox/lpa' : '/lpa');
		} else {*/
			return ( $this->_isSandbox($environment) ? '/sandbox' : '');
		//}
	}

	/**
	 * Return the correct section name postfix for the
	 * given environment
	 *
	 * @param string environment name
	 *
	 * @return string section name postfix
	 */
	private function _getSectionNameFor($environment)
	{
		return ( $this->_isSandbox($environment) ? '_Sandbox' : '');
	}

	/**
	 * Check if the environment is sandbox
	 *
	 * @param string environment name
	 *
	 * @return bool true if environment is sandbox
	 */
	private function _isSandbox($environment)
	{
		return strcasecmp($environment,'sandbox') == 0;
	}
}


text:
package problems

import "/quux"

func baz() {}


text:
<!DOCTYPE HTML>
<html>
<head>
    <title>Jasmine Spec Runner</title>

    <!-- CSS -->
    <link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-core/jasmine.css">

    <!-- JASMINE -->
    <script type="text/javascript" src="jasmine/lib/jasmine-core/jasmine.js"></script>
    <script type="text/javascript" src="jasmine/lib/jasmine-core/jasmine-html.js"></script>

    <!-- DOJO (make sure to include the data-undef-api config option)-->
    <script type="text/javascript">
        var dojoConfig = {
            has: {
                'dojo-undef-api': true
            }
        };
    </script>
    <script type="text/javascript" src="dojo/dojo.js"></script>

    <!-- SPECS -->
    <script type="text/javascript" src="spec/SpecHello.js"></script>

    <script type='text/javascript'>
        (function() {
            var jasmineEnv = jasmine.getEnv();
            jasmineEnv.updateInterval = 1000;

            var htmlReporter = new jasmine.HtmlReporter();

            jasmineEnv.addReporter(htmlReporter);

            jasmineEnv.specFilter = function(spec) {
                return htmlReporter.specFilter(spec);
            };

            var currentWindowOnload = window.onload;

            window.onload = function() {
                if (currentWindowOnload) {
                    currentWindowOnload();
                }
                execJasmine();
            };

            function execJasmine() {
                jasmineEnv.execute();
            }

        })();
    </script>
</head>
<body>
</body>
</html>


text:
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace LOCKSSOMatic\CrudBundle\Entity;

/**
 * Description of ContentProviderTest
 *
 * @author mjoyce
 */
class ContentProviderTest extends \PHPUnit_Framework_TestCase{
    protected $provider;

    public function setUp() {
        parent::setUp();
        $this->provider = new ContentProvider();
    }

    public function testGetPermissionHost() {
        $this->provider->setPermissionurl('http://t0.example.com/path/to/permissions');
        $this->assertEquals('t0.example.com', $this->provider->getPermissionHost());
    }

    public function testGetContent() {
        $this->assertCount(0, $this->provider->getContent());
    }
}


text:
libExcelRead is an implementation of the BiffWorkbook library to read Excel files for the Content Management Systems [WebsiteBaker] [1] or [LEPTON CMS] [2].

#### Requirements

* minimum PHP 5.2.x
* using [WebsiteBaker] [1] _or_ using [LEPTON CMS] [2]

#### Installation

* download the actual [libExcelRead] [3] installation archive
* in CMS backend select the file from "Add-ons" -> "Modules" -> "Install module"

#### First Steps

libExcelRead installs the droplet `excel`.

To show the content of an Excel table as HTML table place the droplet at the desired place in a WYSIWYG section. Use the parameter `file` to specify the Excel file to read. The Excel file must be place in /MEDIA directory of your installation:

    [[excel?file=xyz.xls]]

and save the WYSIWYG section, that's all.

The Excel droplet will output a `<div>` container and a formatted HTML table:

          Head 01
          Head 02
          Head 03

          Cell 01
          Cell 02
          Cell 03

          Cell 01
          Cell 02
          Cell 03

Each row and cell gets classes so you can use the CSS file of your template to format the table:

    table.excel {
      width: 99%;
      table-layout: fixed;
      border-collapse: collapse;
    }
    th.excel {
      text-align: left;
      font-size: 11px;
      font-weight: bold;
      color: #fff;
      background-color: navy;
    }
    td.excel {
      text-align: left;
      font-size: 10px;
    }
    td.excel.cell_02 {
      text-align: right;
    }
    tr.excel.flip {
      color: #000;
      background-color: yellow;
    }
    tr.excel.flop {
      color: #000;
      background-color: transparent;
    }

The `excel` droplet has some more parameters:

`class` - specify an other class than the default `excel`.

`header` - by default the droplet uses the first row of the Excel table as headline. If you set `header=false` the first line will be formatted as an normal row.

`sheet` - by default shows all sheets of the Excel table. If you wish to show a single sheet you can select it with this parameter, so `sheet=2` will show the second sheet.

`title` - if you wish to show the sheet title as `<h2>` formatted title above the table use `title=true`

`auto_url` - set to `true` will create regular http links ... from www.xyz.de or http://... text fragments

`target` - `target=blank` will add the attribute target="_blank" to `auto_url` created links.

`columns` - add positive column numbers separated by comma to show only the specified columns, i.e. `columns=3,5` or use negative column numbers to exclude them, i.e. `columns=-2,-4` will not show columns 2 and 4.

    [[excel?file=test/xyz.xls&class=my_excel_table&sheet=2&header=false]]

will show the Excel table `xyz.xls` from the /MEDIA subdirectory `test`, uses the class `my_excel_table` instead of `excel`, select the second sheet and does not display a headline in the table.

Please visit the [phpManufaktur] [4] to get more informations about **libExcelRead** and join the [Addons Support Group] [5].

[1]: http://websitebaker2.org "WebsiteBaker Content Management System"
[2]: http://lepton-cms.org "LEPTON CMS"
[3]: https://addons.phpmanufaktur.de/download.php?file=libExcelRead
[4]: https://addons.phpmanufaktur.de/de/name/libexcelread.php
[5]: https://phpmanufaktur.de/support


text:
cookbook_file "/root/cheftacular.yml" do
  source   'cheftacular.yml'
  owner    'root'
  group    'root'
  mode     '0755'
  cookbook node['TheCheftacularCookbook']['sensu']['cheftacular_yml_cookbook']
end

node['TheCheftacularCookbook']['sensu']['crons'].each_pair do |cron_name, cron_hash|
  command = cron_hash['create_log'] ? "#{ cron_hash['command'] } > /var/log/sensu/run_#{ cron_name }.log 2>&1" : cron_hash['command']

  cron cron_name do
    minute  cron_hash['minute']
    hour    cron_hash['hour']
    user    'root'
    command command
    action  (cron_hash.has_key?('active') && !cron_hash['active'] ? :delete : :create)
  end
end


text:
set -ex

# Enter the gRPC repo root
cd $(dirname $0)/../../..

source tools/internal_ci/helper_scripts/prepare_build_linux_perf_rc

CPUS=`python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())'`

./tools/run_tests/start_port_server.py || true

tools/run_tests/run_microbenchmark.py --collect summary --bigquery_upload || FAILED="true"

# kill port_server.py to prevent the build from freezing
ps aux | grep port_server\\.py | awk '{print $2}' | xargs kill -9

if [ "$FAILED" != "" ]
then
  exit 1
fi


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

namespace Zaphat.Assets
{
	public abstract class Asset
	{
		public Guid ID { get; set; }
		public string Path { get; set; }
	}
}


text:
/* tslint:disable */

import { ReaderFragment } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";
export type Collections_marketingCategories = ReadonlyArray<{
    readonly name: string;
    readonly collections: ReadonlyArray<{
        readonly slug: string;
        readonly headerImage: string | null;
        readonly title: string;
    }>;
    readonly " $refType": "Collections_marketingCategories";
}>;
export type Collections_marketingCategories$data = Collections_marketingCategories;
export type Collections_marketingCategories$key = ReadonlyArray<{
    readonly " $data"?: Collections_marketingCategories$data;
    readonly " $fragmentRefs": FragmentRefs<"Collections_marketingCategories">;
}>;

const node: ReaderFragment = {
  "kind": "Fragment",
  "name": "Collections_marketingCategories",
  "type": "MarketingCollectionCategory",
  "metadata": {
    "plural": true
  },
  "argumentDefinitions": [],
  "selections": [
    {
      "kind": "ScalarField",
      "alias": null,
      "name": "name",
      "args": null,
      "storageKey": null
    },
    {
      "kind": "LinkedField",
      "alias": null,
      "name": "collections",
      "storageKey": null,
      "args": null,
      "concreteType": "MarketingCollection",
      "plural": true,
      "selections": [
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "slug",
          "args": null,
          "storageKey": null
        },
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "headerImage",
          "args": null,
          "storageKey": null
        },
        {
          "kind": "ScalarField",
          "alias": null,
          "name": "title",
          "args": null,
          "storageKey": null
        }
      ]
    }
  ]
};
(node as any).hash = '76554c57a5339cf4a60df12cdee4be57';
export default node;


text:
set BAT_DIR=%~dp0
call %BAT_DIR%..\bin\yborm_env.bat

set BAT_DIR=%~dp0
cmake -G "Borland Makefiles" -D CMAKE_INSTALL_PREFIX:PATH=%BAT_DIR%.. -D DEP_LIBS_ROOT:PATH=%DEP_LIBS_ROOT% -D BOOST_ROOT:PATH=%BOOST_ROOT% -D USE_QT:STRING=%USE_QT% -D YBORM_ROOT:PATH=%BAT_DIR%.. %BAT_DIR%..\src\examples\auth
make && make install


text:
function getAuth() {
  $.ajax({
    url: "/users/sign_in",
    type: "get",
  }).done(function(signin_response) {
    $(".modal-1-inner").append(signin_response);
  }).fail(function(error) {
    console.log(error);
  });

  $.ajax({
    url: "/users/sign_up",
    type: "get"
  }).done(function(signup_response) {
    $(".modal-2-inner").append(signup_response);
  }).fail(function(error) {
    console.log(error);
  });

  $(".sign-in-link").click(function(event) {
    event.preventDefault();
    $(".modal-1-trigger").click();
  });

  $(".sign-up-link").click(function(event) {
    event.preventDefault();
    $(".modal-2-trigger").click();
  });
}


text:
@implementation OBADeepLinkNavigationTarget

+ (instancetype)targetWithTripDeepLink:(OBATripDeepLink*)tripDeepLink {
    OBADeepLinkNavigationTarget *target = [self navigationTarget:OBANavigationTargetTypeRecentStops];
    target.tripDeepLink = tripDeepLink;

    return target;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];

    if (self) {
        _tripDeepLink = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(tripDeepLink))];
    }

    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];

    [aCoder encodeObject:_tripDeepLink forKey:NSStringFromSelector(@selector(tripDeepLink))];
}

- (id)copyWithZone:(NSZone *)zone {
    OBADeepLinkNavigationTarget *target = [super copyWithZone:zone];
    target->_tripDeepLink = [_tripDeepLink copyWithZone:zone];

    return target;
}

@end


text:
TEST(Dispatch, DispatchSema) {
    static size_t total;
    dispatch_semaphore_t dsema;

    test_start("Dispatch Semaphore");

    dsema = dispatch_semaphore_create(1);
    assert(dsema);

    dispatch_apply(LAPS,
                   dispatch_get_global_queue(0, 0),
                   ^(size_t idx __attribute__((unused))) {
                       dispatch_semaphore_wait(dsema, DISPATCH_TIME_FOREVER);
                       total++;
                       dispatch_semaphore_signal(dsema);
                   });

    dispatch_release(dsema);

    test_long("count", total, LAPS);
    test_stop();

    UIApplicationMainLoop();
}


text:
#define pr_fmt(fmt) "cros_ec_lightbar: " fmt

#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/kobject.h>
#include <linux/mfd/cros_ec.h>
#include <linux/mfd/cros_ec_commands.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/slab.h>

#include "cros_ec_dev.h"

/* Rate-limit the lightbar interface to prevent DoS. */
static unsigned long lb_interval_jiffies = 50 * HZ / 1000;

static ssize_t interval_msec_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{
	unsigned long msec = lb_interval_jiffies * 1000 / HZ;

	return scnprintf(buf, PAGE_SIZE, "%lu\n", msec);
}

static ssize_t interval_msec_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{
	unsigned long msec;

	if (kstrtoul(buf, 0, &msec))
		return -EINVAL;

	lb_interval_jiffies = msec * HZ / 1000;

	return count;
}

static DEFINE_MUTEX(lb_mutex);
/* Return 0 if able to throttle correctly, error otherwise */
static int lb_throttle(void)
{
	static unsigned long last_access;
	unsigned long now, next_timeslot;
	long delay;
	int ret = 0;

	mutex_lock(&lb_mutex);

	now = jiffies;
	next_timeslot = last_access + lb_interval_jiffies;

	if (time_before(now, next_timeslot)) {
		delay = (long)(next_timeslot) - (long)now;
		set_current_state(TASK_INTERRUPTIBLE);
		if (schedule_timeout(delay) > 0) {
			/* interrupted - just abort */
			ret = -EINTR;
			goto out;
		}
		now = jiffies;
	}

	last_access = now;
out:
	mutex_unlock(&lb_mutex);

	return ret;
}

static struct cros_ec_command *alloc_lightbar_cmd_msg(struct cros_ec_dev *ec)
{
	struct cros_ec_command *msg;
	int len;

	len = max(sizeof(struct ec_params_lightbar),
		  sizeof(struct ec_response_lightbar));

	msg = kmalloc(sizeof(*msg) + len, GFP_KERNEL);
	if (!msg)
		return NULL;

	msg->version = 0;
	msg->command = EC_CMD_LIGHTBAR_CMD + ec->cmd_offset;
	msg->outsize = sizeof(struct ec_params_lightbar);
	msg->insize = sizeof(struct ec_response_lightbar);

	return msg;
}

static int get_lightbar_version(struct cros_ec_dev *ec,
				uint32_t *ver_ptr, uint32_t *flg_ptr)
{
	struct ec_params_lightbar *param;
	struct ec_response_lightbar *resp;
	struct cros_ec_command *msg;
	int ret;

	msg = alloc_lightbar_cmd_msg(ec);
	if (!msg)
		return 0;

	param = (struct ec_params_lightbar *)msg->data;
	param->cmd = LIGHTBAR_CMD_VERSION;
	ret = cros_ec_cmd_xfer(ec->ec_dev, msg);
	if (ret < 0) {
		ret = 0;
		goto exit;
	}

	switch (msg->result) {
	case EC_RES_INVALID_PARAM:
		/* Pixel had no version command. */
		if (ver_ptr)
			*ver_ptr = 0;
		if (flg_ptr)
			*flg_ptr = 0;
		ret = 1;
		goto exit;

	case EC_RES_SUCCESS:
		resp = (struct ec_response_lightbar *)msg->data;

		/* Future devices w/lightbars should implement this command */
		if (ver_ptr)
			*ver_ptr = resp->version.num;
		if (flg_ptr)
			*flg_ptr = resp->version.flags;
		ret = 1;
		goto exit;
	}

	/* Anything else (ie, EC_RES_INVALID_COMMAND) - no lightbar */
	ret = 0;
exit:
	kfree(msg);
	return ret;
}

static ssize_t version_show(struct device *dev,
			    struct device_attribute *attr, char *buf)
{
	uint32_t version = 0, flags = 0;
	struct cros_ec_dev *ec = container_of(dev,
					      struct cros_ec_dev, class_dev);
	int ret;

	ret = lb_throttle();
	if (ret)
		return ret;

	/* This should always succeed, because we check during init. */
	if (!get_lightbar_version(ec, &version, &flags))
		return -EIO;

	return scnprintf(buf, PAGE_SIZE, "%d %d\n", version, flags);
}

static ssize_t brightness_store(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{
	struct ec_params_lightbar *param;
	struct cros_ec_command *msg;
	int ret;
	unsigned int val;
	struct cros_ec_dev *ec = container_of(dev,
					      struct cros_ec_dev, class_dev);

	if (kstrtouint(buf, 0, &val))
		return -EINVAL;

	msg = alloc_lightbar_cmd_msg(ec);
	if (!msg)
		return -ENOMEM;

	param = (struct ec_params_lightbar *)msg->data;
	param->cmd = LIGHTBAR_CMD_SET_BRIGHTNESS;
	param->set_brightness.num = val;
	ret = lb_throttle();
	if (ret)
		goto exit;

	ret = cros_ec_cmd_xfer(ec->ec_dev, msg);
	if (ret < 0)
		goto exit;

	if (msg->result != EC_RES_SUCCESS) {
		ret = -EINVAL;
		goto exit;
	}

	ret = count;
exit:
	kfree(msg);
	return ret;
}

/*
 * We expect numbers, and we'll keep reading until we find them, skipping over
 * any whitespace (sysfs guarantees that the input is null-terminated). Every
 * four numbers are sent to the lightbar as <LED,R,G,B>. We fail at the first
 * parsing error, if we don't parse any numbers, or if we have numbers left
 * over.
 */
static ssize_t led_rgb_store(struct device *dev, struct device_attribute *attr,
			     const char *buf, size_t count)
{
	struct ec_params_lightbar *param;
	struct cros_ec_command *msg;
	struct cros_ec_dev *ec = container_of(dev,
					      struct cros_ec_dev, class_dev);
	unsigned int val[4];
	int ret, i = 0, j = 0, ok = 0;

	msg = alloc_lightbar_cmd_msg(ec);
	if (!msg)
		return -ENOMEM;

	do {
		/* Skip any whitespace */
		while (*buf && isspace(*buf))
			buf++;

		if (!*buf)
			break;

		ret = sscanf(buf, "%i", &val[i++]);
		if (ret == 0)
			goto exit;

		if (i == 4) {
			param = (struct ec_params_lightbar *)msg->data;
			param->cmd = LIGHTBAR_CMD_SET_RGB;
			param->set_rgb.led = val[0];
			param->set_rgb.red = val[1];
			param->set_rgb.green = val[2];
			param->set_rgb.blue = val[3];
			/*
			 * Throttle only the first of every four transactions,
			 * so that the user can update all four LEDs at once.
			 */
			if ((j++ % 4) == 0) {
				ret = lb_throttle();
				if (ret)
					goto exit;
			}

			ret = cros_ec_cmd_xfer(ec->ec_dev, msg);
			if (ret < 0)
				goto exit;

			if (msg->result != EC_RES_SUCCESS)
				goto exit;

			i = 0;
			ok = 1;
		}

		/* Skip over the number we just read */
		while (*buf && !isspace(*buf))
			buf++;

	} while (*buf);

exit:
	kfree(msg);
	return (ok && i == 0) ? count : -EINVAL;
}

static char const *seqname[] = {
	"ERROR", "S5", "S3", "S0", "S5S3", "S3S0",
	"S0S3", "S3S5", "STOP", "RUN", "PULSE", "TEST", "KONAMI",
};

static ssize_t sequence_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{
	struct ec_params_lightbar *param;
	struct ec_response_lightbar *resp;
	struct cros_ec_command *msg;
	int ret;
	struct cros_ec_dev *ec = container_of(dev,
					      struct cros_ec_dev, class_dev);

	msg = alloc_lightbar_cmd_msg(ec);
	if (!msg)
		return -ENOMEM;

	param = (struct ec_params_lightbar *)msg->data;
	param->cmd = LIGHTBAR_CMD_GET_SEQ;
	ret = lb_throttle();
	if (ret)
		goto exit;

	ret = cros_ec_cmd_xfer(ec->ec_dev, msg);
	if (ret < 0)
		goto exit;

	if (msg->result != EC_RES_SUCCESS) {
		ret = scnprintf(buf, PAGE_SIZE,
				"ERROR: EC returned %d\n", msg->result);
		goto exit;
	}

	resp = (struct ec_response_lightbar *)msg->data;
	if (resp->get_seq.num >= ARRAY_SIZE(seqname))
		ret = scnprintf(buf, PAGE_SIZE, "%d\n", resp->get_seq.num);
	else
		ret = scnprintf(buf, PAGE_SIZE, "%s\n",
				seqname[resp->get_seq.num]);

exit:
	kfree(msg);
	return ret;
}

static ssize_t sequence_store(struct device *dev, struct device_attribute *attr,
			      const char *buf, size_t count)
{
	struct ec_params_lightbar *param;
	struct cros_ec_command *msg;
	unsigned int num;
	int ret, len;
	struct cros_ec_dev *ec = container_of(dev,
					      struct cros_ec_dev, class_dev);

	for (len = 0; len < count; len++)
		if (!isalnum(buf[len]))
			break;

	for (num = 0; num < ARRAY_SIZE(seqname); num++)
		if (!strncasecmp(seqname[num], buf, len))
			break;

	if (num >= ARRAY_SIZE(seqname)) {
		ret = kstrtouint(buf, 0, &num);
		if (ret)
			return ret;
	}

	msg = alloc_lightbar_cmd_msg(ec);
	if (!msg)
		return -ENOMEM;

	param = (struct ec_params_lightbar *)msg->data;
	param->cmd = LIGHTBAR_CMD_SEQ;
	param->seq.num = num;
	ret = lb_throttle();
	if (ret)
		goto exit;

	ret = cros_ec_cmd_xfer(ec->ec_dev, msg);
	if (ret < 0)
		goto exit;

	if (msg->result != EC_RES_SUCCESS) {
		ret = -EINVAL;
		goto exit;
	}

	ret = count;
exit:
	kfree(msg);
	return ret;
}

/* Module initialization */

static DEVICE_ATTR_RW(interval_msec);
static DEVICE_ATTR_RO(version);
static DEVICE_ATTR_WO(brightness);
static DEVICE_ATTR_WO(led_rgb);
static DEVICE_ATTR_RW(sequence);
static struct attribute *__lb_cmds_attrs[] = {
	&dev_attr_interval_msec.attr,
	&dev_attr_version.attr,
	&dev_attr_brightness.attr,
	&dev_attr_led_rgb.attr,
	&dev_attr_sequence.attr,
	NULL,
};

static umode_t cros_ec_lightbar_attrs_are_visible(struct kobject *kobj,
						  struct attribute *a, int n)
{
	struct device *dev = container_of(kobj, struct device, kobj);
	struct cros_ec_dev *ec = container_of(dev,
					      struct cros_ec_dev, class_dev);
	struct platform_device *pdev = to_platform_device(ec->dev);
	struct cros_ec_platform *pdata = pdev->dev.platform_data;
	int is_cros_ec;

	is_cros_ec = strcmp(pdata->ec_name, CROS_EC_DEV_NAME);

	if (is_cros_ec != 0)
		return 0;

	/* Only instantiate this stuff if the EC has a lightbar */
	if (get_lightbar_version(ec, NULL, NULL))
		return a->mode;
	else
		return 0;
}

struct attribute_group cros_ec_lightbar_attr_group = {
	.name = "lightbar",
	.attrs = __lb_cmds_attrs,
	.is_visible = cros_ec_lightbar_attrs_are_visible,
};


text:
require_relative 'check_mobi/configuration'
require_relative 'check_mobi/core_ext/string'
require_relative 'check_mobi/core_ext/hash'

$:.unshift File.expand_path(File.dirname(__FILE__))

module CheckMobi

  autoload :Client, 'check_mobi/client'
  autoload :Response, 'check_mobi/response'

  module Resources
    autoload :CountryList, 'check_mobi/resources/country_list'
    autoload :CheckNumber, 'check_mobi/resources/check_number'
    autoload :Prefixes, 'check_mobi/resources/prefixes'
    autoload :MyAccount, 'check_mobi/resources/my_account'

    module SMS
      autoload :Send, 'check_mobi/resources/sms/send'
      autoload :Details, 'check_mobi/resources/sms/details'
    end

    module PhoneValidation
      autoload :RequestValidation, 'check_mobi/resources/phone_validation/request_validation'
      autoload :ValidationStatus, 'check_mobi/resources/phone_validation/validation_status'
      autoload :VerifyPin, 'check_mobi/resources/phone_validation/verify_pin'
    end

    module Voice
      autoload :Call, 'check_mobi/resources/voice/call'
      autoload :CallDetails, 'check_mobi/resources/voice/call_details'
      autoload :HangupCall, 'check_mobi/resources/voice/hangup_call'

      module Actions
        autoload :Hangup, 'check_mobi/resources/voice/actions/hangup'
        autoload :Play, 'check_mobi/resources/voice/actions/play'
        autoload :SendDTMF, 'check_mobi/resources/voice/actions/send_dtmf'
        autoload :Speak, 'check_mobi/resources/voice/actions/speak'
        autoload :Wait, 'check_mobi/resources/voice/actions/wait'
      end
    end
  end

  extend Configuration
end


text:
// This header declares classes for the infeed manager and the infeed
// buffer that are used by the GPU runtime to transfer buffers into an
// executing GPU computation, e.g., to feed data into a while loop.

#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_INFEED_MANAGER_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_INFEED_MANAGER_H_

#include "tensorflow/compiler/xla/service/gpu/xfeed_queue.h"
#include "tensorflow/compiler/xla/shape_tree.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/core/platform/stream_executor_no_cuda.h"

namespace xla {
namespace gpu {

// TODO(b/30467474) Once GPU infeed implementation settles, consider
// folding back the cpu and gpu infeed implementations into a generic
// one if possible.
//
// Current limitations:
// * Does not handle multiple devices/replicas.
//
// * Buffer space on GPU is allocated on every infeed enqueue request,
// and it does not handle the case when it runs out of
// memory. Potential solution is to pre-allocate a fixed amount of
// memory and block when that memory is full.

// Defines an infeed buffer that is passed to the runtime by
// the client. The client manages the memory of the buffer.
class InfeedBuffer {
 public:
  InfeedBuffer() = default;
  InfeedBuffer(se::StreamExecutor* executor, int64 length)
      : device_memory_(executor, executor->AllocateArray<uint8>(length)),
        length_(length) {
    CHECK(!device_memory_->is_null());
  }

  int64 length() const { return length_; }

  se::DeviceMemoryBase* device_memory() { return device_memory_.ptr(); }

 private:
  se::ScopedDeviceMemory<uint8> device_memory_;
  int64 length_;
};

// Client-side class used to enqueue infeed buffers.
class InfeedManager : public XfeedQueue<ShapeTree<InfeedBuffer>> {
 public:
  // Returns a cached stream associated with an executor. Allocates a
  // new stream on the first invocation. On subsequent invocations, if
  // the cached executor is not the same as the requested executor,
  // returns null.
  se::Stream* GetStream(se::StreamExecutor* executor);

 private:
  // Mutex for serializing the creation of host_to_device_stream_.
  tensorflow::mutex host_to_device_stream_mu_;

  // Cached host to device stream for queuing infeed data.
  std::unique_ptr<se::Stream> host_to_device_stream_
      GUARDED_BY(host_to_device_stream_mu_);

  // Executor that the host_to_device_stream belongs to. Not owned.
  se::StreamExecutor* host_to_device_executor_ = nullptr;
};

// Singleton creator-or-accessor: Returns the GPU infeed manager.
InfeedManager* GetOrCreateInfeedManager();

}  // namespace gpu
}  // namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_SERVICE_GPU_INFEED_MANAGER_H_


text:
<?php
/**
 * Created by PhpStorm.
 * User: dp
 * Date: 05.09.16
 * Time: 13:22
 */

namespace Ice\Widget;

class Demo_Vendor_Facebook_Login extends Block
{
    protected static function config()
    {
        $config = parent::config();

        $config['render']['template'] = __CLASS__;
        $config['output']['appId'] = '121933101594886';

        return $config;
    }

    protected function build(array $input)
    {
        return parent::build($input);
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Pl. Jam. Pugill. 7; Syst. Ed. 10. 2:873. 1759

#### Original name
null

### Remarks
null


text:
(function(angular) {
  'use strict';

  angular.module('socket', ['btford.socket-io'])

    .factory('socket', function(socketFactory) {
      var socket = socketFactory();

      socket.on('connected', function(data) {
        console.log(data.message);
      });
      return socket;
    })

})(window.angular);


text:
/**
 * DEMO ENTITY
 * 	- Create interaction design
 */

 (function () {
	 'use strict';

	var Other = new iDoo.Entity('other');

	 /*
	// Events
	Other.event('event', function() {
		console.log('action:: Other.event');
	});
  	*/
	// Actions
	Other.action('index', function () {
		console.log('action:: Other.index');
	});

	Other.action('other', function () {
		console.log('action:: Other.other');
	});
	 Other.registerToComponent('HomeComp');
 } ());


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Class com.sun.squawk.debugger.CommandPacket (2013 FRC Java API)
</TITLE>

<META NAME="date" CONTENT="2014-01-01">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

"
2013 FRC Java API
"

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
com.sun.squawk.debugger.CommandPacket

Packages that use CommandPacket

com.sun.squawk.debugger

com.sun.squawk.debugger.sda
The classes that implement the Squawk VM side of the SDWP.

Uses of CommandPacket in com.sun.squawk.debugger

Fields in com.sun.squawk.debugger declared as CommandPacket

protected  CommandPacket
JDWPListener.CommandSet.command

          The command currently being processed.

Methods in com.sun.squawk.debugger with parameters of type CommandPacket

 PacketInputStream
JDWPListener.getInputStreamFor(CommandPacket command)

          Get the input stream from a command packet (sniffer needs to wrap input stream.

 boolean
JDWPListener.CommandSet.handle(JDWPListener listener,
       CommandPacket command)

          Handles a command packet by setting up the variables used to interpret and reply
 to the command and then dispatching to the specific command handler.

protected abstract  void
JDWPListener.processCommand(CommandPacket command)

          Processes a single command received over this listeners connection.

 ReplyPacket
JDWPListener.sendCommand(CommandPacket command)

          Sends a command packet over this connection.

Constructors in com.sun.squawk.debugger with parameters of type CommandPacket

ReplyPacket(CommandPacket command,
            int errorCode)

          Creates a packet to send a reply to a command packet.

Uses of CommandPacket in com.sun.squawk.debugger.sda

Methods in com.sun.squawk.debugger.sda with parameters of type CommandPacket

 void
SDPListener.processCommand(CommandPacket command)

          Processes a single command received over this listeners connection.

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

"
2013 FRC Java API
"

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

"For updated information see the Java FRC site"


text:
package pl.touk.nussknacker.engine

import java.util.Collections
import com.typesafe.config.ConfigFactory
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
import pl.touk.nussknacker.engine.api.process.EmptyProcessConfigCreator
import pl.touk.nussknacker.engine.modelconfig.{DefaultModelConfigLoader, InputConfigDuringExecution}
import pl.touk.nussknacker.engine.testing.LocalModelData

class DefaultModelConfigLoaderTest extends AnyFunSuite with Matchers {

  private val inputConfig = ConfigFactory.parseMap(Collections.singletonMap("property1", "value1"))

  test("should handle absence of model.conf") {
    val loader = new DefaultModelConfigLoader {
      override def modelConfigResource: String = "notExist.conf"
    }

    val config = loader.resolveConfig(InputConfigDuringExecution(inputConfig), getClass.getClassLoader)

    config.getString("property1") shouldBe "value1"
    config.getString("property2") shouldBe "shouldBeOverriden"
    config.getString("testProperty") shouldBe "testValue"
    config.hasPath("otherProperty") shouldBe false
  }

  test("should load model.conf and override with given") {
    val config = LocalModelData(inputConfig, new EmptyProcessConfigCreator).processConfig

    config.getString("property1") shouldBe "value1"
    config.getString("property2") shouldBe "value1Suffix"
    config.getString("testProperty") shouldBe "testValue"
    config.getBoolean("otherProperty") shouldBe true
  }

  test("should load only input config during execution") {
    val config = LocalModelData(inputConfig, new EmptyProcessConfigCreator).inputConfigDuringExecution.config

    config.getString("property1") shouldBe "value1"
    config.hasPath("property2") shouldBe false
    config.hasPath("testProperty") shouldBe false
    config.hasPath("otherProperty") shouldBe false
  }

  test("should not load application.conf") {
    val config = LocalModelData(inputConfig, new EmptyProcessConfigCreator).processConfig

    config.hasPath("shouldNotLoad") shouldBe false

  }
}


text:
package com.thoughtworks.inproctester.jetty.tests;

import com.thoughtworks.inproctester.core.InProcRequest;
import com.thoughtworks.inproctester.core.InProcResponseWrapper;
import com.thoughtworks.inproctester.jetty.HttpAppTester;
import com.thoughtworks.inproctester.jetty.testapp.TestServlet;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class InProcessJettyTest {
    private static HttpAppTester httpAppTester;

    @BeforeClass
    public static void setUp() {
        httpAppTester = new HttpAppTester("/");
        httpAppTester.addServlet(TestServlet.class, "/*");
        httpAppTester.start();
    }

    @AfterClass
    public static void tearDown() {
        httpAppTester.stop();
    }

    @Test
    public void shouldAcceptBodyForPostRequest() throws Exception {
        HashMap<String, String> headers = new HashMap<>();
        headers.put("Host", "localhost");
        headers.put("Content-Type", "text/plain");

        URI uri = new URI("http://localhost/");
        InProcRequest request = new TestRequest("POST", uri, "POST body", headers);

        InProcResponseWrapper response = new InProcResponseWrapper(httpAppTester.getResponses(request));

        assertThat(response.getContent(), is("POST body"));
    }

    @Test
    public void shouldAcceptBodyForPutRequest() throws Exception {
        HashMap<String, String> headers = new HashMap<>();
        headers.put("Host", "localhost");
        headers.put("Content-Type", "text/plain");

        URI uri = new URI("http://localhost/");
        InProcRequest request = new TestRequest("PUT", uri, "PUT body", headers);

        InProcResponseWrapper response = new InProcResponseWrapper(httpAppTester.getResponses(request));

        assertThat(response.getContent(), is("PUT body"));
    }

    private static class TestRequest implements InProcRequest {
        private final String httpMethod;
        private final URI uri;
        private final String content;
        private final Map<String, String> headers;

        public TestRequest(
                String httpMethod,
                URI uri,
                String content,
                Map<String, String> headers) {
            this.httpMethod = httpMethod;
            this.uri = uri;
            this.content = content;
            this.headers = headers;
        }

        @Override public String getHttpMethod() {
            return httpMethod;
        }

        @Override public URI getUri() {
            return uri;
        }

        @Override public String getContent() {
            return content;
        }

        @Override public Set<String> getHeaderNames() {
            return headers.keySet();
        }

        @Override public String getHeader(String headerName) {
            return headers.get(headerName);
        }

        @Override public void addHeader(String headerName, String header) {
            headers.put(headerName, header);
        }
    }
}


text: Modify the ofRectangle so that both the ofPoints given are enclosed within the rectangle.


text: Rails.application.config.session_store :cookie_store, key: '_dummy_rails5_session'


text:
module.exports = {
  File: require('./lib/File'),
  replaceExtension: require('./lib/replaceExtension'),
  colors: require('./lib/colors'),
  log: require('./lib/log'),
  template: require('./lib/template'),
  env: require('./lib/env'),
  beep: require('./lib/beep'),
  isStream: require('./lib/isStream'),
  isBuffer: require('./lib/isBuffer')
};


text:
<?php
// Copyright (c) 2012 The President and Fellows of Harvard College
// Use of this source code is governed by the LICENSE file found in the root of this project.
?>
<?php

/**
 * This is the url to your js test directory.
 */
Configure::write('Jstest.testUrl', '/js/test');

/**
 * This is the full path to the js test directory.
 */
Configure::write('Jstest.testDir', WWW_ROOT . DS . 'js/test');


text:
[![Build Status](https://travis-ci.org/sabottenda/fluent-plugin-stdout-pp.svg)](https://travis-ci.org/sabottenda/fluent-plugin-stdout-pp)

A fluentd plugin to pretty print json with color to stdout

## Requirements

| fluent-plugin-stdout-pp | fluentd    | ruby   |
|-------------------------|------------|--------|
| >= 0.2.0                | >= v0.14.0 | >= 2.1 |
| < 0.2.0                 | >= v0.12.0 | >= 1.9 |

## Installation

Add this line to your application's Gemfile:

    gem 'fluent-plugin-stdout-pp'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install fluent-plugin-stdout-pp

## Configuration

```
<match **>
  @type stdout_pp
  time_color blue
  tag_color yellow
</match>
```

## Parameters

|parameter|description|default|
|---|---|---|
|pp| prety print json or not | true |
|time_color| color name to print time | blue |
|tag_color| color name to print tag | yellow |
|record_colored| print json with color or not | true |

Available colors:
- normal
- red
- green
- yellow
- magenta
- white

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Copyright

    Author	Masahiro Sano <sabottenda@gmail.com>

    Copyright	Copyright (c) 2013- Masahiro Sano

    License	MIT License


text:
package ch.ice.exceptions;

public class MissingCustomerRowsException extends Exception{

	private static final long serialVersionUID = -6640585459525231605L;

	public MissingCustomerRowsException() {}

	public MissingCustomerRowsException(String message){
		super(message);
	}
}


text:
With the country finder you can find every country in the world, where it is located and some basic knowledge is provided. You can filter by continent or just scroll down the list of all countries the choice is yours.

## Why does this application have a purpose?
You can find the countries really fast and see where they're located and on the same page you can learn some basic knowledge about the selected country all in one.

## How does it works
When you landed on the page you can filter (on continent), select or just click on a country to see more information about it. The user sees basic knowledge and a world map with the selected country pinned in the middle.

## Usage
Download the assets folder and place this in the project of your choice. Then import the modules in the your HTML file like this:

```html
<!-- HTML -->
    <script src="assets/js/routie.min.js"></script>
    <script src="assets/js/transparency.min.js"></script>
    <script src="assets/js/aja.min.js"></script>
    <script src="https://maps.googleapis.com/maps/api/js?key=YOURAPICODE"></script>
    <script src="assets/js/maps.config.js"></script>
    <script src="assets/js/modules/requests.js"></script>
    <script src="assets/js/modules/routers.js"></script>
    <script src="assets/js/modules/sections.js"></script>
    <script src="assets/js/modules/filters.js"></script>
    <script src="assets/js/modules/app.js"></script>
</body>
```
Note: For Google Maps you need to place an API key instead of "YOURAPICODE".

### You need some selectors to get it to work use this as example:

#### To load the response of the API Call
- id="loader" to place the loading indicator.
- id="response" where the country data will be rendered.

```html
<div id="loader"><span>Loading...</span></div>
    <div id="response">
        <!-- HTML -->
    </div>
</main>
</section>
<div id="map"></div>
```

#### If the response failed use this
- id="failed" when the API gives no data.
- class="hide" hide by default (need to style in CSS).

```html
<section id="failed" class="hide">
    <h2>Failed to load the content, please try to load the page again.</h2>
</section>
```

#### Countries overview selector
- id="countries" to indicate the container where the countries will be rendered.

```html
<section id="countries">
    <!-- HTML -->
</section>
```

#### Overview filter
- id="showFilters" to show the continent filters.
- id="allClickButtons" where continents will be rendered.
- class="regionRadio" where every single continent will be rendered.

```html
<label class="filterLabel" for="showFilters">Show/hide filters</label>
<input type="checkbox" class="showFilters" value="showFilters" id="showFilters" />
<ul id="allClickButtons">
    <li>
        <input type="radio" class="regionRadio" name="regionGroup" value="all" id="all" checked />
        <label class="region" for="all">All</label>
    </li>
    <div id="filterButtons">
        <li>
            <input type="radio" class="regionRadio" name="regionGroup" />
            <label class="region"></label>
        </li>
    </div>
</ul>
```

#### Countries dropdown select option
- id="countriesSearch" the container of the dropdown for all the country names.
- class="country" where every single country will be rendered.

```html
<select id="countriesSearch">
    <option class="country" value=""></option>
</select>
```

#### List all countries on the page
- id="countriesOverview" the container for the list of countries.
- class="country" where every single country will be rendered.

```html
<div id="countriesOverview">
    <a class="country"></a>
</div>
```

#### Country singulair selector
- id="country" to indicate the container where the singulair country will be rendered.

```html
<section id="country">
    <!-- HTML -->
</section>
```

#### Country singulair information
- id="name" rendered the country name.
- id="listInfoCountry" indicate the detail information container for the selected country.
- class="alpha3Code" where the alpha3Code will be rendered.
- class="population" where the population will be rendered.
- class="area" where the surface will be rendered.
- class="capital" where the capital city will be rendered.
- class="region" where the continent will be rendered.
- class="demonym" where the main language will be rendered.

```html
<h1 id="name"></h1>
<div id="listInfoCountry">
    <ul>
        <li><label>Alpha3Code: </label><span class="alpha3Code"></span></li>
        <li><label>Population: </label><span class="population"></span></li>
        <li><label>Surface: </label><span class="area"></span> km²</li>
        <li><label>Capital city: </label><span class="capital"></span></li>
        <li><label>Continent: </label><span class="region"></span></li>
        <li><label>Main language: </label><span class="demonym"></span></li>
    </ul>
</div>
```

#### Country singulair summery
- id="summery" indicate the summery container for the selected country.
- class="inner" where the summery will be rendered.

```html
<article id="summery">
    <h2>Summary:</h2>
    <div class="inner">
    </div>
</article>
```

## Flow diagram
![alt text](https://github.com/TimoVerkroost/minor-web-app-from-scratch/blob/master/srv/w3-assignment-1-ajax/assets/images/flow-diagram-webapp.png "Flow diagram")

## Interaction diagram
![alt text](https://github.com/TimoVerkroost/minor-web-app-from-scratch/blob/master/srv/w3-assignment-1-ajax/assets/images/interaction-diagram-webapp.png "Interaction diagram")

## Resources
The application is mostly build with native JavaScript only 2 micro libraries are added. beside the JavaScript, the application gets it's information from an external API.
- [Aja.js](http://krampstudio.com/aja.js/) - Ajax without XML Asynchronous JavaScript And JSON.
- [TransparencyJS](https://github.com/leonidas/transparency) - A semantic template engine for the browser. It maps JSON objects to DOM elements by id, class and data-bind attributes.
- [REST Countries API](https://restcountries.eu/) - Get information about countries via a RESTful API.
- [Google Maps API](https://developers.google.com/maps/documentation/javascript/adding-a-google-map) - Embed Google Maps features and functionality in your sites.

## Wishlist
- Dropdown searchbar so the user doesn't have to scroll down the whole dropdown.
- Country flags.
- More detailed information about the countries.
- Load all modules in one JS file and not the HTML file.
- Make selectors in JS flexible for the user, most of them are hardcoded.

## Live demo
- https://timoverkroost.github.io/minor-web-app-from-scratch/srv/w3-assignment-1-ajax/


text:
window.filterModal = (function($) {
    var isInit = false,
        wnd;

    function init() {
        if (isInit === true) return;

        isInit = true;

        wnd = $('#filterWnd');
    }

    function blockUi(width, message) {
        window.StudioBlockUIManager.blockUI(message, width, { bindEvents: false });

        $('#manageWindow .cancelButton').css('cursor', 'pointer');
        $('.containerBodyBlock .buttons .cancel').off('click').on('click', function () {
            $.unblockUI();
            return false;
        });
    }

    function show(filter, type) {
        wnd.find('.buttons .button').hide();
        wnd.find('.mail-confirmationAction').hide();
        wnd.find('.buttons .cancel').show();

        var headerText;

        switch (type) {
        case 'apply':
            wnd.find('.save').show();

            var actionsContainer = wnd.find('.mail-confirmationAction p.actions');

            actionsContainer.empty();

            var i, n = filter.actions.length;
            for (i = 0; i < n; i++) {
                var a = filter.actions[i],
                    actionEl = $('');

                var actionText = "— " + filtersPage.translateAction(a.action);
                if (a.data && a.data !== '') {
                    actionText += " \"{0}\"".format(TMMail
                        .htmlEncode(filtersPage.translateActionData(a.action, a.data)));
                }
                actionEl.html(actionText);

                actionsContainer.append(actionEl).append("
");
            }

            headerText = wnd.attr('apply_header');
            break;
        case 'delete':
            wnd.find('.del').show();
            headerText = wnd.attr('delete_header');
            break;
        case 'confirm':
            wnd.find('.confirm').show();
            wnd.find('.change').show();
            headerText = wnd.attr('confirm_header');
            break;
        default:
            console.error("Modal window type is not accepted");
            return;
        }

        wnd.find('div.containerHeaderBlock:first td:first').html(headerText);

        blockUi(523, wnd);

        window.PopupKeyUpActionProvider.EnterAction = "jq('#filterWnd .containerBodyBlock .buttons .button.blue:visible').trigger('click');";

        wnd.find('.buttons .cancel')
            .off('click')
            .on('click',
                function () {
                    hide();
                    return false;
                });
    }

    function showApply(filter, options) {
        if (!filter) return;

        init();

        show(filter, 'apply');

        wnd.find('.buttons .save')
            .off('click')
            .on('click',
                function () {
                    hide();
                    options.onSuccess(filter);
                });
    }

    function showDelete(filter, options) {
        if (!filter || !filter.id) return;

        init();

        show(filter, 'delete');

        wnd.find('.buttons .del')
            .off('click')
            .on('click',
                function () {
                    hide();
                    options.onSuccess(filter);
                });
    }

    function showDeleteActionConfirm(filter, options) {
        init();

        show(filter, 'confirm');

        wnd.find('.buttons .confirm')
            .off('click')
            .on('click',
                function () {
                    hide();
                    options.onConfirm(filter);
                });

        wnd.find('.buttons .change')
            .off('click')
            .on('click',
                function() {
                    hide();
                    options.onChange(filter);
                });
    }

    function hide() {
        window.PopupKeyUpActionProvider.ClearActions();
        $.unblockUI();
    }

    return {
        init: init,
        showApply: showApply,
        showDelete: showDelete,
        showDeleteActionConfirm: showDeleteActionConfirm,
        hide: hide
    };
})(jQuery);


text:
import $ from "jquery";
import tippy, {delegate} from "tippy.js";

import * as message_lists from "./message_lists";
import * as reactions from "./reactions";
import * as rows from "./rows";
import * as timerender from "./timerender";

// We override the defaults set by tippy library here,
// so make sure to check this too after checking tippyjs
// documentation for default properties.
tippy.setDefaultProps({
    // We don't want tooltips
    // to take more space than
    // mobile widths ever.
    maxWidth: 300,

    // Some delay to showing / hiding the tooltip makes
    // it look less forced and more natural.
    delay: [100, 20],
    placement: "top",

    // disable animations to make the
    // tooltips feel snappy
    animation: false,

    // Show tooltips on long press on touch based
    // devices.
    touch: ["hold", 750],

    // This has the side effect of some properties of parent applying to
    // tooltips.
    appendTo: "parent",

    // html content is not supported by default
    // enable it by passing data-tippy-allowHtml="true"
    // in the tag or a parameter.
});

export function initialize() {
    // Our default tooltip configuration. For this, one simply needs to:
    // * Set `class="tippy-zulip-tooltip"` on an element for enable this.
    // * Set `data-tippy-content="{{t 'Tooltip content' }}"`, often
    //   replacing a `title` attribute on an element that had both.
    // * Set placement; we typically use `data-tippy-placement="top"`.
    delegate("body", {
        target: ".tippy-zulip-tooltip",
    });

    // The below definitions are for specific tooltips that require
    // custom JavaScript code or configuration.  Note that since the
    // below specify the target directly, elements using those should
    // not have the tippy-zulip-tooltip class.

    // message reaction tooltip showing who reacted.
    let observer;
    delegate("body", {
        target: ".message_reaction, .message_reactions .reaction_button",
        placement: "bottom",
        onShow(instance) {
            const elem = $(instance.reference);
            if (!instance.reference.classList.contains("reaction_button")) {
                const local_id = elem.attr("data-reaction-id");
                const message_id = rows.get_message_id(instance.reference);
                const title = reactions.get_reaction_title_data(message_id, local_id);
                instance.setContent(title);
            }

            // Use MutationObserver to check for removal of nodes on which tooltips
            // are still active.
            // We target the message table and check for removal of it, it's children
            // and the reactions individually down in the subtree.
            const target_node = elem.parents(".message_table.focused_table").get(0);
            if (!target_node) {
                // The `reaction` was removed from DOM before we reached here.
                // In that case, we simply hide the tooltip.
                // We have to be smart about hiding the instance, so we hide it as soon
                // as it is displayed.
                setTimeout(instance.hide, 0);
                return;
            }

            const nodes_to_check_for_removal = [
                elem.parents(".recipient_row").get(0),
                elem.parents(".message_reactions").get(0),
                elem.get(0),
            ];
            const config = {attributes: false, childList: true, subtree: true};

            const callback = function (mutationsList) {
                for (const mutation of mutationsList) {
                    for (const node of nodes_to_check_for_removal) {
                        // Hide instance if reference is in the removed node list.
                        if (Array.prototype.includes.call(mutation.removedNodes, node)) {
                            instance.hide();
                        }
                    }
                }
            };
            observer = new MutationObserver(callback);
            observer.observe(target_node, config);
        },
        onHidden(instance) {
            instance.destroy();
            if (observer) {
                observer.disconnect();
            }
        },
        appendTo: () => document.body,
    });

    delegate("body", {
        target: ".compose_control_button",
        // Add some additional delay when they open
        // so that regular users don't have to see
        // them unless they want to.
        delay: [300, 20],
    });

    delegate("body", {
        target: ".message_control_button",
        // This ensures that the tooltip doesn't
        // hide by the selected message blue border.
        appendTo: () => document.body,
        // Add some additional delay when they open
        // so that regular users don't have to see
        // them unless they want to.
        delay: [300, 20],
        onShow(instance) {
            // Handle dynamic "starred messages" and "edit" widgets.
            const elem = $(instance.reference);
            let content = elem.attr("data-tippy-content");
            if (content === undefined) {
                // Tippy cannot get the content for message edit button
                // as it is dynamically inserted based on editability.
                // So, we have to manually get the i element to get the
                // content from it.
                //
                // TODO: Change the template structure so logic is unnecessary.
                const edit_button = elem.find("i.edit_content_button");
                content = edit_button.attr("data-tippy-content");
            }

            instance.setContent(content);
            return true;
        },
    });

    delegate("body", {
        target: ".message_table .message_time",
        appendTo: () => document.body,
        onShow(instance) {
            const time_elem = $(instance.reference);
            const row = time_elem.closest(".message_row");
            const message = message_lists.current.get(rows.id(row));
            const time = new Date(message.timestamp * 1000);
            instance.setContent(timerender.get_full_datetime(time));
        },
        onHidden(instance) {
            instance.destroy();
        },
    });

    delegate("body", {
        target: ".recipient_row_date > span",
        appendTo: () => document.body,
        onHidden(instance) {
            instance.destroy();
        },
    });

    // In case of recipient bar icons, following change
    // ensures that tooltip doesn't hide behind the message
    // box or it is not limited by the parent container.
    delegate("body", {
        target: [".recipient_bar_icon", ".sidebar-title", "#user_filter_icon"],
        appendTo: () => document.body,
    });

    delegate("body", {
        target: ".rendered_markdown time",
        allowHTML: true,
        appendTo: () => document.body,
        onHidden(instance) {
            instance.destroy();
        },
    });
}


text:
"""Train a convolutional neural network to identify photos of my cat

"""

import os
import sys

import numpy as np
from skimage import io
from skimage import transform
from tflearn.data_utils import shuffle

from model import setup_model

SIZE = (32, 32)

image_dir = os.path.abspath("images")
cat = io.imread_collection(os.path.join(image_dir, "cat/*"))
not_cat = io.imread_collection(os.path.join(image_dir, "not_cat/*"))

X_cat = np.asarray([transform.resize(im, SIZE) for im in cat])
X_not_cat = np.asarray([transform.resize(im, SIZE) for im in not_cat])

X = np.concatenate((X_cat, X_not_cat), axis=0)
Y = np.concatenate((np.ones(X_cat.shape[0]),
                    np.zeros(X_not_cat.shape[0])))

Y = np.zeros((X.shape[0], 2))
Y[:X_cat.shape[0], 1] = np.ones(X_cat.shape[0])
Y[-X_not_cat.shape[0]:, 0] = np.ones(X_not_cat.shape[0])

n_training = int(X.shape[0] * .66)
X, Y = shuffle(X, Y)
X, X_test, Y, Y_test = X[:n_training], X[n_training:], Y[:n_training], Y[n_training:]

model = setup_model()

# Train it! We'll do 100 training passes and monitor it as it goes.
model.fit(X, Y, n_epoch=1000, shuffle=True, validation_set=(X_test, Y_test),
          show_metric=True, batch_size=100, snapshot_epoch=True,
          run_id='cat-classifier')
model.save("cat-classifier.tfl")


text:
package edu.uci.ics.asterix.test.aql;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.List;

import junit.framework.TestCase;

import org.junit.Test;

import edu.uci.ics.asterix.aql.base.Statement;
import edu.uci.ics.asterix.aql.parser.AQLParser;
import edu.uci.ics.asterix.aql.parser.ParseException;
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;

public class AQLTestCase extends TestCase {

    private final File queryFile;

    AQLTestCase(File queryFile) {
        super("testAQL");
        this.queryFile = queryFile;
    }

    @Test
    public void testAQL() throws UnsupportedEncodingException, FileNotFoundException, ParseException, AsterixException,
            AlgebricksException {
        Reader fis = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
        AQLParser parser = new AQLParser(fis);
        List<Statement> statements;
        GlobalConfig.ASTERIX_LOGGER.info(queryFile.toString());
        try {
            statements = parser.parse();
        } catch (ParseException e) {
            GlobalConfig.ASTERIX_LOGGER.warning("Failed while testing file " + fis);
            StringWriter sw = new StringWriter();
            PrintWriter writer = new PrintWriter(sw);
            e.printStackTrace(writer);
            GlobalConfig.ASTERIX_LOGGER.warning(sw.toString());
            throw new ParseException("Parsing " + queryFile.toString());
        }

    }
}


text:
package disco

import (
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"mime"
	"net/http"
	"net/url"
	"time"

	cleanhttp "github.com/hashicorp/go-cleanhttp"
	"github.com/hashicorp/terraform/httpclient"
	"github.com/hashicorp/terraform/svchost"
	"github.com/hashicorp/terraform/svchost/auth"
)

const (
	// Fixed path to the discovery manifest.
	discoPath = "/.well-known/terraform.json"

	// Arbitrary-but-small number to prevent runaway redirect loops.
	maxRedirects = 3

	// Arbitrary-but-small time limit to prevent UI "hangs" during discovery.
	discoTimeout = 11 * time.Second

	// 1MB - to prevent abusive services from using loads of our memory.
	maxDiscoDocBytes = 1 * 1024 * 1024
)

// httpTransport is overridden during tests, to skip TLS verification.
var httpTransport = cleanhttp.DefaultPooledTransport()

// Disco is the main type in this package, which allows discovery on given
// hostnames and caches the results by hostname to avoid repeated requests
// for the same information.
type Disco struct {
	hostCache map[svchost.Hostname]*Host
	credsSrc  auth.CredentialsSource

	// Transport is a custom http.RoundTripper to use.
	Transport http.RoundTripper
}

// New returns a new initialized discovery object.
func New() *Disco {
	return NewWithCredentialsSource(nil)
}

// NewWithCredentialsSource returns a new discovery object initialized with
// the given credentials source.
func NewWithCredentialsSource(credsSrc auth.CredentialsSource) *Disco {
	return &Disco{
		hostCache: make(map[svchost.Hostname]*Host),
		credsSrc:  credsSrc,
		Transport: httpTransport,
	}
}

// SetCredentialsSource provides a credentials source that will be used to
// add credentials to outgoing discovery requests, where available.
//
// If this method is never called, no outgoing discovery requests will have
// credentials.
func (d *Disco) SetCredentialsSource(src auth.CredentialsSource) {
	d.credsSrc = src
}

// CredentialsForHost returns a non-nil HostCredentials if the embedded source has
// credentials available for the host, and a nil HostCredentials if it does not.
func (d *Disco) CredentialsForHost(hostname svchost.Hostname) (auth.HostCredentials, error) {
	if d.credsSrc == nil {
		return nil, nil
	}
	return d.credsSrc.ForHost(hostname)
}

// ForceHostServices provides a pre-defined set of services for a given
// host, which prevents the receiver from attempting network-based discovery
// for the given host. Instead, the given services map will be returned
// verbatim.
//
// When providing "forced" services, any relative URLs are resolved against
// the initial discovery URL that would have been used for network-based
// discovery, yielding the same results as if the given map were published
// at the host's default discovery URL, though using absolute URLs is strongly
// recommended to make the configured behavior more explicit.
func (d *Disco) ForceHostServices(hostname svchost.Hostname, services map[string]interface{}) {
	if services == nil {
		services = map[string]interface{}{}
	}

	d.hostCache[hostname] = &Host{
		discoURL: &url.URL{
			Scheme: "https",
			Host:   string(hostname),
			Path:   discoPath,
		},
		hostname:  hostname.ForDisplay(),
		services:  services,
		transport: d.Transport,
	}
}

// Discover runs the discovery protocol against the given hostname (which must
// already have been validated and prepared with svchost.ForComparison) and
// returns an object describing the services available at that host.
//
// If a given hostname supports no Terraform services at all, a non-nil but
// empty Host object is returned. When giving feedback to the end user about
// such situations, we say "host <name> does not provide a <service> service",
// regardless of whether that is due to that service specifically being absent
// or due to the host not providing Terraform services at all, since we don't
// wish to expose the detail of whole-host discovery to an end-user.
func (d *Disco) Discover(hostname svchost.Hostname) (*Host, error) {
	if host, cached := d.hostCache[hostname]; cached {
		return host, nil
	}

	host, err := d.discover(hostname)
	if err != nil {
		return nil, err
	}
	d.hostCache[hostname] = host

	return host, nil
}

// DiscoverServiceURL is a convenience wrapper for discovery on a given
// hostname and then looking up a particular service in the result.
func (d *Disco) DiscoverServiceURL(hostname svchost.Hostname, serviceID string) (*url.URL, error) {
	host, err := d.Discover(hostname)
	if err != nil {
		return nil, err
	}
	return host.ServiceURL(serviceID)
}

// discover implements the actual discovery process, with its result cached
// by the public-facing Discover method.
func (d *Disco) discover(hostname svchost.Hostname) (*Host, error) {
	discoURL := &url.URL{
		Scheme: "https",
		Host:   hostname.String(),
		Path:   discoPath,
	}

	client := &http.Client{
		Transport: d.Transport,
		Timeout:   discoTimeout,

		CheckRedirect: func(req *http.Request, via []*http.Request) error {
			log.Printf("[DEBUG] Service discovery redirected to %s", req.URL)
			if len(via) > maxRedirects {
				return errors.New("too many redirects") // this error will never actually be seen
			}
			return nil
		},
	}

	req := &http.Request{
		Header: make(http.Header),
		Method: "GET",
		URL:    discoURL,
	}
	req.Header.Set("Accept", "application/json")
	req.Header.Set("User-Agent", httpclient.UserAgentString())

	creds, err := d.CredentialsForHost(hostname)
	if err != nil {
		log.Printf("[WARN] Failed to get credentials for %s: %s (ignoring)", hostname, err)
	}
	if creds != nil {
		// Update the request to include credentials.
		creds.PrepareRequest(req)
	}

	log.Printf("[DEBUG] Service discovery for %s at %s", hostname, discoURL)

	resp, err := client.Do(req)
	if err != nil {
		return nil, fmt.Errorf("Failed to request discovery document: %v", err)
	}
	defer resp.Body.Close()

	host := &Host{
		// Use the discovery URL from resp.Request in
		// case the client followed any redirects.
		discoURL:  resp.Request.URL,
		hostname:  hostname.ForDisplay(),
		transport: d.Transport,
	}

	// Return the host without any services.
	if resp.StatusCode == 404 {
		return host, nil
	}

	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("Failed to request discovery document: %s", resp.Status)
	}

	contentType := resp.Header.Get("Content-Type")
	mediaType, _, err := mime.ParseMediaType(contentType)
	if err != nil {
		return nil, fmt.Errorf("Discovery URL has a malformed Content-Type %q", contentType)
	}
	if mediaType != "application/json" {
		return nil, fmt.Errorf("Discovery URL returned an unsupported Content-Type %q", mediaType)
	}

	// This doesn't catch chunked encoding, because ContentLength is -1 in that case.
	if resp.ContentLength > maxDiscoDocBytes {
		// Size limit here is not a contractual requirement and so we may
		// adjust it over time if we find a different limit is warranted.
		return nil, fmt.Errorf(
			"Discovery doc response is too large (got %d bytes; limit %d)",
			resp.ContentLength, maxDiscoDocBytes,
		)
	}

	// If the response is using chunked encoding then we can't predict its
	// size, but we'll at least prevent reading the entire thing into memory.
	lr := io.LimitReader(resp.Body, maxDiscoDocBytes)

	servicesBytes, err := ioutil.ReadAll(lr)
	if err != nil {
		return nil, fmt.Errorf("Error reading discovery document body: %v", err)
	}

	var services map[string]interface{}
	err = json.Unmarshal(servicesBytes, &services)
	if err != nil {
		return nil, fmt.Errorf("Failed to decode discovery document as a JSON object: %v", err)
	}
	host.services = services

	return host, nil
}

// Forget invalidates any cached record of the given hostname. If the host
// has no cache entry then this is a no-op.
func (d *Disco) Forget(hostname svchost.Hostname) {
	delete(d.hostCache, hostname)
}

// ForgetAll is like Forget, but for all of the hostnames that have cache entries.
func (d *Disco) ForgetAll() {
	d.hostCache = make(map[svchost.Hostname]*Host)
}


text:
'use strict';

const React = require('react');
const ReactNative = require('react-native');
const { Animated, StyleSheet, View, Dimensions } = ReactNative;

const DEFAULT_ANIMATE_TIME = 300;

module.exports = React.createClass({
    getInitialState () {
        return {
            fadeAnim: new Animated.Value(0),
            overlayStyle: styles.emptyOverlay, //on android opacity=0 also can cover screen, so use overlayStyle fix it
        };
    },
    onAnimatedEnd () {
        !this.props.visible && this.setState({ overlayStyle:styles.emptyOverlay });
    },
    componentWillReceiveProps (newProps) {
        newProps.visible && this.setState({ overlayStyle: styles.fullOverlay });
        return Animated.timing(this.state.fadeAnim, {
            toValue: newProps.visible ? 1 : 0,
            duration: DEFAULT_ANIMATE_TIME,
        }).start(this.onAnimatedEnd);
    },

    render () {
        return (
            <Animated.View style={[this.state.overlayStyle, { opacity: this.state.fadeAnim }]}>
                {this.props.children}
            </Animated.View>
        );
    },
});

const styles = StyleSheet.create({
    fullOverlay: {
        top: 0,
        bottom: 0,
        left: 0,
        right: 0,
        backgroundColor: 'transparent',
        position: 'absolute',
    },
    emptyOverlay: {
        backgroundColor: 'transparent',
        position: 'absolute',
    },
});


text:
int bad_mesh_quality(const Param&, const Variables&, int&);
void remesh(const Param&, Variables&, int);

#endif


text:
/**
 *
 */
package com.contalcob.bsp.report.control;

import play.mvc.Controller;
import play.mvc.Result;

import com.contalcob.sec.login.control.LoginControl;
import com.contalcob.utils.Constant;

/**
 * company : yonax73@gmail.com

 * user : YQ

 * update date : May 20, 2015

 * update by : Yonatan Alexis Quintero Rodriguez

 *
 * @created : May 20, 2015

 * @version : 0.1

 * @author Yonatan Alexis Quintero Rodriguez
 *
 */
public class ReportControl extends Controller {

	public static Result dashboard() {
		if (session(Constant.SESSION_LOGIN_ID) == null) {
			return LoginControl.signOut();
		}
		return ok(views.html.bsp.report.dashboard.render());
	}
}