text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BrandonPotter.XBox
{
    public class XBoxController
    {
        private SharpDX.XInput.Controller dxC;
        private SharpDX.XInput.State lastGamepadState = new SharpDX.XInput.State();
        private int lastLeftMotorRawValue;
        private long lastMsRefreshed;
        private int lastRightMotorRawValue;
        private int pIndex;
        private long ticksPerMs = TimeSpan.TicksPerMillisecond;
        private bool connected = false;

        private static Dictionary<int, XBoxController> _controllers = null;
        public static IEnumerable<XBoxController> GetConnectedControllers()
        {
            InitControllers();

            return _controllers.Values.Where(c => c.IsConnected).ToList();
        }

        internal static IEnumerable<XBoxController> GetAllControllers()
        {
            InitControllers();

            return _controllers.Values.ToList();
        }

        private static void InitControllers()
        {
            if (_controllers == null)
            {
                _controllers = new Dictionary<int, XBoxController>();

                _controllers[0] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.One));
                _controllers[1] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Two));
                _controllers[2] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Three));
                _controllers[3] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Four));
            }
        }

        internal XBoxController(SharpDX.XInput.Controller dxController)
        {
            this.dxC = dxController;
            this.pIndex = (int)this.dxC.UserIndex;
            this.SnapDeadZoneCenter = 50.0;
            this.SnapDeadZoneTolerance = 10.0;
            this.TriggerLeftPressThreshold = 10.0;
            this.TriggerRightPressThreshold = 10.0;
            this.RefreshIntervalMilliseconds = 30;
        }

        private void EnsureRefresh()
        {
            long num = Environment.TickCount * this.ticksPerMs;

            if (!connected)
            {
                if ((num - this.lastMsRefreshed) < 1000)
                {
                    return;
                }
            }

            if ((num - this.lastMsRefreshed) > this.RefreshIntervalMilliseconds)
            {
                this.RefreshControllerState();
            }
        }

        private double GetPercentageValue(double min, double max, double value)
        {
            if (value > max)
            {
                return 100.0;
            }
            double num = max - min;
            if (num < 0.0)
            {
                return 0.0;
            }
            double num2 = 0.0 - min;
            double num3 = max + num2;
            double num4 = value + num2;
            if (num4 == 0.0)
            {
                return 0.0;
            }
            return ((num4 / num3) * 100.0);
        }

        private void RefreshControllerState()
        {
            this.lastMsRefreshed = Environment.TickCount * this.ticksPerMs;

            try
            {
                var state = this.dxC.GetState();
                this.lastGamepadState = state;
                connected = true;
            } catch (SharpDX.SharpDXException ex)
            {
                if (ex.Message.ToUpper().Contains("THE DEVICE IS NOT CONNECTED"))
                {
                    connected = false;
                }
            }
        }

        private double RoundToSnap(double value)
        {
            double num = this.SnapDeadZoneCenter - this.SnapDeadZoneTolerance;
            double num2 = this.SnapDeadZoneCenter + this.SnapDeadZoneTolerance;
            if ((value >= num) && (value <= num2))
            {
                return this.SnapDeadZoneCenter;
            }
            return value;
        }

        public void SetLeftMotorVibrationSpeed(double percentageSpeed)
        {
            int num = Convert.ToInt32((double)(65000.0 * (percentageSpeed / 100.0)));
            this.lastLeftMotorRawValue = num;
            this.SetMotorSpeeds();
        }

        private void SetMotorSpeeds()
        {
            this.dxC.SetVibration(new SharpDX.XInput.Vibration() { LeftMotorSpeed = Convert.ToUInt16(this.lastLeftMotorRawValue), RightMotorSpeed = Convert.ToUInt16(this.lastRightMotorRawValue) });
        }

        public void SetRightMotorVibrationSpeed(double percentageSpeed)
        {
            int num = Convert.ToInt32((double)(65000.0 * (percentageSpeed / 100.0)));
            this.lastRightMotorRawValue = num;
            this.SetMotorSpeeds();
        }

        public override string ToString()
        {
            int num = this.pIndex + 1;
            return ("XBox Controller " + num.ToString());
        }

        // Properties
        public bool ButtonAPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.A);
            }
        }

        public bool ButtonBackPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.Back);
            }
        }

        public bool ButtonBPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.B);
            }
        }

        public bool ButtonDownPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.DPadDown);
            }
        }

        public bool ButtonLeftPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.DPadLeft);
            }
        }

        public bool ButtonRightPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.DPadRight);
            }
        }

        public bool ButtonShoulderLeftPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.LeftShoulder);
            }
        }

        public bool ButtonShoulderRightPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.RightShoulder);
            }
        }

        public bool ButtonStartPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.Start);
            }
        }

        public bool ButtonUpPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.DPadUp);
            }
        }

        public bool ButtonXPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.X);
            }
        }

        public bool ButtonYPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.Y);
            }
        }

        public bool IsConnected
        {
            get
            {
                this.EnsureRefresh();
                return this.connected;
            }
        }

        public double LeftMotorVibrationSpeed
        {
            get
            {
                this.EnsureRefresh();
                return this.GetPercentageValue(0.0, 65000.0, (double)this.lastLeftMotorRawValue);
            }
        }

        public int PlayerIndex
        {
            get
            {
                return this.pIndex;
            }
        }

        public int RefreshIntervalMilliseconds { get; set; }

        public double RightMotorVibrationSpeed
        {
            get
            {
                this.EnsureRefresh();
                return this.GetPercentageValue(0.0, 65000.0, (double)this.lastRightMotorRawValue);
            }
        }

        public double SnapDeadZoneCenter { get; set; }

        public double SnapDeadZoneTolerance { get; set; }

        public double ThumbLeftX
        {
            get
            {
                this.EnsureRefresh();
                return this.RoundToSnap(this.GetPercentageValue(-32768.0, 32767.0, (double)this.lastGamepadState.Gamepad.LeftThumbX));
            }
        }

        public double ThumbLeftY
        {
            get
            {
                this.EnsureRefresh();
                return this.RoundToSnap(this.GetPercentageValue(-32768.0, 32767.0, (double)this.lastGamepadState.Gamepad.LeftThumbY));
            }
        }

        public bool ThumbpadLeftPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.LeftThumb);
            }
        }

        public bool ThumbpadRightPressed
        {
            get
            {
                this.EnsureRefresh();
                return lastGamepadState.Gamepad.Buttons.HasFlag(SharpDX.XInput.GamepadButtonFlags.RightThumb);
            }
        }

        public double ThumbRightX
        {
            get
            {
                this.EnsureRefresh();
                return this.RoundToSnap(this.GetPercentageValue(-32768.0, 32767.0, (double)this.lastGamepadState.Gamepad.RightThumbX));
            }
        }

        public double ThumbRightY
        {
            get
            {
                this.EnsureRefresh();
                return this.RoundToSnap(this.GetPercentageValue(-32768.0, 32767.0, (double)this.lastGamepadState.Gamepad.RightThumbY));
            }
        }

        public double TriggerLeftPosition
        {
            get
            {
                this.EnsureRefresh();
                return this.GetPercentageValue(0.0, 255.0, (double)this.lastGamepadState.Gamepad.LeftTrigger);
            }
        }

        public bool TriggerLeftPressed
        {
            get
            {
                this.EnsureRefresh();
                return (this.TriggerLeftPosition > this.TriggerLeftPressThreshold);
            }
        }

        public double TriggerLeftPressThreshold { get; set; }

        public double TriggerRightPosition
        {
            get
            {
                this.EnsureRefresh();
                return this.GetPercentageValue(0.0, 255.0, (double)this.lastGamepadState.Gamepad.RightTrigger);
            }
        }

        public bool TriggerRightPressed
        {
            get
            {
                this.EnsureRefresh();
                return (this.TriggerRightPosition > this.TriggerRightPressThreshold);
            }
        }

        public double TriggerRightPressThreshold { get; set; }
    }
}


text:
/**
 * myTitleFilter
 * intended for use in the <title> tag.
 */

angular.module(PKG.name+'.filters').filter('myTitleFilter',
function myTitleFilter () {

  return function(state) {
    var title = state.data && state.data.title;
    return (title ? title + ' | ' : '') + 'Coopr';
  };

});

redpajama_set_name: RedPajamaGithub


text:
import logging
import json
import django

from flask import request
from werkzeug.exceptions import BadRequest

from django.conf import settings
from cohorts.metadata_helpers import get_full_case_metadata, get_full_sample_metadata

logger = logging.getLogger(settings.LOGGER_NAME)

def get_metadata(barcode=None, type=None):

    result = None
    barcodes = None

    try:
        if barcode:
            barcodes = [barcode]
        else:
            request_data = request.get_json()
            if 'barcodes' in request_data:
                barcodes = request_data['barcodes']

        if not barcodes or not len(barcodes):
            result = {
                'message': 'A list of {} barcodes was not found in this request. Please double-check the expected request JSON format.'.format(type)
            }
        else:
            if type == 'sample':
                result = get_full_sample_metadata(barcodes)
            else:
                result = get_full_case_metadata(barcodes)
            if not result or not result['total_found']:
                if not result:
                    result = {}
                else:
                    del result['total_found']
                result['message'] = "No metadata was found for the supplied {} barcodes.".format(type)
            else:
                if 'not_found' in result:
                    result['notes'] = "Some {} barcodes provided were not found. See 'not_found' for a list.".format(type)

    except BadRequest as e:
        logger.warn("[WARNING] Received bad request - couldn't load JSON.")
        result = {
            'message': 'The JSON provided in this request appears to be improperly formatted.',
        }

    except Exception as e:
        logger.error("[ERROR] While fetching {} metadata: ".format(type))
        logger.exception(e)

    return result


text:
import Ember from 'ember';

export default Ember.Component.extend({
  maxValue:0,
  updateValue: function(){
    "use strict";
    var value = this.get("value");
    var maxValue = this.get("maxValue");
    if(value>maxValue) {
      this.set('maxValue',value);
    }
  }.observes("value")
});


text:
//
//  JSGameMenu.m
//  JSGameMenu
//
//  Created by Jared Sealey on 9/22/13.
//  Copyright (c) 2013 Jared Sealey. All rights reserved.
//

#import "JSGameMenu.h"

@implementation JSGameMenu

#define FRONT 1001
#define BACK  1000

-(id)initWithSize:(CGSize)size  withReplayHandler:(dispatch_block_t)replay withExitHandler:(dispatch_block_t)exit {
    return [self initWithSize:size withColorTheme:[UIColor grayColor] withReplayHandler:replay withExitHandler:exit];
}

-(id)initWithSize:(CGSize)size withColorTheme:(UIColor*)theme  withReplayHandler:(dispatch_block_t)replay withExitHandler:(dispatch_block_t)exit{
    if (self = [super init]) {

        /* Set the position of the game menu to the top right corner of the current frame */
        self.position = CGPointMake(size.width - 25, size.height - 30);

        /* Set up PAUSE button */
        [self addButtonWithSprite:&_pause withImageName:@"pause" withColor:theme withSize:CGSizeMake(50,50)  withPosition:CGPointMake(_pause.position.x, _pause.position.y - 10)];

        /* Set up PLAY button */
        [self addButtonWithSprite:&_play withImageName:@"play" withColor:theme withSize:CGSizeMake(44,44)  withPosition:CGPointMake(-15, -30)];

        /* Set up REPLAY button */
        [self addButtonWithSprite:&_replay withImageName:@"replay" withColor:theme withSize:CGSizeMake(44,44)  withPosition:CGPointMake(-15, -74)];

        /* Set up EXIT button */
        [self addButtonWithSprite:&_exit withImageName:@"exit" withColor:theme withSize:CGSizeMake(44,44)  withPosition:CGPointMake(-15, -118)];

        /* The PLAY, REPLAY and EXIT button start out hidden */
        [_play   setHidden:YES];
        [_replay setHidden:YES];
        [_exit   setHidden:YES];

        /* Make sure all of the buttons show up above the current scene and in the correct order */
        _pause.zPosition = FRONT;
        _play.zPosition = _replay.zPosition = _exit.zPosition = BACK;

        /* Set the handlers for use later */
        _replayHandler = replay;
        _exitHandler   = exit;

    }
    return self;
}

-(void) handleTouch:(NSSet *)touches withEvent:(UIEvent *)event {
    for (UITouch *touch in touches) {

        CGPoint location = [touch locationInNode:self];
        SKNode *node = [self nodeAtPoint:location];

        NSLog(@"%@",node.name);

        if (self.parent.isPaused == NO) {
            if ([node.name isEqualToString:@"pause"]) {

                [self.parent setPaused:YES];

                _pause.zPosition = BACK;
                _play.zPosition  = FRONT;

                [_pause  setHidden:YES];
                [_play   setHidden:NO];
                [_replay setHidden:NO];
                [_exit   setHidden:NO];

            }
        } else {
            if ([node.name isEqualToString:@"play"]) {

                [self.parent setPaused:NO];

                _pause.zPosition = FRONT;
                _play.zPosition  = BACK;

                [_pause  setHidden:NO];
                [_play   setHidden:YES];
                [_replay setHidden:YES];
                [_exit   setHidden:YES];

            } else if ([node.name isEqualToString:@"replay"]) {
                _replayHandler();
            } else if([node.name isEqualToString:@"exit"]) {
                _exitHandler();
            }
        }
    }
}

/* I had to pass the sprite as strongly indirect since ARC requires their pointer types to be passed for double pointers */
-(void) addButtonWithSprite:(SKSpriteNode * __strong *)sprite withImageName:(NSString*)name withColor:(UIColor*)theme withSize:(CGSize)size withPosition:(CGPoint)position {

    *sprite = [SKSpriteNode spriteNodeWithColor:[UIColor clearColor] size:size];
    [*sprite setPosition:position];
    [*sprite setName:name];

    SKSpriteNode *image = [SKSpriteNode spriteNodeWithImageNamed:[NSString stringWithFormat:@"%@.png",name]];
    image.name = name;
    image.color = theme;
    image.colorBlendFactor = 1.0;

    if([name isEqualToString:@"pause"])
        image.alpha = 0.5;

    [*sprite addChild:image];
    [self addChild:*sprite];
}

@end


text:
import { NgModule, ApplicationRef, provide, Provider } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';

import { removeNgStyles, createNewHosts } from '@angularclass/hmr';

/*
 * Platform and Environment providers/directives/pipes
 */
import { ENV_PROVIDERS } from './environment';
import { routing } from './app.routing';

// App is our top level component
import { App } from './app.component';
import { AppState } from './app.service';
import { GlobalState } from './global.state';
import { NgaModule } from './theme/nga.module';
import { PagesModule } from './pages/pages.module';
import { AuthorisationGuard } from './authorisation.guard';
import { Configuration } from './configuration';
import { LogService } from 'angular2-log/log';
import { GlobalService } from './globals';

import { LocalStorageService, LOCAL_STORAGE_SERVICE_CONFIG } from 'angular-2-local-storage';

let localStorageServiceConfig = {
    prefix: 'my-app',
    storageType: 'localStorage'
};
// Provide the config to the service:
const LOCAL_STORAGE_CONFIG_PROVIDER: Provider = provide(LOCAL_STORAGE_SERVICE_CONFIG, {
    useValue: localStorageServiceConfig
});

// Application wide providers
const APP_PROVIDERS = [
  AppState,
  GlobalState
];

/**
 * `AppModule` is the main entry point into Angular2's bootstraping process
 */
@NgModule({
  bootstrap: [App],
  declarations: [
    App
  ],
  imports: [ // import Angular's modules
    BrowserModule,
    HttpModule,
    RouterModule,
    FormsModule,
    ReactiveFormsModule,
    NgaModule,
    PagesModule,
    routing
  ],
  providers: [ // expose our Services and Providers into Angular's dependency injection
    ENV_PROVIDERS,
    APP_PROVIDERS,
    LocalStorageService, LOCAL_STORAGE_CONFIG_PROVIDER,
    AuthorisationGuard, LogService,
    GlobalService
  ]
})

export class AppModule {

  constructor(public appRef: ApplicationRef, public appState: AppState) {

  }

  hmrOnInit(store) {
    if (!store || !store.state) return;
    console.log('HMR store', store);
    this.appState._state = store.state;
    this.appRef.tick();
    delete store.state;
  }

  hmrOnDestroy(store) {
    const cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
    // recreate elements
    const state = this.appState._state;
    store.state = state;
    store.disposeOldHosts = createNewHosts(cmpLocation);
    // remove styles
    removeNgStyles();
  }

  hmrAfterDestroy(store) {
    // display new elements
    store.disposeOldHosts();
    delete store.disposeOldHosts;
  }
}


text:
class CategoryPolicy

  attr_reader :user, :category

  def initialize(user, category)
    @user = user
    @category = category
  end

  def all
    user.admin?
  end

  alias_method :new?,     :all
  alias_method :edit?,    :all
  alias_method :create?,  :all
  alias_method :update?,  :all
  alias_method :destroy?, :all

end


text:
#include <linux/module.h>
#include <linux/of_device.h>

#include <sound/soc.h>

#include <sysdev/bestcomm/bestcomm.h>
#include <sysdev/bestcomm/gen_bd.h>
#include <asm/mpc52xx_psc.h>

#include "mpc5200_dma.h"

/*
 * Interrupt handlers
 */
static irqreturn_t psc_dma_status_irq(int irq, void *_psc_dma)
{
	struct psc_dma *psc_dma = _psc_dma;
	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
	u16 isr;

	isr = in_be16(&regs->mpc52xx_psc_isr);

	/* Playback underrun error */
	if (psc_dma->playback.active && (isr & MPC52xx_PSC_IMR_TXEMP))
		psc_dma->stats.underrun_count++;

	/* Capture overrun error */
	if (psc_dma->capture.active && (isr & MPC52xx_PSC_IMR_ORERR))
		psc_dma->stats.overrun_count++;

	out_8(&regs->command, MPC52xx_PSC_RST_ERR_STAT);

	return IRQ_HANDLED;
}

/**
 * psc_dma_bcom_enqueue_next_buffer - Enqueue another audio buffer
 * @s: pointer to stream private data structure
 *
 * Enqueues another audio period buffer into the bestcomm queue.
 *
 * Note: The routine must only be called when there is space available in
 * the queue.  Otherwise the enqueue will fail and the audio ring buffer
 * will get out of sync
 */
static void psc_dma_bcom_enqueue_next_buffer(struct psc_dma_stream *s)
{
	struct bcom_bd *bd;

	/* Prepare and enqueue the next buffer descriptor */
	bd = bcom_prepare_next_buffer(s->bcom_task);
	bd->status = s->period_bytes;
	bd->data[0] = s->period_next_pt;
	bcom_submit_next_buffer(s->bcom_task, NULL);

	/* Update for next period */
	s->period_next_pt += s->period_bytes;
	if (s->period_next_pt >= s->period_end)
		s->period_next_pt = s->period_start;
}

static void psc_dma_bcom_enqueue_tx(struct psc_dma_stream *s)
{
	if (s->appl_ptr > s->runtime->control->appl_ptr) {
		/*
		 * In this case s->runtime->control->appl_ptr has wrapped around.
		 * Play the data to the end of the boundary, then wrap our own
		 * appl_ptr back around.
		 */
		while (s->appl_ptr < s->runtime->boundary) {
			if (bcom_queue_full(s->bcom_task))
				return;

			s->appl_ptr += s->period_size;

			psc_dma_bcom_enqueue_next_buffer(s);
		}
		s->appl_ptr -= s->runtime->boundary;
	}

	while (s->appl_ptr < s->runtime->control->appl_ptr) {

		if (bcom_queue_full(s->bcom_task))
			return;

		s->appl_ptr += s->period_size;

		psc_dma_bcom_enqueue_next_buffer(s);
	}
}

/* Bestcomm DMA irq handler */
static irqreturn_t psc_dma_bcom_irq_tx(int irq, void *_psc_dma_stream)
{
	struct psc_dma_stream *s = _psc_dma_stream;

	spin_lock(&s->psc_dma->lock);
	/* For each finished period, dequeue the completed period buffer
	 * and enqueue a new one in it's place. */
	while (bcom_buffer_done(s->bcom_task)) {
		bcom_retrieve_buffer(s->bcom_task, NULL, NULL);

		s->period_current_pt += s->period_bytes;
		if (s->period_current_pt >= s->period_end)
			s->period_current_pt = s->period_start;
	}
	psc_dma_bcom_enqueue_tx(s);
	spin_unlock(&s->psc_dma->lock);

	/* If the stream is active, then also inform the PCM middle layer
	 * of the period finished event. */
	if (s->active)
		snd_pcm_period_elapsed(s->stream);

	return IRQ_HANDLED;
}

static irqreturn_t psc_dma_bcom_irq_rx(int irq, void *_psc_dma_stream)
{
	struct psc_dma_stream *s = _psc_dma_stream;

	spin_lock(&s->psc_dma->lock);
	/* For each finished period, dequeue the completed period buffer
	 * and enqueue a new one in it's place. */
	while (bcom_buffer_done(s->bcom_task)) {
		bcom_retrieve_buffer(s->bcom_task, NULL, NULL);

		s->period_current_pt += s->period_bytes;
		if (s->period_current_pt >= s->period_end)
			s->period_current_pt = s->period_start;

		psc_dma_bcom_enqueue_next_buffer(s);
	}
	spin_unlock(&s->psc_dma->lock);

	/* If the stream is active, then also inform the PCM middle layer
	 * of the period finished event. */
	if (s->active)
		snd_pcm_period_elapsed(s->stream);

	return IRQ_HANDLED;
}

static int psc_dma_hw_free(struct snd_pcm_substream *substream)
{
	snd_pcm_set_runtime_buffer(substream, NULL);
	return 0;
}

/**
 * psc_dma_trigger: start and stop the DMA transfer.
 *
 * This function is called by ALSA to start, stop, pause, and resume the DMA
 * transfer of data.
 */
static int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct psc_dma_stream *s;
	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
	u16 imr;
	unsigned long flags;
	int i;

	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
		s = &psc_dma->capture;
	else
		s = &psc_dma->playback;

	dev_dbg(psc_dma->dev, "psc_dma_trigger(substream=%p, cmd=%i)"
		" stream_id=%i\n",
		substream, cmd, substream->pstr->stream);

	switch (cmd) {
	case SNDRV_PCM_TRIGGER_START:
		s->period_bytes = frames_to_bytes(runtime,
						  runtime->period_size);
		s->period_start = virt_to_phys(runtime->dma_area);
		s->period_end = s->period_start +
				(s->period_bytes * runtime->periods);
		s->period_next_pt = s->period_start;
		s->period_current_pt = s->period_start;
		s->period_size = runtime->period_size;
		s->active = 1;

		/* track appl_ptr so that we have a better chance of detecting
		 * end of stream and not over running it.
		 */
		s->runtime = runtime;
		s->appl_ptr = s->runtime->control->appl_ptr -
				(runtime->period_size * runtime->periods);

		/* Fill up the bestcomm bd queue and enable DMA.
		 * This will begin filling the PSC's fifo.
		 */
		spin_lock_irqsave(&psc_dma->lock, flags);

		if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) {
			bcom_gen_bd_rx_reset(s->bcom_task);
			for (i = 0; i < runtime->periods; i++)
				if (!bcom_queue_full(s->bcom_task))
					psc_dma_bcom_enqueue_next_buffer(s);
		} else {
			bcom_gen_bd_tx_reset(s->bcom_task);
			psc_dma_bcom_enqueue_tx(s);
		}

		bcom_enable(s->bcom_task);
		spin_unlock_irqrestore(&psc_dma->lock, flags);

		out_8(&regs->command, MPC52xx_PSC_RST_ERR_STAT);

		break;

	case SNDRV_PCM_TRIGGER_STOP:
		s->active = 0;

		spin_lock_irqsave(&psc_dma->lock, flags);
		bcom_disable(s->bcom_task);
		if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
			bcom_gen_bd_rx_reset(s->bcom_task);
		else
			bcom_gen_bd_tx_reset(s->bcom_task);
		spin_unlock_irqrestore(&psc_dma->lock, flags);

		break;

	default:
		dev_dbg(psc_dma->dev, "invalid command\n");
		return -EINVAL;
	}

	/* Update interrupt enable settings */
	imr = 0;
	if (psc_dma->playback.active)
		imr |= MPC52xx_PSC_IMR_TXEMP;
	if (psc_dma->capture.active)
		imr |= MPC52xx_PSC_IMR_ORERR;
	out_be16(&regs->isr_imr.imr, psc_dma->imr | imr);

	return 0;
}

/* ---------------------------------------------------------------------
 * The PSC DMA 'ASoC platform' driver
 *
 * Can be referenced by an 'ASoC machine' driver
 * This driver only deals with the audio bus; it doesn't have any
 * interaction with the attached codec
 */

static const struct snd_pcm_hardware psc_dma_hardware = {
	.info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
		SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
		SNDRV_PCM_INFO_BATCH,
	.formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |
		SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE,
	.rate_min = 8000,
	.rate_max = 48000,
	.channels_min = 1,
	.channels_max = 2,
	.period_bytes_max	= 1024 * 1024,
	.period_bytes_min	= 32,
	.periods_min		= 2,
	.periods_max		= 256,
	.buffer_bytes_max	= 2 * 1024 * 1024,
	.fifo_size		= 512,
};

static int psc_dma_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
	struct psc_dma_stream *s;
	int rc;

	dev_dbg(psc_dma->dev, "psc_dma_open(substream=%p)\n", substream);

	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
		s = &psc_dma->capture;
	else
		s = &psc_dma->playback;

	snd_soc_set_runtime_hwparams(substream, &psc_dma_hardware);

	rc = snd_pcm_hw_constraint_integer(runtime,
		SNDRV_PCM_HW_PARAM_PERIODS);
	if (rc < 0) {
		dev_err(substream->pcm->card->dev, "invalid buffer size\n");
		return rc;
	}

	s->stream = substream;
	return 0;
}

static int psc_dma_close(struct snd_pcm_substream *substream)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
	struct psc_dma_stream *s;

	dev_dbg(psc_dma->dev, "psc_dma_close(substream=%p)\n", substream);

	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
		s = &psc_dma->capture;
	else
		s = &psc_dma->playback;

	if (!psc_dma->playback.active &&
	    !psc_dma->capture.active) {

		/* Disable all interrupts and reset the PSC */
		out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr);
		out_8(&psc_dma->psc_regs->command, 4 << 4); /* reset error */
	}
	s->stream = NULL;
	return 0;
}

static snd_pcm_uframes_t
psc_dma_pointer(struct snd_pcm_substream *substream)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
	struct psc_dma_stream *s;
	dma_addr_t count;

	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
		s = &psc_dma->capture;
	else
		s = &psc_dma->playback;

	count = s->period_current_pt - s->period_start;

	return bytes_to_frames(substream->runtime, count);
}

static int
psc_dma_hw_params(struct snd_pcm_substream *substream,
			 struct snd_pcm_hw_params *params)
{
	snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);

	return 0;
}

static struct snd_pcm_ops psc_dma_ops = {
	.open		= psc_dma_open,
	.close		= psc_dma_close,
	.hw_free	= psc_dma_hw_free,
	.ioctl		= snd_pcm_lib_ioctl,
	.pointer	= psc_dma_pointer,
	.trigger	= psc_dma_trigger,
	.hw_params	= psc_dma_hw_params,
};

static u64 psc_dma_dmamask = 0xffffffff;
static int psc_dma_new(struct snd_card *card, struct snd_soc_dai *dai,
			   struct snd_pcm *pcm)
{
	struct snd_soc_pcm_runtime *rtd = pcm->private_data;
	struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
	size_t size = psc_dma_hardware.buffer_bytes_max;
	int rc = 0;

	dev_dbg(rtd->socdev->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n",
		card, dai, pcm);

	if (!card->dev->dma_mask)
		card->dev->dma_mask = &psc_dma_dmamask;
	if (!card->dev->coherent_dma_mask)
		card->dev->coherent_dma_mask = 0xffffffff;

	if (pcm->streams[0].substream) {
		rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
				size, &pcm->streams[0].substream->dma_buffer);
		if (rc)
			goto playback_alloc_err;
	}

	if (pcm->streams[1].substream) {
		rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
				size, &pcm->streams[1].substream->dma_buffer);
		if (rc)
			goto capture_alloc_err;
	}

	if (rtd->socdev->card->codec->ac97)
		rtd->socdev->card->codec->ac97->private_data = psc_dma;

	return 0;

 capture_alloc_err:
	if (pcm->streams[0].substream)
		snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer);

 playback_alloc_err:
	dev_err(card->dev, "Cannot allocate buffer(s)\n");

	return -ENOMEM;
}

static void psc_dma_free(struct snd_pcm *pcm)
{
	struct snd_soc_pcm_runtime *rtd = pcm->private_data;
	struct snd_pcm_substream *substream;
	int stream;

	dev_dbg(rtd->socdev->dev, "psc_dma_free(pcm=%p)\n", pcm);

	for (stream = 0; stream < 2; stream++) {
		substream = pcm->streams[stream].substream;
		if (substream) {
			snd_dma_free_pages(&substream->dma_buffer);
			substream->dma_buffer.area = NULL;
			substream->dma_buffer.addr = 0;
		}
	}
}

struct snd_soc_platform mpc5200_audio_dma_platform = {
	.name		= "mpc5200-psc-audio",
	.pcm_ops	= &psc_dma_ops,
	.pcm_new	= &psc_dma_new,
	.pcm_free	= &psc_dma_free,
};
EXPORT_SYMBOL_GPL(mpc5200_audio_dma_platform);

int mpc5200_audio_dma_create(struct of_device *op)
{
	phys_addr_t fifo;
	struct psc_dma *psc_dma;
	struct resource res;
	int size, irq, rc;
	const __be32 *prop;
	void __iomem *regs;
	int ret;

	/* Fetch the registers and IRQ of the PSC */
	irq = irq_of_parse_and_map(op->node, 0);
	if (of_address_to_resource(op->node, 0, &res)) {
		dev_err(&op->dev, "Missing reg property\n");
		return -ENODEV;
	}
	regs = ioremap(res.start, 1 + res.end - res.start);
	if (!regs) {
		dev_err(&op->dev, "Could not map registers\n");
		return -ENODEV;
	}

	/* Allocate and initialize the driver private data */
	psc_dma = kzalloc(sizeof *psc_dma, GFP_KERNEL);
	if (!psc_dma) {
		ret = -ENOMEM;
		goto out_unmap;
	}

	/* Get the PSC ID */
	prop = of_get_property(op->node, "cell-index", &size);
	if (!prop || size < sizeof *prop) {
		ret = -ENODEV;
		goto out_free;
	}

	spin_lock_init(&psc_dma->lock);
	mutex_init(&psc_dma->mutex);
	psc_dma->id = be32_to_cpu(*prop);
	psc_dma->irq = irq;
	psc_dma->psc_regs = regs;
	psc_dma->fifo_regs = regs + sizeof *psc_dma->psc_regs;
	psc_dma->dev = &op->dev;
	psc_dma->playback.psc_dma = psc_dma;
	psc_dma->capture.psc_dma = psc_dma;
	snprintf(psc_dma->name, sizeof psc_dma->name, "PSC%u", psc_dma->id);

	/* Find the address of the fifo data registers and setup the
	 * DMA tasks */
	fifo = res.start + offsetof(struct mpc52xx_psc, buffer.buffer_32);
	psc_dma->capture.bcom_task =
		bcom_psc_gen_bd_rx_init(psc_dma->id, 10, fifo, 512);
	psc_dma->playback.bcom_task =
		bcom_psc_gen_bd_tx_init(psc_dma->id, 10, fifo);
	if (!psc_dma->capture.bcom_task ||
	    !psc_dma->playback.bcom_task) {
		dev_err(&op->dev, "Could not allocate bestcomm tasks\n");
		ret = -ENODEV;
		goto out_free;
	}

	/* Disable all interrupts and reset the PSC */
	out_be16(&psc_dma->psc_regs->isr_imr.imr, psc_dma->imr);
	 /* reset receiver */
	out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_RST_RX);
	 /* reset transmitter */
	out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_RST_TX);
	 /* reset error */
	out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_RST_ERR_STAT);
	 /* reset mode */
	out_8(&psc_dma->psc_regs->command, MPC52xx_PSC_SEL_MODE_REG_1);

	/* Set up mode register;
	 * First write: RxRdy (FIFO Alarm) generates rx FIFO irq
	 * Second write: register Normal mode for non loopback
	 */
	out_8(&psc_dma->psc_regs->mode, 0);
	out_8(&psc_dma->psc_regs->mode, 0);

	/* Set the TX and RX fifo alarm thresholds */
	out_be16(&psc_dma->fifo_regs->rfalarm, 0x100);
	out_8(&psc_dma->fifo_regs->rfcntl, 0x4);
	out_be16(&psc_dma->fifo_regs->tfalarm, 0x100);
	out_8(&psc_dma->fifo_regs->tfcntl, 0x7);

	/* Lookup the IRQ numbers */
	psc_dma->playback.irq =
		bcom_get_task_irq(psc_dma->playback.bcom_task);
	psc_dma->capture.irq =
		bcom_get_task_irq(psc_dma->capture.bcom_task);

	rc = request_irq(psc_dma->irq, &psc_dma_status_irq, IRQF_SHARED,
			 "psc-dma-status", psc_dma);
	rc |= request_irq(psc_dma->capture.irq,
			  &psc_dma_bcom_irq_rx, IRQF_SHARED,
			  "psc-dma-capture", &psc_dma->capture);
	rc |= request_irq(psc_dma->playback.irq,
			  &psc_dma_bcom_irq_tx, IRQF_SHARED,
			  "psc-dma-playback", &psc_dma->playback);
	if (rc) {
		ret = -ENODEV;
		goto out_irq;
	}

	/* Save what we've done so it can be found again later */
	dev_set_drvdata(&op->dev, psc_dma);

	/* Tell the ASoC OF helpers about it */
	return snd_soc_register_platform(&mpc5200_audio_dma_platform);
out_irq:
	free_irq(psc_dma->irq, psc_dma);
	free_irq(psc_dma->capture.irq, &psc_dma->capture);
	free_irq(psc_dma->playback.irq, &psc_dma->playback);
out_free:
	kfree(psc_dma);
out_unmap:
	iounmap(regs);
	return ret;
}
EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create);

int mpc5200_audio_dma_destroy(struct of_device *op)
{
	struct psc_dma *psc_dma = dev_get_drvdata(&op->dev);

	dev_dbg(&op->dev, "mpc5200_audio_dma_destroy()\n");

	snd_soc_unregister_platform(&mpc5200_audio_dma_platform);

	bcom_gen_bd_rx_release(psc_dma->capture.bcom_task);
	bcom_gen_bd_tx_release(psc_dma->playback.bcom_task);

	/* Release irqs */
	free_irq(psc_dma->irq, psc_dma);
	free_irq(psc_dma->capture.irq, &psc_dma->capture);
	free_irq(psc_dma->playback.irq, &psc_dma->playback);

	iounmap(psc_dma->psc_regs);
	kfree(psc_dma);
	dev_set_drvdata(&op->dev, NULL);

	return 0;
}
EXPORT_SYMBOL_GPL(mpc5200_audio_dma_destroy);

MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver");
MODULE_LICENSE("GPL");


text:
package pinkerton

import (
	"errors"
	"io"
	"net/url"
	"path/filepath"
	"sync"

	docker "github.com/docker/docker/api/types"
	"github.com/docker/docker/cliconfig"
	"github.com/docker/docker/daemon/events"
	"github.com/docker/docker/daemon/graphdriver"
	_ "github.com/docker/docker/daemon/graphdriver/aufs"
	"github.com/docker/docker/graph"
	"github.com/docker/docker/image"
	"github.com/docker/docker/opts"
	"github.com/docker/docker/pkg/archive"
	"github.com/docker/docker/pkg/jsonmessage"
	"github.com/docker/docker/pkg/reexec"
	"github.com/docker/docker/pkg/term"
	"github.com/docker/docker/registry"
)

var internalDockerEndpoints = []string{
	"docker-receive.discoverd",
	"100.100.0.0/16",
}

func init() {
	// This will run docker-untar and docker-applyLayer in a chroot
	reexec.Init()
}

type Context struct {
	store  *graph.TagStore
	graph  *graph.Graph
	driver graphdriver.Driver
	mtx    sync.Mutex
}

func BuildContext(driver, root string) (*Context, error) {
	d, err := graphdriver.GetDriver(driver, root, nil, nil, nil)
	if err != nil {
		return nil, err
	}

	g, err := graph.NewGraph(filepath.Join(root, "graph"), d, nil, nil)
	if err != nil {
		return nil, err
	}

	config := &graph.TagStoreConfig{
		Graph:  g,
		Events: events.New(),
		Registry: registry.NewService(&registry.Options{
			Mirrors:            opts.NewListOpts(nil),
			InsecureRegistries: *opts.NewListOptsRef(&internalDockerEndpoints, nil),
		}),
	}
	store, err := graph.NewTagStore(filepath.Join(root, "repositories-"+d.String()), config)
	if err != nil {
		return nil, err
	}

	return NewContext(store, g, d), nil
}

func NewContext(store *graph.TagStore, graph *graph.Graph, driver graphdriver.Driver) *Context {
	return &Context{store: store, graph: graph, driver: driver}
}

func (c *Context) PullDocker(url string, out io.Writer) (string, error) {
	c.mtx.Lock()
	defer c.mtx.Unlock()

	ref, err := NewRef(url)
	if err != nil {
		return "", err
	}

	if ref.imageID != "" && c.graph.Exists(ref.imageID) {
		return ref.imageID, nil
	}

	if img, err := c.store.LookupImage(ref.DockerRef()); err == nil && img != nil {
		return img.ID, nil
	}

	config := &graph.ImagePullConfig{
		AuthConfig: &cliconfig.AuthConfig{
			Username: ref.username,
			Password: ref.password,
		},
		OutStream: out,
	}
	if err := c.store.Pull(ref.DockerRepo(), ref.Tag(), config); err != nil {
		return "", err
	}

	img, err := c.store.LookupImage(ref.DockerRef())
	if err != nil {
		return "", err
	}

	return img.ID, nil
}

func (c *Context) Checkout(id, imageID string) (string, error) {
	c.mtx.Lock()
	defer c.mtx.Unlock()

	id = "tmp-" + id
	if err := c.driver.Create(id, imageID); err != nil {
		return "", err
	}
	path, err := c.driver.Get(id, "")
	if err != nil {
		return "", err
	}
	return path, nil
}

func (c *Context) Cleanup(id string) error {
	c.mtx.Lock()
	defer c.mtx.Unlock()

	id = "tmp-" + id
	if err := c.driver.Put(id); err != nil {
		return err
	}
	return c.driver.Remove(id)
}

func (c *Context) History(name string) ([]*docker.ImageHistory, error) {
	return c.store.History(name)
}

func (c *Context) Diff(id, parent string) (archive.Archive, error) {
	return c.driver.Diff(id, parent)
}

func (c *Context) LookupImage(name string) (*image.Image, error) {
	return c.store.LookupImage(name)
}

func DockerPullPrinter(out io.Writer) io.Writer {
	rd, wr := io.Pipe()
	termOut, isTerm := term.GetFdInfo(out)
	go jsonmessage.DisplayJSONMessagesStream(rd, out, termOut, isTerm)
	return wr
}

var ErrNoImageID = errors.New("pinkerton: missing image id")

func ImageID(s string) (string, error) {
	u, err := url.Parse(s)
	if err != nil {
		return "", err
	}
	q := u.Query()
	id := q.Get("id")
	if id == "" {
		return "", ErrNoImageID
	}
	return id, nil
}


text:
var phaser = require('../phaser');

module.exports = function(game, gameEntities) {
    var PreloaderGameState = new phaser.State();

    PreloaderGameState.preload = function() {
        var img = 'assets/img/';

        // mode 0
        game.load.spritesheet('bird0', img + '0/bird.png', 48, 35);
        game.load.image('town0', img + '0/town.png');
        game.load.image('pipe0', img + '0/pipe.png');

        // mode 1
        game.load.spritesheet('bird1', img + '1/bird.png', 96, 84.5);
        game.load.image('town1', img + '1/town.png');
        game.load.image('pipe1', img + '1/pipe.png');
        game.load.image('pipe1_2', img + '1/pipe2.png');

        game.load.spritesheet('clouds', img + 'clouds.png', 64, 34);
        game.load.image('gr', img + 'gr.png');
        game.load.image('go', img + 'go.png');
        game.load.image('play', img + 'play.png');
        game.load.image('record', img + 'record.png');
        game.load.image('tap', img + 'tap.png');
        game.load.image('hand', img + 'hand.png');
        game.load.image('medal', img + 'medals.png');
        game.load.image('gear', img + 'gear.png');
    };

    PreloaderGameState.create = function() {
        game.add.tween(gameEntities.logoBg).to({ fill: 0x53BECE }, 1000, phaser.Easing.Linear.None, true);

        game.add.tween(gameEntities.logo).to({ alpha: 0 }, 1000, phaser.Easing.Linear.None, true)
            .onComplete.add(function() {
                game.state.start('MainMenu', false, false);
            }, this);
    };

    return PreloaderGameState;
};


text:
<?php

namespace Magento\Fedex\Test\Unit\Model;

use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\CatalogInventory\Model\StockRegistry;
use Magento\Directory\Helper\Data;
use Magento\Directory\Model\Country;
use Magento\Directory\Model\CountryFactory;
use Magento\Directory\Model\CurrencyFactory;
use Magento\Directory\Model\RegionFactory;
use Magento\Fedex\Model\Carrier;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Module\Dir\Reader;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Framework\Xml\Security;
use Magento\Quote\Model\Quote\Address\RateRequest;
use Magento\Quote\Model\Quote\Address\RateResult\Error as RateResultError;
use Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory as RateErrorFactory;
use Magento\Quote\Model\Quote\Address\RateResult\Method;
use Magento\Quote\Model\Quote\Address\RateResult\MethodFactory;
use Magento\Shipping\Model\Rate\Result as RateResult;
use Magento\Shipping\Model\Rate\ResultFactory as RateResultFactory;
use Magento\Shipping\Model\Simplexml\ElementFactory;
use Magento\Shipping\Model\Tracking\Result;
use Magento\Shipping\Model\Tracking\Result\Error;
use Magento\Shipping\Model\Tracking\Result\ErrorFactory;
use Magento\Shipping\Model\Tracking\Result\Status;
use Magento\Shipping\Model\Tracking\Result\StatusFactory;
use Magento\Shipping\Model\Tracking\ResultFactory;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use Psr\Log\LoggerInterface;

/**
 * CarrierTest contains units test for Fedex carrier methods
 *
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class CarrierTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var ObjectManager
     */
    private $helper;

    /**
     * @var Carrier|MockObject
     */
    private $model;

    /**
     * @var ScopeConfigInterface|MockObject
     */
    private $scope;

    /**
     * @var Error|MockObject
     */
    private $error;

    /**
     * @var ErrorFactory|MockObject
     */
    private $errorFactory;

    /**
     * @var ErrorFactory|MockObject
     */
    private $trackErrorFactory;

    /**
     * @var StatusFactory|MockObject
     */
    private $statusFactory;

    /**
     * @var Result
     */
    private $result;

    /**
     * @inheritdoc
     */
    protected function setUp()
    {
        $this->helper = new ObjectManager($this);
        $this->scope = $this->getMockBuilder(ScopeConfigInterface::class)
            ->disableOriginalConstructor()
            ->getMock();

        $this->scope->expects(static::any())
            ->method('getValue')
            ->willReturnCallback([$this, 'scopeConfigGetValue']);

        $countryFactory = $this->getCountryFactory();
        $rateFactory = $this->getRateFactory();
        $storeManager = $this->getStoreManager();
        $resultFactory = $this->getResultFactory();
        $this->initRateErrorFactory();

        $rateMethodFactory = $this->getRateMethodFactory();

        $this->trackErrorFactory = $this->getMockBuilder(ErrorFactory::class)
            ->disableOriginalConstructor()
            ->setMethods(['create'])
            ->getMock();

        $this->statusFactory = $this->getMockBuilder(StatusFactory::class)
            ->disableOriginalConstructor()
            ->setMethods(['create'])
            ->getMock();

        $elementFactory = $this->getMockBuilder(ElementFactory::class)
            ->disableOriginalConstructor()
            ->getMock();

        $collectionFactory = $this->getMockBuilder(CollectionFactory::class)
            ->disableOriginalConstructor()
            ->getMock();

        $regionFactory = $this->getMockBuilder(RegionFactory::class)
            ->disableOriginalConstructor()
            ->getMock();

        $currencyFactory = $this->getMockBuilder(CurrencyFactory::class)
            ->disableOriginalConstructor()
            ->getMock();

        $data = $this->getMockBuilder(Data::class)
            ->disableOriginalConstructor()
            ->getMock();

        $stockRegistry = $this->getMockBuilder(StockRegistry::class)
            ->disableOriginalConstructor()
            ->getMock();

        $reader = $this->getMockBuilder(Reader::class)
            ->disableOriginalConstructor()
            ->getMock();

        $this->model = $this->getMockBuilder(Carrier::class)
            ->setMethods(['_getCachedQuotes', '_debug'])
            ->setConstructorArgs(
                [
                    'scopeConfig' => $this->scope,
                    'rateErrorFactory' => $this->errorFactory,
                    'logger' => $this->getMock(LoggerInterface::class),
                    'xmlSecurity' => new Security(),
                    'xmlElFactory' => $elementFactory,
                    'rateFactory' => $rateFactory,
                    'rateMethodFactory' => $rateMethodFactory,
                    'trackFactory' => $resultFactory,
                    'trackErrorFactory' => $this->trackErrorFactory,
                    'trackStatusFactory' => $this->statusFactory,
                    'regionFactory' => $regionFactory,
                    'countryFactory' => $countryFactory,
                    'currencyFactory' => $currencyFactory,
                    'directoryData' => $data,
                    'stockRegistry' => $stockRegistry,
                    'storeManager' => $storeManager,
                    'configReader' => $reader,
                    'productCollectionFactory' => $collectionFactory,
                ]
            )
            ->getMock();
    }

    public function testSetRequestWithoutCity()
    {
        $requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class)
            ->disableOriginalConstructor()
            ->setMethods(['getDestCity'])
            ->getMock();
        $requestMock->expects($this->once())
            ->method('getDestCity')
            ->willReturn(null);
        $this->model->setRequest($requestMock);
    }

    public function testSetRequestWithCity()
    {
        $requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class)
            ->disableOriginalConstructor()
            ->setMethods(['getDestCity'])
            ->getMock();
        $requestMock->expects($this->exactly(2))
            ->method('getDestCity')
            ->willReturn('Small Town');
        $this->model->setRequest($requestMock);
    }

    /**
     * Callback function, emulates getValue function
     * @param $path
     * @return null|string
     */
    public function scopeConfigGetValue($path)
    {
        switch ($path) {
            case 'carriers/fedex/showmethod':
                return 1;
                break;
            case 'carriers/fedex/allowed_methods':
                return 'ServiceType';
                break;
        }
        return null;
    }

    /**
     * @param float $amount
     * @param string $rateType
     * @param float $expected
     * @dataProvider collectRatesDataProvider
     */
    public function testCollectRatesRateAmountOriginBased($amount, $rateType, $expected)
    {
        $this->scope->expects(static::any())
            ->method('isSetFlag')
            ->willReturn(true);

        // @codingStandardsIgnoreStart
        $netAmount = new \stdClass();
        $netAmount->Amount = $amount;

        $totalNetCharge = new \stdClass();
        $totalNetCharge->TotalNetCharge = $netAmount;
        $totalNetCharge->RateType = $rateType;

        $ratedShipmentDetail = new \stdClass();
        $ratedShipmentDetail->ShipmentRateDetail = $totalNetCharge;

        $rate = new \stdClass();
        $rate->ServiceType = 'ServiceType';
        $rate->RatedShipmentDetails = [$ratedShipmentDetail];

        $response = new \stdClass();
        $response->HighestSeverity = 'SUCCESS';
        $response->RateReplyDetails = $rate;
        // @codingStandardsIgnoreEnd

        $this->model->expects(static::any())
            ->method('_getCachedQuotes')
            ->willReturn(serialize($response));
        $request = $this->getMockBuilder(RateRequest::class)
            ->disableOriginalConstructor()
            ->getMock();

        foreach ($this->model->collectRates($request)->getAllRates() as $allRates) {
            $this->assertEquals($expected, $allRates->getData('cost'));
        }
    }

    /**
     * Get list of rates variations
     * @return array
     */
    public function collectRatesDataProvider()
    {
        return [
            [10.0, 'RATED_ACCOUNT_PACKAGE', 10],
            [11.50, 'PAYOR_ACCOUNT_PACKAGE', 11.5],
            [100.01, 'RATED_ACCOUNT_SHIPMENT', 100.01],
            [32.2, 'PAYOR_ACCOUNT_SHIPMENT', 32.2],
            [15.0, 'RATED_LIST_PACKAGE', 15],
            [123.25, 'PAYOR_LIST_PACKAGE', 123.25],
            [12.12, 'RATED_LIST_SHIPMENT', 12.12],
            [38.9, 'PAYOR_LIST_SHIPMENT', 38.9],
        ];
    }

    public function testCollectRatesErrorMessage()
    {
        $this->scope->expects(static::once())
            ->method('isSetFlag')
            ->willReturn(false);

        $this->error->expects(static::once())
            ->method('setCarrier')
            ->with('fedex');
        $this->error->expects(static::once())
            ->method('setCarrierTitle');
        $this->error->expects(static::once())
            ->method('setErrorMessage');

        $request = new RateRequest();
        $request->setPackageWeight(1);

        static::assertSame($this->error, $this->model->collectRates($request));
    }

    /**
     * @param string $data
     * @param array $maskFields
     * @param string $expected
     * @dataProvider logDataProvider
     */
    public function testFilterDebugData($data, array $maskFields, $expected)
    {
        $refClass = new \ReflectionClass(Carrier::class);
        $property = $refClass->getProperty('_debugReplacePrivateDataKeys');
        $property->setAccessible(true);
        $property->setValue($this->model, $maskFields);

        $refMethod = $refClass->getMethod('filterDebugData');
        $refMethod->setAccessible(true);
        $result = $refMethod->invoke($this->model, $data);
        static::assertEquals($expected, $result);
    }

    /**
     * Get list of variations
     */
    public function logDataProvider()
    {
        return [
            [
                [
                    'WebAuthenticationDetail' => [
                        'UserCredential' => [
                            'Key' => 'testKey',
                            'Password' => 'testPassword'
                        ]
                    ],
                    'ClientDetail' => [
                        'AccountNumber' => 4121213,
                        'MeterNumber' => 'testMeterNumber'
                    ]
                ],
                ['Key', 'Password', 'MeterNumber'],
                [
                    'WebAuthenticationDetail' => [
                        'UserCredential' => [
                            'Key' => '****',
                            'Password' => '****'
                        ]
                    ],
                    'ClientDetail' => [
                        'AccountNumber' => 4121213,
                        'MeterNumber' => '****'
                    ]
                ],
            ],
        ];
    }

    /**
     * @covers \Magento\Fedex\Model\Carrier::getTracking
     */
    public function testGetTrackingErrorResponse()
    {
        $tracking = '123456789012';
        $errorMessage = 'Tracking information is unavailable.';

        // @codingStandardsIgnoreStart
        $response = new \stdClass();
        $response->HighestSeverity = 'ERROR';
        $response->Notifications = new \stdClass();
        $response->Notifications->Message = $errorMessage;
        // @codingStandardsIgnoreEnd

        $this->model->expects(static::once())
            ->method('_getCachedQuotes')
            ->willReturn(serialize($response));

        $error = $this->helper->getObject(Error::class);
        $this->trackErrorFactory->expects(static::once())
            ->method('create')
            ->willReturn($error);

        $this->model->getTracking($tracking);
        $tracks = $this->model->getResult()->getAllTrackings();

        static::assertEquals(1, count($tracks));

        /** @var Error $current */
        $current = $tracks[0];
        static::assertInstanceOf(Error::class, $current);
        static::assertEquals(__($errorMessage), $current->getErrorMessage());
    }

    /**
     * @covers \Magento\Fedex\Model\Carrier::getTracking
     * @param string $shipTimestamp
     * @param string $expectedDate
     * @dataProvider shipDateDataProvider
     */
    public function testGetTracking($shipTimestamp, $expectedDate)
    {
        $tracking = '123456789012';

        // @codingStandardsIgnoreStart
        $response = new \stdClass();
        $response->HighestSeverity = 'SUCCESS';
        $response->CompletedTrackDetails = new \stdClass();

        $trackDetails = new \stdClass();
        $trackDetails->ShipTimestamp = $shipTimestamp;
        $trackDetails->DeliverySignatureName = 'signature';

        $trackDetails->StatusDetail = new \stdClass();
        $trackDetails->StatusDetail->Description = 'SUCCESS';

        $trackDetails->Service = new \stdClass();
        $trackDetails->Service->Description = 'ground';
        $trackDetails->EstimatedDeliveryTimestamp = '2016-08-10T10:20:26+00:00';

        $trackDetails->EstimatedDeliveryAddress = new \stdClass();
        $trackDetails->EstimatedDeliveryAddress->City = 'Culver City';
        $trackDetails->EstimatedDeliveryAddress->StateOrProvinceCode = 'CA';
        $trackDetails->EstimatedDeliveryAddress->CountryCode = 'US';

        $trackDetails->PackageWeight = new \stdClass();
        $trackDetails->PackageWeight->Value = 23;
        $trackDetails->PackageWeight->Units = 'LB';

        $response->CompletedTrackDetails->TrackDetails = [$trackDetails];
        // @codingStandardsIgnoreEnd

        $this->model->expects(static::once())
            ->method('_getCachedQuotes')
            ->willReturn(serialize($response));

        $status = $this->helper->getObject(Status::class);
        $this->statusFactory->expects(static::once())
            ->method('create')
            ->willReturn($status);

        $this->model->getTracking($tracking);
        $tracks = $this->model->getResult()->getAllTrackings();
        static::assertEquals(1, count($tracks));

        $current = $tracks[0];
        $fields = [
            'signedby',
            'status',
            'service',
            'deliverydate',
            'deliverytime',
            'deliverylocation',
            'weight',
        ];
        array_walk($fields, function ($field) use ($current) {
            static::assertNotEmpty($current[$field]);
        });

        static::assertEquals('2016-08-10', $current['deliverydate']);
        static::assertEquals('10:20:26', $current['deliverytime']);
        static::assertEquals($expectedDate, $current['shippeddate']);
    }

    /**
     * Get list of variations for testing ship date
     * @return array
     */
    public function shipDateDataProvider()
    {
        return [
            ['shipTimestamp' => '2016-08-05T14:06:35+00:00', 'expectedDate' => '2016-08-05'],
            ['shipTimestamp' => '2016-08-05T14:06:35', 'expectedDate' => null],
            ['shipTimestamp' => '2016-08-05 14:06:35', 'expectedDate' => null],
            ['shipTimestamp' => '2016-08-05 14:06:35+00:00', 'expectedDate' => null],
            ['shipTimestamp' => '2016-08-05', 'expectedDate' => null],
            ['shipTimestamp' => '2016/08/05', 'expectedDate' => null],
        ];
    }

    /**
     * @covers \Magento\Fedex\Model\Carrier::getTracking
     */
    public function testGetTrackingWithEvents()
    {
        $tracking = '123456789012';

        // @codingStandardsIgnoreStart
        $response = new \stdClass();
        $response->HighestSeverity = 'SUCCESS';
        $response->CompletedTrackDetails = new \stdClass();

        $event = new \stdClass();
        $event->EventDescription = 'Test';
        $event->Timestamp = '2016-08-05T19:14:53+00:00';
        $event->Address = new \stdClass();

        $event->Address->City = 'Culver City';
        $event->Address->StateOrProvinceCode = 'CA';
        $event->Address->CountryCode = 'US';

        $trackDetails = new \stdClass();
        $trackDetails->Events = $event;

        $response->CompletedTrackDetails->TrackDetails = $trackDetails;
        // @codingStandardsIgnoreEnd

        $this->model->expects(static::once())
            ->method('_getCachedQuotes')
            ->willReturn(serialize($response));

        $status = $this->helper->getObject(Status::class);
        $this->statusFactory->expects(static::once())
            ->method('create')
            ->willReturn($status);

        $this->model->getTracking($tracking);
        $tracks = $this->model->getResult()->getAllTrackings();
        static::assertEquals(1, count($tracks));

        $current = $tracks[0];
        static::assertNotEmpty($current['progressdetail']);
        static::assertEquals(1, count($current['progressdetail']));

        $event = $current['progressdetail'][0];
        $fields = ['activity', 'deliverydate', 'deliverytime', 'deliverylocation'];
        array_walk($fields, function ($field) use ($event) {
            static::assertNotEmpty($event[$field]);
        });
        static::assertEquals('2016-08-05', $event['deliverydate']);
        static::assertEquals('19:14:53', $event['deliverytime']);
    }

    /**
     * Init RateErrorFactory and RateResultErrors mocks
     * @return void
     */
    private function initRateErrorFactory()
    {
        $this->error = $this->getMockBuilder(RateResultError::class)
            ->disableOriginalConstructor()
            ->setMethods(['setCarrier', 'setCarrierTitle', 'setErrorMessage'])
            ->getMock();
        $this->errorFactory = $this->getMockBuilder(RateErrorFactory::class)
            ->disableOriginalConstructor()
            ->setMethods(['create'])
            ->getMock();
        $this->errorFactory->expects(static::any())
            ->method('create')
            ->willReturn($this->error);
    }

    /**
     * Creates mock rate result factory
     * @return RateResultFactory|MockObject
     */
    private function getRateFactory()
    {
        $rate = $this->getMockBuilder(RateResult::class)
            ->disableOriginalConstructor()
            ->setMethods(['getError'])
            ->getMock();
        $rateFactory = $this->getMockBuilder(RateResultFactory::class)
            ->disableOriginalConstructor()
            ->setMethods(['create'])
            ->getMock();
        $rateFactory->expects(static::any())
            ->method('create')
            ->willReturn($rate);

        return $rateFactory;
    }

    /**
     * Creates mock object for CountryFactory class
     * @return CountryFactory|MockObject
     */
    private function getCountryFactory()
    {
        $country = $this->getMockBuilder(Country::class)
            ->disableOriginalConstructor()
            ->setMethods(['load', 'getData'])
            ->getMock();
        $country->expects(static::any())
            ->method('load')
            ->willReturnSelf();

        $countryFactory = $this->getMockBuilder(CountryFactory::class)
            ->disableOriginalConstructor()
            ->setMethods(['create'])
            ->getMock();
        $countryFactory->expects(static::any())
            ->method('create')
            ->willReturn($country);

        return $countryFactory;
    }

    /**
     * Creates mock object for ResultFactory class
     * @return ResultFactory|MockObject
     */
    private function getResultFactory()
    {
        $resultFactory = $this->getMockBuilder(ResultFactory::class)
            ->disableOriginalConstructor()
            ->setMethods(['create'])
            ->getMock();
        $this->result = $this->helper->getObject(Result::class);
        $resultFactory->expects(static::any())
            ->method('create')
            ->willReturn($this->result);

        return $resultFactory;
    }

    /**
     * Creates mock object for store manager
     * @return StoreManagerInterface|MockObject
     */
    private function getStoreManager()
    {
        $store = $this->getMockBuilder(Store::class)
            ->disableOriginalConstructor()
            ->setMethods(['getBaseCurrencyCode'])
            ->getMock();
        $storeManager = $this->getMock(StoreManagerInterface::class);
        $storeManager->expects(static::any())
            ->method('getStore')
            ->willReturn($store);

        return $storeManager;
    }

    /**
     * Creates mock object for rate method factory
     * @return MethodFactory|MockObject
     */
    private function getRateMethodFactory()
    {
        $priceCurrency = $this->getMock(PriceCurrencyInterface::class);
        $rateMethod = $this->getMockBuilder(Method::class)
            ->setConstructorArgs(['priceCurrency' => $priceCurrency])
            ->setMethods(null)
            ->getMock();
        $rateMethodFactory = $this->getMockBuilder(MethodFactory::class)
            ->disableOriginalConstructor()
            ->setMethods(['create'])
            ->getMock();
        $rateMethodFactory->expects(static::any())
            ->method('create')
            ->willReturn($rateMethod);

        return $rateMethodFactory;
    }
}


text:
/*
 * This file was automatically generated by sel-utils and
 * released under the MIT License.
 *
 * License: https://github.com/sel-project/sel-utils/blob/master/LICENSE
 * Repository: https://github.com/sel-project/sel-utils
 * Generated from https://github.com/sel-project/sel-utils/blob/master/xml/protocol/pocket105.xml
 */
package sul.protocol.pocket105.play;

import sul.utils.*;

public class RemoveEntity extends Packet {

	public static final byte ID = (byte)15;

	public static final boolean CLIENTBOUND = true;
	public static final boolean SERVERBOUND = false;

	@Override
	public int getId() {
		return ID;
	}

	public long entityId;

	public RemoveEntity() {}

	public RemoveEntity(long entityId) {
		this.entityId = entityId;
	}

	@Override
	public int length() {
		return Buffer.varlongLength(entityId) + 1;
	}

	@Override
	public byte[] encode() {
		this._buffer = new byte[this.length()];
		this.writeBigEndianByte(ID);
		this.writeVarlong(entityId);
		return this.getBuffer();
	}

	@Override
	public void decode(byte[] buffer) {
		this._buffer = buffer;
		readBigEndianByte();
		entityId=this.readVarlong();
	}

	public static RemoveEntity fromBuffer(byte[] buffer) {
		RemoveEntity ret = new RemoveEntity();
		ret.decode(buffer);
		return ret;
	}

	@Override
	public String toString() {
		return "RemoveEntity(entityId: " + this.entityId + ")";
	}

}


text:
using UnityEngine;
using System.Collections;

namespace Magicolo.EditorTools {
	[System.Serializable]
	public class EditorHelper {

		public Object[] selection;

		[SerializeField]
		protected bool repaintDummy;

		[SerializeField]
		protected bool repaint;

		public virtual void Update() {
			Unsubscribe();
			Subscribe();
		}

		public virtual void Subscribe() {
			#if UNITY_EDITOR
			UnityEditor.EditorApplication.hierarchyWindowChanged += OnHierarchyWindowChanged;
			UnityEditor.EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyWindowItemGUI;
			UnityEditor.EditorApplication.modifierKeysChanged += OnModifierKeysChanged;
			UnityEditor.EditorApplication.playmodeStateChanged += OnPlaymodeStateChanged;
			UnityEditor.EditorApplication.projectWindowChanged += OnProjectWindowChanged;
			UnityEditor.EditorApplication.projectWindowItemOnGUI += OnProjectWindowItemGUI;
			UnityEditor.EditorApplication.searchChanged += OnSearchChanged;
			UnityEditor.EditorApplication.update += OnUpdate;
			#endif
		}

		public virtual void Unsubscribe() {
			#if UNITY_EDITOR
			UnityEditor.EditorApplication.hierarchyWindowChanged -= OnHierarchyWindowChanged;
			UnityEditor.EditorApplication.hierarchyWindowItemOnGUI -= OnHierarchyWindowItemGUI;
			UnityEditor.EditorApplication.modifierKeysChanged -= OnModifierKeysChanged;
			UnityEditor.EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged;
			UnityEditor.EditorApplication.projectWindowChanged -= OnProjectWindowChanged;
			UnityEditor.EditorApplication.projectWindowItemOnGUI -= OnProjectWindowItemGUI;
			UnityEditor.EditorApplication.searchChanged -= OnSearchChanged;
			UnityEditor.EditorApplication.update -= OnUpdate;
			UnityEditor.EditorApplication.update -= CheckForSelectionChanges;
			#endif
		}

		public virtual void OnHierarchyWindowChanged() {
		}

		public virtual void OnHierarchyWindowItemGUI(int instanceId, Rect selectionrect) {
		}

		public virtual void OnModifierKeysChanged() {
		}

		public virtual void OnPlaymodeStateChanged() {
			Update();
		}

		public virtual void OnProjectWindowChanged() {
		}

		public virtual void OnProjectWindowItemGUI(string guid, Rect selectionRect) {
		}

		public virtual void OnSearchChanged() {
		}

		public virtual void OnSelectionChanged() {
		}

		public virtual void OnUpdate() {
			CheckForSelectionChanges();
		}

		void CheckForSelectionChanges() {
			#if UNITY_EDITOR
			bool changed = false;
			Object[] currentSelection = UnityEditor.Selection.objects;

			if (selection == null || selection.Length != currentSelection.Length) {
				changed = true;
			}
			else {
				for (int i = 0; i < selection.Length; i++) {
					if (selection[i] != currentSelection[i]){
						changed = true;
						break;
					}
				}
			}

			if (changed) {
				selection = UnityEditor.Selection.objects;
				OnSelectionChanged();
				UnityEditor.Selection.objects = selection;
			}
			#endif
		}
	}
}


text:
""" Part of weight_app

    :copyright: (c) 2012 by Andreas Madsack.
    :license: BSD, see LICENSE for more details.
"""
from models import Scale, Weight, User
from main import db
from lxml import etree
import datetime
import fitbit

def import_weight_from_xml(filename, username=None):
    """ Import Scales and Weight from my own old xml-Data
    """

    def add_scales(doc, username):
        for elem in doc.xpath("//scales/item"):
            sc1 = Scale(name=unicode(elem.attrib["id"]))
            for i in elem:
                if i.tag=='owner':
                    sc1.owner = unicode(i.text)
                if i.tag=='model' and i.text:
                    sc1.model = unicode(i.text)
            db.session.add(sc1)
            db.session.flush()
            if 'default' in elem.attrib and \
                    elem.attrib['default'] == "True" and username:
                u1 = User.query.get(username)
                u1.default_scale_name = sc1.name
        db.session.commit()

    def add_weight(doc, username):
        if username:
            u1 = User.query.get(username)
        for elem in doc.xpath('//days/day'):
            we1 = Weight()
            we1.wdate = datetime.datetime.strptime(elem.attrib['date'],
                                                   '%Y-%m-%d')
            if u1:
                we1.user_username = u1.username
            w = False
            for i in elem:
                if i.tag=='weight' and i.text:
                    if 'scale' in i.attrib:
                        sc1 = Scale.query.get(unicode(i.attrib['scale']))
                        if sc1:
                            we1.scale_name = sc1.name
                    we1.weight = unicode(i.text)
                    w = True
                if i.tag=='comment' and i.text:
                    we1.comment = unicode(i.text)
            if w:
                db.session.add(we1)
        db.session.commit()

    doc = etree.parse(filename)
    add_scales(doc, username)
    add_weight(doc, username)

def new_pw():
    """ Generate a new password with letters and digits
    """
    import string
    import random
    return "".join(random.sample(string.letters + string.digits, 8))

def get_emailaddress():
    import subprocess
    m = subprocess.Popen('git config --get user.email',
                         shell=True, stdout=subprocess.PIPE).stdout
    email = unicode(m.read())
    if '@' not in email:
        email = None
    return email

def fitbit_push(user, wdate, weight):
    # import credentials from extra file:
    from credentials import APP_KEY, APP_SECRET

    fb = fitbit.Fitbit(APP_KEY, APP_SECRET,
                       user_key=user.fitbit_user_key,
                       user_secret=user.fitbit_user_secret)
    fb.body(date=wdate, data={'weight': weight})


text:
<?php

declare(strict_types=1);

namespace Churn\Process;

use Churn\File\File;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;

/**
 * @internal
 */
abstract class ChurnProcess implements ProcessInterface
{
    /**
     * The file the process will be executed on.
     *
     * @var File
     */
    protected $file;

    /**
     * The Symfony Process Component.
     *
     * @var Process
     */
    protected $process;

    /**
     * Class constructor.
     *
     * @param File $file The file the process is being executed on.
     * @param Process $process The process being executed on the file.
     */
    public function __construct(File $file, Process $process)
    {
        $this->file = $file;
        $this->process = $process;
    }

    /**
     * Start the process.
     */
    public function start(): void
    {
        $this->process->start();
    }

    /**
     * Determines if the process was successful.
     *
     * @throws ProcessFailedException If the process failed.
     */
    public function isSuccessful(): bool
    {
        $exitCode = $this->process->getExitCode();

        if ($exitCode > 0) {
            throw new ProcessFailedException($this->process);
        }

        return 0 === $exitCode;
    }

    /**
     * Gets the file the process is being executed on.
     */
    public function getFile(): File
    {
        return $this->file;
    }

    /**
     * Gets the output of the process.
     */
    protected function getOutput(): string
    {
        return $this->process->getOutput();
    }
}


text:
<?php

return array(
    'plural' => function($n) { return ($n != 1); },
    'attachment' => 'Anhang',
    'When there is nothing to read, redirect me to this page' => 'Wenn es nichts zu lesen gibt, leite mich auf diese Seite weiter',
    'There is nothing new to read, enjoy your favorites articles!' => 'Es gibt nichts zu lesen, genieße deine Favoriten!',
    'There is nothing new to read, enjoy your previous readings!' => 'Es gibt nichts zu lesen, genieße bereits gelesenes!',
    'Immediately' => 'Sofort',
    '(error occurred during the last check)' => '(Fehler bei der letzten Aktualisierung)',
    'The feed id is required' => 'Die Feed-ID ist erforderlich',
    'The title is required' => 'Der Titel ist erforderlich',
    'The site url is required' => 'Die Website-URL ist erforderlich',
    'The feed url is required' => 'Die Feed-URL ist erforderlich',
    'or' => 'oder',
    'edit' => 'bearbeiten',
    'cancel' => 'abbrechen',
    'Feed URL' => 'Feed-URL',
    'Website URL' => 'Website-URL',
    'Title' => 'Titel',
    'Edit subscription' => 'Abonnement bearbeiten',
    'Unable to edit your subscription.' => 'Bearbeiten des Abonnements fehlgeschlagen.',
    'Your subscription has been updated.' => 'Dein Abonnement wurde aktualisiert.',
    'Older items first' => 'Ältere Einträge zuerst',
    'Most recent first' => 'Neueste Einträge zuerst',
    'Default sorting order for items' => 'Standardsortierung der Einträge',
    'This subscription is empty, %sgo back to unread items%s' => 'Dieses Abonnement ist leer, %szurück zu den ungelesenen Artikeln gehen%s',
    'sort by date %s(%s)%s' => 'nach Datum sortieren %s(%s)%s',
    'most recent first' => 'neueste zuerst',
    'older first' => 'ältere zuerst',
    'Show only this subscription' => 'Nur dieses Abonnement anzeigen',
    'Go to unread' => 'Zu den ungelesenen Einträgen gehen',
    'Go to bookmarks' => 'Zu den Lesezeichen gehen',
    'Go to history' => 'Zu dem Verlauf gehen',
    'Go to subscriptions' => 'Zu den Abonnements gehen',
    'Go to preferences' => 'Zu den Einstellungen gehen',
    'Bookmarklet' => 'Bookmarklet',
    'Subscribe with Miniflux' => 'Mit Miniflux abonnieren',
    'Drag and drop this link to your bookmarks' => 'Ziehe diesen Link in deine Lesezeichen',
    'Download full content' => 'Vollständigen Inhalt herunterladen',
    'Downloading full content is slower because Miniflux grab the content from the original website. You should use that for subscriptions that display only a summary. This feature doesn\'t work with all websites.' => 'Den vollständigen Inhalt herunterzuladen beansprucht mehr Zeit, da Miniflux den Inhalt von der Original-Website holt. Du solltest diese Funktion nur für Feeds nutzen, die lediglich einen Auszug anzeigen. Diese Funktion funktioniert nicht mit jeder Website.',
    'No message' => 'Keine Nachricht',
    'flush messages' => 'Meldungen entfernen',
    'API endpoint:' => 'API-Endpunkt:',
    'API username:' => 'API-Benutzername:',
    'API token:' => 'API-Token:',
    'Generate new tokens' => 'Neue Token generieren',
    'Bookmark RSS Feed' => 'RSS-Feed der Lesezeichen',
    'updated just now' => 'gerade aktualisiert',
    'checked at' => 'überprüft am',
    'never updated after creation' => 'niemals aktualisiert nach der Erstellung',
    'Subscription disabled' => 'Abonnement deaktiviert',
    'content downloaded' => 'Inhalt heruntergeladen',
    'in progress...' => 'In Bearbeitung...',
    'unable to fetch content' => 'Laden des Inhalts fehlgeschlagen',
    'Download content' => 'Inhalt herunterladen',
    'download content' => 'Inhalt herunterladen',
    'Help' => 'Hilfe',
    'Theme' => 'Theme',
    'Items per page' => 'Einträge pro Seite',
    'Previous page' => 'vorherige Seite',
    'Next page' => 'nächste Seite',
    'Do not fetch the content of articles' => 'Den Inhalt der Artikel nicht auslesen',
    'Remove automatically read items' => 'Gelesene Einträge automatisch entfernen',
    'Never' => 'Niemals',
    'After %d day' => array('Nach %d Tag', 'Nach %d Tagen'),
    'unread' => 'ungelesen',
    'Unread' => 'Ungelesen',
    'bookmark' => 'Lesezeichen',
    'remove bookmark' => 'Lesezeichen entfernen',
    'bookmarks' => 'Lesezeichen',
    'Bookmarks' => 'Lesezeichen',
    'Bookmark item' => 'Eintrag zu den Lesezeichen hinzufügen',
    'No bookmark' => 'Kein Lesezeichen',
    'history' => 'Verlauf',
    'subscriptions' => 'Abonnements',
    'Subscriptions' => 'Abonnements',
    'preferences' => 'Einstellungen',
    'Preferences' => 'Einstellungen',
    'logout' => 'Abmelden',
    'Username' => 'Benutzername',
    'Password' => 'Passwort',
    'Confirmation' => 'Bestätigung',
    'Language' => 'Sprache',
    'Save' => 'Speichern',
    'Database size:' => 'Größe der Datenbank:',
    'Optimize the database' => 'Datenbank optimieren',
    '(VACUUM command)' => '(Befehl: SQL VACUUM)',
    'Download the entire database' => 'Die komplette Datenbank herunterladen',
    '(Gzip compressed Sqlite file)' => '(GZIP komprimierte SQLite-Datei)',
    'Keyboard shortcuts' => 'Tastenkürzel',
    'Previous item' => 'Vorheriger Eintrag',
    'Next item' => 'Nächster Eintrag',
    'Mark as read or unread' => 'Als gelesen oder ungelesen markieren',
    'Open original link' => 'Original-Link öffnen',
    'Open item' => 'Eintrag öffnen',
    'About' => 'Über',
    'Miniflux version:' => 'Miniflux-Version:',
    'Nothing to read' => 'Nichts zu lesen',
    'mark all as read' => 'Alle als gelesen markieren',
    'original link' => 'Original-Link',
    'mark as read' => 'als gelesen markieren',
    'No history' => 'Kein Verlauf',
    'mark as unread' => 'als ungelesen markieren',
    'History' => 'Verlauf',
    'flush all items' => 'alle Einträge entfernen',
    'Item not found' => 'Eintrag nicht gefunden',
    'Next' => 'Nächster',
    'Previous' => 'Vorheriger',
    'Sign in' => 'Anmelden',
    'feeds' => 'Abonnements',
    'add' => 'hinzufügen',
    'import' => 'importieren',
    'export' => 'exportieren',
    'OPML Import' => 'OPML-Datei importieren',
    'OPML file' => 'OPML-Datei',
    'Import' => 'Importieren',
    'refresh all' => 'alle aktualisieren',
    'No subscription' => 'Kein Abonnement',
    'remove' => 'entfernen',
    'Remove' => 'Entfernen',
    'refresh' => 'aktualisieren',
    'New subscription' => 'Neues Abonnement',
    'Website or Feed URL' => 'Website oder Feed-URL',
    'Add' => 'Hinzufügen',
    'http://website/' => 'http://website/',
    'Official website:' => 'Offizielle Website:',
    'Bad username or password' => 'Falscher Benutzername oder falsches Passwort',
    'Unable to update your preferences.' => 'Aktualisieren der Einstellungen fehlgeschlagen.',
    'Your preferences are updated.' => 'Einstellungen wurden aktualisiert.',
    'Unable to import your OPML file.' => 'Import der OPML-Datei fehlgeschlagen.',
    'Your feeds have been imported.' => 'Deine Abonnements wurden importiert.',
    'Unable to find a subscription.' => 'Keine Abonnements gefunden.',
    'Subscription added successfully.' => 'Abonnement erfolgreich hinzugefügt.',
    'Your subscriptions are updated' => 'Abonnements wurden aktualisiert',
    'Unable to remove this subscription.' => 'Entfernen dieses Abonnements fehlgeschlagen.',
    'This subscription has been removed successfully.' => 'Dieses Abonnement wurde erfolgreich entfernt.',
    'The user name is required' => 'Der Benutzername ist erforderlich',
    'The maximum length is 50 characters' => 'Die Maximal-Länge beträgt 50 Zeichen',
    'The password is required' => 'Das Passwort ist erforderlich',
    'The minimum length is 6 characters' => 'Die Minimal-Länge beträgt 6 Zeichen',
    'The confirmation is required' => 'Die Bestätigung ist erforderlich',
    'Passwords don\'t match' => 'Passwörter stimmen nicht überein',
    'Do you really want to remove these items from your history?' => 'Möchtest du wirklich diese Einträge aus deinem Verlauf entfernen?',
    'Do you really want to remove this subscription: "%s"?' => 'Möchtest du wirklich dieses Abonnement entfernen: "%s"?',
    'Nothing to read, do you want to %supdate your subscriptions%s?' => 'Nichts zu lesen, möchtest du %sdeine Abonnements aktualisieren%s?',
    'Show help' => 'Hilfe zeigen',
    'Close help' => 'Hilfe schließen',
    '%d second ago' => array('Vor %d Sekunde', 'Vor %d Sekunden'),
    '%d minute ago' => array('Vor %d Minute', 'Vor %d Minuten'),
    '%d hour ago' => array('Vor %d Stunde', 'Vor %d Stunden'),
    '%d day ago' => array('Vor %d Tag', 'Vor %d Tagen'),
    '%d week ago' => array('Vor %d Woche', 'Vor %d Wochen'),
    '%d month ago' => array('Vor %d Monat', 'Vor %d Monaten'),
    'Timezone' => 'Zeitzone',
    'Update all subscriptions' => 'Alle Abonnements aktualisieren',
    'Auto-Update URL' => 'Auto-Update URL',
    'Update Miniflux' => 'Miniflux aktualisieren',
    'Miniflux is updated!' => 'Miniflux wurde erfolgreich aktualisiert!',
    'Unable to update Miniflux, check the console for errors.' => 'Aktualisierung von Miniflux fehlgeschlagen, überprüfe die Konsole nach Fehlermeldungen.',
    'Don\'t forget to backup your database' => 'Vergiss nicht, die Datenbank zu sichern',
    'The name must have only alpha-numeric characters' => 'Der Name darf nur alphanumerische Zeichen enthalten',
    'New database' => 'Neue Datenbank',
    'Database name' => 'Name der Datenbank',
    'Default database' => 'Standard-Datenbank',
    'Select another database' => 'Andere Datenbank auswählen',
    'The database name is required' => 'Der Datenbank-Name ist erforderlich',
    'Database created successfully.' => 'Datenbank erfolgreich erstellt.',
    'Unable to create the new database.' => 'Fehler bei der Erstellung der neuen Datenbank.',
    'Add a new database (new user)' => 'Neue Datenbank hinzufügen (neuer Benutzer)',
    'Create' => 'Erstellen',
    'Unknown' => 'Unbekannt',
    'Remember Me' => 'Erinnere dich an mich',
    'Display items on lists' => 'Einträge in Listen anzeigen',
    'Summaries' => 'Zusammenfassungen',
    'Full contents' => 'Komplette Inhalte',
    'Force RTL mode (Right-to-left language)' => 'Textrichtung von rechts nach links erzwingen',
    'Activated' => 'Aktiviert',
    'Remove this feed' => 'Dieses Abonnement entfernen',
    'Miniflux' => 'Miniflux',
    'mini%sflux%s' => 'mini%sflux%s',
    'All' => 'Alle',
    'Advanced' => 'Erweitert',
    'Documentation' => 'Dokumentation',
    'Installation instructions' => 'Installationsanleitung',
    'Upgrade to a new version' => 'Auf eine neue Version aktualisieren',
    'Cronjob' => 'Cronjob',
    'Advanced configuration' => 'Fortgeschrittene Konfiguration',
    'Full article download' => 'Ganzen Artikel herunterladen',
    'Multiple users' => 'Mehrere Benutzer',
    'Themes' => 'Themes',
    'Json-RPC API' => 'Json-RPC API',
    'Fever API' => 'Fever API',
    'Translations' => 'Übersetzungen',
    'Run Miniflux with Docker' => 'Miniflux mit Docker laufen lassen',
    'FAQ' => 'FAQ',
    'settings' => 'Einstellungen',
    'help' => 'Hilfe',
    'api' => 'api',
    'about' => 'über',
    'This action will update Miniflux with the last development version, are you sure?' => 'Miniflux wird auf die aktuelle Entwicklungsversion aktualisiert. Bist du sicher?',
    'database' => 'Datenbank',
    'Console' => 'Konsole',
    'Miniflux API' => 'Miniflux API',
    'menu' => 'Menü',
    'Default' => 'Standard',
    'Value required' => 'Wert ist erforderlich',
    'Must be an integer' => 'Muss eine Ganzzahl sein',
    'Remove automatically unread items' => 'Ungelesene Artikel automatisch entfernen',
    'Toggle RTL mode' => 'Textrichtung umschalten',
    'external services' => 'externe Dienste',
    'Send bookmarks to Pinboard' => 'Sende Lesezeichen an Pinboard',
    'Pinboard API token' => 'Pinboard API Token',
    'Pinboard tags' => 'Pinboard Tags',
    'Instapaper username' => 'Instapaper Benutzername',
    'Instapaper password' => 'Instapaper Passwort',
    'Instapaper' => 'Instapaper',
    'Pinboard' => 'Pinboard',
    'Send bookmarks to Instapaper' => 'Sende Lesezeichen an Instapaper',
    'Authentication' => 'Anmeldung',
    'Reading' => 'Lesen',
    'Application' => 'Anwendung',
    'Enable image proxy' => 'Verwende Proxyserver für Bilder',
    'Avoid mixed content warnings with HTTPS' => 'Vermeidet Warnungen wegen gemischtem Inhalt bei HTTPS',
    'Download favicons' => 'Favicons herunterladen',
    'general' => 'allgemein',
    'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Fehler bei der letzten Aktualisierung. Aktualisiere den Feed manuell und prüfe die %sKonsole%s anschließend auf Fehler!',
    // 'Refresh interval in minutes for unread counter' => '',
    // 'Nothing to show. Enable the debug mode to see log messages.' => '',
    // 'Enable debug mode' => '',
    // 'Original link marks article as read' => '',
    // 'Cloak the image referrer' => '',
    // 'This subscription already exists.' => '',
    // 'Connection timeout.' => '',
    // 'Error occured.' => '',
    // 'Feed is malformed.' => '',
    // 'Invalid SSL certificate.' => '',
    // 'Maximum number of HTTP redirections exceeded.' => '',
    // 'The content size exceeds to maximum allowed size.' => '',
    // 'Unable to detect the feed format.' => '',
);


text:
title: Gallery
slug: gallery
mainpic: main.jpg
content:
    items: '@self.children'
---


text:
module Furnish
  module Vagrant
    # The version of furnish-vagrant.
    VERSION = '0.1.1'
  end
end


text:
/*! \file $Id: ShareData.h 88 2011-09-30 14:26:46Z caoym $
*  \author caoym
*  \brief dll share data
*/
#pragma once

#define MAX_RECORDS_COUNT (1024*16)
/**
 * share data between GDI hooked processes
 */
struct SHARE_DATA
{
	/** specify who create installed hooks
	 * while CChangeRecorder::Stop,only the owner can uninstall hooks
	 */
	LONG owner;
	HHOOK hooks[WH_MAX];
	LONG changes_begin;
	LONG changes_writting_end; //the end the include the data which is being writing
	LONG changes_done_end;     //the end the include the data without writing
	LONG image_file_size;
	RECT changes[MAX_RECORDS_COUNT]; //
};
extern SHARE_DATA g_share_data;


text:
BaseController.Initialize Method
================================
Initializes data that might not be available when the constructor is called.

**Namespace:** [MvcAccount.Shared][1]
**Assembly:** MvcAccount (in MvcAccount.dll)

Syntax
------

```csharp
protected override void Initialize(
	RequestContext requestContext
)
```

#### Parameters

##### *requestContext*
Type: [System.Web.Routing.RequestContext][2]
The HTTP context and route data.

See Also
--------

#### Reference
[BaseController Class][3]
[MvcAccount.Shared Namespace][1]

[1]: ../README.md
[2]: http://msdn.microsoft.com/en-us/library/cc680130
[3]: README.md


text:
module Slack
  module Web
    module Api
      module Endpoints
        module UsergroupsUsers
          #
          # List all users in a User Group
          #
          # @option options [string] :usergroup
          #   The encoded ID of the User Group to update.
          # @option options [boolean] :include_disabled
          #   Allow results that involve disabled User Groups.
          # @option options [string] :team_id
          #   encoded team id where the user group exists, required if org token is used.
          # @see https://api.slack.com/methods/usergroups.users.list
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups.users/usergroups.users.list.json
          def usergroups_users_list(options = {})
            throw ArgumentError.new('Required arguments :usergroup missing') if options[:usergroup].nil?
            post('usergroups.users.list', options)
          end

          #
          # Update the list of users for a User Group
          #
          # @option options [string] :usergroup
          #   The encoded ID of the User Group to update.
          # @option options [array] :users
          #   A comma separated string of encoded user IDs that represent the entire list of users for the User Group.
          # @option options [boolean] :include_count
          #   Include the number of users in the User Group.
          # @option options [string] :team_id
          #   encoded team id where the user group exists, required if org token is used.
          # @see https://api.slack.com/methods/usergroups.users.update
          # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups.users/usergroups.users.update.json
          def usergroups_users_update(options = {})
            throw ArgumentError.new('Required arguments :usergroup missing') if options[:usergroup].nil?
            throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
            post('usergroups.users.update', options)
          end
        end
      end
    end
  end
end


text:
package org.springframework.cloud.dataflow.rest.resource;

import org.springframework.cloud.dataflow.core.Launcher;
import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.ResourceSupport;

/**
 * @author Ilayaperumal Gopinathan
 */
public class LauncherResource extends ResourceSupport {

	private String name;

	private String type;

	private String description;

	@SuppressWarnings("unused")
	private LauncherResource() {
	}

	public LauncherResource(Launcher launcher) {
		this.name = launcher.getName();
		this.type = launcher.getType();
		this.description = launcher.getDescription();
	}

	public String getName() {
		return name;
	}

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

	public String getType() {
		return type;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public static class Page extends PagedResources<LauncherResource> {

	}
}