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

    /**
     * @ngdoc directive
     * @name esri.map.directive:esriSceneView
     * @restrict E
     * @element
     * @scope
     *
     * @description
     * This is the directive which will create a
     * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html SceneView}
     * instance using the ArcGIS API for JavaScript.
     * There are plenty of examples showing how to use this directive and its bound parameters.
     *
     * ## Examples
     * - {@link ../#/examples/scene-view SceneView}
     * - {@link ../#/examples/extrude-polygon Extrude Polygon}
     * - {@link ../#/examples/scene-toggle-elevation Toggle Basemap Elevation}
     * - {@link ../#/examples and more...}
     *
     * @param {Object} map Instance of a {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html Map}
     *  or {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-WebScene.html WebScene}.
     * @param {Function=} on-create Callback for successful creation of the SceneView.
     * @param {Function=} on-load Callback for successful loading of the SceneView.
     * @param {Function=} on-error Callback for rejected/failed loading of the SceneView, for example when WebGL is not supported.
     * @param {Object | String=} view-options An object or inline object hash string defining additional
     *  {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#properties SceneView properties}.
     * @param {String=} register-as A name to use when registering the view so that it can be used by other controllers.
     *  See {@link esri.core.factory:esriRegistry esriRegistry}.
     */
    angular.module('esri.map')
        .directive('esriSceneView', function esriSceneView() {
            return {
                // element only
                restrict: 'E',

                transclude: true,

                // isolate scope
                scope: {
                    // one-way binding
                    registerAs: '@?',
                    // two-way binding
                    map: '=?',
                    // function binding for event handlers
                    onCreate: '&',
                    onLoad: '&',
                    onError: '&',
                    // function binding for reading object hash from attribute string
                    // or from scope object property
                    viewOptions: '&'
                },

                template: '<div ng-transclude></div>',

                controllerAs: 'sceneViewCtrl',

                bindToController: true,

                // directive api
                controller: 'EsriSceneViewController',
                link: function esriSceneViewLink(scope, element, attrs, controller) {
                    scope.$watch('sceneViewCtrl.map', function(newVal) {
                        controller.setMap(newVal);
                    });
                }
            };
        });
})(angular);


text:
from flask import Flask, session, g, render_template
from flask.ext.openid import OpenID

app = Flask(__name__)
app.config.from_object('websiteconfig')

from flask_website.openid_auth import DatabaseOpenIDStore
oid = OpenID(app, store_factory=DatabaseOpenIDStore)

@app.errorhandler(404)
def not_found(error):
    return render_template('404.html'), 404

@app.before_request
def load_current_user():
    g.user = User.query.filter_by(openid=session['openid']).first() \
        if 'openid' in session else None

@app.teardown_request
def remove_db_session(exception):
    db_session.remove()

app.add_url_rule('/docs/', endpoint='docs.index', build_only=True)
app.add_url_rule('/docs/<path:page>/', endpoint='docs.show',
                 build_only=True)
app.add_url_rule('/docs/flask-docs.pdf', endpoint='docs.pdf',
                 build_only=True)
app.add_url_rule('/docs/flask-docs.zip', endpoint='docs.zip',
                 build_only=True)

from flask_website.views import general
from flask_website.views import community
from flask_website.views import mailinglist
from flask_website.views import snippets
from flask_website.views import extensions
app.register_blueprint(general.mod)
app.register_blueprint(community.mod)
app.register_blueprint(mailinglist.mod)
app.register_blueprint(snippets.mod)
app.register_blueprint(extensions.mod)

from flask_website.database import User, db_session
from flask_website import utils

app.jinja_env.filters['datetimeformat'] = utils.format_datetime
app.jinja_env.filters['timedeltaformat'] = utils.format_timedelta
app.jinja_env.filters['displayopenid'] = utils.display_openid

redpajama_set_name: RedPajamaGithub


text:
FAUXPAS_IGNORED_IN_FILE(APIAvailability)

NSString *stringIfHasContentsElseNil(NSString *string);

@interface STPAddress ()

@property (nonatomic, readwrite, nonnull, copy) NSDictionary *allResponseFields;
@property (nonatomic, readwrite, nullable, copy) NSString *givenName;
@property (nonatomic, readwrite, nullable, copy) NSString *familyName;
@end

@implementation STPAddress

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"

- (instancetype)initWithABRecord:(ABRecordRef)record {
    self = [super init];
    if (self) {
        NSString *firstName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonFirstNameProperty);
        NSString *lastName = (__bridge_transfer NSString*)ABRecordCopyValue(record, kABPersonLastNameProperty);
        NSString *first = firstName ?: @"";
        NSString *last = lastName ?: @"";
        NSString *name = [@[first, last] componentsJoinedByString:@" "];
        _name = [name stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

        ABMultiValueRef emailValues = ABRecordCopyValue(record, kABPersonEmailProperty);
        _email = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(emailValues, 0));
        if (emailValues != NULL) {
            CFRelease(emailValues);
        }

        ABMultiValueRef phoneValues = ABRecordCopyValue(record, kABPersonPhoneProperty);
        NSString *phone = (__bridge_transfer NSString *)(ABMultiValueCopyValueAtIndex(phoneValues, 0));
        if (phoneValues != NULL) {
            CFRelease(phoneValues);
        }
        phone = [STPCardValidator sanitizedNumericStringForString:phone];
        if ([phone length] > 0) {
            _phone = phone;
        }

        ABMultiValueRef addressValues = ABRecordCopyValue(record, kABPersonAddressProperty);
        if (addressValues != NULL) {
            if (ABMultiValueGetCount(addressValues) > 0) {
                CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(addressValues, 0);
                NSString *street = CFDictionaryGetValue(dict, kABPersonAddressStreetKey);
                if (street) {
                    _line1 = street;
                }
                NSString *city = CFDictionaryGetValue(dict, kABPersonAddressCityKey);
                if (city) {
                    _city = city;
                }
                NSString *state = CFDictionaryGetValue(dict, kABPersonAddressStateKey);
                if (state) {
                    _state = state;
                }
                NSString *zip = CFDictionaryGetValue(dict, kABPersonAddressZIPKey);
                if (zip) {
                    _postalCode = zip;
                }
                NSString *country = CFDictionaryGetValue(dict, kABPersonAddressCountryCodeKey);
                if (country) {
                    _country = [country uppercaseString];
                }
                if (dict != NULL) {
                    CFRelease(dict);
                }
            }
            CFRelease(addressValues);
        }
    }
    return self;
}

- (ABRecordRef)ABRecordValue {
    ABRecordRef record = ABPersonCreate();
    if ([self firstName] != nil) {
        CFStringRef firstNameRef = (__bridge CFStringRef)[self firstName];
        ABRecordSetValue(record, kABPersonFirstNameProperty, firstNameRef, nil);
    }
    if ([self lastName] != nil) {
        CFStringRef lastNameRef = (__bridge CFStringRef)[self lastName];
        ABRecordSetValue(record, kABPersonLastNameProperty, lastNameRef, nil);
    }
    if (self.phone != nil) {
        ABMutableMultiValueRef phonesRef = ABMultiValueCreateMutable(kABMultiStringPropertyType);
        ABMultiValueAddValueAndLabel(phonesRef, (__bridge CFStringRef)self.phone,
                                     kABPersonPhoneMainLabel, NULL);
        ABRecordSetValue(record, kABPersonPhoneProperty, phonesRef, nil);
        CFRelease(phonesRef);
    }
    if (self.email != nil) {
        ABMutableMultiValueRef emailsRef = ABMultiValueCreateMutable(kABMultiStringPropertyType);
        ABMultiValueAddValueAndLabel(emailsRef, (__bridge CFStringRef)self.email,
                                     kABHomeLabel, NULL);
        ABRecordSetValue(record, kABPersonEmailProperty, emailsRef, nil);
        CFRelease(emailsRef);
    }
    ABMutableMultiValueRef addressRef = ABMultiValueCreateMutable(kABMultiDictionaryPropertyType);
    NSMutableDictionary *addressDict = [NSMutableDictionary dictionary];
    addressDict[(NSString *)kABPersonAddressStreetKey] = [self street];
    addressDict[(NSString *)kABPersonAddressCityKey] = self.city;
    addressDict[(NSString *)kABPersonAddressStateKey] = self.state;
    addressDict[(NSString *)kABPersonAddressZIPKey] = self.postalCode;
    addressDict[(NSString *)kABPersonAddressCountryCodeKey] = self.country;
    ABMultiValueAddValueAndLabel(addressRef, (__bridge CFTypeRef)[addressDict copy], kABWorkLabel, NULL);
    ABRecordSetValue(record, kABPersonAddressProperty, addressRef, nil);
    CFRelease(addressRef);
    return CFAutorelease(record);
}

#pragma clang diagnostic pop

- (NSString *)sanitizedPhoneStringFromCNPhoneNumber:(CNPhoneNumber *)phoneNumber {
    NSString *phone = phoneNumber.stringValue;
    if (phone) {
        phone = [STPCardValidator sanitizedNumericStringForString:phone];
    }

    return stringIfHasContentsElseNil(phone);
}

- (instancetype)initWithCNContact:(CNContact *)contact {
    self = [super init];
    if (self) {

        _givenName = stringIfHasContentsElseNil(contact.givenName);
        _familyName = stringIfHasContentsElseNil(contact.familyName);
        _name = stringIfHasContentsElseNil([CNContactFormatter stringFromContact:contact
                                                                           style:CNContactFormatterStyleFullName]);
        _email = stringIfHasContentsElseNil([contact.emailAddresses firstObject].value);
        _phone = [self sanitizedPhoneStringFromCNPhoneNumber:contact.phoneNumbers.firstObject.value];

        [self setAddressFromCNPostalAddress:contact.postalAddresses.firstObject.value];
    }
    return self;
}

- (instancetype)initWithPKContact:(PKContact *)contact {
    self = [super init];
    if (self) {
        NSPersonNameComponents *nameComponents = contact.name;
        if (nameComponents) {
            _givenName = stringIfHasContentsElseNil(nameComponents.givenName);
            _familyName = stringIfHasContentsElseNil(nameComponents.familyName);
            _name = stringIfHasContentsElseNil([NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:nameComponents
                                                                                style:NSPersonNameComponentsFormatterStyleDefault
                                                                                options:(NSPersonNameComponentsFormatterOptions)0]);
        }
        _email = stringIfHasContentsElseNil(contact.emailAddress);
        _phone = [self sanitizedPhoneStringFromCNPhoneNumber:contact.phoneNumber];
        [self setAddressFromCNPostalAddress:contact.postalAddress];

    }
    return self;
}

- (void)setAddressFromCNPostalAddress:(CNPostalAddress *)address {
    if (address) {
        _line1 = stringIfHasContentsElseNil(address.street);
        _city = stringIfHasContentsElseNil(address.city);
        _state = stringIfHasContentsElseNil(address.state);
        _postalCode = stringIfHasContentsElseNil(address.postalCode);
        _country = stringIfHasContentsElseNil(address.ISOCountryCode.uppercaseString);
    }
}

- (PKContact *)PKContactValue {
    PKContact *contact = [PKContact new];
    NSPersonNameComponents *name = [NSPersonNameComponents new];
    name.givenName = [self firstName];
    name.familyName = [self lastName];
    contact.name = name;
    contact.emailAddress = self.email;
    CNMutablePostalAddress *address = [CNMutablePostalAddress new];
    address.street = [self street];
    address.city = self.city;
    address.state = self.state;
    address.postalCode = self.postalCode;
    address.country = self.country;
    contact.postalAddress = address;
    contact.phoneNumber = [CNPhoneNumber phoneNumberWithStringValue:self.phone];
    return contact;
}

- (NSString *)firstName {
    if (self.givenName) {
        return self.givenName;
    }
    else {
        NSArray<NSString *>*components = [self.name componentsSeparatedByString:@" "];
        return [components firstObject];
    }
}

- (NSString *)lastName {
    if (self.familyName) {
        return self.familyName;
    }
    else {
        NSArray<NSString *>*components = [self.name componentsSeparatedByString:@" "];
        NSString *firstName = [components firstObject];
        NSString *lastName = [self.name stringByReplacingOccurrencesOfString:firstName withString:@""];
        lastName = [lastName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
        if ([lastName length] == 0) {
            lastName = nil;
        }
        return lastName;
    }
}

- (NSString *)street {
    NSString *street = nil;
    if (self.line1 != nil) {
        street = [@"" stringByAppendingString:self.line1];
    }
    if (self.line2 != nil) {
        street = [@[street ?: @"", self.line2] componentsJoinedByString:@" "];
    }
    return street;
}

- (BOOL)containsRequiredFields:(STPBillingAddressFields)requiredFields {
    BOOL containsFields = YES;
    switch (requiredFields) {
        case STPBillingAddressFieldsNone:
            return YES;
        case STPBillingAddressFieldsZip:
            return [STPPostalCodeValidator stringIsValidPostalCode:self.postalCode
                                                       countryCode:self.country];
        case STPBillingAddressFieldsFull:
            return [self hasValidPostalAddress];
    }
    return containsFields;
}

- (BOOL)containsRequiredShippingAddressFields:(PKAddressField)requiredFields {
    BOOL containsFields = YES;
    if (requiredFields & PKAddressFieldName) {
        containsFields = containsFields && [self.name length] > 0;
    }
    if (requiredFields & PKAddressFieldEmail) {
        containsFields = containsFields && [STPEmailAddressValidator stringIsValidEmailAddress:self.email];
    }
    if (requiredFields & PKAddressFieldPhone) {
        containsFields = containsFields && [STPPhoneNumberValidator stringIsValidPhoneNumber:self.phone forCountryCode:self.country];
    }
    if (requiredFields & PKAddressFieldPostalAddress) {
        containsFields = containsFields && [self hasValidPostalAddress];
    }
    return containsFields;
}

- (BOOL)hasValidPostalAddress {
    return (self.line1.length > 0
            && self.city.length > 0
            && self.country.length > 0
            && (self.state.length > 0 || ![self.country isEqualToString:@"US"])
            && [STPPostalCodeValidator stringIsValidPostalCode:self.postalCode
                                                   countryCode:self.country]);
}

+ (PKAddressField)applePayAddressFieldsFromBillingAddressFields:(STPBillingAddressFields)billingAddressFields {
    FAUXPAS_IGNORED_IN_METHOD(APIAvailability);
    switch (billingAddressFields) {
        case STPBillingAddressFieldsNone:
            return PKAddressFieldNone;
        case STPBillingAddressFieldsZip:
        case STPBillingAddressFieldsFull:
            return PKAddressFieldPostalAddress;
    }
}

#pragma mark STPAPIResponseDecodable

+ (NSArray *)requiredFields {
    return @[];
}

+ (instancetype)decodedObjectFromAPIResponse:(NSDictionary *)response {
    NSDictionary *dict = [response stp_dictionaryByRemovingNullsValidatingRequiredFields:[self requiredFields]];
    if (!dict) {
        return nil;
    }

    STPAddress *address = [self new];
    address.allResponseFields = dict;
    address.city = dict[@"city"];
    address.country = dict[@"country"];
    address.line1 = dict[@"line1"];
    address.line2 = dict[@"line2"];
    address.postalCode = dict[@"postal_code"];
    address.state = dict[@"state"];
    return address;
}

@end

NSString *stringIfHasContentsElseNil(NSString *string) {
    if (string.length > 0) {
        return string;
    }
    else {
        return nil;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Kevin Huang</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/jquery.fullPage.css" rel="stylesheet">

    <link href="css/mystyle.css" rel="stylesheet">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        Toggle navigation

      </button>
      Kevin Huang

Home (current)

About

Projects

Contact

      Hi, my name is Kevin Huang.

      I am a junior at Washington University double majoring in computer science and mathematics. I'm originally from a suburb of Cleveland, Ohio, but also really enjoy life in St. Louis.

      My professional interests include Android app development, educational software, and tools that make life more convenient.

      Outside of those, I also enjoy playing basketball, following the NBA, weightlifting, and lion dancing.

        <img class="media-object" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+PGRlZnMvPjxyZWN0IHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgZmlsbD0iI0VFRUVFRSIvPjxnPjx0ZXh0IHg9IjEyLjUiIHk9IjMyIiBzdHlsZT0iZmlsbDojQUFBQUFBO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjEwcHQ7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+NjR4NjQ8L3RleHQ+PC9nPjwvc3ZnPg==" alt="...">

Project 1

      Project description...

        <img class="media-object" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+PGRlZnMvPjxyZWN0IHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgZmlsbD0iI0VFRUVFRSIvPjxnPjx0ZXh0IHg9IjEyLjUiIHk9IjMyIiBzdHlsZT0iZmlsbDojQUFBQUFBO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjEwcHQ7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+NjR4NjQ8L3RleHQ+PC9nPjwvc3ZnPg==" alt="...">

Project 2

      Project description...

        <img class="media-object" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+PGRlZnMvPjxyZWN0IHdpZHRoPSI2NCIgaGVpZ2h0PSI2NCIgZmlsbD0iI0VFRUVFRSIvPjxnPjx0ZXh0IHg9IjEyLjUiIHk9IjMyIiBzdHlsZT0iZmlsbDojQUFBQUFBO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1mYW1pbHk6QXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7Zm9udC1zaXplOjEwcHQ7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+NjR4NjQ8L3RleHQ+PC9nPjwvc3ZnPg==" alt="...">

Project 3

      Project description...

Contact me

    <form action="/my-handling-form-page" method="post">

        Name:
        <input type="text" id="name" placeholder="Enter your name" />

        Email:
        <input type="email" id="mail" placeholder="Enter your email" />

        Message:
        <textarea id="msg" placeholder="Type your message here."></textarea>

        <button type="submit">Send</button>

    </form>

Home · About · Projects · Contact · © 2015 Kevin Huang


text:
using namespace std;

#ifdef NDEBUG
#define my_assert(...) ((void)0)
#else
#define my_assert(expr)                                                        \
	((expr) ? (void)0                                                          \
	        : (fprintf(stderr, "%s:%i %s: Assertion `%s' failed.\n", __FILE__, \
	                   __LINE__, __PRETTY_FUNCTION__, #expr),                  \
	           exit(1)))
#endif

struct Verdict {
	ostream& out = cerr;

	struct OK {
		double score;
		std::string message_prefix;
	};

	struct WRONG {
		std::string message_prefix;
	};

	// E.g. usage:
	// ...
	// // Give partial points, even if the rest of the answer will be invalid:
	// verdict.wrong_override = Verdict::OK {50, "First line is correct\n"};
	std::variant<OK, WRONG> wrong_override = WRONG {};

	// 100% points
	[[noreturn]] void ok() {
		out << "OK" << endl;
		exit(0);
	}

	// @p score * 1% points
	template <class... Args>
	[[noreturn]] void ok(double score, Args&&... message) {
		out << "OK\n" << score << '\n';
		(out << ... << std::forward<Args>(message)) << endl;
		exit(0);
	}

	// 100% points
	template <class Arg1, class... Args,
	          enable_if_t<not is_convertible_v<Arg1, double>, int> = 0>
	[[noreturn]] void ok(Arg1&& message_part1, Args&&... message_part2) {
		out << "OK\n\n" << std::forward<Arg1>(message_part1);
		(out << ... << std::forward<Args>(message_part2)) << endl;
		exit(0);
	}

	// If wrong_override holds OK, then wrong_override.score * 1% points, 0%
	// points otherwise
	template <class... Args>
	[[noreturn]] void wrong(Args&&... message) {
		std::visit(
		   [&](auto&& wr) {
			   using T = decay_t<decltype(wr)>;
			   if constexpr (is_same_v<T, OK>) {
				   out << "OK\n" << wr.score << "\n";
			   } else if constexpr (is_same_v<T, WRONG>) {
				   out << "WRONG\n\n";
			   }
			   out << wr.message_prefix;
		   },
		   wrong_override);

		(out << ... << std::forward<Args>(message)) << endl;
		exit(0);
	}
} verdict;

static inline int __attribute__((constructor)) ignore_sigpipe() {
	//                  ^ Trick to make compiler call it before main()
	// When checker waits for input but solution exits, a SIGPIPE signal is
	// delivered - we have to ignore it, otherwise it would kill checker process
	struct sigaction sa;
	std::memset(&sa, 0, sizeof(sa));
	sa.sa_handler = SIG_IGN;
	sa.sa_flags = SA_RESTART;
	return sigaction(SIGPIPE, &sa, nullptr);
}

#include <chrono>

int main(int argc, char** argv) {
	// argv[0] command (ignored)
	// argv[1] test_in
	//
	// stdin = stdout of solution
	// stdout = stdin of solution
	// stderr = where to write checker output
	//
	// Output (to stderr):
	// Line 1: "OK" or "WRONG"
	// Line 2 (optional; ignored if line 1 == "WRONG" - score is set to 0
	// anyway):
	//   leave empty or provide a real number x from interval [0, 100], which
	//   means that the test will get no more than x percent of its maximal
	//   score.
	// Line 3 and next (optional): A checker comment

	my_assert(argc == 2);

	// Well implemented judger will hold checker file descriptors to distinguish
	// solution errors caused by checker's exit i.e. SIGPIPE on writing to
	// stdout or read() on stdin returning 0 (thus producing UB in solutions
	// that assume the input is valid)
	(void)close(STDIN_FILENO);
	(void)close(STDOUT_FILENO);

	// Give some time for solution to hang on its stdout pipe's end before we exit
	using namespace std::chrono;
	auto now = system_clock::now();
	while (system_clock::now() - now < milliseconds(4)) {} // sleep is forbidden

	verdict.ok(42, "Partial points");
}


text:
import abc

class Reader:
    """
        Abstract class which defines the minimal functionality of Readers. You will need to extend from tis class
        if you want to create your own reader.
    """
    def __init__(self):
        pass

    @abc.abstractmethod
    def get_count(self):
        """
            Gets the amount of items in this Reader.

            :return: amount of items (int)
        """
        return

    @abc.abstractmethod
    def get_value(self, value_name, index):
        """
            Get a value from the reader.

            :param value_name: The name of the value
            :param index: The index of the value
            :return: The value with the given value name at the given index. Example get_value('Age', 0) -> 25
        """
        return

    @abc.abstractmethod
    def value_exists(self, value_name):
        """
            Checks if the given value name exists.

            :param value_name: The value name to check
            :return: True if the given value name exists in the Reader and False otherwise
        """
        return

    @abc.abstractmethod
    def get_item(self, index):
        """
            Get a dictionary with values and their names at a given index.

            :param index: Index of the values you want
            :return: A list with values. Example: ['Name': 'John', 'Surname': 'Doe', 'Age': 25]
        """
        return


text:
    <link rel="stylesheet" ./href="weather_app2.css" />
    <link rel="stylesheet" ./href="w3.css" />

    <meta http-equiv="Content-Security-Policy" content="default-src 'self' foo.com">
    <meta http-equiv="refresh" content="300" >

  		WEATHER NOW

  		WEATHER
  		TIDES

  		INTERACTIVE HISTORY

  		CHARTS / IMAGERY

  		FULL WEBSITE


text:
gem "google-cloud-core"
require "google/cloud"
require "google/cloud/config"
require "googleauth"

module Google
  module Cloud
    ##
    # Creates a new object for connecting to the Vision service.
    # Each call creates a new connection.
    #
    # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
    #   set of resources and operations that the connection can access. See
    #   [Using OAuth 2.0 to Access Google
    #   APIs](https://developers.google.com/identity/protocols/OAuth2).
    #
    #   The default scope is:
    #
    #   * `https://www.googleapis.com/auth/cloud-platform`
    # @param [Integer] timeout Default timeout to use in requests. Optional.
    # @param [Hash] client_config A hash of values to override the default
    #   behavior of the API client. Optional.
    #
    # @return [Google::Cloud::Vision::Project]
    #
    # @example
    #   require "google/cloud"
    #
    #   gcloud = Google::Cloud.new
    #   vision = gcloud.vision
    #
    #   image = vision.image "path/to/landmark.jpg"
    #
    #   landmark = image.landmark
    #   landmark.description #=> "Mount Rushmore"
    #
    # @example The default scope can be overridden with the `scope` option:
    #   require "google/cloud"
    #
    #   gcloud  = Google::Cloud.new
    #   platform_scope = "https://www.googleapis.com/auth/cloud-platform"
    #   vision = gcloud.vision scope: platform_scope
    #
    def vision scope: nil, timeout: nil, client_config: nil
      Google::Cloud.vision @project, @keyfile, scope: scope,
                                               timeout: (timeout || @timeout),
                                               client_config: client_config
    end

    ##
    # Creates a new object for connecting to the Vision service.
    # Each call creates a new connection.
    #
    # @param [String] project_id Project identifier for the Vision service you
    #   are connecting to. If not present, the default project for the
    #   credentials is used.
    # @param [String, Hash, Google::Auth::Credentials] credentials The path to
    #   the keyfile as a String, the contents of the keyfile as a Hash, or a
    #   Google::Auth::Credentials object. (See {Vision::Credentials})
    # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
    #   set of resources and operations that the connection can access. See
    #   [Using OAuth 2.0 to Access Google
    #   APIs](https://developers.google.com/identity/protocols/OAuth2).
    #
    #   The default scope is:
    #
    #   * `https://www.googleapis.com/auth/cloud-platform`
    # @param [Integer] timeout Default timeout to use in requests. Optional.
    # @param [Hash] client_config A hash of values to override the default
    #   behavior of the API client. Optional.
    #
    # @return [Google::Cloud::Vision::Project]
    #
    # @example
    #   require "google/cloud"
    #
    #   vision = Google::Cloud.vision
    #
    #   image = vision.image "path/to/landmark.jpg"
    #
    #   landmark = image.landmark
    #   landmark.description #=> "Mount Rushmore"
    #
    def self.vision project_id = nil, credentials = nil, scope: nil,
                    timeout: nil, client_config: nil
      require "google/cloud/vision"
      Google::Cloud::Vision.new project_id: project_id,
                                credentials: credentials,
                                scope: scope, timeout: timeout,
                                client_config: client_config
    end
  end
end

# Set the default vision configuration
Google::Cloud.configure.add_config! :vision do |config|
  default_project = Google::Cloud::Config.deferred do
    ENV["VISION_PROJECT"]
  end
  default_creds = Google::Cloud::Config.deferred do
    Google::Cloud::Config.credentials_from_env(
      "VISION_CREDENTIALS", "VISION_CREDENTIALS_JSON",
      "VISION_KEYFILE", "VISION_KEYFILE_JSON"
    )
  end

  config.add_field! :project_id, default_project, match: String, allow_nil: true
  config.add_alias! :project, :project_id
  config.add_field! :credentials, default_creds,
                    match: [String, Hash, Google::Auth::Credentials],
                    allow_nil: true
  config.add_alias! :keyfile, :credentials
  config.add_field! :scope, nil, match: [String, Array]
  config.add_field! :timeout, nil, match: Integer
  config.add_field! :client_config, nil, match: Hash
  # Update the documentation on the Vision module methods when these
  # defaults change.
  config.add_field! :default_max_faces, 100
  config.add_field! :default_max_landmarks, 100
  config.add_field! :default_max_logos, 100
  config.add_field! :default_max_labels, 100
  config.add_field! :default_max_crop_hints, 100
  config.add_field! :default_max_web, 100
end


text:
/*================================================================================
  code generated by: java2cpp
  author: Zoran Angelov, mailto://baldzar@gmail.com
  class: android.widget.AbsSeekBar
================================================================================*/

#ifndef J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_WIDGET_ABSSEEKBAR_HPP_DECL
#define J2CPP_ANDROID_WIDGET_ABSSEEKBAR_HPP_DECL

namespace j2cpp { namespace android { namespace graphics { namespace drawable { class Drawable; } } } }
namespace j2cpp { namespace android { namespace content { class Context; } } }
namespace j2cpp { namespace android { namespace view { class KeyEvent; } } }
namespace j2cpp { namespace android { namespace view { class MotionEvent; } } }
namespace j2cpp { namespace android { namespace widget { class ProgressBar; } } }
namespace j2cpp { namespace android { namespace util { class AttributeSet; } } }

#include <android/content/Context.hpp>
#include <android/graphics/drawable/Drawable.hpp>
#include <android/util/AttributeSet.hpp>
#include <android/view/KeyEvent.hpp>
#include <android/view/MotionEvent.hpp>
#include <android/widget/ProgressBar.hpp>

namespace j2cpp {

namespace android { namespace widget {

	class AbsSeekBar;
	class AbsSeekBar
		: public object<AbsSeekBar>
	{
	public:

		J2CPP_DECLARE_CLASS

		J2CPP_DECLARE_METHOD(0)
		J2CPP_DECLARE_METHOD(1)
		J2CPP_DECLARE_METHOD(2)
		J2CPP_DECLARE_METHOD(3)
		J2CPP_DECLARE_METHOD(4)
		J2CPP_DECLARE_METHOD(5)
		J2CPP_DECLARE_METHOD(6)
		J2CPP_DECLARE_METHOD(7)
		J2CPP_DECLARE_METHOD(8)
		J2CPP_DECLARE_METHOD(9)
		J2CPP_DECLARE_METHOD(10)
		J2CPP_DECLARE_METHOD(11)
		J2CPP_DECLARE_METHOD(12)
		J2CPP_DECLARE_METHOD(13)
		J2CPP_DECLARE_METHOD(14)
		J2CPP_DECLARE_METHOD(15)

		explicit AbsSeekBar(jobject jobj)
		: object<AbsSeekBar>(jobj)
		{
		}

		operator local_ref<android::widget::ProgressBar>() const;

		AbsSeekBar(local_ref< android::content::Context > const&);
		AbsSeekBar(local_ref< android::content::Context > const&, local_ref< android::util::AttributeSet > const&);
		AbsSeekBar(local_ref< android::content::Context > const&, local_ref< android::util::AttributeSet > const&, jint);
		void setThumb(local_ref< android::graphics::drawable::Drawable >  const&);
		jint getThumbOffset();
		void setThumbOffset(jint);
		void setKeyProgressIncrement(jint);
		jint getKeyProgressIncrement();
		void setMax(jint);
		jboolean onTouchEvent(local_ref< android::view::MotionEvent >  const&);
		jboolean onKeyDown(jint, local_ref< android::view::KeyEvent >  const&);
	}; //class AbsSeekBar

} //namespace widget
} //namespace android

} //namespace j2cpp

#endif //J2CPP_ANDROID_WIDGET_ABSSEEKBAR_HPP_DECL

#else //J2CPP_INCLUDE_IMPLEMENTATION

#ifndef J2CPP_ANDROID_WIDGET_ABSSEEKBAR_HPP_IMPL
#define J2CPP_ANDROID_WIDGET_ABSSEEKBAR_HPP_IMPL

namespace j2cpp {

android::widget::AbsSeekBar::operator local_ref<android::widget::ProgressBar>() const
{
	return local_ref<android::widget::ProgressBar>(get_jobject());
}

android::widget::AbsSeekBar::AbsSeekBar(local_ref< android::content::Context > const &a0)
: object<android::widget::AbsSeekBar>(
	call_new_object<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(0),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(0)
	>(a0)
)
{
}

android::widget::AbsSeekBar::AbsSeekBar(local_ref< android::content::Context > const &a0, local_ref< android::util::AttributeSet > const &a1)
: object<android::widget::AbsSeekBar>(
	call_new_object<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(1),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(1)
	>(a0, a1)
)
{
}

android::widget::AbsSeekBar::AbsSeekBar(local_ref< android::content::Context > const &a0, local_ref< android::util::AttributeSet > const &a1, jint a2)
: object<android::widget::AbsSeekBar>(
	call_new_object<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(2),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(2)
	>(a0, a1, a2)
)
{
}

void android::widget::AbsSeekBar::setThumb(local_ref< android::graphics::drawable::Drawable > const &a0)
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(3),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(3),
		void
	>(get_jobject(), a0);
}

jint android::widget::AbsSeekBar::getThumbOffset()
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(4),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(4),
		jint
	>(get_jobject());
}

void android::widget::AbsSeekBar::setThumbOffset(jint a0)
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(5),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(5),
		void
	>(get_jobject(), a0);
}

void android::widget::AbsSeekBar::setKeyProgressIncrement(jint a0)
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(6),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(6),
		void
	>(get_jobject(), a0);
}

jint android::widget::AbsSeekBar::getKeyProgressIncrement()
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(7),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(7),
		jint
	>(get_jobject());
}

void android::widget::AbsSeekBar::setMax(jint a0)
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(8),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(8),
		void
	>(get_jobject(), a0);
}

jboolean android::widget::AbsSeekBar::onTouchEvent(local_ref< android::view::MotionEvent > const &a0)
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(14),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(14),
		jboolean
	>(get_jobject(), a0);
}

jboolean android::widget::AbsSeekBar::onKeyDown(jint a0, local_ref< android::view::KeyEvent > const &a1)
{
	return call_method<
		android::widget::AbsSeekBar::J2CPP_CLASS_NAME,
		android::widget::AbsSeekBar::J2CPP_METHOD_NAME(15),
		android::widget::AbsSeekBar::J2CPP_METHOD_SIGNATURE(15),
		jboolean
	>(get_jobject(), a0, a1);
}

J2CPP_DEFINE_CLASS(android::widget::AbsSeekBar,"android/widget/AbsSeekBar")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,0,"<init>","(Landroid/content/Context;)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,1,"<init>","(Landroid/content/Context;Landroid/util/AttributeSet;)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,2,"<init>","(Landroid/content/Context;Landroid/util/AttributeSet;I)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,3,"setThumb","(Landroid/graphics/drawable/Drawable;)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,4,"getThumbOffset","()I")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,5,"setThumbOffset","(I)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,6,"setKeyProgressIncrement","(I)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,7,"getKeyProgressIncrement","()I")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,8,"setMax","(I)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,9,"verifyDrawable","(Landroid/graphics/drawable/Drawable;)Z")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,10,"drawableStateChanged","()V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,11,"onSizeChanged","(IIII)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,12,"onDraw","(Landroid/graphics/Canvas;)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,13,"onMeasure","(II)V")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,14,"onTouchEvent","(Landroid/view/MotionEvent;)Z")
J2CPP_DEFINE_METHOD(android::widget::AbsSeekBar,15,"onKeyDown","(ILandroid/view/KeyEvent;)Z")

} //namespace j2cpp

#endif //J2CPP_ANDROID_WIDGET_ABSSEEKBAR_HPP_IMPL

#endif //J2CPP_INCLUDE_IMPLEMENTATION


text:
using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class MOMHitBox : HitBox
{
    [SyncVar]
    public float waitTime;

    protected override void Start()
    {
        base.Start();
        StartCoroutine(MoveOn());
    }

    IEnumerator MoveOn()
    {
        var rigid = GetComponent<Rigidbody>();
        yield return new WaitForSeconds(waitTime);
        for (var i = 0; i < 60; i++)
        {
            rigid.AddForce(transform.up * 0.3f, ForceMode.VelocityChange);
            yield return new WaitForFixedUpdate();
        }
    }

    public override void OnTakeEffect(bool isServer, GameObject target, bool isBlocked)
    {
        base.OnTakeEffect(isServer, target, isBlocked);

        var opponent = target.GetComponent<BattlerGeneric>();
        var dist = GetHitDir(target);

        if (isBlocked)
        {
            opponent.DealDamage(isBlocked, 400, 1.3f, hurtStyle, player.GetComponent<PlayerGeneric>());
            target.GetComponent<MovingGeneric>().AddDisplace(dist * 4.0f, 0.5f);
        }
        else
        {
            opponent.DealDamage(isBlocked, 1500, 0.5f, hurtStyle, player.GetComponent<PlayerGeneric>());
            target.GetComponent<MovingGeneric>().AddDisplace(dist * 5.0f, 0.5f);
        }

        KillSelf();
    }
}


text:
/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.google.calendar;

import java.util.Map;

import org.apache.camel.CamelContext;
import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
import org.apache.camel.spi.PropertyConfigurerGetter;
import org.apache.camel.spi.ConfigurerStrategy;
import org.apache.camel.spi.GeneratedPropertyConfigurer;
import org.apache.camel.util.CaseInsensitiveMap;
import org.apache.camel.support.component.PropertyConfigurerSupport;

/**
 * Generated by camel build tools - do NOT edit this file!
 */
@SuppressWarnings("unchecked")
public class GoogleCalendarComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, ExtendedPropertyConfigurerGetter {

    private static final Map<String, Object> ALL_OPTIONS;
    static {
        Map<String, Object> map = new CaseInsensitiveMap();
        map.put("applicationName", java.lang.String.class);
        map.put("clientId", java.lang.String.class);
        map.put("configuration", org.apache.camel.component.google.calendar.GoogleCalendarConfiguration.class);
        map.put("delegate", java.lang.String.class);
        map.put("scopes", java.util.List.class);
        map.put("bridgeErrorHandler", boolean.class);
        map.put("lazyStartProducer", boolean.class);
        map.put("autowiredEnabled", boolean.class);
        map.put("clientFactory", org.apache.camel.component.google.calendar.GoogleCalendarClientFactory.class);
        map.put("accessToken", java.lang.String.class);
        map.put("clientSecret", java.lang.String.class);
        map.put("emailAddress", java.lang.String.class);
        map.put("keyResource", java.lang.String.class);
        map.put("p12FileName", java.lang.String.class);
        map.put("refreshToken", java.lang.String.class);
        map.put("user", java.lang.String.class);
        ALL_OPTIONS = map;
    }

    private org.apache.camel.component.google.calendar.GoogleCalendarConfiguration getOrCreateConfiguration(GoogleCalendarComponent target) {
        if (target.getConfiguration() == null) {
            target.setConfiguration(new org.apache.camel.component.google.calendar.GoogleCalendarConfiguration());
        }
        return target.getConfiguration();
    }

    @Override
    public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
        GoogleCalendarComponent target = (GoogleCalendarComponent) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "accesstoken":
        case "accessToken": getOrCreateConfiguration(target).setAccessToken(property(camelContext, java.lang.String.class, value)); return true;
        case "applicationname":
        case "applicationName": getOrCreateConfiguration(target).setApplicationName(property(camelContext, java.lang.String.class, value)); return true;
        case "autowiredenabled":
        case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true;
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
        case "clientfactory":
        case "clientFactory": target.setClientFactory(property(camelContext, org.apache.camel.component.google.calendar.GoogleCalendarClientFactory.class, value)); return true;
        case "clientid":
        case "clientId": getOrCreateConfiguration(target).setClientId(property(camelContext, java.lang.String.class, value)); return true;
        case "clientsecret":
        case "clientSecret": getOrCreateConfiguration(target).setClientSecret(property(camelContext, java.lang.String.class, value)); return true;
        case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.google.calendar.GoogleCalendarConfiguration.class, value)); return true;
        case "delegate": getOrCreateConfiguration(target).setDelegate(property(camelContext, java.lang.String.class, value)); return true;
        case "emailaddress":
        case "emailAddress": getOrCreateConfiguration(target).setEmailAddress(property(camelContext, java.lang.String.class, value)); return true;
        case "keyresource":
        case "keyResource": getOrCreateConfiguration(target).setKeyResource(property(camelContext, java.lang.String.class, value)); return true;
        case "lazystartproducer":
        case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
        case "p12filename":
        case "p12FileName": getOrCreateConfiguration(target).setP12FileName(property(camelContext, java.lang.String.class, value)); return true;
        case "refreshtoken":
        case "refreshToken": getOrCreateConfiguration(target).setRefreshToken(property(camelContext, java.lang.String.class, value)); return true;
        case "scopes": getOrCreateConfiguration(target).setScopes(property(camelContext, java.util.List.class, value)); return true;
        case "user": getOrCreateConfiguration(target).setUser(property(camelContext, java.lang.String.class, value)); return true;
        default: return false;
        }
    }

    @Override
    public Map<String, Object> getAllOptions(Object target) {
        return ALL_OPTIONS;
    }

    @Override
    public Class<?> getOptionType(String name, boolean ignoreCase) {
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "accesstoken":
        case "accessToken": return java.lang.String.class;
        case "applicationname":
        case "applicationName": return java.lang.String.class;
        case "autowiredenabled":
        case "autowiredEnabled": return boolean.class;
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": return boolean.class;
        case "clientfactory":
        case "clientFactory": return org.apache.camel.component.google.calendar.GoogleCalendarClientFactory.class;
        case "clientid":
        case "clientId": return java.lang.String.class;
        case "clientsecret":
        case "clientSecret": return java.lang.String.class;
        case "configuration": return org.apache.camel.component.google.calendar.GoogleCalendarConfiguration.class;
        case "delegate": return java.lang.String.class;
        case "emailaddress":
        case "emailAddress": return java.lang.String.class;
        case "keyresource":
        case "keyResource": return java.lang.String.class;
        case "lazystartproducer":
        case "lazyStartProducer": return boolean.class;
        case "p12filename":
        case "p12FileName": return java.lang.String.class;
        case "refreshtoken":
        case "refreshToken": return java.lang.String.class;
        case "scopes": return java.util.List.class;
        case "user": return java.lang.String.class;
        default: return null;
        }
    }

    @Override
    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
        GoogleCalendarComponent target = (GoogleCalendarComponent) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "accesstoken":
        case "accessToken": return getOrCreateConfiguration(target).getAccessToken();
        case "applicationname":
        case "applicationName": return getOrCreateConfiguration(target).getApplicationName();
        case "autowiredenabled":
        case "autowiredEnabled": return target.isAutowiredEnabled();
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": return target.isBridgeErrorHandler();
        case "clientfactory":
        case "clientFactory": return target.getClientFactory();
        case "clientid":
        case "clientId": return getOrCreateConfiguration(target).getClientId();
        case "clientsecret":
        case "clientSecret": return getOrCreateConfiguration(target).getClientSecret();
        case "configuration": return target.getConfiguration();
        case "delegate": return getOrCreateConfiguration(target).getDelegate();
        case "emailaddress":
        case "emailAddress": return getOrCreateConfiguration(target).getEmailAddress();
        case "keyresource":
        case "keyResource": return getOrCreateConfiguration(target).getKeyResource();
        case "lazystartproducer":
        case "lazyStartProducer": return target.isLazyStartProducer();
        case "p12filename":
        case "p12FileName": return getOrCreateConfiguration(target).getP12FileName();
        case "refreshtoken":
        case "refreshToken": return getOrCreateConfiguration(target).getRefreshToken();
        case "scopes": return getOrCreateConfiguration(target).getScopes();
        case "user": return getOrCreateConfiguration(target).getUser();
        default: return null;
        }
    }

    @Override
    public Object getCollectionValueType(Object target, String name, boolean ignoreCase) {
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "scopes": return java.lang.String.class;
        default: return null;
        }
    }
}


text:
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'yii\\swiftmailer\\' => array($vendorDir . '/yiisoft/yii2-swiftmailer'),
    'yii\\resque\\' => array($baseDir . '/craryprimitiveman/yii2-resque'),
    'yii\\redis\\' => array($vendorDir . '/yiisoft/yii2-redis'),
    'yii\\mongodb\\' => array($vendorDir . '/yiisoft/yii2-mongodb'),
    'yii\\gii\\' => array($vendorDir . '/yiisoft/yii2-gii'),
    'yii\\faker\\' => array($vendorDir . '/yiisoft/yii2-faker'),
    'yii\\debug\\' => array($vendorDir . '/yiisoft/yii2-debug'),
    'yii\\composer\\' => array($vendorDir . '/yiisoft/yii2-composer'),
    'yii\\codeception\\' => array($vendorDir . '/yiisoft/yii2-codeception'),
    'yii\\bootstrap\\' => array($vendorDir . '/yiisoft/yii2-bootstrap'),
    'yii\\apidoc\\' => array($vendorDir . '/yiisoft/yii2-apidoc'),
    'yii\\' => array($vendorDir . '/yiisoft/yii2'),
    'cebe\\markdown\\latex\\' => array($vendorDir . '/cebe/markdown-latex'),
    'cebe\\markdown\\' => array($vendorDir . '/cebe/markdown'),
    'cebe\\jssearch\\' => array($vendorDir . '/cebe/js-search/lib'),
    'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
);


text:
Simple helper for inserting new css rules into page (not into element).

## Help

Unfortunately I don't have any more time to maintain this repository :-(

Don't you want to save me and this project by taking over it?

![sad cat](https://raw.githubusercontent.com/sakren/sakren.github.io/master/images/sad-kitten.jpg)

## Installation

```
$ npm install insert-style
```

## Usage

```
var insert = require('insert-style');

insert('.title', 'color: red; border: 1px solid blue;');
```

## Changelog

* 1.0.1
	+ Move under Carrooi organization
	+ Abandon package

* 1.0.0
	+ First version


text:
// typeinfo/NullRobot.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
// Using a dynamic proxy to create an Optional
import java.lang.reflect.*;
import java.util.*;
import java.util.stream.*;
import onjava.*;

class NullRobotProxyHandler
implements InvocationHandler {
  private String nullName;
  private Robot proxied = new NRobot();
  NullRobotProxyHandler(Class<? extends Robot> type) {
    nullName = type.getSimpleName() + " NullRobot";
  }
  private class NRobot implements Null, Robot {
    @Override
    public String name() { return nullName; }
    @Override
    public String model() { return nullName; }
    @Override
    public List<Operation> operations() {
      return Collections.emptyList();
    }
  }
  @Override
  public Object
  invoke(Object proxy, Method method, Object[] args)
  throws Throwable {
    return method.invoke(proxied, args);
  }
}

public class NullRobot {
  public static Robot
  newNullRobot(Class<? extends Robot> type) {
    return (Robot)Proxy.newProxyInstance(
      NullRobot.class.getClassLoader(),
      new Class[]{ Null.class, Robot.class },
      new NullRobotProxyHandler(type));
  }
  public static void main(String[] args) {
    Stream.of(
      new SnowRemovalRobot("SnowBee"),
      newNullRobot(SnowRemovalRobot.class)
    ).forEach(Robot::test);
  }
}
/* Output:
Robot name: SnowBee
Robot model: SnowBot Series 11
SnowBee can shovel snow
SnowBee shoveling snow
SnowBee can chip ice
SnowBee chipping ice
SnowBee can clear the roof
SnowBee clearing roof
[Null Robot]
Robot name: SnowRemovalRobot NullRobot
Robot model: SnowRemovalRobot NullRobot
*/


text:
//
//  MissWidget.h
//  JumpJump
//
//  Created by Cary Zheng on 14-3-27.
//
//

#ifndef __JumpJump__MissWidget__
#define __JumpJump__MissWidget__

#include "cocos2d.h"

class MissWidget : public cocos2d::Node
{
public:
    CREATE_FUNC(MissWidget);

    virtual bool init();

    void addMissItem();
    int getMissItemNum();

private:
    cocos2d::Vector<cocos2d::Sprite*> _missItems;
};

#endif /* defined(__JumpJump__MissWidget__) */


text:
..
  Licensed under the Apache License, Version 2.0 (the "License"); you may
  not use this file except in compliance with the License. You may obtain
  a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  License for the specific language governing permissions and limitations
  under the License.

=================
Managing Policies
=================

A **policy type**  can be treated as the meta-type of a `Policy` object. A
registry of policy types is built when the Cluster service starts. When
creating a `Policy` object, you will indicate the policy type used in its
`spec` property.

List Policies
~~~~~~~~~~~~~

To examine the list of policies:

.. literalinclude:: ../../examples/cluster/policy.py
   :pyobject: list_policies

When listing policies, you can specify the sorting option using the ``sort``
parameter and you can do pagination using the ``limit`` and ``marker``
parameters.

Full example: `manage policy`_

Create Policy
~~~~~~~~~~~~~

When creating a policy, you will provide a dictionary with keys and values
according to the policy type referenced.

.. literalinclude:: ../../examples/cluster/policy.py
   :pyobject: create_policy

Optionally, you can specify a ``metadata`` keyword argument that contains some
key-value pairs to be associated with the policy.

Full example: `manage policy`_

Find Policy
~~~~~~~~~~~

To find a policy based on its name or ID:

.. literalinclude:: ../../examples/cluster/policy.py
   :pyobject: find_policy

Full example: `manage policy`_

Get Policy
~~~~~~~~~~

To get a policy based on its name or ID:

.. literalinclude:: ../../examples/cluster/policy.py
   :pyobject: get_policy

Full example: `manage policy`_

Update Policy
~~~~~~~~~~~~~

After a policy is created, most of its properties are immutable. Still, you
can update a policy's ``name`` and/or ``metadata``.

.. literalinclude:: ../../examples/cluster/policy.py
   :pyobject: update_policy

The Cluster service doesn't allow updating the ``spec`` of a policy. The only
way to achieve that is to create a new policy.

Full example: `manage policy`_

Delete Policy
~~~~~~~~~~~~~

A policy can be deleted after creation, provided that it is not referenced
by any active clusters or nodes. If you attempt to delete a policy that is
still in use, you will get an error message.

.. literalinclude:: ../../examples/cluster/policy.py
   :pyobject: delete_policy

.. _manage policy: http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/examples/cluster/policy.py


text: ui theme for atom


text:
import { ArticleManager } from "./ArticleManager";
import { AsyncResult } from "./AsyncResult";
import { DataStore } from "./dao/Storage";
import {
  ColoringRuleSource,
  FilteringType,
  getFilteringTypeId,
  getFilteringTypes,
  HTMLElementType,
  KeywordMatchingArea,
  KeywordMatchingMethod,
  SortingType,
} from "./DataTypes";
import { FeedlyPage } from "./FeedlyPage";
import { HTMLGlobalSettings } from "./HTMLGlobalSettings";
import {
  HTMLSubscriptionManager,
  HTMLSubscriptionSetting,
} from "./HTMLSubscription";
import { KeywordManager } from "./KeywordManager";
import { SettingsManager } from "./SettingsManager";
import { Subscription } from "./Subscription";
import { ColoringRule } from "./SubscriptionDTO";
import {
  $id,
  bindMarkup,
  currentPageNotSupported,
  isChecked,
  onClick,
  setChecked,
} from "./Utils";

export class UIManager {
  page: FeedlyPage;
  settingsManager: SettingsManager;
  keywordManager: KeywordManager;
  htmlSubscriptionManager: HTMLSubscriptionManager;
  articleManager: ArticleManager;
  subscription: Subscription;
  autoLoadAllArticlesCB: HTMLGlobalSettings<boolean>;
  loadByBatchEnabledCB: HTMLGlobalSettings<boolean>;
  batchSizeInput: HTMLGlobalSettings<number>;
  globalSettingsEnabledCB: HTMLGlobalSettings<boolean>;
  crossCheckDuplicatesCB: HTMLGlobalSettings<boolean>;
  crossCheckDuplicatesDaysInput: HTMLGlobalSettings<number>;
  globalSettings: HTMLGlobalSettings<any>[];
  containsReadArticles = false;
  forceReloadGlobalSettings = false;

  keywordToId = {};
  idCount = 1;
  sortingSelectId = "SortingType";

  htmlSettingsElements = [
    {
      type: HTMLElementType.SelectBox,
      ids: [
        this.sortingSelectId,
        "KeywordMatchingMethod",
        this.getKeywordMatchingSelectId(false),
      ],
    },
    {
      type: HTMLElementType.ColorInput,
      ids: ["HighlightDuplicatesColor"],
    },
    {
      type: HTMLElementType.CheckBox,
      ids: [
        "FilteringEnabled",
        "RestrictingEnabled",
        "SortingEnabled",
        "PinHotToTop",
        "KeepUnread_AdvancedControlsReceivedPeriod",
        "Hide_AdvancedControlsReceivedPeriod",
        "ShowIfHot_AdvancedControlsReceivedPeriod",
        "MarkAsReadVisible_AdvancedControlsReceivedPeriod",
        "OpenAndMarkAsRead",
        "MarkAsReadAboveBelow",
        "HideWhenMarkAboveBelow",
        "HideAfterRead",
        "ReplaceHiddenWithGap",
        "AlwaysUseDefaultMatchingAreas",
        "VisualOpenAndMarkAsRead",
        "TitleOpenAndMarkAsRead",
        "MarkAsReadFiltered",
        "AutoRefreshEnabled",
        "OpenCurrentFeedArticles",
        "OpenCurrentFeedArticlesUnreadOnly",
        "MarkAsReadOnOpenCurrentFeedArticles",
        "DisplayDisableAllFiltersButton",
        "HideDuplicates",
        "MarkAsReadDuplicates",
        "HighlightDuplicates",
        "Enabled_FilteringByReadingTime",
        "KeepUnread_FilteringByReadingTime",
        "DisablePageOverrides",
      ],
    },
    {
      type: HTMLElementType.NumberInput,
      ids: [
        "MinPopularity_AdvancedControlsReceivedPeriod",
        "AutoRefreshMinutes",
        "MaxOpenCurrentFeedArticles",
        "ThresholdMinutes_FilteringByReadingTime",
        "WordsPerMinute_FilteringByReadingTime",
      ],
    },
  ];

  settingsDivContainerId = this.getHTMLId("settingsDivContainer");
  closeBtnId = this.getHTMLId("CloseSettingsBtn");

  init() {
    return new AsyncResult<any>((p) => {
      this.settingsManager = new SettingsManager(this);
      this.keywordManager = new KeywordManager();
      this.page = new FeedlyPage();
      this.htmlSubscriptionManager = new HTMLSubscriptionManager(this);
      this.settingsManager.init().then(() => {
        this.articleManager = new ArticleManager(
          this.settingsManager,
          this.keywordManager,
          this.page
        );
        this.autoLoadAllArticlesCB = new HTMLGlobalSettings<boolean>(
          ext.autoLoadAllArticlesId,
          true,
          this
        );
        this.globalSettingsEnabledCB = new HTMLGlobalSettings<boolean>(
          "globalSettingsEnabled",
          true,
          this,
          true,
          false
        );
        this.loadByBatchEnabledCB = new HTMLGlobalSettings<boolean>(
          ext.loadByBatchEnabledId,
          false,
          this
        );
        this.batchSizeInput = new HTMLGlobalSettings<number>(
          ext.batchSizeId,
          200,
          this
        );
        const crossCheckSettings =
          this.settingsManager.getCrossCheckDuplicatesSettings();
        this.crossCheckDuplicatesCB = new HTMLGlobalSettings<boolean>(
          "CrossCheckDuplicates",
          false,
          this,
          false,
          false
        );
        this.crossCheckDuplicatesDaysInput = new HTMLGlobalSettings<number>(
          "CrossCheckDuplicatesDays",
          3,
          this,
          false,
          false
        );
        this.crossCheckDuplicatesCB.setAdditionalChangeCallback((val) =>
          crossCheckSettings.setEnabled(val)
        );
        this.crossCheckDuplicatesDaysInput.setAdditionalChangeCallback((val) =>
          crossCheckSettings.setDays(val)
        );
        this.globalSettings = [
          this.autoLoadAllArticlesCB,
          this.loadByBatchEnabledCB,
          this.batchSizeInput,
          this.globalSettingsEnabledCB,
          this.crossCheckDuplicatesCB,
          this.crossCheckDuplicatesDaysInput,
        ];
        this.initGlobalSettings(this.globalSettings.slice(0)).then(() => {
          this.page.initAutoLoad();
          this.updateSubscription().then(() => {
            this.initUI();
            this.registerSettings();
            this.postUpdate();
            this.initSettingsCallbacks();
            this.postInit();
            p.done();
          }, this);
        }, this);
      }, this);
    }, this);
  }

  initGlobalSettings(settings: HTMLGlobalSettings<any>[]): AsyncResult<any> {
    if (settings.length == 1) {
      return settings[0].init();
    } else {
      return new AsyncResult<any>((p) => {
        settings
          .pop()
          .init()
          .then(() => {
            this.initGlobalSettings(settings).chain(p);
          }, this);
      }, this);
    }
  }

  resetGlobalSettings(settings: HTMLGlobalSettings<any>[]): AsyncResult<any> {
    if (settings.length == 1) {
      return settings[0].reset();
    } else {
      return new AsyncResult<any>((p) => {
        settings
          .pop()
          .reset()
          .then(() => {
            this.resetGlobalSettings(settings).chain(p);
          }, this);
      }, this);
    }
  }

  updatePage() {
    if (currentPageNotSupported()) {
      return;
    }
    try {
      this.resetPage();
      this.updateSubscription().then(this.postUpdate, this);
    } catch (err) {
      console.log(err);
    }
  }

  postUpdate() {
    if (currentPageNotSupported()) {
      return;
    }
    this.updateMenu();
    setTimeout(() => {
      this.refreshFilteringAndSorting();
    }, 500);
    if (this.subscription.isAutoRefreshEnabled()) {
      setInterval(() => {
        window.location.reload();
      }, this.subscription.getAutoRefreshTime());
    }
  }

  resetPage() {
    this.containsReadArticles = false;
    this.articleManager.resetArticles();
  }

  refreshPage() {
    this.updatePage();
    this.refreshFilteringAndSorting();
  }

  refreshFilteringAndSorting() {
    this.page.reset();
    this.page.update(this.subscription);
    this.articleManager.refreshArticles();
  }

  updateSubscription(): AsyncResult<any> {
    return new AsyncResult<any>((p) => {
      if (currentPageNotSupported()) {
        p.done();
        return;
      }
      var globalSettingsEnabled = this.globalSettingsEnabledCB.getValue();
      this.settingsManager
        .loadSubscription(globalSettingsEnabled, this.forceReloadGlobalSettings)
        .then((sub) => {
          this.subscription = sub;
          p.done();
        }, this);
    }, this);
  }

  updateMenu() {
    this.htmlSubscriptionManager.update();
    getFilteringTypes().forEach((type) => {
      this.prepareFilteringList(type);
    });
    this.updateSettingsControls();

    // Additional sorting types
    $("#FFnS_AdditionalSortingTypes").empty();
    this.subscription.getAdditionalSortingTypes().forEach((s) => {
      var id = this.registerAdditionalSortingType();
      $id(id).val(s);
    });

    // coloring rules
    $("#FFnS_ColoringRules").empty();
    this.subscription
      .getColoringRules()
      .forEach(this.registerColoringRule, this);
    this.refreshColoringRuleArrows();

    this.updateSettingsModeTitle();
    this.updateFilteringKeywordMatchingSelects();
  }

  updateSettingsModeTitle() {
    var title = this.globalSettingsEnabledCB.getValue()
      ? "Global"
      : "Subscription";
    title += " settings";
    $id("FFnS_settings_mode_title").text(title);
  }

  updateSettingsControls() {
    $id("FFnS_SettingsControls_SelectedSubscription").html(
      this.getImportOptionsHTML()
    );
    var linkedSubContainer = $id("FFnS_SettingsControls_LinkedSubContainer");
    var linkedSub = $id("FFnS_SettingsControls_LinkedSub");
    if (
      (!this.globalSettingsEnabledCB.getValue() &&
        this.subscription.getURL() !==
          this.settingsManager.getActualSubscriptionURL()) ||
      (this.globalSettingsEnabledCB.getValue() &&
        !this.settingsManager.isGlobalMode())
    ) {
      linkedSubContainer.css("display", "");
      linkedSub.text(
        "Subscription currently linked to: " + this.subscription.getURL()
      );
    } else {
      linkedSubContainer.css("display", "none");
      linkedSub.text("");
    }
  }

  getSettingsControlsSelectedSubscription(): string {
    return $id("FFnS_SettingsControls_SelectedSubscription").val() as string;
  }

  initUI() {
    this.initSettingsMenu();
    this.initShowSettingsBtns();
    this.globalSettings.forEach((globalSetting) => {
      globalSetting.initUI();
    });
  }

  initSettingsMenu() {
    var marginElementClass = this.getHTMLId("margin_element");
    var tabsMenuId = this.getHTMLId("tabs_menu");
    var tabsContentContainerId = this.getHTMLId("tabs_content");

    var settingsHtml = bindMarkup(templates.settingsHTML, [
      {
        name: "SortingSelect",
        value: this.getSortingSelectHTML(this.getHTMLId(this.sortingSelectId)),
      },
      {
        name: "FilteringList.Type.FilteredOut",
        value: this.getFilteringListHTML(FilteringType.FilteredOut),
      },
      {
        name: "FilteringList.Type.RestrictedOn",
        value: this.getFilteringListHTML(FilteringType.RestrictedOn),
      },
      {
        name: "ImportMenu.SubscriptionOptions",
        value: this.getImportOptionsHTML(),
      },
      { name: "closeIconLink", value: ext.closeIconLink },
      { name: "plusIconLink", value: ext.plusIconLink },
      { name: "eraseIconLink", value: ext.eraseIconLink },
      {
        name: "DefaultKeywordMatchingArea",
        value: this.getKeywordMatchingSelectHTML("multiple required", false),
      },
      {
        name: "KeywordMatchingMethod",
        value: this.getKeywordMatchingMethod(true),
      },
    ]);
    $("body").prepend(settingsHtml);

    // set up tabs
    $("#" + tabsMenuId + " a").click(function (event) {
      event.preventDefault();
      $(this).parent().addClass("current");
      $(this).parent().siblings().removeClass("current");
      var tab = $(this).attr("href");
      $("#" + tabsContentContainerId + " > div")
        .not(tab)
        .css("display", "none");
      $(tab).show();
      focusKeywordsInput();
    });
    $("#" + tabsContentContainerId + " > div")
      .first()
      .show();

    $(document).keyup((event) => {
      if (event.key === "Escape") {
        $id(this.settingsDivContainerId).hide();
      }
      this.checkKeywordsInputEnter(event);
    });

    $("#FFnS_settingsDivContainer").click((event) => {
      if (event.target.id === "FFnS_settingsDivContainer") {
        $id(this.settingsDivContainerId).hide();
      }
    });
  }

  checkKeywordsInputEnter(event: JQuery.KeyUpEvent) {
    if (event.key !== "Enter") {
      return;
    }
    keywordInputs.forEach((e) => {
      const { input, type } = e;
      if ($(input).is(":focus")) {
        this.addKeyword($(input), type);
      }
    });
  }

  getSortingSelectHTML(id: string): string {
    return bindMarkup(templates.sortingSelectHTML, [
      { name: "Id", value: id },
      { name: "PopularityDesc", value: SortingType.PopularityDesc },
      { name: "TitleAsc", value: SortingType.TitleAsc },
      { name: "PopularityAsc", value: SortingType.PopularityAsc },
      { name: "TitleDesc", value: SortingType.TitleDesc },
      { name: "PublishDateNewFirst", value: SortingType.PublishDateNewFirst },
      { name: "PublishDateOldFirst", value: SortingType.PublishDateOldFirst },
      { name: "PublishDayNewFirst", value: SortingType.PublishDayNewFirst },
      { name: "PublishDayOldFirst", value: SortingType.PublishDayOldFirst },
      { name: "ReceivedDateNewFirst", value: SortingType.ReceivedDateNewFirst },
      { name: "ReceivedDateOldFirst", value: SortingType.ReceivedDateOldFirst },
      { name: "SourceAsc", value: SortingType.SourceAsc },
      { name: "SourceDesc", value: SortingType.SourceDesc },
      {
        name: "SourceNewestReceiveDate",
        value: SortingType.SourceNewestReceiveDate,
      },
      { name: "Random", value: SortingType.Random },
    ]);
  }

  getFilteringListHTML(type: FilteringType): string {
    var ids = this.getIds(type);
    var filteringListHTML = bindMarkup(templates.filteringListHTML, [
      { name: "FilteringTypeTabId", value: this.getFilteringTypeTabId(type) },
      { name: "inputId", value: this.getHTMLId(ids.inputId) },
      { name: "plusBtnId", value: this.getHTMLId(ids.plusBtnId) },
      { name: "eraseBtnId", value: this.getHTMLId(ids.eraseBtnId) },
      { name: "filetringKeywordsId", value: ids.filetringKeywordsId },
      {
        name: "FilteringKeywordMatchingArea",
        value: this.getKeywordMatchingSelectHTML("filtering", true, type),
      },
    ]);
    return filteringListHTML;
  }

  getKeywordMatchingSelectHTML(
    attributes: string,
    includeDefaultOption: boolean,
    type?: FilteringType,
    selectId?: string
  ): string {
    var defaultOption = includeDefaultOption
      ? bindMarkup(templates.emptyOptionHTML, [
          { name: "value", value: "-- area (optional) --" },
        ])
      : "";
    var filteringListHTML = bindMarkup(templates.keywordMatchingSelectHTML, [
      {
        name: "Id",
        value: selectId || this.getKeywordMatchingSelectId(true, type),
      },
      { name: "attributes", value: attributes },
      { name: "defaultOption", value: defaultOption },
      { name: "selectFirst", value: includeDefaultOption ? "" : "selected" },
      { name: "KeywordMatchingArea.Title", value: KeywordMatchingArea.Title },
      { name: "KeywordMatchingArea.Body", value: KeywordMatchingArea.Body },
      { name: "KeywordMatchingArea.Author", value: KeywordMatchingArea.Author },
    ]);
    return filteringListHTML;
  }

  getKeywordMatchingSelectId(html: boolean, type?: FilteringType) {
    var suffix = type == undefined ? "s" : "_" + FilteringType[type];
    var id = "KeywordMatchingArea" + suffix;
    return html ? this.getHTMLId(id) : id;
  }

  getKeywordMatchingMethod(fullSize: boolean, id?: string) {
    id = id || "FFnS_KeywordMatchingMethod";
    return bindMarkup(templates.keywordMatchingMethodHTML, [
      { name: "id", value: id },
      {
        name: "KeywordMatchingMethod.Simple",
        value: KeywordMatchingMethod.Simple,
      },
      { name: "KeywordMatchingMethod.Word", value: KeywordMatchingMethod.Word },
      {
        name: "KeywordMatchingMethod.RegExp",
        value: KeywordMatchingMethod.RegExp,
      },
      { name: "size", value: fullSize ? 'size="3"' : "" },
    ]);
  }

  getImportOptionsHTML(): string {
    var optionsHTML = "";
    var urls = this.settingsManager.getAllSubscriptionURLs();
    urls.forEach((url) => {
      optionsHTML += bindMarkup(templates.optionHTML, [
        { name: "value", value: url },
      ]);
    });
    return optionsHTML;
  }

  initShowSettingsBtns() {
    var this_ = this;
    NodeCreationObserver.onCreation(
      ext.settingsBtnPredecessorSelector,
      (predecessor) => {
        if (
          currentPageNotSupported() ||
          $(predecessor).parent().find(".ShowSettingsBtn").length > 0
        ) {
          return;
        }
        var settingsBtn = $("<div>", {
          title: "Feedly filtering and sorting",
          style: "cursor: pointer;",
          class: "ShowSettingsBtn"
        });
        $(predecessor).after(settingsBtn);
        $(settingsBtn).click(function () {
          $id(this_.settingsDivContainerId).toggle();
          focusKeywordsInput();
        });
      }
    );
  }

  registerSettings() {
    this.htmlSettingsElements.forEach((element) => {
      this.htmlSubscriptionManager.registerSettings(element.ids, element.type);
    });
    this.htmlSubscriptionManager.registerSettings(
      [
        "Hours_AdvancedControlsReceivedPeriod",
        "Days_AdvancedControlsReceivedPeriod",
      ],
      HTMLElementType.NumberInput,
      {
        update: (subscriptionSetting: HTMLSubscriptionSetting) => {
          var advancedControlsReceivedPeriod =
            subscriptionSetting.manager.subscription.getAdvancedControlsReceivedPeriod();
          var maxHours = advancedControlsReceivedPeriod.maxHours;
          var advancedPeriodHours = maxHours % 24;
          var advancedPeriodDays = Math.floor(maxHours / 24);
          if (subscriptionSetting.id.indexOf("Hours") != -1) {
            $id(subscriptionSetting.htmlId).val(advancedPeriodHours);
          } else {
            $id(subscriptionSetting.htmlId).val(advancedPeriodDays);
          }
        },
      }
    );
    this.htmlSubscriptionManager.registerSelectBoxBoolean(
      ext.markAsReadAboveBelowReadId,
      (subscription: Subscription) => {
        return subscription.isMarkAsReadAboveBelowRead();
      }
    );
    this.htmlSubscriptionManager.registerSelectBoxBoolean(
      "FilterLong_FilteringByReadingTime",
      (subscription: Subscription) => {
        return subscription.getFilteringByReadingTime().filterLong;
      }
    );
  }

  initSettingsCallbacks() {
    this.htmlSubscriptionManager.setUpCallbacks();

    $id(this.closeBtnId).click(() => {
      $id(this.settingsDivContainerId).toggle();
    });

    let importSettings = $id("FFnS_ImportSettings");
    importSettings.change(() => {
      this.settingsManager.importAllSettings(importSettings.prop("files")[0]);
    });

    $id("FFnS_ExportSettings").click(() => {
      this.settingsManager.exportAllSettings();
    });

    $id("FFnS_SettingsControls_ImportFromOtherSub").click(() => {
      this.importFromOtherSub();
    });

    $id("FFnS_SettingsControls_LinkToSub").click(() => {
      this.linkToSub();
    });

    $id("FFnS_SettingsControls_UnlinkFromSub").click(() => {
      this.unlinkFromSub();
    });

    $id("FFnS_SettingsControls_DeleteSub").click(() => {
      this.deleteSub();
    });

    $id("FFnS_AddSortingType").click(() => {
      var id = this.registerAdditionalSortingType();
      this.subscription.addAdditionalSortingType($id(id).val() as SortingType);
      this.refreshFilteringAndSorting();
    });

    $id("FFnS_EraseSortingTypes").click(() => {
      this.subscription.setAdditionalSortingTypes([]);
      $("#FFnS_AdditionalSortingTypes").empty();
      this.refreshFilteringAndSorting();
    });

    onClick($id("FFnS_AddColoringRule"), () => {
      let cr = new ColoringRule();
      this.registerColoringRule(cr);
      this.subscription.addColoringRule(cr);
      this.articleManager.refreshColoring();
      this.refreshColoringRuleArrows();
    });

    onClick($id("FFnS_EraseColoringRules"), () => {
      this.subscription.setColoringRules([]);
      $id("FFnS_ColoringRules").empty();
      this.articleManager.refreshColoring();
    });

    this.setUpFilteringListEvents();

    $id("FFnS_AlwaysUseDefaultMatchingAreas").change(
      this.updateFilteringKeywordMatchingSelects
    );
  }

  updateFilteringKeywordMatchingSelects() {
    var selects = $(".FFnS_keywordMatchingSelect[filtering]");
    if (isChecked($($id("FFnS_AlwaysUseDefaultMatchingAreas")))) {
      selects.hide();
    } else {
      selects.show();
    }
  }

  postInit() {
    let syncManager = DataStore.getSyncStorageManager();
    let syncCBId = "FFnS_syncSettingsEnabled";
    if (syncManager) {
      setChecked(syncCBId, syncManager.isSyncEnabled());
      $id(syncCBId).change(() => {
        syncManager.setSyncEnabled(isChecked($id(syncCBId)));
        this.forceReloadGlobalSettings = true;
        this.resetGlobalSettings(this.globalSettings.slice(0)).then(() => {
          this.refreshPage();
          this.forceReloadGlobalSettings = false;
        }, this);
      });
    } else {
      $id(syncCBId).closest(".setting_group").remove();
    }

    const forceRefreshArticlesBtn = $("<button>", {
      id: ext.forceRefreshArticlesId,
      style: "display: none;",
    });
    $("body").append(forceRefreshArticlesBtn);
    forceRefreshArticlesBtn.click((e) => {
      e.preventDefault();
      this.articleManager.refreshArticles();
    });

    onClick(
      $(".icon-fx-light-mode-md-black, .icon-fx-dark-mode-md-black"),
      () => {
        setTimeout(() => this.articleManager.refreshColoring(), 100);
      }
    );
  }

  registerAdditionalSortingType(): string {
    var id = this.getHTMLId("AdditionalSortingType_" + this.idCount++);
    $("#FFnS_AdditionalSortingTypes").append(this.getSortingSelectHTML(id));
    $id(id).change(() => this.updateAdditionalSortingTypes());
    return id;
  }

  registerColoringRule(cr: ColoringRule) {
    var ids = new ColoringRuleHTMLIds(
      this.getHTMLId("ColoringRule_" + this.idCount++)
    );
    let self = this;
    // append template
    let html = bindMarkup(templates.coloringRuleHTML, [
      { name: "Id", value: ids.id },
      { name: "Color", value: cr.color },
      { name: "SpecificKeywords", value: ColoringRuleSource.SpecificKeywords },
      { name: "SourceTitle", value: ColoringRuleSource.SourceTitle },
      {
        name: "RestrictingKeywords",
        value: ColoringRuleSource.RestrictingKeywords,
      },
      {
        name: "FilteringKeywords",
        value: ColoringRuleSource.FilteringKeywords,
      },
      {
        name: "KeywordMatchingMethod",
        value: this.getKeywordMatchingMethod(
          false,
          ids.id + "_KeywordMatchingMethod"
        ),
      },
      {
        name: "KeywordMatchingArea",
        value: this.getKeywordMatchingSelectHTML(
          "required",
          false,
          null,
          ids.id + "_KeywordMatchingArea"
        ),
      },
      { name: "plusIconLink", value: ext.plusIconLink },
      { name: "eraseIconLink", value: ext.eraseIconLink },
      { name: "moveUpIconLink", value: ext.moveUpIconLink },
      { name: "moveDownIconLink", value: ext.moveDownIconLink },
    ]);
    $("#FFnS_ColoringRules").append(html);

    // set current values
    setChecked(ids.highlightId, cr.highlightAllTitle);
    $id(ids.sourceId).val(cr.source);
    $id(ids.matchingMethodId).val(cr.matchingMethod);
    $id(ids.matchingAreaId).val(cr.matchingArea);
    this.refreshColoringRuleSpecificKeywords(cr, ids);
    let refreshVisibility = () => {
      $id(ids.keywordGroupId).css(
        "display",
        cr.source == ColoringRuleSource.SpecificKeywords ? "" : "none"
      );
      let sourceTitle = cr.source == ColoringRuleSource.SourceTitle;
      $id(ids.matchingMethodContainerId).css(
        "display",
        sourceTitle ? "none" : ""
      );
      $id(ids.matchingAreaContainerId).css(
        "display",
        sourceTitle ? "none" : ""
      );
      $id(ids.optionsSpanId).css("display", sourceTitle ? "none" : "");
      $id(ids.sourceTitleInfosId).css("display", sourceTitle ? "" : "none");
    };
    new jscolor($id(ids.colorId)[0]);
    refreshVisibility();

    // change callbacks
    function onChange(
      id: string,
      cb: () => void,
      input?: boolean,
      click?: boolean,
      onchange?: boolean
    ) {
      function callback() {
        try {
          let noChange = cb.call(this);
          if (noChange) {
            return;
          }
          self.subscription.save();
          self.articleManager.refreshColoring();
          refreshVisibility();
        } catch (e) {
          console.log(e);
        }
      }
      click
        ? onClick($id(id), callback)
        : input
        ? ($id(id)[0].oninput = callback)
        : $id(id).change(callback);
      if (onchange) {
        $id(id)[0].onchange = callback;
      }
    }
    onChange(ids.highlightId, function () {
      cr.highlightAllTitle = isChecked($(this));
    });
    onChange(ids.sourceId, function () {
      cr.source = Number($(this).val());
    });
    onChange(ids.matchingMethodId, function () {
      cr.matchingMethod = Number($(this).val());
    });
    onChange(ids.matchingAreaId, function () {
      cr.matchingArea = Number($(this).val());
    });
    onChange(
      ids.colorId,
      function () {
        let str = $(this).val() as string;
        if (str.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i)) {
          cr.color = str.toUpperCase();
        } else {
          $(this).val(str);
          return true;
        }
      },
      true,
      false,
      true
    );
    onChange(
      ids.addBtnId,
      () => {
        let keyword = $id(ids.keywordInputId).val() as string;
        if (keyword != null && keyword !== "") {
          cr.specificKeywords.push(keyword);
        }
        $id(ids.keywordInputId).val("");
        this.refreshColoringRuleSpecificKeywords(cr, ids);
      },
      false,
      true
    );
    onChange(
      ids.eraseBtnId,
      () => {
        cr.specificKeywords = [];
        $id(ids.keywordContainerId).empty();
      },
      false,
      true
    );

    // Coloring rule management
    onClick($id(ids.removeColoringRuleId), () => {
      let rules = self.subscription.getColoringRules();
      let i = rules.indexOf(cr);
      if (i > -1) {
        rules.splice(i, 1);
        self.subscription.save();
        self.articleManager.refreshColoring();
      }
      $id(ids.id).remove();
      self.refreshColoringRuleArrows();
    });
    let getMoveColoringRuleCallback = (up: boolean) => {
      return () => {
        let rules = self.subscription.getColoringRules();
        let i = rules.indexOf(cr);
        if (up ? i > 0 : i < rules.length) {
          let swapIdx = up ? i - 1 : i + 1;
          let swap = rules[swapIdx];
          rules[swapIdx] = rules[i];
          rules[i] = swap;
          self.subscription.save();
          self.articleManager.refreshColoring();
          let element = $id(ids.id);
          if (up) {
            let prev = element.prev();
            element.detach().insertBefore(prev);
          } else {
            let next = element.next();
            element.detach().insertAfter(next);
          }
          self.refreshColoringRuleArrows();
        }
      };
    };
    onClick($id(ids.moveUpColoringRuleId), getMoveColoringRuleCallback(true));
    onClick(
      $id(ids.moveDownColoringRuleId),
      getMoveColoringRuleCallback(false)
    );
  }

  refreshColoringRuleArrows() {
    $(".FFnS_MoveUpColoringRule").not(":first").show();
    $(".FFnS_MoveUpColoringRule:first").hide();
    $(".FFnS_MoveDownColoringRule").not(":last").show();
    $(".FFnS_MoveDownColoringRule:last").hide();
  }

  refreshColoringRuleSpecificKeywords(
    cr: ColoringRule,
    ids: ColoringRuleHTMLIds
  ) {
    var keywords = cr.specificKeywords;
    var html = "";

    for (var i = 0; i < keywords.length; i++) {
      var keyword = keywords[i];
      var keywordId = this.getKeywordId(ids.id, keyword);
      var keywordHTML = bindMarkup(templates.keywordHTML, [
        { name: "keywordId", value: keywordId },
        { name: "keyword", value: keyword },
      ]);
      html += keywordHTML;
    }

    $id(ids.keywordContainerId).html(html);
  }

  private setUpFilteringListEvents() {
    getFilteringTypes().forEach(this.setUpFilteringListManagementEvents, this);
  }

  private setUpFilteringListManagementEvents(type: FilteringType) {
    var ids = this.getIds(type);

    // Add button
    $id(this.getHTMLId(ids.plusBtnId)).click(() => {
      var input = $id(this.getHTMLId(ids.inputId));
      this.addKeyword(input, type);
    });

    // Erase all button
    $id(this.getHTMLId(ids.eraseBtnId)).click(() => {
      if (confirm("Erase all the keywords of this list ?")) {
        this.subscription.resetFilteringList(type);
        this.updateFilteringList(type);
      }
    });
  }

  private addKeyword(input: JQuery, type: FilteringType) {
    var keyword = input.val() as string;
    if (keyword != null && keyword !== "") {
      var area = $id(
        this.getKeywordMatchingSelectId(true, type)
      ).val() as string;
      if (area.length > 0) {
        keyword = this.keywordManager.insertArea(keyword, area);
      }
      this.subscription.addKeyword(keyword, type);
      this.updateFilteringList(type);
      input.val("");
    }
  }

  private setUpKeywordButtonsEvents(type: FilteringType) {
    var ids = this.getIds(type);
    var keywordList = this.subscription.getFilteringList(type);

    // Keyword buttons events
    var t = this;
    for (var i = 0; i < keywordList.length; i++) {
      var keywordId = this.getKeywordId(ids.typeId, keywordList[i]);
      $id(keywordId).click(function () {
        var keyword = $(this).text();
        if (confirm("Delete the keyword ?")) {
          t.subscription.removeKeyword(keyword, type);
          t.updateFilteringList(type);
        }
      });
    }
  }

  updateFilteringList(type: FilteringType) {
    this.prepareFilteringList(type);
    this.refreshFilteringAndSorting();
  }

  prepareFilteringList(type: FilteringType) {
    var ids = this.getIds(type);
    var filteringList = this.subscription.getFilteringList(type);
    var filteringKeywordsHTML = "";

    for (var i = 0; i < filteringList.length; i++) {
      var keyword = filteringList[i];
      var keywordId = this.getKeywordId(ids.typeId, keyword);
      var filteringKeywordHTML = bindMarkup(templates.keywordHTML, [
        { name: "keywordId", value: keywordId },
        { name: "keyword", value: keyword },
      ]);
      filteringKeywordsHTML += filteringKeywordHTML;
    }

    $id(ids.filetringKeywordsId).html(filteringKeywordsHTML);
    this.setUpKeywordButtonsEvents(type);
  }

  updateAdditionalSortingTypes() {
    var additionalSortingTypes = [] as SortingType[];
    $("#FFnS_AdditionalSortingTypes > select").each((i, e) => {
      additionalSortingTypes.push($(e).val() as SortingType);
    });
    this.subscription.setAdditionalSortingTypes(additionalSortingTypes);
    this.refreshFilteringAndSorting();
  }

  addArticle(article: HTMLElement) {
    if (currentPageNotSupported()) {
      return;
    }
    try {
      this.articleManager.addNewArticle(article);
      const callback = this.readArticlesMutationCallback(article);
      var articleObserver = new MutationObserver(callback);
      articleObserver.observe(article, { attributes: true });
      callback([], articleObserver);
    } catch (err) {
      console.log(err);
    }
  }

  private readArticlesMutationCallback(article: Element): MutationCallback {
    return (mr, observer) => {
      let readClassElement = !$(article).hasClass(ext.inlineViewClass)
        ? $(article)
        : $(article).closest(ext.articleViewEntryContainerSelector);
      if (
        readClassElement.hasClass(ext.readArticleClass) &&
        !$(article).hasClass(ext.inlineViewClass)
      ) {
        if (this.subscription.isHideAfterRead()) {
          if (this.subscription.isReplaceHiddenWithGap()) {
            $(article).attr("gap-article", "true");
          } else {
            $(article).remove();
          }
        }
        observer.disconnect();
      }
    };
  }

  addSection(section: Element) {
    if (currentPageNotSupported()) {
      return;
    }
    if (section.id === "section0") {
      $(section).find("h2").text(" ");
    } else {
      $(section).remove();
    }
  }

  importFromOtherSub() {
    var selectedURL = this.getSettingsControlsSelectedSubscription();
    if (
      selectedURL &&
      confirm(
        "Import settings from the subscription url /" + selectedURL + " ?"
      )
    ) {
      this.settingsManager
        .importSubscription(selectedURL)
        .then(this.refreshPage, this);
    }
  }

  linkToSub() {
    var selectedURL = this.getSettingsControlsSelectedSubscription();
    if (
      selectedURL &&
      confirm("Link current subscription to: /" + selectedURL + " ?")
    ) {
      this.settingsManager.linkToSubscription(selectedURL);
      this.refreshPage();
    }
  }

  unlinkFromSub() {
    if (confirm("Unlink current subscription ?")) {
      this.settingsManager.deleteSubscription(
        this.settingsManager.getActualSubscriptionURL()
      );
      this.refreshPage();
    }
  }

  deleteSub() {
    var selectedURL = this.getSettingsControlsSelectedSubscription();
    if (selectedURL && confirm("Delete : /" + selectedURL + " ?")) {
      this.settingsManager.deleteSubscription(selectedURL);
      this.refreshPage();
    }
  }

  public getHTMLId(id: string) {
    return "FFnS_" + id;
  }

  getKeywordId(keywordListId: string, keyword: string) {
    if (!(keyword in this.keywordToId)) {
      var id = this.idCount++;
      this.keywordToId[keyword] = id;
    }
    return this.getHTMLId(keywordListId + "_" + this.keywordToId[keyword]);
  }

  getFilteringTypeTabId(filteringType: FilteringType) {
    return this.getHTMLId("Tab_" + FilteringType[filteringType]);
  }

  getIds(type: FilteringType) {
    var id = getFilteringTypeId(type);
    return {
      typeId: "Keywords_" + id,
      inputId: "Input_" + id,
      plusBtnId: "Add_" + id,
      eraseBtnId: "DeleteAll_" + id,
      filetringKeywordsId: "FiletringKeywords_" + id,
    };
  }
}

class ColoringRuleHTMLIds {
  id: string;
  highlightId: string;
  colorId: string;
  sourceId: string;
  matchingMethodId: string;
  matchingMethodContainerId: string;
  matchingAreaId: string;
  matchingAreaContainerId: string;
  keywordInputId: string;
  addBtnId: string;
  eraseBtnId: string;
  keywordContainerId: string;
  keywordGroupId: string;
  specificColorGroupId: string;
  optionsSpanId: string;
  sourceTitleInfosId: string;
  removeColoringRuleId: string;
  moveUpColoringRuleId: string;
  moveDownColoringRuleId: string;
  constructor(id: string) {
    this.id = id;
    this.highlightId = id + " .FFnS_HighlightAllTitle";
    this.colorId = id + " .FFnS_SpecificColor";
    this.sourceId = id + " .FFnS_ColoringRule_Source";
    this.matchingMethodId = id + " .FFnS_KeywordMatchingMethod";
    this.matchingMethodContainerId =
      id + " .FFnS_ColoringRule_MatchingMethodGroup";
    this.matchingAreaId = id + " .FFnS_keywordMatchingSelect";
    this.matchingAreaContainerId = id + " .FFnS_ColoringRule_MatchingAreaGroup";
    this.keywordInputId = id + " .FFnS_ColoringRule_KeywordInput";
    this.addBtnId = id + " .FFnS_ColoringRule_AddKeyword";
    this.eraseBtnId = id + " .FFnS_ColoringRule_EraseKeywords";
    this.keywordContainerId = id + " .FFnS_ColoringRuleKeywords";
    this.keywordGroupId = id + " .FFnS_ColoringRule_KeywordsGroup";
    this.specificColorGroupId = id + " .FFnS_SpecificColorGroup";
    this.optionsSpanId = id + " .FFnS_ColoringRule_Options";
    this.sourceTitleInfosId = id + " .FFnS_ColoringRule_SourceTitleInfos";
    this.removeColoringRuleId = id + " .FFnS_RemoveColoringRule";
    this.moveUpColoringRuleId = id + " .FFnS_MoveUpColoringRule";
    this.moveDownColoringRuleId = id + " .FFnS_MoveDownColoringRule";
  }
}

const keywordInputs = [
  { input: "#FFnS_Input_FilteredOut", type: FilteringType.FilteredOut },
  { input: "#FFnS_Input_RestrictedOn", type: FilteringType.RestrictedOn },
];

const focusKeywordsInputSelector = keywordInputs
  .map((e) => e.input + ":visible")
  .join(",");

function focusKeywordsInput() {
  $(focusKeywordsInputSelector).focus().val("");
}


text:
package org.apache.camel.processor.async;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.slf4j.MDC;

/**
 * @version
 */
public class AsyncMDCTest extends ContextTestSupport {

    public void testMDC() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("Bye Camel");

        template.sendBody("direct:a", "Hello World");

        assertMockEndpointsSatisfied();
    }

    public void testThreeMessagesMDC() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("Bye Camel", "Bye Camel", "Bye Camel");

        log.info("#1 message");
        template.sendBody("direct:a", "Hello World");

        log.info("#2 message");
        template.sendBody("direct:a", "Hello Camel");

        log.info("#3 message");
        template.sendBody("direct:a", "Hi Camel");

        assertMockEndpointsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // enable MDC
                context.setUseMDCLogging(true);

                context.addComponent("async", new MyAsyncComponent());

                from("direct:a").routeId("route-a")
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                assertEquals("route-a", MDC.get("routeId"));
                                assertEquals(exchange.getExchangeId(), MDC.get("exchangeId"));
                            }
                        })
                        .to("log:before")
                        .to("async:bye:camel")
                        .to("log:after")
                        .to("direct:b");

                from("direct:b").routeId("route-b")
                        .process(new Processor() {
                            public void process(Exchange exchange) throws Exception {
                                assertEquals("route-b", MDC.get("routeId"));
                                assertEquals(exchange.getExchangeId(), MDC.get("exchangeId"));
                            }
                        })
                        .to("log:bar").to("mock:result");
            }
        };
    }

}