text:
var csrf_token;
$(function () {
    // Display loading indicator.  This disappears after the first
    // get_events completes.
    if (page_params.have_initial_messages && !page_params.needs_tutorial) {
        loading.make_indicator($('#page_loading_indicator'), {text: 'Loading...'});
    } else if (!page_params.needs_tutorial) {
        $('#first_run_message').show();
    }

    // This requires that we used Django's {% csrf_token %} somewhere on the page.
    csrf_token = $('input[name="csrfmiddlewaretoken"]').attr('value');

    $.ajaxSetup({
        beforeSend: function (xhr, settings) {
            if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
                // Only send the token to relative URLs i.e. locally.
                xhr.setRequestHeader("X-CSRFToken", csrf_token);
            }
        },
    });

    // For some reason, jQuery wants this to be attached to an element.
    $(document).ajaxError(function (event, xhr) {
        if (xhr.status === 401) {
            // We got logged out somehow, perhaps from another window or a session timeout.
            // We could display an error message, but jumping right to the login page seems
            // smoother and conveys the same information.
            window.location.replace(page_params.login_page);
        }
    });

    if (typeof $ !== 'undefined') {
        $.fn.expectOne = function () {
            if (blueslip && this.length !== 1) {
                blueslip.error("Expected one element in jQuery set, " + this.length + " found");
            }
            return this;
        };
    }

});


text:
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QSystemTrayIcon
import svn_popup_lib
import sys
import os
import ConfigParser
import io
import datetime

class MainWindow(QtGui.QMainWindow):

    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.setWindowIcon(QtGui.QIcon('icon.png'))
        self.trayIcon = QtGui.QSystemTrayIcon(QtGui.QIcon('icon.png'))
        self.trayIcon.show()

        #--------------------------------------------------------------
        # Read config file
        main_config_file = open('conf.cfg', 'r')
        main_config_source = main_config_file.read()
        main_config_file.close()

        main_config = ConfigParser.RawConfigParser()
        main_config.readfp(io.BytesIO(main_config_source))
        #--------------------------------------------------------------
        self.paths_to_search = []
        # Look and record paths
        for itm in main_config.items('paths'):
            par, val = itm
            val = val.strip('"')
            if os.path.exists(val):
                self.paths_to_search.append(val + '\n')
        self.paths_str = ''
        for itm in self.paths_to_search:
            self.paths_str = self.paths_str + itm
        #--------------------------------------------------------------

        self.trayIcon.showMessage('Looking started', 'paths: ' + str(self.paths_str), QSystemTrayIcon.Information, 5000)

        #set timer
        self.timer = QtCore.QTimer(self)
        update_interval = int(main_config.get('conf', 'update_interval'))
        self.timer.setInterval(update_interval * 1000)
        self.timer.timeout.connect(self.run_app)
        self.timer.start()

        # set first tooltip
        self.trayIcon.setToolTip('paths: '  + str(self.paths_str))

        exitAction = QtGui.QAction('&Exit', self)
        exitAction.triggered.connect(self.closeEvent)

        show_message_Action = QtGui.QAction('&Show paths', self)
        show_message_Action.triggered.connect(self.show_message)

        menu = QtGui.QMenu(self)
        menu.addAction(exitAction)
        menu.addAction(show_message_Action)
        self.trayIcon.setContextMenu(menu)

    def run_app(self):

        far_paths = ''

        for c_path in self.paths_to_search:
            c_rev, c_mess = svn_popup_lib.get_cur_revision(c_path)
            h_rev, h_mess = svn_popup_lib.get_head_revision(c_path)

            if (c_rev is not None) and (h_rev is not None):
                if int(c_rev) != int(h_rev):
                    far_paths = far_paths + c_path + '\n'
            else:
                err_log = open('err.log', 'a')
                err_log.write('--------------------\n')
                err_log.write(str(datetime.datetime.now()) + '\n')
                err_log.write(c_mess.replace('[def]',''))
                err_log.write('--------------------\n')
                err_log.write(h_mess.replace('[def]',''))
                err_log.write('--------------------\n')
                err_log.close()

        if far_paths != '':
            self.trayIcon.showMessage('Not up to date', 'paths: ' + far_paths, QSystemTrayIcon.Information, 5000)
            self.trayIcon.setToolTip(far_paths)

    def show_message(self):
        self.trayIcon.showMessage('Looking paths', 'paths: '  + str(self.paths_str), QSystemTrayIcon.Information, 5000)

    # http://stackoverflow.com/questions/5506781/pyqt4-application-on-windows-is-crashing-on-exit
    def closeEvent(self, event):
        sys.exit(0)

app = QtGui.QApplication(sys.argv)
w = MainWindow()
#w.show()
sys.exit(app.exec_())

redpajama_set_name: RedPajamaGithub


text:
@implementation CAPSPhotoView

// Constructor for using UIImage to set image
- (id)initWithFrame:(CGRect)frame dateTitle:(NSString *)dateTitle title:(NSString *)title subtitle:(NSString *)subtitle
{
    self = [super init];

	if (self != nil) {
        // Initialization code
        self.frame = frame;

        // Default settings
        _bounceRange = 100;
        _maxZoomScale = 4.0;
        _minZoomScale = 1.0;
        _doubleTapZoomScale = 2.0;

        // Initial setting
        hidden = YES;
        originalImageViewHidden = YES;

        // Set up UI
        [self buildUI];

        // Set detail view labels
        [dateTitleLabel setText:dateTitle];
        [titleLabel setText:title];
        [subtitleLabel setText:subtitle];

        // Set up touch recognizers
        [self buildGestureRecognizers];
    }

    return self;
}

- (void)buildGestureRecognizers
{
    // Set up tap gestures for when detail view is shown
    UITapGestureRecognizer *imageSingleTapTouchGestureDetailView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showHidePhotoDetailView)];
    imageSingleTapTouchGestureDetailView.numberOfTapsRequired = 1;
    [photoDetailGestureView addGestureRecognizer:imageSingleTapTouchGestureDetailView];
    [imageSingleTapTouchGestureDetailView setDelegate:self];

    UITapGestureRecognizer *imageDoubleTapGestureDetailView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapToZoom:)];
    imageDoubleTapGestureDetailView.numberOfTapsRequired = 2;
    [photoDetailGestureView addGestureRecognizer:imageDoubleTapGestureDetailView];
    [imageDoubleTapGestureDetailView setDelegate:self];

    [imageSingleTapTouchGestureDetailView requireGestureRecognizerToFail:imageDoubleTapGestureDetailView];

    // Set up tap gestures on image
    UITapGestureRecognizer *imageSingleTapTouchGestureImage = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showHidePhotoDetailView)];
    imageSingleTapTouchGestureImage.numberOfTapsRequired = 1;
    [imageView addGestureRecognizer:imageSingleTapTouchGestureImage];
    [imageSingleTapTouchGestureImage setDelegate:self];

    UITapGestureRecognizer *imageDoubleTapGestureImage = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapToZoom:)];
    imageDoubleTapGestureImage.numberOfTapsRequired = 2;
    [imageView addGestureRecognizer:imageDoubleTapGestureImage];
    [imageDoubleTapGestureImage setDelegate:self];

    [imageSingleTapTouchGestureImage requireGestureRecognizerToFail:imageDoubleTapGestureImage];

    // Set up tap gestures on scrollview
    UITapGestureRecognizer *imageSingleTapTouchGestureScrollView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showHidePhotoDetailView)];
    imageSingleTapTouchGestureScrollView.numberOfTapsRequired = 1;
    [imageScrollView addGestureRecognizer:imageSingleTapTouchGestureScrollView];
    [imageSingleTapTouchGestureScrollView setDelegate:self];

    UITapGestureRecognizer *imageDoubleTapGestureImageScrollView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapToZoom:)];
    imageDoubleTapGestureImageScrollView.numberOfTapsRequired = 2;
    [imageScrollView addGestureRecognizer:imageDoubleTapGestureImageScrollView];
    [imageDoubleTapGestureImageScrollView setDelegate:self];

    [imageSingleTapTouchGestureScrollView requireGestureRecognizerToFail:imageDoubleTapGestureImageScrollView];

    // Set up pan gesture for when detail view is present
    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
    [panGesture setDelaysTouchesBegan:TRUE];
    [panGesture setDelaysTouchesEnded:TRUE];
    [panGesture setCancelsTouchesInView:TRUE];
    [photoDetailGestureView addGestureRecognizer:panGesture];
    [panGesture setDelegate:self];
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return imageView;
}

- (void)scrollViewDidZoom:(UIScrollView *)scrollView
{
    UIView *subView = [scrollView.subviews objectAtIndex:0];

    CGFloat offsetX = (scrollView.bounds.size.width > scrollView.contentSize.width) ?
    (scrollView.bounds.size.width - scrollView.contentSize.width) * 0.5 : 0.0;

    CGFloat offsetY = (scrollView.bounds.size.height > scrollView.contentSize.height) ?
    (scrollView.bounds.size.height - scrollView.contentSize.height) * 0.5 : 0.0;

    subView.center = CGPointMake(scrollView.contentSize.width * 0.5 + offsetX,
                                 scrollView.contentSize.height * 0.5 + offsetY);

    scrollView.bounces = YES;
}

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
{
    if (scale == 1.0) {
        scrollView.bounces = NO;

        [UIView animateWithDuration:0.3
                         animations:^{
                             photoDetailView.alpha = 1;
                         }];
    }
}

- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
{
    [UIView animateWithDuration:0.3
                     animations:^{
                         photoDetailView.alpha = 0;
                     }];
}

- (void)handleDoubleTapToZoom:(UIPanGestureRecognizer *)recognizer
{
    if (imageView.frame.size.width > deviceWidth) {
        [UIView animateWithDuration:0.3
                         animations:^{
                             // Zoom scroll view to set scale
                             [imageScrollView setZoomScale:_minZoomScale animated:YES];

                             // Show detail view
                             photoDetailView.alpha = 1;
                         }];

        [self enableCloseButtonAndDetailView];
    } else {
        [UIView animateWithDuration:0.3
                         animations:^{

                             // Zoom to tapped location
                             CGPoint currentlocation = [recognizer locationInView:self];
                             [self zoomToPoint:currentlocation withScale:_doubleTapZoomScale animated:YES forScrollView:imageScrollView];

                             // Hide detail view
                             photoDetailView.alpha = 0;
                         }];

        [self disableCloseButtonAndDetailView];
    }
}

- (void)zoomToPoint:(CGPoint)zoomPoint withScale:(CGFloat)scale animated:(BOOL)animated forScrollView:(UIScrollView *)scrollView
{
    // Normalize current content size back to content scale of 1.0f
    CGSize contentSize;
    contentSize.width = (scrollView.contentSize.width / scrollView.zoomScale);
    contentSize.height = (scrollView.contentSize.height / scrollView.zoomScale);

    // Translate the zoom point to relative to the content rect
    zoomPoint.x = (zoomPoint.x / scrollView.bounds.size.width) * contentSize.width;
    zoomPoint.y = (zoomPoint.y / scrollView.bounds.size.height) * contentSize.height;

    // Derive the size of the region to zoom to
    CGSize zoomSize;
    zoomSize.width = scrollView.bounds.size.width / scale;
    zoomSize.height = scrollView.bounds.size.height / scale;

    // Offset the zoom rect so the actual zoom point is in the middle of the rectangle
    CGRect zoomRect;
    zoomRect.origin.x = zoomPoint.x - zoomSize.width / 2.0f;
    zoomRect.origin.y = zoomPoint.y - zoomSize.height / 2.0f;
    zoomRect.size.width = zoomSize.width;
    zoomRect.size.height = zoomSize.height;

    // Apply the resize
    [scrollView zoomToRect:zoomRect animated:animated];
}

- (void)disableCloseButtonAndDetailView
{
    closeBtn.enabled = NO;
    [photoDetailView setUserInteractionEnabled:NO];
}

- (void)enableCloseButtonAndDetailView
{
    closeBtn.enabled = YES;
    [photoDetailView setUserInteractionEnabled:YES];
}

// Swipe photo up or down to close
- (void)handlePan:(UIPanGestureRecognizer *)recognizer
{
    [UIView animateWithDuration:0.2
                     animations:^{
                         photoDetailView.alpha = 0;
                     }];

    CGPoint translation = [recognizer translationInView:imageView];

    imageView.center=CGPointMake(imageView.center.x, imageView.center.y+ translation.y);

    [recognizer setTranslation:CGPointMake(0, 0) inView:imageView];

    // Fade on swipe up/down
    float rangeMax = 150.0;
    float startImageViewY = deviceHeight / 2;
    dimView.alpha = (rangeMax - ABS(startImageViewY - imageView.center.y)) / rangeMax;

    [self showStatusBar];// TEST

    // Close photo view or bounce back depending on how far picture got swiped up/down
    if (recognizer.state == UIGestureRecognizerStateEnded) {

        if (imageView.frame.origin.y > photoViewImageOrigin.y - _bounceRange && imageView.frame.origin.y < photoViewImageOrigin.y + _bounceRange) {
            [UIView beginAnimations:@"RIGHT-WITH-RIGHT" context:NULL];
            [UIView setAnimationDuration:0.2];
            [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:nil cache:YES];
            [UIView setAnimationBeginsFromCurrentState:YES];

            // Reset the frame view size
            imageView.frame = CGRectMake(photoViewImageOrigin.x, photoViewImageOrigin.y, photoViewImageSize.width, photoViewImageSize.height);
            [UIView setAnimationDelegate:self];

            //  Call bounce animation method
            [UIView setAnimationDidStopSelector:@selector(bounceBackToOrigin)];
            [UIView commitAnimations];
        } else {

            if (isModal) {

                CGFloat endY;

                if (imageView.frame.origin.y < photoViewImageOrigin.y - 100) {
                    endY = 0 - photoViewImageSize.height;
                } else {
                    endY = deviceHeight;
                }

                [UIView animateWithDuration:0.3
                                 animations:^{
                                     dimView.alpha = 0;
                                     imageView.frame = CGRectMake(imageView.frame.origin.x, endY, imageView.frame.size.width, imageView.frame.size.height);
                                 }];
            } else {
                photoDetailView.alpha = 0;

                CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
                animation.timingFunction = [CAMediaTimingFunction     functionWithName:kCAMediaTimingFunctionLinear];
                animation.fromValue = [NSNumber numberWithFloat:0.0f];
                animation.toValue = [NSNumber numberWithFloat:startPhotoRadius];
                animation.duration = 0.4;
                [imageView.layer setCornerRadius:startPhotoRadius];
                [imageView.layer addAnimation:animation forKey:@"cornerRadius"];

                [UIView animateWithDuration:0.4
                                 animations:^{
                                     dimView.alpha = 0;
                                     imageView.frame = CGRectMake(photoOrigin.x, photoOrigin.y, photoSize.width, photoSize.height);
                                 }];

                [self performSelector:@selector(toggleOriginalImageView) withObject:nil afterDelay:0.4];
            }

            [self performSelector:@selector(removeSelfFromSuperview) withObject:nil afterDelay:0.4];
        }
    }
}

- (void)bounceBackToOrigin
{
    CABasicAnimation *bounceAnimation = [CABasicAnimation animationWithKeyPath:@"position.x"];
    bounceAnimation.duration = 0.7;
    bounceAnimation.repeatCount = 0;
    bounceAnimation.autoreverses = YES;
    bounceAnimation.fillMode = kCAFillModeBackwards;
    bounceAnimation.removedOnCompletion = YES;
    bounceAnimation.additive = NO;
    [imageView.layer addAnimation:bounceAnimation forKey:@"bounceAnimation"];

    [UIView animateWithDuration:0.1
                     animations:^{
                                    photoDetailView.alpha = 1;
                                    dimView.alpha = 1;
                                }];

    [self performSelector:@selector(hideStatusBar) withObject:nil afterDelay:0.1]; // TEST
}

- (void)showHidePhotoDetailView
{
    // Check if image needs to be zoomed out to original size
    if (imageView.frame.size.width > deviceWidth || (int)imageView.frame.size.height > deviceHeight) {
        [UIView animateWithDuration:0.3
                         animations:^{
                             [imageScrollView setZoomScale:_minZoomScale animated:YES];

                             photoDetailView.alpha = 1;
                         }];

        [self enableCloseButtonAndDetailView];
    } else {
        // Show or hide detail view
        if (photoDetailView.alpha == 0) {
            [UIView animateWithDuration:0.3
                             animations:^{
                                 photoDetailView.alpha = 1;
                             }];
            [self enableCloseButtonAndDetailView];
        } else {
            [UIView animateWithDuration:0.3
                             animations:^{
                                 photoDetailView.alpha = 0;
                             }];
            [self disableCloseButtonAndDetailView];
        }
    }
}

- (void)removeSelfFromSuperview
{
    [self removeFromSuperview];
}

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

- (void)hideStatusBar
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
}

- (void)showStatusBar
{
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}

- (void)toggleStatusBar
{
    [[UIApplication sharedApplication] setStatusBarHidden:hidden withAnimation:UIStatusBarAnimationNone];

    hidden = !hidden;
}

- (void)tappedCloseButton
{
    [self disableCloseButtonAndDetailView];

    if (isModal) {
        photoDetailView.alpha = 0;

        [UIView animateWithDuration:0.3
                         animations:^{
                             dimView.alpha = 0;
                             imageView.frame = CGRectMake(imageView.frame.origin.x, deviceHeight, imageView.frame.size.width, imageView.frame.size.height);
                         }];
    } else {
        photoDetailView.alpha = 0;

        CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
        animation.timingFunction = [CAMediaTimingFunction     functionWithName:kCAMediaTimingFunctionLinear];
        animation.fromValue = [NSNumber numberWithFloat:0.0f];
        animation.toValue = [NSNumber numberWithFloat:startPhotoRadius];
        animation.duration = 0.4;
        [imageView.layer setCornerRadius:startPhotoRadius];
        [imageView.layer addAnimation:animation forKey:@"cornerRadius"];

        [UIView animateWithDuration:0.4
                         animations:^{
                             dimView.alpha = 0;
                             imageView.frame = CGRectMake(photoOrigin.x, photoOrigin.y, photoSize.width, photoSize.height);
                         }];

        [self performSelector:@selector(toggleOriginalImageView) withObject:nil afterDelay:0.4];
    }

    [self performSelector:@selector(removeSelfFromSuperview) withObject:nil afterDelay:0.4];
    [self performSelector:@selector(toggleStatusBar) withObject:nil afterDelay:0.1];
}

- (void)toggleOriginalImageView
{
    startImageView.hidden = originalImageViewHidden;

    originalImageViewHidden = !originalImageViewHidden;
}

- (void)setDimViewAlpha:(CGFloat)alpha
{
    [dimView setAlpha:alpha];
}

- (void)setPhotoDetailViewAlpha:(CGFloat)alpha
{
    [photoDetailView setAlpha:alpha];
}

- (void)setFrameForImage:(CGRect)frame
{
    [imageView setFrame:frame];
}

- (void)setImageInfoFromImageView:(UIImageView *)imgView
{
    // Translate image view origin to window
    CGPoint origin = [imgView.superview convertPoint:imgView.frame.origin toView:nil];

    // Set parameters from start image view
    photoOrigin = origin;
    photoSize = imgView.frame.size;
    startPhotoRadius = imgView.layer.cornerRadius;
    photo = imgView.image;

    [imageView setImage:photo];
}

// Start showing Photoview
- (void)fadeInPhotoViewFromImageView:(UIImageView *)imgView
{
    hidden = YES;

    // Set isModal flag to NO
    isModal = NO;

    [self enableCloseButtonAndDetailView];

    // Use original image view to make effect of animation better by hiding it
    imgView.clipsToBounds = YES;
    startImageView = imgView;
    [self toggleOriginalImageView];

    [self setImageInfoFromImageView:startImageView];

    imageView.frame = CGRectMake(photoOrigin.x, photoOrigin.y, photoSize.width, photoSize.height);

    // Set up image view if necessary for radius
    if (startPhotoRadius > 0) {
        imageView.layer.cornerRadius = startPhotoRadius;
    }

    imageView.clipsToBounds = YES;

    [dimView setAlpha:0];
    [photoDetailView setAlpha:0];

    [[[UIApplication sharedApplication] keyWindow] addSubview:self];
    [[[UIApplication sharedApplication] keyWindow] bringSubviewToFront:self];

    // Corner radius animation
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
    animation.timingFunction = [CAMediaTimingFunction     functionWithName:kCAMediaTimingFunctionLinear];
    animation.fromValue = [NSNumber numberWithFloat:startPhotoRadius];
    animation.toValue = [NSNumber numberWithFloat:0.0f];
    animation.duration = 0.4;
    [imageView.layer setCornerRadius:0.0];
    [imageView.layer addAnimation:animation forKey:@"cornerRadius"];

    // Calculate height for image in photo view
    float scale = deviceWidth / startImageView.image.size.width;
    int height = startImageView.image.size.height * scale;

    // Accomodate long pictures
    if (height > deviceHeight) { // height more than device height
        scale = deviceHeight / startImageView.image.size.height;
        photoViewImageSize.height = deviceHeight;
        photoViewImageSize.width = startImageView.image.size.width * scale;
        photoViewImageOrigin.x = (deviceWidth - photoViewImageSize.width) / 2;
        photoViewImageOrigin.y = 0;
    } else {
        photoViewImageSize.height = startImageView.image.size.height * scale;
        photoViewImageSize.width = deviceWidth;
        photoViewImageOrigin.x = 0;
        photoViewImageOrigin.y = (deviceHeight - photoViewImageSize.height) / 2;
    }

    // Photo enlarge animation
    [UIView animateWithDuration:0.4
                     animations:^{
                         [dimView setAlpha:1];

                         [imageView setFrame:CGRectMake(photoViewImageOrigin.x, photoViewImageOrigin.y, photoViewImageSize.width, photoViewImageSize.height)];
                     }];

    // Set up scroll view content size
    imageScrollView.contentSize = imageView.frame.size;

    [self addGestureRecognizer:imageScrollView.pinchGestureRecognizer];

    [self performSelector:@selector(showHidePhotoDetailView) withObject:nil afterDelay:0.4];
    [self performSelector:@selector(toggleStatusBar) withObject:nil afterDelay:0.25];
}

- (void)openPhotoViewAsModalWithImageView:(UIImageView *)imgView
{
    hidden = YES;

    // Set isModal flag to YES
    isModal = YES;

    [self enableCloseButtonAndDetailView];

    [dimView setAlpha:1];
    [photoDetailView setAlpha:1];

    // Use original image view to make effect of animation better by hiding it
    imgView.clipsToBounds = YES;
    startImageView = imgView;

    [self setImageInfoFromImageView:startImageView];

    imageView.layer.cornerRadius = startPhotoRadius;

    CGRect oldFrame = CGRectMake(0, 0, deviceWidth, deviceHeight);//self.frame;

    self.frame = CGRectMake(self.frame.origin.x, deviceHeight, self.frame.size.width, self.frame.size.height);

    [[[UIApplication sharedApplication] keyWindow] addSubview:self];
    [[[UIApplication sharedApplication] keyWindow] bringSubviewToFront:self];

    // Calculate height for image in photo view
    float scale = deviceWidth / startImageView.image.size.width;
    int height = startImageView.image.size.height * scale;

    // Accomodate long pictures
    if (height > deviceHeight) { // height more than device height
        scale = deviceHeight / startImageView.image.size.height;
        photoViewImageSize.height = deviceHeight;
        photoViewImageSize.width = startImageView.image.size.width * scale;
        photoViewImageOrigin.x = (deviceWidth - photoViewImageSize.width) / 2;
        photoViewImageOrigin.y = 0;
    } else {
        photoViewImageSize.height = startImageView.image.size.height * scale;
        photoViewImageSize.width = deviceWidth;
        photoViewImageOrigin.x = 0;
        photoViewImageOrigin.y = (deviceHeight - photoViewImageSize.height) / 2;
    }

    // Set image view frame
    [imageView setFrame:CGRectMake(photoViewImageOrigin.x, photoViewImageOrigin.y, photoViewImageSize.width, photoViewImageSize.height)];

    // Modal animation
    [UIView animateWithDuration:0.3
                     animations:^{
                         [self setFrame:oldFrame];
                     }];

    // Set up scroll view content size
    imageScrollView.contentSize = imageView.frame.size;

    [self addGestureRecognizer:imageScrollView.pinchGestureRecognizer];

    [self performSelector:@selector(toggleStatusBar) withObject:nil afterDelay:0.25];
}

- (void)buildUI
{
    // Set device height and width variables
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    deviceWidth = screenRect.size.width;
    deviceHeight = screenRect.size.height;

    // Set up dim view
    dimView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, deviceWidth, deviceHeight)];
    dimView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
    dimView.backgroundColor = [UIColor blackColor];
    dimView.userInteractionEnabled = YES;
    dimView.alpha = 1;
    [self addSubview:dimView];

    // Set up scroll view
    imageScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, deviceWidth, deviceHeight)];
    imageScrollView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
    [imageScrollView setBounces:NO];
    [imageScrollView setShowsHorizontalScrollIndicator:NO];
    [imageScrollView setShowsVerticalScrollIndicator:NO];
    [imageScrollView setScrollEnabled:YES];
    imageScrollView.delegate = self;
    imageScrollView.maximumZoomScale = _maxZoomScale;
    imageScrollView.minimumZoomScale = _minZoomScale;
    imageScrollView.backgroundColor = [UIColor clearColor];
    [self addSubview:imageScrollView];

    // Set up image view adn add to scroll view
    imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, deviceWidth, deviceHeight)];
    imageView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
    imageView.contentMode = UIViewContentModeScaleAspectFill;
    imageView.backgroundColor = [UIColor clearColor];
    [imageScrollView addSubview:imageView];

    // Set up detail view
    photoDetailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, deviceWidth, deviceHeight)];
    photoDetailView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
    photoDetailView.backgroundColor = [UIColor clearColor];
    photoDetailView.userInteractionEnabled = YES;
    [photoDetailView setContentMode:UIViewContentModeScaleToFill];
    [self addSubview:photoDetailView];

    // Set up detail view components
    photoDetailGestureView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, deviceWidth, deviceHeight)];
    photoDetailGestureView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
    photoDetailGestureView.backgroundColor = [UIColor clearColor];
    photoDetailGestureView.userInteractionEnabled = YES;
    [photoDetailView addSubview:photoDetailGestureView];

    closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    closeBtn.frame = CGRectMake(253, 11, 57, 27);
    closeBtn.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
    closeBtn.backgroundColor = [UIColor colorWithRed:23.0/255.0 green:23.0/255.0 blue:23.0/255.0 alpha:0.65];
    closeBtn.layer.cornerRadius = 3;
    closeBtn.clipsToBounds = YES;
    closeBtn.layer.borderWidth = 1.0;
    closeBtn.layer.borderColor = [UIColor whiteColor].CGColor;
    closeBtn.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:14.0f];
    [closeBtn setTitle:@"Done" forState:UIControlStateNormal];
    [closeBtn addTarget:self action:@selector(tappedCloseButton) forControlEvents:UIControlEventTouchUpInside];
    [photoDetailView addSubview:closeBtn];

    detailBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 482, 320, 86)];
    detailBackground.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
    detailBackground.backgroundColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.5];
    [photoDetailView addSubview:detailBackground];

    detailLine = [[UIView alloc] initWithFrame:CGRectMake(10, 509, 300, 1)];
    detailLine.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
    detailLine.backgroundColor = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:0.4];
    [photoDetailView addSubview:detailLine];

    dateTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(110, 484, 200, 21)];
    dateTitleLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
    dateTitleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:13.0f];
    dateTitleLabel.backgroundColor = [UIColor clearColor];
    dateTitleLabel.textColor = [UIColor whiteColor];
    dateTitleLabel.textAlignment = NSTextAlignmentRight;
    [photoDetailView addSubview:dateTitleLabel];

    titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 513, 300, 25)];
    titleLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
    titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Medium" size:19.0f];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.textAlignment = NSTextAlignmentLeft;
    [photoDetailView addSubview:titleLabel];

    subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 539, 300, 21)];
    subtitleLabel.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin;
    subtitleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:14.0f];
    subtitleLabel.backgroundColor = [UIColor clearColor];
    subtitleLabel.textColor = [UIColor whiteColor];
    subtitleLabel.textAlignment = NSTextAlignmentLeft;
    [photoDetailView addSubview:subtitleLabel];
}

@end


text:
"""Service formatter."""

from aquilon.worker.formats.formatters import ObjectFormatter
from aquilon.worker.formats.list import ListFormatter
from aquilon.aqdb.model import Service

class ServiceFormatter(ObjectFormatter):
    def format_raw(self, service, indent=""):
        details = [indent + "Service: %s" % service.name]
        details.append(indent + "  Template: %s" % service.cfg_path)
        max_clients = service.max_clients
        if max_clients is None:
            max_clients = "Unlimited"
        details.append(indent + "  Default Maximum Client Count: %s" %
                       max_clients)
        for archetype in service.archetypes:
            details.append(indent + "  Required for Archetype: " +
                           archetype.name)
        for personality in service.personalities:
            details.append(indent +
                           "  Required for Personality: %s Archetype: %s" %
                           (personality.name, personality.archetype.name))
        if service.comments:
            details.append(indent + "  Comments: %s" % service.comments)
        for instance in service.instances:
            details.append(self.redirect_raw(instance, indent + "  "))
        return "\n".join(details)

    def format_proto(self, service, skeleton=None):
        slf = ServiceListFormatter()
        return slf.format_proto([service], skeleton)

ObjectFormatter.handlers[Service] = ServiceFormatter()

class ServiceList(list):
    """Class to hold a list of services to be formatted"""
    pass

class ServiceListFormatter(ListFormatter):
    protocol = "aqdservices_pb2"

    def format_proto(self, sl, skeleton=None):
        servicelist_msg = self.loaded_protocols[self.protocol].ServiceList()
        for service in sl:
            self.add_service_msg(servicelist_msg.services.add(), service)
        return servicelist_msg.SerializeToString()

ObjectFormatter.handlers[ServiceList] = ServiceListFormatter()


text:
package org.apache.hive.beeline.cli;

import org.apache.hive.beeline.BeeLine;

import java.io.IOException;
import java.io.InputStream;

public class HiveCli {
  private BeeLine beeLine;

  public static void main(String[] args) throws IOException {
    int status = new HiveCli().runWithArgs(args, null);
    System.exit(status);
  }

  public int runWithArgs(String[] cmd, InputStream inputStream) throws IOException {
    beeLine = new BeeLine(false);
    try {
      return beeLine.begin(cmd, inputStream);
    } finally {
      beeLine.close();
    }
  }
}


text:
<manifest
	package="nl.nl2312.rxcupboard2">

</manifest>


text:
package com.ly.base.common.redis.extents;
@FunctionalInterface
public interface RedisCacheKeyOperate {
	/**
	 * 获取单个对象cacheKey
	 * @param value 对象对应的field值
	 * @return
	 */
	public String cacheKey(Object value);
}


text:
export function checkImmutableSchema(schema) {
  return function (props, propName, componentName) {
    const item = props[propName];
    if (!item.toJS) {
      return new Error(
        `Invalid prop ${propName} supplied to
        ${componentName}, not immutable`
      );
    }

    for (const val in schema) {
      if (!item[val]) {
        return new Error(
          `Invalid prop ${propName} supplied to
          ${componentName}. Missed - ${val} key`
        );
      }
    }
  };
}


text:
package testonly

import (
	"context"
	"fmt"
)

// Report contains all of the information submitted when creating an incident report.
type Report struct {
	BaseURL string
	Summary string
	FullURL string
	Details string
}

// FakeReporter sends incident reports to its Reports channel.
type FakeReporter struct {
	Updates    chan Report
	Violations chan Report
}

// LogUpdate sends an incident report to the FakeReporter's Updates channel.
func (f *FakeReporter) LogUpdate(ctx context.Context, baseURL, summary, fullURL, details string) {
	f.Updates <- Report{
		BaseURL: baseURL,
		Summary: summary,
		FullURL: fullURL,
		Details: details,
	}
}

// LogUpdatef sends an incident report to the FakeReporter's Updates channel, formatting parameters along the way.
func (f *FakeReporter) LogUpdatef(ctx context.Context, baseURL, summary, fullURL, detailsFmt string, args ...interface{}) {
	f.LogUpdate(ctx, baseURL, summary, fullURL, fmt.Sprintf(detailsFmt, args...))
}

// LogViolation sends an incident report to the FakeReporter's Violations channel.
func (f *FakeReporter) LogViolation(ctx context.Context, baseURL, summary, fullURL, details string) {
	f.Violations <- Report{
		BaseURL: baseURL,
		Summary: summary,
		FullURL: fullURL,
		Details: details,
	}
}

// LogViolationf sends an incident report to the FakeReporter's Violations channel, formatting parameters along the way.
func (f *FakeReporter) LogViolationf(ctx context.Context, baseURL, summary, fullURL, detailsFmt string, args ...interface{}) {
	f.LogViolation(ctx, baseURL, summary, fullURL, fmt.Sprintf(detailsFmt, args...))
}


text:
import * as Joi from "@hapi/joi";
export declare type TPebblebedJoiSchemaObject<T> = {
    [key in keyof T]: Joi.Schema;
};
export declare function createObjectValidator<T = any>(keysSchema: TPebblebedJoiSchemaObject<T>): Joi.ObjectSchema<any>;
export declare const JoiUtils: {
    createObjectValidator: typeof createObjectValidator;
};


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Clowder</title>
  <meta name="description" content="An knowledge sharing system for a disconnected world">
  <meta name="author" content="Anton Whalley">

  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="css/fonts.css" rel="stylesheet" type="text/css">

  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" href="css/skeleton.css">
  <link rel="stylesheet" href="css/custom.css">

  <link rel="icon" type="image/png" href="images/favicon.png">

Clowder

All Pages

Create Page

Shares

          Connection:

Most Viewed

A test page (4)

A test page (2)

Browse

Quick Links

Create New Page

Documentation

Starting Off

Your Active Shares

A test page

A test page

SHARE PAGES

        Title
        <input class="u-full-width" placeholder="Name Of Page" id="titleInput" required>

      <input class="button-primary" value="Save" type="button" id="btnSave">

    <webview src="editor/pageeditor.html#fragment" id="editorview" partition="pageeditor" autosize="true" minwidth="500" minheight="450"></webview>

<webview id="wikidbview" partition="persist:wikidb" src="wikidb.html#fragment" style="display: none;"></webview>


text:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
  xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
  xmlns:camel="http://camel.apache.org/schema/blueprint"
  xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0 https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0 http://aries.apache.org/schemas/blueprint-ext/blueprint-ext.xsd
       http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0  http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
       http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

  <cm:property-placeholder id="properties"
    persistent-id="org.fcrepo.apix.indexing" update-strategy="reload">

    <cm:default-properties>
      <cm:property name="error.maxRedeliveries" value="10" />
      <cm:property name="service.index.stream" value="broker:topic:fedora" />
      <cm:property name="service.reindex.stream" value="broker:queue:service.reindex" />
      <cm:property name="triplestore.baseUrl"
        value="http://localhost:8080/fuseki/test/update" />
      <cm:property name="reindexing.service.uri" value="http://localhost:9090/reindexing/" />
      <cm:property name="ldp.path.extension.container"
        value="/extensions" />
    </cm:default-properties>

  </cm:property-placeholder>

  <bean id="indexerRoutes" class="org.fcrepo.apix.indexing.impl.ServiceIndexingRoutes">
    <property name="extensionContainer" value="${ldp.path.extension.container}" />
    <property name="reindexStream" value="${service.reindex.stream}" />
  </bean>

  <bean id="http" class="org.apache.camel.component.http4.HttpComponent" />
  <bean id="https" class="org.apache.camel.component.http4.HttpComponent" />

  <bean id="httpClientBuilder" class="org.apache.http.impl.client.HttpClientBuilder"
    factory-method="create" />

  <bean id="httpClient" factory-ref="httpClientBuilder"
    factory-method="build" />

  <camelContext id="FcrepoServiceIndexer"
    xmlns="http://camel.apache.org/schema/blueprint">
    <routeBuilder ref="indexerRoutes" />
  </camelContext>

  <service interface="org.apache.camel.CamelContext" ref="FcrepoServiceIndexer">
    <service-properties>
      <entry key="role" value="FcrepoServiceIndexer" />
    </service-properties>
  </service>

</blueprint>


text:
package com.alexrnl.subtitlecorrector;

import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
import java.util.logging.Logger;

import javax.swing.plaf.nimbus.NimbusLookAndFeel;

import com.alexrnl.commons.error.ExceptionUtils;
import com.alexrnl.commons.gui.swing.SwingUtils;
import com.alexrnl.subtitlecorrector.gui.controller.MainWindowController;
import com.alexrnl.subtitlecorrector.gui.model.MainWindowModel;
import com.alexrnl.subtitlecorrector.gui.view.GraphicUserPrompt;
import com.alexrnl.subtitlecorrector.gui.view.MainWindowView;

/**
 * GUI application for correcting subtitles.

 * @author Alex
 */
public final class GUIApp extends AbstractApp {
	/** Logger */
	private static final Logger	LG	= Logger.getLogger(GUIApp.class.getName());

	/**
	 * Constructor #1.

	 * @param args
	 *        the arguments from the command line.
	 * @throws IOException
	 *         if a resource cannot be loaded.
	 * @throws URISyntaxException
	 *         if the path of the translation file cannot be build.
	 */
	public GUIApp (final List<String> args) throws IOException, URISyntaxException {
		super(new GraphicUserPrompt());
		SwingUtils.setLookAndFeel(new NimbusLookAndFeel().getName());
	}

	@Override
	public boolean launch () {
		LG.info("Subtitle Corrector starting...");

		// Load MVC
		final MainWindowController controller = new MainWindowController(this);
		final MainWindowModel model = new MainWindowModel();
		final MainWindowView view = new MainWindowView(null, controller, getTranslator());
		controller.addModel(model);
		controller.addView(view);

		try {
			synchronized (view) {
				while (!view.isReady()) {
					view.wait();
				}
			}
		} catch (final InterruptedException e) {
			LG.warning("Main thread interrupted while waiting for GUI building: " + ExceptionUtils.display(e));
		}
		view.setVisible(true);

		LG.info("Subtitle Corrector running");
		return true;
	}

}


text:
namespace llvm {

class Function;
class MachineIRBuilder;
class X86TargetLowering;
class Value;

class X86CallLowering : public CallLowering {
public:
  X86CallLowering(const X86TargetLowering &TLI);

  bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
                   unsigned VReg) const override;

  bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
                            ArrayRef<unsigned> VRegs) const override;
};
} // End of namespace llvm;
#endif


text:
package com.github.dlisin.graylog.plugin.output.email;

import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
import org.graylog2.configuration.EmailConfiguration;
import org.graylog2.plugin.Message;
import org.graylog2.plugin.configuration.Configuration;
import org.graylog2.plugin.configuration.ConfigurationRequest;
import org.graylog2.plugin.configuration.fields.ConfigurationField;
import org.graylog2.plugin.configuration.fields.ListField;
import org.graylog2.plugin.configuration.fields.NumberField;
import org.graylog2.plugin.configuration.fields.TextField;
import org.graylog2.plugin.outputs.MessageOutput;
import org.graylog2.plugin.outputs.MessageOutputConfigurationException;
import org.graylog2.plugin.streams.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collections;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.atomic.AtomicBoolean;

@SuppressWarnings("WeakerAccess")
public class EmailOutput implements MessageOutput {

  private final Logger logger = LoggerFactory.getLogger(getClass());
  private final AtomicBoolean running = new AtomicBoolean(false);

  private final EmailOutputTask emailOutputTask;
  private final Timer emailTimer;

  @AssistedInject
  public EmailOutput(@Assisted Stream stream,
                     EmailConfiguration emailConfig,
                     @Assisted Configuration pluginConfig) throws MessageOutputConfigurationException {
    logger.info("Initializing EmailOutput: stream='{}'; emailConfig='{}'; pluginConfig='{}'", stream, emailConfig, pluginConfig);
    EmailOutputConfiguration emailOutputConfig = new EmailOutputConfiguration(pluginConfig);
    emailOutputTask = new EmailOutputTask(stream, emailConfig, emailOutputConfig);

    logger.debug("Scheduling EmailOutputTask:, interval={} min", emailOutputConfig.getEmailInterval().toMinutes());
    emailTimer = new Timer("Timer-EmailOutputTask-" + stream.getId());
    emailTimer.scheduleAtFixedRate(emailOutputTask, 0, emailOutputConfig.getEmailInterval().toMillis());

    running.set(true);
  }

  @Override
  public boolean isRunning() {
    return running.get();
  }

  @Override
  public void stop() {
    logger.info("Stopping EmailOutput");
    logger.info("Canceling EmailOutputTask: ");
    emailTimer.cancel();

    running.set(false);
  }

  @Override
  public void write(List<Message> messages) throws Exception {
    emailOutputTask.addMessages(messages);
  }

  @Override
  public void write(Message message) throws Exception {
    emailOutputTask.addMessage(message);
  }

  public interface Factory extends MessageOutput.Factory<EmailOutput> {
    @Override
    EmailOutput create(Stream stream, Configuration configuration);

    @Override
    EmailOutput.Config getConfig();

    @Override
    EmailOutput.Descriptor getDescriptor();
  }

  public static class Descriptor extends MessageOutput.Descriptor {
    public Descriptor() {
      super(
        EmailOutputPlugin.PLUGIN_NAME,
        false,
        EmailOutputPlugin.PLUGIN_URL,
        EmailOutputPlugin.PLUGIN_DESCRIPTION);
    }
  }

  public static class Config extends MessageOutput.Config {
    @Override
    public ConfigurationRequest getRequestedConfiguration() {
      ConfigurationRequest configRequest = new ConfigurationRequest();
      configRequest.addField(new ListField(EmailOutputConfiguration.GROUP_BY_FIELDS,
        "Group By Fields",
        Collections.emptyList(),
        Collections.emptyMap(),
        "Fields names that should be used for grouping messages",
        ConfigurationField.Optional.OPTIONAL,
        ListField.Attribute.ALLOW_CREATE));
      configRequest.addField(new NumberField(EmailOutputConfiguration.EMAIL_INTERVAL,
        "E-mail Interval",
        1,
        "E-mail all messages received in the given number of minutes",
        ConfigurationField.Optional.NOT_OPTIONAL));
      configRequest.addField(new TextField(EmailOutputConfiguration.EMAIL_SUBJECT,
        "E-Mail Subject",
        EmailOutputConfiguration.DEFAULT_EMAIL_SUBJECT,
        "The subject of sent out mail",
        ConfigurationField.Optional.NOT_OPTIONAL));
      configRequest.addField(new TextField(EmailOutputConfiguration.EMAIL_BODY,
        "E-Mail Body",
        EmailOutputConfiguration.DEFAULT_EMAIL_BODY,
        "The template to generate the body from",
        ConfigurationField.Optional.NOT_OPTIONAL,
        TextField.Attribute.TEXTAREA));
      configRequest.addField(new ListField(EmailOutputConfiguration.EMAIL_RECEIVERS,
        "E-Mail Receivers",
        Collections.emptyList(),
        Collections.emptyMap(),
        "E-Mail addresses that should receive this mail",
        ConfigurationField.Optional.OPTIONAL,
        ListField.Attribute.ALLOW_CREATE));

      return configRequest;
    }
  }
}


text:
namespace pddl
{
namespace detail
{

////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Effect
//
////////////////////////////////////////////////////////////////////////////////////////////////////

normalizedAST::Effect normalize(ast::Effect &&effect, detail::NormalizationContext &normalizationContext)
{
	const auto handleLiteral =
		[](ast::Literal &literal) -> normalizedAST::Effect
		{
			return normalize(std::move(literal));
		};

	const auto handleAnd =
		[&](ast::AndPointer<ast::Effect> &and_) -> normalizedAST::Effect
		{
			normalizedAST::And<normalizedAST::Effect>::Arguments arguments;

			for (auto &argument : and_->arguments)
				arguments.emplace_back(normalize(std::move(argument), normalizationContext));

			return std::make_unique<normalizedAST::And<normalizedAST::Effect>>(std::move(arguments));
		};

	const auto handleForAll =
		[&](ast::ForAllPointer<ast::Effect> &forAll) -> normalizedAST::Effect
		{
			auto normalizedArgument = normalize(std::move(forAll->argument), normalizationContext);
			return std::make_unique<normalizedAST::ForAll<normalizedAST::Effect>>(std::move(forAll->parameters), std::move(normalizedArgument));
		};

	const auto handleWhen =
		[&](ast::WhenPointer<ast::Precondition, ast::ConditionalEffect> &when) -> normalizedAST::Effect
		{
			auto normalizedCondition = normalize(std::move(when->argumentLeft), normalizationContext);
			auto normalizedConditionalEffect = normalize(std::move(when->argumentRight));

			return std::make_unique<normalizedAST::When<normalizedAST::Precondition, normalizedAST::ConditionalEffect>>(std::move(normalizedCondition), std::move(normalizedConditionalEffect));
		};

	return effect.match(handleLiteral, handleAnd, handleForAll, handleWhen);
}

////////////////////////////////////////////////////////////////////////////////////////////////////

}
}


text:
package com.cjm721.overloaded.tile.hyperTransfer;

import com.cjm721.overloaded.storage.stacks.intint.LongItemStack;
import com.cjm721.overloaded.storage.item.IHyperHandlerItem;
import com.cjm721.overloaded.tile.ModTiles;
import com.cjm721.overloaded.tile.hyperTransfer.base.AbstractTileHyperSender;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;

import javax.annotation.Nonnull;

import static com.cjm721.overloaded.capabilities.CapabilityHyperItem.HYPER_ITEM_HANDLER;

/** {@link TileEntity That is able to receive items from a remote source} */
public class TileHyperItemSender extends AbstractTileHyperSender<LongItemStack, IHyperHandlerItem> {

  public TileHyperItemSender() {
    super(ModTiles.hyperItemSender, HYPER_ITEM_HANDLER);
  }

  @Override
  @Nonnull
  protected LongItemStack generate(long amount) {
    return new LongItemStack(ItemStack.EMPTY, amount);
  }

  @Override
  protected boolean isCorrectPartnerType(TileEntity te) {
    return te instanceof TileHyperItemReceiver;
  }
}


text:
package com.khoslalabs.nagarjuna_pamu.misscalltrigger;

import android.app.Application;

public class MissCallTrigger extends Application {

	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
	}

	@Override
	public void onTerminate() {
		// TODO Auto-generated method stub
		super.onTerminate();
	}

}


text:
require 'uri'

class Api::Json::OembedController < Api::ApplicationController
  include CartoDB

  skip_before_filter :api_authorization_required

  # Returns oembed data as required
  def show
    url = params[:url]
    width = params[:maxwidth] || '100%'
    height = params[:maxheight] || '520px'
    format = request.query_parameters[:format]
    force_https = true if params[:allow_http].nil?

    if (width =~ /^[0-9]+(%|px)?$/) == nil
      raise ActionController::RoutingError.new('Incorrect width')
    end
    if (height =~ /^[0-9]+(%|px)?$/) == nil
      raise ActionController::RoutingError.new('Incorrect height')
    end

    uri = URI.parse(url)

    begin
      uuid = /(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})/.match(uri.path)[0]
    rescue NoMethodError
      raise ActionController::RoutingError.new('UUID not found in URL')
    end

    begin
      viz = CartoDB::Visualization::Member.new(id: uuid).fetch
    rescue KeyError
      name = ''
    else
      name = viz.name
    end

    protocol = force_https ? "https" : uri.scheme

    url_data = URI.split(url)
    organization = nil
    if url_data[5][0..2] == "/u/"
      user = url_data[5].split('/')[2]
      user_profile = "#{protocol}://#{url_data[2]}/u/#{user}"
      organization = url_data[2].split('.')[0]
    else
      user = url_data[2].split('.')[0]
      user_profile = "#{protocol}://#{url_data[2]}"
    end

    # build the url using full schema because any visuaization should work with any user
    url = CartoDB.user_url(user, organization)  + public_visualizations_embed_map_path(id: uuid)
    # force the schema
    if protocol == 'https' && !url.include?('https')
      url = url.sub('http', 'https')
    end

    html = "<iframe width='#{width}' height='#{height}' frameborder='0' src='#{url}' allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>"

    response_data = {
        :type => 'rich',
        :version => '1.0',
        :width => width,
        :height => height,
        :title => name,
        :html => html,
        :author_name => user,
        :author_url => user_profile,
        :provider_name => 'CartoDB',
        :provider_url => "#{protocol}://www.cartodb.com/"
    }

    if format == 'xml'
      render xml: response_data.to_xml(root: 'oembed')
    else
      render json: response_data.to_json
    end
  end
end


text:
/////////////////////////////////////////////////////////////////////////////
// Name:        src/msw/spinbutt.cpp
// Purpose:     wxSpinButton
// Author:      Julian Smart
// Modified by:
// Created:     04/01/98
// Copyright:   (c) Julian Smart
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

// ============================================================================
// declarations
// ============================================================================

// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------

// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly"
    #include "wx/app.h"
#endif

#if wxUSE_SPINBTN

#include "wx/spinbutt.h"

#include "wx/msw/private.h"

#ifndef UDM_SETRANGE32
    #define UDM_SETRANGE32 (WM_USER+111)
#endif

#ifndef UDM_SETPOS32
    #define UDM_SETPOS32 (WM_USER+113)
    #define UDM_GETPOS32 (WM_USER+114)
#endif

// ============================================================================
// implementation
// ============================================================================

// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------

// ----------------------------------------------------------------------------
// wxSpinButton
// ----------------------------------------------------------------------------

bool wxSpinButton::Create(wxWindow *parent,
                          wxWindowID id,
                          const wxPoint& pos,
                          const wxSize& size,
                          long style,
                          const wxString& name)
{
    // basic initialization
    m_windowId = (id == wxID_ANY) ? NewControlId() : id;

    SetName(name);

    int x = pos.x;
    int y = pos.y;
    int width = size.x;
    int height = size.y;

    m_windowStyle = style;

    SetParent(parent);

    // get the right size for the control
    if ( width <= 0 || height <= 0 )
    {
        wxSize bestSize = DoGetBestSize();
        if ( width <= 0 )
            width = bestSize.x;
        if ( height <= 0 )
            height = bestSize.y;
    }

    if ( x < 0 )
        x = 0;
    if ( y < 0 )
        y = 0;

    // translate the styles
    DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | /*  WS_CLIPSIBLINGS | */
                   UDS_NOTHOUSANDS | // never useful, sometimes harmful
                   UDS_SETBUDDYINT;  // it doesn't harm if we don't have buddy

    if ( m_windowStyle & wxCLIP_SIBLINGS )
        wstyle |= WS_CLIPSIBLINGS;
    if ( m_windowStyle & wxSP_HORIZONTAL )
        wstyle |= UDS_HORZ;
    if ( m_windowStyle & wxSP_ARROW_KEYS )
        wstyle |= UDS_ARROWKEYS;
    if ( m_windowStyle & wxSP_WRAP )
        wstyle |= UDS_WRAP;

    // create the UpDown control.
    m_hWnd = (WXHWND)CreateUpDownControl
                     (
                       wstyle,
                       x, y, width, height,
                       GetHwndOf(parent),
                       m_windowId,
                       wxGetInstance(),
                       NULL, // no buddy
                       m_max, m_min,
                       m_min // initial position
                     );

    if ( !m_hWnd )
    {
        wxLogLastError(wxT("CreateUpDownControl"));

        return false;
    }

    if ( parent )
    {
        parent->AddChild(this);
    }

    SubclassWin(m_hWnd);

    SetInitialSize(size);

    return true;
}

wxSpinButton::~wxSpinButton()
{
}

// ----------------------------------------------------------------------------
// size calculation
// ----------------------------------------------------------------------------

wxSize wxSpinButton::DoGetBestSize() const
{
    const bool vert = HasFlag(wxSP_VERTICAL);

    wxSize bestSize(::GetSystemMetrics(vert ? SM_CXVSCROLL : SM_CXHSCROLL),
                    ::GetSystemMetrics(vert ? SM_CYVSCROLL : SM_CYHSCROLL));

    if ( vert )
        bestSize.y *= 2;
    else
        bestSize.x *= 2;

    return bestSize;
}

// ----------------------------------------------------------------------------
// Attributes
// ----------------------------------------------------------------------------

int wxSpinButton::GetValue() const
{
    int n;
#ifdef UDM_GETPOS32
    // use the full 32 bit range if available
    n = ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0);
#else
    // we're limited to 16 bit
    n = (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0));
#endif // UDM_GETPOS32

    if (n < m_min) n = m_min;
    if (n > m_max) n = m_max;

    return n;
}

void wxSpinButton::SetValue(int val)
{
    // wxSpinButtonBase::SetValue(val); -- no, it is pure virtual

#ifdef UDM_SETPOS32
    // use the full 32 bit range if available
    ::SendMessage(GetHwnd(), UDM_SETPOS32, 0, val);
#else
    ::SendMessage(GetHwnd(), UDM_SETPOS, 0, MAKELONG((short) val, 0));
#endif // UDM_SETPOS32
}

void wxSpinButton::NormalizeValue()
{
    SetValue( GetValue() );
}

void wxSpinButton::SetRange(int minVal, int maxVal)
{
    const bool hadRange = m_min < m_max;

    wxSpinButtonBase::SetRange(minVal, maxVal);

#ifdef UDM_SETRANGE32
    // use the full 32 bit range if available
    ::SendMessage(GetHwnd(), UDM_SETRANGE32, minVal, maxVal);
#else
    // we're limited to 16 bit
    ::SendMessage(GetHwnd(), UDM_SETRANGE, 0,
                  (LPARAM) MAKELONG((short)maxVal, (short)minVal));
#endif // UDM_SETRANGE32

    // the current value might be out of the new range, force it to be in it
    NormalizeValue();

    // if range was valid but becomes degenerated (min == max) now or vice
    // versa then the spin buttons are automatically disabled/enabled back
    // but don't update themselves for some reason, so do it manually
    if ( hadRange != (m_min < m_max) )
    {
        // update the visual state of the button
        Refresh();
    }
}

bool wxSpinButton::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
                               WXWORD WXUNUSED(pos), WXHWND control)
{
    wxCHECK_MSG( control, false, wxT("scrolling what?") );

    if ( wParam != SB_THUMBPOSITION )
    {
        // probable SB_ENDSCROLL - we don't react to it
        return false;
    }

    wxSpinEvent event(wxEVT_SCROLL_THUMBTRACK, m_windowId);
    // We can't use 16 bit position provided in this message for spin buttons
    // using 32 bit range.
    event.SetPosition(GetValue());
    event.SetEventObject(this);

    return HandleWindowEvent(event);
}

bool wxSpinButton::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM *result)
{
    NM_UPDOWN *lpnmud = (NM_UPDOWN *)lParam;

    if (lpnmud->hdr.hwndFrom != GetHwnd()) // make sure it is the right control
        return false;

    wxSpinEvent event(lpnmud->iDelta > 0 ? wxEVT_SCROLL_LINEUP
                                         : wxEVT_SCROLL_LINEDOWN,
                      m_windowId);
    event.SetPosition(lpnmud->iPos + lpnmud->iDelta);
    event.SetEventObject(this);

    bool processed = HandleWindowEvent(event);

    *result = event.IsAllowed() ? 0 : 1;

    return processed;
}

bool wxSpinButton::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD WXUNUSED(id))
{
    // No command messages
    return false;
}

#endif // wxUSE_SPINBTN


text:
The code repository for the Affordance++ master thesis

### Install instructions

1. opening up a virtual env for python (3.4)
virtualenv -p /usr/bin/python3.4 <path/to/new/virtualenv/>

2. pip install -r requirements.txt

3. git clone https://github.com/rpavlik/vrpn.git
make the main C library (cmake, make)

4. ccmake with te follwoing command:
ccmake ../ -DPYTHON_LIBRARIES=/Library/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON_INCLUDE_PATH=/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -DPYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m
or
ccmake ../ -DPYTHON_LIBRARIES=/Library/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON_INCLUDE_PATH=/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -DPYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m

and then make

5. cd into ../python and edit GNUMakefile and uncommet #mac unversal and #python 3.4 and then make
make install
copy manually the universal(or whatever build name)/vrpn.so to your libs place, for instance venv/lib/Python/site-packages

6. install mondodb
> mongod --dbpath mongodata/

7. Install Unity

Should run.

###
use coffee -j compiled.js -cwo www/static/js www/static/coffee/ for coffee compiling


text: Third parties software & init script.


text:
package com.koch.ambeth.training.travelguides.model;

public interface Image extends GuideBookBaseEntity
{
	String NAME = "Name";

	String getName();

	void setName(String name);
}


text:
"""Twisted implementation of an interface to the Gerrit REST API and
associated JSON objects."""

import json
import urlparse

from common.gerrit.base import GERRIT_JSON_HEADER
from common.twisted_util.agent import Agent
from common.twisted_util.agent_util import ToRelativeURL, RelativeURLJoin
from common.twisted_util.response import JsonResponse, StringResponse
from common.twisted_util.body_producers import JsonBodyProducer
from common.twisted_util.netrc_authorizer import NETRCAuthorizer
from common.twisted_util.gce_authorizer import GCEAuthorizer
from twisted.python import log

class GerritJsonResponse(JsonResponse):
  """JsonResponse specialization for Gerrit responses.

  Gerrit includes a header in its JSON responses to prevent XSS attacks:
  https://gerrit-review.googlesource.com/Documentation/rest-api.html#output

  This class strips that off before allowing standard JSON processing to
  happen on the remainder of the body.
  """
  # pylint: disable=no-init

  def _processBody(self, body):
    if not body.startswith(GERRIT_JSON_HEADER):
      raise ValueError("Mal-formed JSON response does not begin with Gerrit "
                       "JSON header: (%r != %r)" % (
                           body[:len(GERRIT_JSON_HEADER)],
                           GERRIT_JSON_HEADER))
    return JsonResponse._processBody(
        self,
        body[len(GERRIT_JSON_HEADER):]
    )

class GerritAgent(Agent):
  """An 'Agent' that is specialized to query Gerrit servers."""

  def __init__(self, host, *args, **kwargs):
    # Use 'HTTPS' as the default protocol (backwards compatibility)
    url = urlparse.urlparse(host)
    if url.scheme == '':
      host = 'https://%s' % (host,)
      is_https = True
    elif url.scheme == 'https':
      is_https = True
    else:
      is_https = False

    # Use 'NETRCAuthorizer' if none is provided (backwards-compatibility), but
    # only for HTTPS. For GCE hosts, use custom mechanism to retrieve token as
    # GCE machines do not use .netrc.
    if (kwargs.get('authorizer') is None) and (is_https):
      if GCEAuthorizer.is_gce_host():
        log.msg("Using default 'GCE' authorizer for HTTPS connection")
        kwargs['authorizer'] = GCEAuthorizer(GCEAuthorizer.get_token_dict())
      else:
        log.msg("Using default 'NETRC' authorizer for HTTPS connection")
        kwargs['authorizer'] = NETRCAuthorizer()
    Agent.__init__(self, host, *args, **kwargs)

  # Overrides 'Agent._buildRequest'
  def _buildRequest(self, path, headers):
    """Constructs a Gerrit request.

    See 'Agent._buildRequest' for details.
    """
    # Add authorization
    if self._authorizer is not None:
      if self._authorizer.addAuthHeadersForURL(
          headers,
          self.base_url):
        # Switch to authenticated Gerrit URL
        path = ToRelativeURL(path)
        if not path.startswith('a/'):
          path = RelativeURLJoin('a/', path)
      elif self.verbose:
        log.msg("No authentication for URL %r" % (self.base_url,))
    return RelativeURLJoin(self.base_url, path)

  # Disable argument number difference | pylint: disable=W0221
  def request(self, method, path, body=None, protocol=None, **kwargs):
    """Makes a request to a Gerrit server.

    'protocol' is a function that accepts a 'Response' object and
    returns a Deferred whose return value is the loaded body. Some examples of
    such functions are:
      - StringResponse.Get
      - GerritJsonResponse.Get
    If omitted, the 'GerritJsonResponse.Get' function will be used, treating
    the Gerrit response as JSON and deserializing it as a return value.

    Args:
      method: (str) The HTTP request type (GET, PUT, POST, DELETE)
      path: (str) The path within the Agent's host to query
      body: (object) If not 'None', the JSON object to serialize as the HTTP
          request body.
      protocol: (func) The Response processing function; if omitted, the
          Response will be treated as JSON and deserialized.
      kwargs: Remaining keyword arguments to 'Agent.request'
    Returns: (Deferred) By default, the Deferred will return the JSON response;
        this can be overridden via the 'protocol' parameter.
    """
    if body is not None:
      kwargs.setdefault('body_producer', JsonBodyProducer(body))
    kwargs.setdefault('error_protocol', StringResponse.Get)
    default_json = (protocol is None)
    if default_json:
      protocol = GerritJsonResponse.Get

    d = Agent.request(
        self,
        method,
        path,
        **kwargs)
    d.addCallback(protocol)

    if (self.verbose) and (default_json):
      def cbDumpResponse(response):
        log.msg("Gerrit response:\n", json.dumps(response, indent=2))
        return response
      d.addCallback(cbDumpResponse)

    return d


text:
<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "po_item".
 *
 * @property integer $id
 * @property integer $po_id
 * @property string $po_item_no
 * @property double $quantity
 *
 * @property Po $id0
 */
class PoItem extends \yii\db\ActiveRecord{
	/**
	 * @inheritdoc
	 */
	public static function tableName(){
		return 'po_item';
	}

	/**
	 * @inheritdoc
	 */
	public function rules(){
		return [
			[['po_item_no', 'quantity'], 'required'],
			[['po_id'], 'integer'],
			[['quantity'], 'number'],
			[['po_item_no'], 'string', 'max' => 10]
		];
	}

	/**
	 * @inheritdoc
	 */
	public function attributeLabels(){
		return [
			'id' => Yii::t('backend', 'ID'),
			'po_id' => Yii::t('backend', 'Po ID'),
			'po_item_no' => Yii::t('backend', 'Po Item No'),
			'quantity' => Yii::t('backend', 'Quantity'),
		];
	}

	/**
	 * @return \yii\db\ActiveQuery
	 */
	public function getId0(){
		return $this->hasOne(Po::className(), ['id' => 'id']);
	}
}


text:
namespace Simple.Web
{
    public partial struct Status
    {
// ReSharper disable MemberHidesStaticFromOuterClass
        public static class Redirect
        {
            public static Status MovedPermanently(string location)
            {
                return new Status(301, "Moved Permanently", location);
            }
            public static Status Found(string location)
            {
                return new Status(302, "Found", location);
            }
            public static Status SeeOther(string location)
            {
                return new Status(303, "See Other", location);
            }
            public static readonly Status NotModified = new Status(304, "Not Modified");
            public static Status UseProxy(string location)
            {
                return new Status(305, "Use Proxy", location);
            }
            public static Status TemporaryRedirect(string location)
            {
                return new Status(307, "Temporary Redirect", location);
            }
// ReSharper restore MemberHidesStaticFromOuterClass
        }
    }
}