text:
//
//  GenericCard.m
//  ThesApp
//
//  Created by Paolo Burzacca on 20/05/15.
//  Copyright (c) 2015 IIT Cnr. All rights reserved.
//

#import "GenericScrollCard.h"
#import "Utils.h"

#define PADDING_BTN 8
#define HEADER_HEIGHT 110
#define HEADER_BOTTOM_PADDING 15

#define TITOLI_FONT_SIZE 12.0f
#define TITLE_PADDING_BOTTOM 5
#define TITLE_PADDING_TOP 25
#define TITLE_PADDING_LEFT 10
#define TITLE_HEIGHT 20
#define TITLE_FONT_SIZE 30

@implementation GenericScrollCard

-(id) initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self prepare];
    }
    return self;
}

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

-(void) initVars {
    paddingLeft = TITLE_PADDING_LEFT;
    titleLabelHeight = TITLE_HEIGHT;
}

-(void) prepare {

     NSLog(@"[GenericScrollCard] prepare");

    [self initVars];

    //scroll view
    self.bouncesZoom = NO;
    self.bounces = NO;
    self.backgroundColor = [UIColor clearColor];
    self.showsVerticalScrollIndicator = NO;
    self.showsHorizontalScrollIndicator = NO;
    self.clipsToBounds = YES;
    self.delaysContentTouches = YES;
    self.canCancelContentTouches = YES;

    CGRect wrapperFrame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    wrapper = [[UIView alloc] initWithFrame:wrapperFrame];
    [self addSubview:wrapper];

    fullWidth = wrapper.frame.size.width;
    if (fullWidth < 1) fullWidth = [[UIScreen mainScreen] bounds].size.width;
    fullWithPadding = fullWidth; // - 2 * PADDING_BTN;

    float titleHeight = 35;
    float titleFontSize = TITLE_FONT_SIZE;

    //////////////////////////////////////////////////////////////
    //preparo scheda

    wrapper.backgroundColor = [UIColor whiteColor];
    wrapper.clipsToBounds = YES;
    wrapper.layer.cornerRadius = 3;

    self.layer.cornerRadius = 3;
    self.layer.shadowOffset = CGSizeMake(2, 2);
    self.layer.shadowRadius = 4.0;
    self.layer.shadowColor = [UIColor grayColor].CGColor;
    self.layer.shadowOpacity = 1.0;
    self.layer.masksToBounds = NO;

    //////////////////////////////////////////////////////////////
    //disegno header
    CGRect headerFrame = CGRectMake(0, 0, fullWithPadding, HEADER_HEIGHT);
    header = [[UIView alloc] initWithFrame:headerFrame];
    header.backgroundColor = [Utils getHeaderColor];
    [wrapper addSubview:header];

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

    /*
    //back button
    CGRect buttonFrame = CGRectMake(PADDING_BTN, PADDING_BTN, btnWidth, btnHeight);
    back = [[UIButton alloc] initWithFrame:buttonFrame];
    //back.backgroundColor = [UIColor clearColor];
    [back setTitle:@"<" forState:UIControlStateNormal];
    [back setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [header addSubview:back];
    */

    //////////////////////////////////////////////////////////////
    //title label
    float title_padding_top = PADDING_BTN + TITLE_PADDING_TOP;
    CGRect titleFrame = CGRectMake(PADDING_BTN, title_padding_top, fullWithPadding, titleHeight);
    titolo = [[TitoloLabel alloc] initWithFrame:titleFrame];
    titolo.backgroundColor = [UIColor clearColor];
    titolo.font = [titolo.font fontWithSize: titleFontSize];
    titolo.textColor = [UIColor whiteColor];
    titolo.numberOfLines = 0;
    [header addSubview:titolo];
}

-(void) addCardTitle:(NSString *) title {
    titolo.text = title;
    [titolo sizeToFit];
    [header sizeToFit];
}

-(float) getHeaderHeightAndPadding {
    return header.frame.origin.y + header.frame.size.height + HEADER_BOTTOM_PADDING;
}

-(NSString *) getName {
    return @"generico";
}

-(void) categoryClick:(Etichetta *) btn {
    NSLog(@"categoryClick su %@", self.dominio.descriptor);

    if (btn.testo == nil) {
        NSLog(@"testo nullo, esco");
        return;
    }
    if (btn.testo.length == 0) {
        NSLog(@"testo 0, esco");
        return;
    }

    NSLog(@"continuo..");

    [self.controller addCategoryCard:btn.testo withDomain:self.dominio];
}

-(void) openLocalizedTerm:(Etichetta *) btn {

    if (btn.testo == nil) {
        NSLog(@"testo nullo, esco");
        return;
    }
    if (btn.testo.length == 0) {
        NSLog(@"testo 0, esco");
        return;
    }

    NSString *value = btn.testo;
    NSString *lang =  (btn.lingua != nil) ? btn.lingua : lingua;
    NSLog(@"openLocalizedTerm: %@ in lingua %@", value, lang);
    [self.controller getTerm:value inLanguage:lang];
}

-(void) openTerm:(Etichetta *) btn {
    NSString *value = [btn titleLabel].text;
    NSLog(@"openTerm: %@", value);
    [self.controller getTerm:value inLanguage:lingua];
}

-(void) dietro:(UIButton *) btn {
    [self.controller goBack];
}

-(void) addSectionTitle:(NSString *) title {

    CGRect catTitleFrame = CGRectMake(paddingLeft, top, fullWithPadding - 2 * paddingLeft, titleLabelHeight);
    UILabel *catTitle = [[UILabel alloc] initWithFrame:catTitleFrame];
    catTitle.textColor = [UIColor darkGrayColor];
    catTitle.font = [catTitle.font fontWithSize:TITOLI_FONT_SIZE];
    NSString *tradotto = NSLocalizedString(title, @"");
    catTitle.text = (tradotto != nil) ? tradotto : title;
    [wrapper addSubview:catTitle];
    top += titleLabelHeight + TITLE_PADDING_BOTTOM;
}

@end


text:
package com.mindlin.assembler.assemblers;

import java.io.ByteArrayOutputStream;

//Registers: A,X,Y,S
public class Toolchain6502 implements Toolchain {
	@Override
	public byte[] convert(Instruction x, String... ps) {
		switch (x) {
		case LOAD_REG_IMMEDIATE: {
			Register reg = reg(ps[0]);
			byte val = addr(ps[1])[0];
			switch (reg) {
			case A:
				return bcat(0xA9, val);
			case X:
				return bcat(0xA2, val);
			case Y:
				return bcat(0xA0, val);
			default:
				throw new IllegalArgumentException("Invalid register " + reg + "!");
			}
		}
		case LOAD_REG_0PAGE: {
			Register reg = reg(ps[0]);
			byte addr = addr(ps[1])[0];
			switch (reg) {
			case A:
				return bcat(0xA5, addr);
			case X:
				return bcat(0xA6, addr);
			case Y:
				return bcat(0xA4, addr);
			default:
				throw new IllegalArgumentException("Invalid register " + reg + "!");
			}
		}
		case LOAD_REG_0PAGE_REG: {
			Register reg1 = reg(ps[0]);
			Register reg2 = reg(ps[2]);
			byte addr = addr(ps[1])[0];
			switch (reg1) {
			case A:
				if (reg2 == Register.X)
					return bcat(0xB5, addr);
				else
					throw new IllegalArgumentException("Invalid instruction: LDA " + ps[1] + ","
							+ reg2.toString());
			case X:
				if (reg2 == Register.Y)
					return bcat(0xB6, addr);
				else
					throw new IllegalArgumentException("Invalid instruction: LDX " + ps[1] + ","
							+ reg2.toString());
			case Y:
				if (reg2 == Register.X)
					return bcat(0xB4, addr);
				else
					throw new IllegalArgumentException("Invalid instruction: LDY " + ps[1] + ","
							+ reg2.toString());
			default:
				throw new IllegalArgumentException("Invalid register " + reg1 + "!");
			}
		}
		case LOAD_REG_ABS: {
			Register reg = reg(ps[0]);
			byte addr = addr(ps[1])[0];
			switch (reg) {
			case A:
				return bcat(0xAD, addr);
			case X:
				return bcat(0xAE, addr);
			case Y:
				return bcat(0xAC, addr);
			default:
				throw new IllegalArgumentException("Invalid register " + reg + "!");
			}
		}
		case LOAD_REG_ABS_REG: {
			Register reg = reg(ps[0]);
			Register reg2=reg(ps[2]);
			byte addr = addr(ps[1])[0];
			switch (reg) {
			case A:
				if(reg2==Register.X)
					return bcat(0xBD, addr);
				else if(reg2==Register.Y)
					return bcat(0xB9, addr);
			case X:
				if(reg2!=Register.Y)
					throw new IllegalArgumentException("Invalid instruction: LDX " + ps[1] + "," + reg2.toString());
				return bcat(0xBE, addr);
			case Y:
				if(reg2!=Register.X)
					throw new IllegalArgumentException("Invalid instruction: LDX " + ps[1] + "," + reg2.toString());
				return bcat(0xBC, addr);
			default:
				throw new IllegalArgumentException("Invalid register " + reg + "!");
			}
		}
		case LOAD_REG_INDREG:
			//only valid for LDA (value,X)
			if (reg(ps[0]) == Register.A && reg(ps[2]) == Register.X)
				return bcat(0xA1, addr(ps[1])[0]);
			throw new IllegalArgumentException("Invalid register " + reg(ps[0]) + "!");
		case LOAD_REG_IND_REG:
			//only valid for LDA (value),y
			if (reg(ps[0]) == Register.A && reg(ps[2]) == Register.Y)
				return bcat(0xB1, addr(ps[1])[0]);
			throw new IllegalArgumentException("Invalid register combo " + reg(ps[0]) + " & "+reg(ps[2])+"!");
		case STORE_REG_0PAGE: {
			Register reg = reg(ps[0]);
			byte addr = addr(ps[1])[0];
			switch (reg) {
			case A:
				return bcat(0x85, addr);
			case X:
				return bcat(0x86, addr);
			case Y:
				return bcat(0x84, addr);
			default:
				throw new IllegalArgumentException("Invalid register " + reg + "!");
			}
		}
		case STORE_REG_0PAGE_REG: {
			Register reg1 = reg(ps[0]);
			Register reg2 = reg(ps[2]);
			byte addr = addr(ps[1])[0];
			switch (reg1) {
			case A:
				if (reg2 == Register.X)
					return bcat(0x95, addr);
				else
					throw new IllegalArgumentException("Invalid instruction: STA " + ps[1] + ","
							+ reg2.toString());
			case X:
				if (reg2 == Register.Y)
					return bcat(0x96, addr);
				else
					throw new IllegalArgumentException("Invalid instruction: STX " + ps[1] + ","
							+ reg2.toString());
			case Y:
				if (reg2 == Register.X)
					return bcat(0x94, addr);
				else
					throw new IllegalArgumentException("Invalid instruction: STY " + ps[1] + ","
							+ reg2.toString());
			default:
				throw new IllegalArgumentException("Invalid register " + reg1 + "!");
			}
		}
		case STORE_REG_ABS: {
			Register reg = reg(ps[0]);
			byte addr = addr(ps[1])[0];
			switch (reg) {
			case A:
				return bcat(0x8D, addr);
			case X:
				return bcat(0x8E, addr);
			case Y:
				return bcat(0x8C, addr);
			default:
				throw new IllegalArgumentException("Invalid register " + reg + "!");
			}
		}
		case STORE_REG_ABS_REG: {
			Register reg = reg(ps[0]);
			Register reg2=reg(ps[2]);
			byte addr = addr(ps[1])[0];
			switch (reg) {
			case A:
				if(reg2==Register.X)
					return bcat(0x9D, addr);
				else if(reg2==Register.Y)
					return bcat(0x99, addr);
				else
					throw new IllegalArgumentException("Invalid instruction: STA " + ps[1] + "," + reg2.toString());
			default:
				throw new IllegalArgumentException("Invalid register " + reg + "!");
			}
		}
		case STORE_REG_INDREG:
			//only valid for STA (value,X)
			if (reg(ps[0]) == Register.A && reg(ps[2]) == Register.X)
				return bcat(0x81, addr(ps[1])[0]);
			throw new IllegalArgumentException("Invalid register " + reg(ps[0]) + "!");
		case STORE_REG_IND_REG:
			//only valid for STA (value),y
			if (reg(ps[0]) == Register.A && reg(ps[2]) == Register.Y)
				return bcat(0x91, addr(ps[1])[0]);
			throw new IllegalArgumentException("Invalid register combo " + reg(ps[0]) + " & "+reg(ps[2])+"!");
		case TRANSFER:{
			Register reg1 = reg(ps[0]);
			Register reg2 = reg(ps[1]);
			switch(reg1) {
			case A:
				switch(reg2) {
				case X:
					return bcat(0xAA);
				case Y:
					return bcat(0xA8);
				default:
					throw new IllegalArgumentException("Invalid instruction: TA"+reg2.toString());
				}
			case X:
				switch(reg2) {
				case A:
					return bcat(0x8A);
				case S:
					return bcat(0x9A);
				default:
					throw new IllegalArgumentException("Invalid instruction: TA"+reg2.toString());
				}
			case Y:
				if(reg2!=Register.A)
					throw new IllegalArgumentException("Invalid instruction: TY"+reg2.toString());
				return bcat(0x98);
			case S:
				if(reg2!=Register.X)
					throw new IllegalArgumentException("Invalid instruction: TS"+reg2.toString());
				return bcat(0xBA);
			}
		}
		default:
			throw new IllegalStateException("Unknown instruction " + x.toString());
		}
	}

	protected Register reg(String num) {
		try {
			return Register.values()[Integer.parseInt(num)];
		} catch (ArrayIndexOutOfBoundsException e) {
			throw new IllegalArgumentException("Invalid Register: " + num);
		}
	}

	protected byte[] addr(String param) {
		char[] tmp;
		if (param.startsWith("$"))
			tmp = param.substring(1).toCharArray();
		else
			tmp = param.toCharArray();

		byte[] data = new byte[tmp.length / 2];
		for (int i = 0; i < tmp.length; i += 2)
			data[i / 2] = (byte) ((Character.digit(tmp[i], 16) << 4) + Character.digit(tmp[i + 1], 16));
		return data;
	}

	protected byte[] bcat(Object... bytes) {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		for (Object e : bytes)
			if (e instanceof byte[])
				for (byte b : ((byte[]) e))
					baos.write(b);
			else
				baos.write((byte) (0xFF & ((int)e)));
		return baos.toByteArray();
	}

	protected static enum Register {
		A, X, Y, S;
	}
}

redpajama_set_name: RedPajamaGithub


text:
@interface AMFRemotingCall (Private)
- (NSString *)_nextResponseURI;
- (void)_cleanup;
@end

@implementation AMFRemotingCall

@synthesize service=m_service, method=m_method, arguments=m_arguments, amfVersion=m_amfVersion,
	delegate=m_delegate;

static uint32_t g_responseCount = 1;

#pragma mark -
#pragma mark Initialization & Deallocation

- (id)init{
	if (self = [super init]){
		m_receivedData = nil;
		m_connection = nil;
		m_delegate = nil;
		m_isLoading = NO;
		m_amfVersion = kAMF3Encoding;
		m_error = nil;
		m_amfHeaders = nil;

		m_request = [[NSMutableURLRequest alloc] init];
		[m_request setHTTPMethod:@"POST"];
		[m_request setValue:@"application/x-amf" forHTTPHeaderField:@"Content-Type"];
		[m_request setValue:@"CocoaAMF" forHTTPHeaderField:@"User-Agent"];
	}
	return self;
}

- (id)initWithURL:(NSURL *)url service:(NSString *)service method:(NSString *)method
	arguments:(NSObject *)arguments{
	if (self = [self init]){
		self.URL = url;
		self.service = service;
		self.method = method;
		self.arguments = arguments;
	}
	return self;
}

+ (AMFRemotingCall *)remotingCallWithURL:(NSURL *)url service:(NSString *)service
	method:(NSString *)method arguments:(NSObject *)arguments{
	AMFRemotingCall *remotingCall = [[AMFRemotingCall alloc] initWithURL:url service:service
		method:method arguments:arguments];
	return [remotingCall autorelease];
}

- (void)dealloc{
	[m_connection release];
	[m_request release];
	[m_service release];
	[m_method release];
	[m_arguments release];
	[m_error release];
	[m_amfHeaders release];
	[super dealloc];
}

#pragma mark -
#pragma mark Public methods

- (void)start{
	if (m_isLoading){
		return;
	}

	AMFActionMessage *message = [[AMFActionMessage alloc] init];
	message.version = m_amfVersion;
	NSString *targetURI = @"null";
	if (m_service != nil && m_method != nil)
		targetURI = [NSString stringWithFormat:@"%@.%@", m_service, m_method];
	[message addBodyWithTargetURI:targetURI responseURI:[self _nextResponseURI] data:m_arguments];
	if (m_amfHeaders != nil)
		message.headers = [m_amfHeaders allValues];

	[m_request setHTTPBody:[message data]];
	[message release];

	m_error = nil;
	m_receivedData = [[NSMutableData alloc] init];
	m_connection = [[NSURLConnection alloc] initWithRequest:m_request delegate:self];

	m_isLoading = YES;
}

- (void)setURL:(NSURL *)url{
	[m_request setURL:url];
}

- (NSURL *)URL{
	return [m_request URL];
}

- (void)addValue:(NSString *)value forHTTPHeaderField:(NSString *)field{
	[m_request addValue:value forHTTPHeaderField:field];
}

- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field{
	[m_request setValue:value forHTTPHeaderField:field];
}

- (NSString *)valueForHTTPHeaderField:(NSString *)field{
	return [m_request valueForHTTPHeaderField:field];
}

- (void)setValue:(NSObject *)value forAMFHeaderField:(NSString *)field
	mustUnderstand:(BOOL)mustUnderstand{
	if (m_amfHeaders == nil)
		m_amfHeaders = [[NSMutableDictionary alloc] init];
	[m_amfHeaders setValue:[AMFMessageHeader messageHeaderWithName:field data:value
		mustUnderstand:mustUnderstand] forKey:field];
}

#pragma mark -
#pragma mark Private methods

- (NSString *)_nextResponseURI{
	return [NSString stringWithFormat:@"/%d", g_responseCount++];
}

- (void)_cleanup{
	[m_connection release];
	m_connection = nil;
	[m_receivedData release];
	m_receivedData = nil;
	[m_error release];
	m_error = nil;
}

#pragma mark -
#pragma mark NSURLConnection Delegate methods

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
	if ([[[(NSHTTPURLResponse *)response allHeaderFields] objectForKey:@"Content-Type"]
		rangeOfString:@"application/x-amf"].location == NSNotFound){
		m_error = [[NSError errorWithDomain:kAMFRemotingCallErrorDomain
			code:kAMFInvalidResponseErrorCode userInfo:[NSDictionary dictionaryWithObject:
				[NSString stringWithFormat:@"The server returned no application/x-amf data at URL %@.",
					[[response URL] absoluteString]] forKey:NSLocalizedDescriptionKey]] retain];
	}else if ([(NSHTTPURLResponse *)response statusCode] != 200){
		m_error = [[NSError errorWithDomain:kAMFRemotingCallErrorDomain
			code:kAMFServerErrorErrorCode userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
				[NSString stringWithFormat:@"The server returned status code %d at URL %@.",
					[(NSHTTPURLResponse *)response statusCode], [[response URL] absoluteString]],
				NSLocalizedDescriptionKey, [NSNumber numberWithInt:
					[(NSHTTPURLResponse *)response statusCode]], kAMFServerStatusCodeKey, nil]] retain];
	}

	if ([m_delegate respondsToSelector:@selector(remotingCall:didReceiveResponse:)]){
		objc_msgSend(m_delegate, @selector(remotingCall:didReceiveResponse:), self, response);
	}
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
	[m_receivedData appendData:data];
	if ([m_delegate respondsToSelector:@selector(remotingCall:didReceiveData:)]){
		objc_msgSend(m_delegate, @selector(remotingCall:didReceiveData:), self, data);
	}
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
	if (!m_error && [m_receivedData length] == 0){
		m_error = [[NSError errorWithDomain:kAMFRemotingCallErrorDomain
			code:kAMFInvalidResponseErrorCode userInfo:[NSDictionary dictionaryWithObject:
				@"The server returned zero bytes of data" forKey:NSLocalizedDescriptionKey]] retain];
	}

	if (m_error){
		objc_msgSend(m_delegate, @selector(remotingCall:didFailWithError:), self, m_error);
	}else{
		AMFActionMessage *message = [[AMFActionMessage alloc] initWithData:m_receivedData];
		NSObject *data = [[message.bodies objectAtIndex:0] data];
		objc_msgSend(m_delegate, @selector(remotingCallDidFinishLoading:receivedObject:),
			self, data);
		[message release];
	}
	[self _cleanup];
	m_isLoading = NO;
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
	objc_msgSend(m_delegate, @selector(remotingCall:didFailWithError:), self, error);
	[self _cleanup];
	m_isLoading = NO;
}

- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request
	redirectResponse:(NSURLResponse *)redirectResponse{
	if ([m_delegate respondsToSelector:@selector(remotingCall:willSendRequest:redirectResponse:)]){
		return (NSURLRequest *)objc_msgSend(m_delegate,
			@selector(remotingCall:willSendRequest:redirectResponse:), self, request,
			redirectResponse);
	}
	return request;
}

@end


text:
<?php

namespace Doitonlinemedia\Admin\App\Commands;

use Doitonlinemedia\Admin\App\Models\DataType;
use Illuminate\Console\Command;
use \File;
use Illuminate\Support\Facades\Input;

class BuildRelation extends Command
{
    protected $signature = 'test:test';

    protected $description = '';

    protected $modelTemplate = '';

    protected $modelName = null;
    protected $modelPath = null;
    protected $modelFilename = null;

    public function __construct()
    {
        parent::__construct();

        $this->modelTemplate = \File::get(__DIR__.'/resources/relation.stub');
    }

    public function build()
    {
        $moduleAlias = ucfirst($this->option('module_alias'));
        $this->modelTemplate = str_replace('TemplateModel', $this->modelName, $this->modelTemplate);
        $this->modelTemplate = str_replace('{Module}', $moduleAlias, $this->modelTemplate);
        $this->modelTemplate = str_replace('protected $table = \'\';', 'protected $table = \'' . strtolower($this->option('table')) . '\';', $this->modelTemplate);

        return $this->modelTemplate;
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TextAdventures.Quest.EditorControls
{
    /// <summary>
    /// Interaction logic for ExpressionTemplate.xaml
    /// </summary>
    public partial class ExpressionTemplate : UserControl
    {
        private List<IElementEditorControl> m_controls = new List<IElementEditorControl>();
        private IEditorData m_data;
        private string m_templatesFilter;

        public event Action<string> Dirty;
        public event Action RequestSave;

        public ExpressionTemplate()
        {
            InitializeComponent();
        }

        public EditorController Controller { get; set; }

        public void Initialise(IEditorDefinition definition, string expression, IEditorData parentData)
        {
            foreach (IElementEditorControl ctl in m_controls)
            {
                ctl.Helper.Dirty -= SubControl_Dirty;
            }

            m_controls.Clear();
            stackPanel.Children.Clear();

            if (m_data != null)
            {
                m_data.Changed -= m_data_Changed;
            }

            m_data = Controller.GetExpressionEditorData(expression, ExpressionTypeTemplateFilter, parentData);
            m_data.Changed += m_data_Changed;

            foreach (IEditorControl ctl in definition.Controls)
            {
                AddControl(ctl, expression);
            }
        }

        public void Uninitialise()
        {
            foreach (IElementEditorControl ctl in m_controls)
            {
                ctl.Populate(null);
                ctl.Helper.Dirty -= SubControl_Dirty;
                ctl.Helper.RequestParentElementEditorSave -= SubControl_RequestParentElementEditorSave;
                ctl.Helper.DoUninitialise();
            }
            if (m_data != null)
            {
                m_data.Changed -= m_data_Changed;
            }
            m_data = null;
        }

        void m_data_Changed(object sender, EventArgs e)
        {
            RequestSave();
        }

        private void AddControl(IEditorControl ctl, string expression)
        {
            Control newControl = ControlFactory.CreateEditorControl(Controller, ctl.ControlType);
            stackPanel.Children.Add(newControl);

            newControl.VerticalAlignment = VerticalAlignment.Top;
            if (newControl is LabelControl)
            {
                newControl.Padding = new Thickness(3, 3, 3, 0);
            }
            else
            {
                newControl.Padding = new Thickness(3, 0, 3, 0);
            }

            IElementEditorControl elementEditor = newControl as IElementEditorControl;
            if (elementEditor != null)
            {
                elementEditor.Helper.DoInitialise(Controller, ctl);
                elementEditor.Populate(m_data);
                elementEditor.Helper.Dirty += SubControl_Dirty;
                elementEditor.Helper.RequestParentElementEditorSave += SubControl_RequestParentElementEditorSave;
                m_controls.Add(elementEditor);
            }
        }

        void SubControl_RequestParentElementEditorSave()
        {
            RequestSave();
        }

        void SubControl_Dirty(object sender, DataModifiedEventArgs e)
        {
            Dirty(SaveExpression(e.Attribute, (string)e.NewValue));
        }

        public string SaveExpression()
        {
            // Copy control list as saving will cause it to be repopulated
            List<IElementEditorControl> controls = new List<IElementEditorControl>(m_controls);
            foreach (IElementEditorControl ctl in controls)
            {
                ctl.Save();
            }
            return SaveExpression(null, null);
        }

        private string SaveExpression(string changedAttribute, string changedValue)
        {
            return Controller.GetExpression(m_data, changedAttribute, changedValue);
        }

        public string ExpressionTypeTemplateFilter
        {
            get { return m_templatesFilter; }
            set { m_templatesFilter = value; }
        }
    }
}


text:
// Autogenerated from vk-api-schema. Please don't edit it manually.
package com.vk.api.sdk.objects.friends;

import com.google.gson.annotations.SerializedName;
import com.vk.api.sdk.queries.EnumParam;

/**
 * Friend status with the user
 */
public enum FriendStatusStatus implements EnumParam {
    @SerializedName("0")
    NOT_A_FRIEND(0),

    @SerializedName("1")
    OUTCOMING_REQUEST(1),

    @SerializedName("2")
    INCOMING_REQUEST(2),

    @SerializedName("3")
    IS_FRIEND(3);

    private final Integer value;

    FriendStatusStatus(Integer value) {
        this.value = value;
    }

    public String getValue() {
        return value.toString();
    }

    @Override
    public String toString() {
        return value.toString().toLowerCase();
    }
}


text:
- [Getting started](./getting-started.md)

    - [Dissecting Hello World](./dissecting-hello-world.md)

    - [Using the REPL](./using-the-repl.md)

    - [Anatomy of a gluon program](./anatomy-of-a-gluon-program.md)

    - [Extending the guessing game with extensible effects](./extending-the-guessing-game-with-effects.md)

- [Syntax and semantics](./syntax-and-semantics.md)

- [Metadata](./metadata.md)

- [Modules](./modules.md)

- [Embedding API](./embedding-api.md)

    - [Marshalling types](./marshalling-types.md)

- [Standard types and functions](./standard-types-and-functions.md)


text:
using System.Net.Http;
using System.Threading.Tasks;
using System;
using System.IO;

namespace RestEase
{
    /// <summary>
    /// Called by the generated REST API implementation, this knows how to invoke the API and return a suitable response
    /// </summary>
    public interface IRequester : IDisposable
    {
        /// <summary>
        /// Invoked when the API interface method being called returns a Task
        /// </summary>
        /// <param name="requestInfo">Object holding all information about the request</param>
        /// <returns>Task to return to the API interface caller</returns>
        Task RequestVoidAsync(IRequestInfo requestInfo);

        /// <summary>
        /// Invoked when the API interface method being called returns a Task{T}
        /// </summary>
        /// <typeparam name="T">Type of response object expected by the caller</typeparam>
        /// <param name="requestInfo">Object holding all information about the request</param>
        /// <returns>Task to return to the API interface caller</returns>
        Task<T> RequestAsync<T>(IRequestInfo requestInfo);

        /// <summary>
        /// Invoked when the API interface method being called returns a Task{HttpResponseMessage}
        /// </summary>
        /// <param name="requestInfo">Object holding all information about the request</param>
        /// <returns>Task to return to the API interface caller</returns>
        Task<HttpResponseMessage> RequestWithResponseMessageAsync(IRequestInfo requestInfo);

        /// <summary>
        /// Invoked when the API interface method being called returns a Task{Response{T}}
        /// </summary>
        /// <typeparam name="T">Type of response object expected by the caller</typeparam>
        /// <param name="requestInfo">Object holding all information about the request</param>
        /// <returns>Task to return to the API interface caller</returns>
        Task<Response<T>> RequestWithResponseAsync<T>(IRequestInfo requestInfo);

        /// <summary>
        /// Invoked when the API interface method being called returns a Task{Stream}
        /// </summary>
        /// <param name="requestInfo">Object holding all information about the request</param>
        /// <returns>Task to return to the API interface caller</returns>
        Task<Stream?> RequestStreamAsync(IRequestInfo requestInfo);
    }
}


text:
package roger

import (
	"errors"
	"strconv"

	"github.com/senseyeio/roger/constants"
	"github.com/senseyeio/roger/sexp"
)

// Packet is the interface satisfied by objects returned from a R command.
// It contains either the resulting object or an error.
type Packet interface {

	// GetResultObject will parse the packet's contents, returning a go interface{}.
	// If the Packet contains an error this will be returned.
	// If conversion fails, an error will be returned.
	GetResultObject() (interface{}, error)

	// IsError returns a boolean defining whether the Packet contains an error.
	IsError() bool

	// Returns the packet's error or nil if there is none.
	GetError() error

	// IsOk returns a boolean defining whether Packet was success
	IsOk() bool
}

type packet struct {
	cmd     int
	content []byte
	err     error
}

func newPacket(cmd int, content []byte) Packet {
	return &packet{
		cmd:     cmd,
		content: content,
	}
}

func newErrorPacket(err error) Packet {
	return &packet{
		err: err,
	}
}

func (p *packet) IsError() bool {
	return p.err != nil || p.cmd&15 == 2
}

func (p *packet) IsOk() bool {
	return !p.IsError()
}

func (p *packet) getStatusCode() int {
	return p.cmd >> 24 & 127
}

func (p *packet) GetError() error {
	if p.IsError() {
		return p.getError()
	} else {
		return nil
	}
}

func (p *packet) getError() error {
	errDescMap := map[int]string{
		2:   "Invalid expression",
		3:   "Parse error",
		127: "Unknown variable/method"}

	if p.err != nil {
		return p.err
	}

	if errDesc, found := errDescMap[p.getStatusCode()]; found {
		return errors.New("Command error with status: " + errDesc)
	}

	return errors.New("Command error with status code: " + strconv.Itoa(p.getStatusCode()))
}

func (p *packet) GetResultObject() (interface{}, error) {
	if p.IsError() {
		return nil, p.getError()
	}
	if len(p.content) == 0 {
		return nil, errors.New("Command failed for an unknown reason")
	}
	isSexp := p.content[0] == byte(constants.DtSexp)
	isLarge := p.content[0] == byte(constants.DtSexp|constants.DtLarge)
	if !isSexp && !isLarge {
		return nil, errors.New("Expected DT_SEXP or DT_LARGE response")
	}
	offset := constants.SmHeaderSize
	if isLarge {
		offset = constants.LgHeaderSize
	}
	return sexp.Parse(p.content[offset:len(p.content)], 0)
}


text:
var express = require('express');
var load = require('express-load');
var bodyParser = require('body-parser');

module.exports = function (){

	var app = express();

	app.use(express.static('./app/public')); //rota pra o ccs e js

	app.set('view engine', 'ejs');
	app.set('views', './app/views');

	app.use(bodyParser.urlencoded({extended: true})); //pq do true msm?
	app.use(bodyParser.json());

	load('routes',{cwd: 'app'})
		.then('infra')
		.into(app);

	return app;
}


text:
import _ from 'lodash';
import extractText from '../unfluff/unfluff';
import i18n from '../shared/i18n';
import { fetchText } from '../shared/fetcher';
import BaseDownloader from './base_downloader';

class ContentRunner {

    fetch(url) {
        return fetchText(url.link).then((html) => (extractText(html, url.lang)));
    }

    process(json, task) {
        task.resolve({ text: json.text, lang: json.lang || task.url.lang });
    }
}

const singleton = new BaseDownloader(new ContentRunner());

// We should use throttling to prevent overwhelming requesting.
singleton.throttle = () => {
    return Math.random() * 3000 + 1000;
};

export default singleton;


text:
import os
from setuptools import setup, find_packages
# http://peak.telecommunity.com/DevCenter/setuptools#developer-s-guide

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()

try:
    CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
except IOError:
    CHANGES = ''

requires = ['nine', 'bag>=0.3.4', 'deform_bootstrap==0.2.8', 'pyramid_deform']

setup(name='deform_bootstrap_extra',
    version='0.2.8',
    description="A complement to deform_bootstrap, which offers "
    "Twitter Bootstrap compatible widgets, templates and styles "
    "for the deform form library.",
    long_description='\n\n'.join([README, CHANGES]),
    author='Nando Florestan',
    author_email='nandoflorestan@gmail.com',
    url='https://github.com/nandoflorestan/deform_bootstrap_extra',
    keywords='twitter bootstrap deform styles css web forms form',
    classifiers=[  # http://pypi.python.org/pypi?:action=list_classifiers
        "Development Status :: 5 - Production/Stable",
        "Intended Audience :: Developers",
        'License :: OSI Approved :: BSD License',
        "Environment :: Web Environment",
        "Framework :: Pyramid",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.2",
        "Programming Language :: Python :: 3.3",
        "Topic :: Software Development :: Libraries :: Python Modules",
    ],
    license='BSD',
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
    install_requires=requires,
    tests_require=requires,
    test_suite="deform_bootstrap_extra.jests",
)


text:
"""Tests for Debug male/female classification model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import tempfile

from absl.testing import flagsaver
from classifaedes import export
from classifaedes import hparams_lib
from classifaedes import learner
from classifaedes import metadata
import tensorflow.compat.v1 as tf

flags = tf.app.flags
FLAGS = flags.FLAGS

class LearnerTest(tf.test.TestCase):

  def testRunExperiment(self):
    """An end-to-end test using tf.learn.Experiment's built-in test."""
    data_dir = os.path.join(
        os.path.dirname(os.path.abspath(__file__)),

        'testdata/data_dir')

    model_dir = tempfile.mkdtemp()
    export_dir_base = tempfile.mkdtemp()

    hps = hparams_lib.defaults()
    hps.batch_size = 2
    hps.filter_depth_mul = 0.1
    hps.arch = 'inception_v3b'
    input_md = metadata.load_metadata(data_dir=data_dir)
    image_shape = metadata.shape_from_metadata(input_md)

    with flagsaver.flagsaver(data_dir=data_dir,
                             shuffle_q_capacity=4,
                             shuffle_q_min_after_deq=2,
                             read_q_capacity=2,
                             train_steps=2,
                             evals_per_ckpt=5):
      experiment_fn = learner.build_experiment_fn(hps, input_md)
      tf.logging.info('Testing train, eval...')
      eval_metrics = experiment_fn(model_dir).test()

      tf.logging.info('Testing model export...')
      export_dir = export.run_export(
          hps, image_shape, model_dir, export_dir_base)
      export.run_test_inference(image_shape, export_dir)

    self.assertIsNotNone(eval_metrics.get('loss'))

if __name__ == '__main__':
  tf.test.main()


text:
/* jshint sub:true */

var install = require('../src/plugman/install'),
    actions = require('cordova-common').ActionStack,
    xmlHelpers = require('cordova-common').xmlHelpers,
    et      = require('elementtree'),
    PlatformJson = require('cordova-common').PlatformJson,
    events = require('cordova-common').events,
    plugman = require('../src/plugman/plugman'),
    platforms = require('../src/plugman/platforms/common'),
    knownPlatforms  = require('../src/platforms/platforms'),
    common  = require('./common'),
    fs      = require('fs'),
    os      = require('os'),
    path    = require('path'),
    shell   = require('shelljs'),
    child_process = require('child_process'),
    semver  = require('semver'),
    Q = require('q'),
    spec    = __dirname,
    done    = false,
    srcProject = path.join(spec, 'projects', 'android_install'),
    temp_dir = path.join(fs.realpathSync(os.tmpdir()), 'plugman-test'),
    project = path.join(temp_dir, 'android_install'),
    plugins_dir = path.join(spec, 'plugins'),
    plugins_install_dir = path.join(project, 'cordova', 'plugins'),
    plugins = {
        'org.test.plugins.dummyplugin' : path.join(plugins_dir, 'org.test.plugins.dummyplugin'),
        'com.cordova.engine' : path.join(plugins_dir, 'com.cordova.engine'),
        'com.cordova.engine-android' : path.join(plugins_dir, 'com.cordova.engine-android'),
        'org.test.plugins.childbrowser' : path.join(plugins_dir, 'org.test.plugins.childbrowser'),
        'com.adobe.vars' : path.join(plugins_dir, 'com.adobe.vars'),
        'org.test.defaultvariables' : path.join(plugins_dir, 'org.test.defaultvariables'),
        'org.test.invalid.engine.script' : path.join(plugins_dir, 'org.test.invalid.engine.script'),
        'org.test.invalid.engine.no.platform' : path.join(plugins_dir, 'org.test.invalid.engine.no.platform'),
        'org.test.invalid.engine.no.scriptSrc' : path.join(plugins_dir, 'org.test.invalid.engine.no.scriptSrc'),
        'A' : path.join(plugins_dir, 'dependencies', 'A'),
        'B' : path.join(plugins_dir, 'dependencies', 'B'),
        'C' : path.join(plugins_dir, 'dependencies', 'C'),
        'F' : path.join(plugins_dir, 'dependencies', 'F'),
        'G' : path.join(plugins_dir, 'dependencies', 'G')
    },
    promise,
    results = {},
    superspawn = require('cordova-common').superspawn;

// Pre-crete the temp dir, without it the test fails.
shell.mkdir('-p', temp_dir);

function installPromise(f) {
  f.then(function(res) { done = true; }, function(err) { done = err; });
}

var existsSync = fs.existsSync;

// Mocked functions for tests
var fake = {
    'existsSync' : {
        'noPlugins' : function(path){
            // fake installed plugin directories as 'not found'
            if( path.slice(-5) !== '.json' && path.indexOf(plugins_install_dir) >= 0) {
                return false;
            }

            return existsSync(path);
        }
    },
    'fetch' : {
        'dependencies' : function(id, dir) {
            if(id == plugins['A'])
                return Q(id); // full path to plugin

            return Q( path.join(plugins_dir, 'dependencies', id) );
        }
    }
};

var TEST_XML = '<?xml version="1.0" encoding="UTF-8"?>\n' +
    '<widget xmlns     = "http://www.w3.org/ns/widgets"\n' +
    '        xmlns:cdv = "http://cordova.apache.org/ns/1.0"\n' +
    '        id        = "io.cordova.hellocordova"\n' +
    '        version   = "0.0.1">\n' +
    '    <name>Hello Cordova</name>\n' +
    '    <description>\n' +
    '        A sample Apache Cordova application that responds to the deviceready event.\n' +
    '    </description>\n' +
    '    <author href="http://cordova.io" email="dev@cordova.apache.org">\n' +
    '        Apache Cordova Team\n' +
    '    </author>\n' +
    '    <content src="index.html" />\n' +
    '    <access origin="*" />\n' +
    '    <preference name="fullscreen" value="true" />\n' +
    '    <preference name="webviewbounce" value="true" />\n' +
    '</widget>\n';

describe('start', function() {
    var config_queue_add, proc, actions_push, ca, emit;

    beforeEach(function() {
        config_queue_add = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
        proc = spyOn(actions.prototype, 'process').andReturn( Q(true) );
        actions_push = spyOn(actions.prototype, 'push');
        ca = spyOn(actions.prototype, 'createAction');

        var origParseElementtreeSync = xmlHelpers.parseElementtreeSync.bind(xmlHelpers);
        spyOn(xmlHelpers, 'parseElementtreeSync').andCallFake(function(path) {
            if (/config.xml$/.test(path)) return new et.ElementTree(et.XML(TEST_XML));
            return origParseElementtreeSync(path);
        });
    });

    it('start', function() {
        shell.rm('-rf', project);
        shell.cp('-R', path.join(srcProject, '*'), project);

        // Every time when addPlugin is called it will return some truthy value
        var returnValueIndex = 0;
        var returnValues = [true, {}, [], 'foo', function(){}];
        var api = knownPlatforms.getPlatformApi('android', project);
        var addPluginOrig = api.addPlugin;
        spyOn(api, 'addPlugin').andCallFake(function () {
            return addPluginOrig.apply(api, arguments)
            .thenResolve(returnValues[returnValueIndex++]);
        });

        done = false;
        promise = Q()
         .then(
            function(){
                return install('android', project, plugins['org.test.plugins.dummyplugin']);
            }
        ).then(
            function(result){
                expect(result).toBeTruthy();
                results['actions_callCount'] = actions_push.callCount;
                results['actions_create'] = ca.argsForCall[0];
                results['config_add'] = config_queue_add.argsForCall[0];

                return Q();
            }
        ).then(
            function(){
                return install('android', project, plugins['com.cordova.engine']);
            }
        ).then(
            function(result){
                expect(result).toBeTruthy();
                emit = spyOn(events, 'emit');
                return install('android', project, plugins['org.test.plugins.childbrowser']);
            }
        ).then(
            function(result){
                expect(result).toBeTruthy();
                return install('android', project, plugins['com.adobe.vars'], plugins_install_dir, { cli_variables:{API_KEY:'batman'} });
            }
        ).then(
            function(result){
                expect(result).toBeTruthy();
                return install('android', project, plugins['org.test.defaultvariables'], plugins_install_dir, { cli_variables:{API_KEY:'batman'} });
            }
        ).then(
            function(result){
                expect(result).toBeTruthy();
                done = true;
                results['emit_results'] = [];

                for(var i in emit.calls) {
                    if(emit.calls[i].args[0] === 'results')
                        results['emit_results'].push(emit.calls[i].args[1]);
                }

                events.emit('verbose', '***** DONE START *****');
            }
        ).fail(
            function(error) {
                expect(error).toBeUndefined();
            }
        );
        waitsFor(function() { return done; }, 'promise never resolved', 2000);
    });
});

describe('install', function() {
    var chmod, exec, add_to_queue, cp, rm, fetchSpy;
    var spawnSpy;

    beforeEach(function() {

        exec = spyOn(child_process, 'exec').andCallFake(function(cmd, cb) {
            cb(false, '', '');
        });
        spawnSpy = spyOn(superspawn, 'spawn').andReturn(Q('3.1.0'));
        spyOn(fs, 'mkdirSync').andReturn(true);
        spyOn(shell, 'mkdir').andReturn(true);
        spyOn(platforms, 'copyFile').andReturn(true);

        fetchSpy = spyOn(plugman.raw, 'fetch').andReturn( Q( plugins['com.cordova.engine'] ) );
        chmod = spyOn(fs, 'chmodSync').andReturn(true);
        spyOn(fs, 'writeFileSync').andReturn(true);
        cp = spyOn(shell, 'cp').andReturn(true);
        rm = spyOn(shell, 'rm').andReturn(true);
        add_to_queue = spyOn(PlatformJson.prototype, 'addInstalledPluginToPrepareQueue');
        done = false;
    });

    describe('success', function() {
        it('should emit a results event with platform-agnostic <info>', function() {
            // org.test.plugins.childbrowser
            expect(results['emit_results'][0]).toBe('No matter what platform you are installing to, this notice is very important.');
        });
        it('should emit a results event with platform-specific <info>', function() {
            // org.test.plugins.childbrowser
            expect(results['emit_results'][1]).toBe('Please make sure you read this because it is very important to complete the installation of your plugin.');
        });
        it('should interpolate variables into <info> tags', function() {
            // VariableBrowser
            expect(results['emit_results'][2]).toBe('Remember that your api key is batman!');
        });
        it('should call fetch if provided plugin cannot be resolved locally', function() {
            fetchSpy.andReturn( Q( plugins['org.test.plugins.dummyplugin'] ) );
            spyOn(fs, 'existsSync').andCallFake( fake['existsSync']['noPlugins'] );

            runs(function() {
                installPromise(install('android', project, 'CLEANYOURSHORTS' ));
            });
            waitsFor(function() { return done; }, 'install promise never resolved', 200);
            runs(function() {
                expect(done).toBe(true);
                expect(fetchSpy).toHaveBeenCalled();
            });
        });
        it('should call fetch and convert oldID to newID', function() {
            fetchSpy.andReturn( Q( plugins['org.test.plugins.dummyplugin'] ) );
            spyOn(fs, 'existsSync').andCallFake( fake['existsSync']['noPlugins'] );
            var emit = spyOn(events, 'emit');
            runs(function() {
                installPromise(install('android', project, 'org.apache.cordova.device' ));
            });
            waitsFor(function() { return done; }, 'install promise never resolved', 200);
            runs(function() {
                expect(emit.calls[0].args[1]).toBe('Notice: org.apache.cordova.device has been automatically converted to cordova-plugin-device and fetched from npm. This is due to our old plugins registry shutting down.');
                expect(done).toBe(true);
                expect(fetchSpy).toHaveBeenCalled();
            });
        });

        describe('engine versions', function () {
            var fail, satisfies;
            beforeEach(function () {
                fail = jasmine.createSpy('fail');
                satisfies = spyOn(semver, 'satisfies').andReturn(true);
                spyOn(PlatformJson.prototype, 'isPluginInstalled').andReturn(false);
            });

            it('should check version if plugin has engine tag', function(done){
                exec.andCallFake(function(cmd, cb) { cb(null, '2.5.0\n'); });
                install('android', project, plugins['com.cordova.engine'])
                .fail(fail)
                .fin(function () {
                    expect(satisfies).toHaveBeenCalledWith('2.5.0','>=1.0.0', true);
                    done();
                });
            });
            it('should check version and munge it a little if it has "rc" in it so it plays nice with semver (introduce a dash in it)', function(done) {
                exec.andCallFake(function(cmd, cb) { cb(null, '3.0.0rc1\n'); });
                install('android', project, plugins['com.cordova.engine'])
                .fail(fail)
                .fin(function () {
                    expect(satisfies).toHaveBeenCalledWith('3.0.0-rc1','>=1.0.0', true);
                    done();
                });
            });
            it('should check specific platform version over cordova version if specified', function(done) {
                exec.andCallFake(function(cmd, cb) { cb(null, '3.1.0\n'); });
                install('android', project, plugins['com.cordova.engine-android'])
                .fail(fail)
                .fin(function() {
                    expect(satisfies).toHaveBeenCalledWith('3.1.0','>=3.1.0', true);
                    done();
                });
            });
            it('should check platform sdk version if specified', function(done) {
                var cordovaVersion = require('../package.json').version.replace(/-dev|-nightly.*$/, '');
                exec.andCallFake(function(cmd, cb) { cb(null, '18\n'); });
                install('android', project, plugins['com.cordova.engine-android'])
                .fail(fail)
                .fin(function() {
                    expect(satisfies.calls.length).toBe(3);
                    // <engine name="cordova" VERSION=">=3.0.0"/>
                    expect(satisfies.calls[0].args).toEqual([ cordovaVersion, '>=3.0.0', true ]);
                    // <engine name="cordova-android" VERSION=">=3.1.0"/>
                    expect(satisfies.calls[1].args).toEqual([ '18.0.0', '>=3.1.0', true ]);
                    // <engine name="android-sdk" VERSION=">=18"/>
                    expect(satisfies.calls[2].args).toEqual([ '18.0.0','>=18', true ]);
                    done();
                });
            });
            it('should check engine versions', function(done) {
                install('android', project, plugins['com.cordova.engine'])
                .fail(fail)
                .fin(function() {
                    var plugmanVersion = require('../package.json').version.replace(/-dev|-nightly.*$/, '');
                    var cordovaVersion = require('../package.json').version.replace(/-dev|-nightly.*$/, '');
                    expect(satisfies.calls.length).toBe(4);
                    // <engine name="cordova" version=">=2.3.0"/>
                    expect(satisfies.calls[0].args).toEqual([ cordovaVersion, '>=2.3.0', true ]);
                    // <engine name="cordova-plugman" version=">=0.10.0" />
                    expect(satisfies.calls[1].args).toEqual([ plugmanVersion, '>=0.10.0', true ]);
                    // <engine name="mega-fun-plugin" version=">=1.0.0" scriptSrc="megaFunVersion" platform="*" />
                    expect(satisfies.calls[2].args).toEqual([ null, '>=1.0.0', true ]);
                    // <engine name="mega-boring-plugin" version=">=3.0.0" scriptSrc="megaBoringVersion" platform="ios|android" />
                    expect(satisfies.calls[3].args).toEqual([ null, '>=3.0.0', true ]);
                    done();
                });
            });
            it('should not check custom engine version that is not supported for platform', function(done) {
                install('blackberry10', project, plugins['com.cordova.engine'])
                .then(fail)
                .fail(function () {
                    expect(satisfies).not.toHaveBeenCalledWith('','>=3.0.0', true);
                })
                .fin(done);
            });
        });

        it('should not check custom engine version that is not supported for platform', function() {
            var spy = spyOn(semver, 'satisfies').andReturn(true);
            runs(function() {
                installPromise( install('blackberry10', project, plugins['com.cordova.engine']) );
            });
            waitsFor(function() { return done; }, 'install promise never resolved', 200);
            runs(function() {
                expect(spy).not.toHaveBeenCalledWith('','>=3.0.0');
            });
        });

        describe('with dependencies', function() {
            var emit;
            beforeEach(function() {
                spyOn(fs, 'existsSync').andCallFake( fake['existsSync']['noPlugins'] );
                fetchSpy.andCallFake( fake['fetch']['dependencies'] );
                emit = spyOn(events, 'emit');
                exec.andCallFake(function(cmd, cb) {
                    cb(null, '9.0.0\n');
                });
            });

            it('should install any dependent plugins if missing', function() {
                runs(function() {
                    installPromise( install('android', project, plugins['A']) );
                });
                waitsFor(function() { return done; }, 'install promise never resolved', 200);
                runs(function() {
                    // Look for 'Installing plugin ...' in events
                    var install = common.spy.getInstall(emit);

                    expect(install).toEqual([
                        'Install start for "C" on android.',
                        'Install start for "D" on android.',
                        'Install start for "A" on android.'
                    ]);
                });
            });

            it('should install any dependent plugins from registry when url is not defined', function() {
                // Plugin A depends on C & D
                runs(function() {
                    installPromise( install('android', project, plugins['A']) );
                });
                waitsFor(function() { return done; }, 'promise never resolved', 200);
                runs(function() {
                    // TODO: this is same test as above? Need test other dependency with url=?
                    var install = common.spy.getInstall(emit);

                    expect(install).toEqual([
                        'Install start for "C" on android.',
                        'Install start for "D" on android.',
                        'Install start for "A" on android.'
                    ]);
                });
            });

            it('should process all dependent plugins with alternate routes to the same plugin', function() {
                // Plugin F depends on A, C, D and E
                runs(function () {
                    installPromise(install('android', project, plugins['F']));
                });
                waitsFor(function () { return done; }, 'install promise never resolved', 200);
                runs(function () {
                    var install = common.spy.getInstall(emit);

                    expect(install).toEqual([
                        'Install start for "C" on android.',
                        'Install start for "D" on android.',
                        'Install start for "A" on android.',
                        'Install start for "D" on android.',
                        'Install start for "F" on android.'
                    ]);
                });
            });

            it('should throw if there is a cyclic dependency', function() {
                runs(function () {
                    installPromise( install('android', project, plugins['G']) );
                });
                waitsFor(function () { return done; }, 'install promise never resolved', 200);
                runs(function () {
                    common.spy.getInstall(emit);

                    expect(done.message).toEqual('Cyclic dependency from G to H');
                });
            });

            it('install subdir relative to top level plugin if no fetch meta', function() {
                runs(function () {
                    installPromise(install('android', project, plugins['B']));
                });
                waitsFor(function () { return done; }, 'install promise never resolved', 200);
                runs(function () {
                    var install = common.spy.getInstall(emit);

                    expect(install).toEqual([
                        'Install start for "D" on android.',
                        'Install start for "E" on android.',
                        'Install start for "B" on android.'
                    ]);
                });
            });

            it('install uses meta data (if available) of top level plugin source', function() {
                // Fake metadata so plugin 'B' appears from 'meta/B'
                var meta = require('../src/plugman/util/metadata');
                spyOn(meta, 'get_fetch_metadata').andCallFake(function(){
                    return {
                        source: {type: 'dir', url: path.join(plugins['B'], '..', 'meta')}
                    };
                });

                runs(function () {
                    installPromise(install('android', project, plugins['B']));
                });
                waitsFor(function () { return done; }, 'install promise never resolved', 200);
                runs(function () {
                    var install = common.spy.getInstall(emit);

                    expect(install).toEqual([
                        'Install start for "D" on android.',
                        'Install start for "E" on android.',
                        'Install start for "B" on android.'
                    ]);

                    var copy = common.spy.startsWith(emit, 'Copying from');
                    expect(copy.length).toBe(3);
                    expect(copy[0].indexOf(path.normalize('meta/D')) > 0).toBe(true);
                    expect(copy[1].indexOf(path.normalize('meta/subdir/E')) > 0).toBe(true);
                });
            });
        });
    });

    describe('failure', function() {
        it('should throw if platform is unrecognized', function() {
            runs(function() {
                installPromise( install('atari', project, 'SomePlugin') );
            });
            waitsFor(function() { return done; }, 'install promise never resolved', 200);
            runs(function() {
                expect(''+done).toContain('atari not supported.');
            });
        });
        it('should throw if variables are missing', function(done) {
            var success = jasmine.createSpy('success');
            spyOn(PlatformJson.prototype, 'isPluginInstalled').andReturn(false);
            install('android', project, plugins['com.adobe.vars'])
            .then(success)
            .fail(function (err) {
                expect(err).toContain('Variable(s) missing: API_KEY');
            })
            .fin(function () {
                expect(success).not.toHaveBeenCalled();
                done();
            });
        });
        it('should throw if git is not found on the path and a remote url is requested', function() {
            spyOn(fs, 'existsSync').andCallFake( fake['existsSync']['noPlugins'] );
            fetchSpy.andCallThrough();
            spyOn(shell, 'which').andReturn(null);
            runs(function() {
                installPromise( install('android', project, 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git') );
            });
            waitsFor(function(){ return done; }, 'install promise never resolved', 200);
            runs(function() {
                expect(''+done).toContain('"git" command line tool is not installed: make sure it is accessible on your PATH.');
            });
        });
        it('should not fail when trying to install plugin less than minimum version. Skip instead  ', function(){
            spyOn(semver, 'satisfies').andReturn(false);
            exec.andCallFake(function(cmd, cb) {
                cb(null, '0.0.1\n');
            });
            runs(function() {
                installPromise( install('android', project, plugins['com.cordova.engine']) );
            });
            waitsFor(function(){ return done; }, 'install promise never resolved', 200);
            runs(function() {
                expect(''+done).toMatch(true);
            });
        });
        it('should throw if the engine scriptSrc escapes out of the plugin dir.', function(done) {
            var success = jasmine.createSpy('success'),
                fail = jasmine.createSpy('fail').andCallFake(function(err) {
                    // <engine name="path-escaping-plugin" version=">=1.0.0" scriptSrc="../../../malicious/script" platform="*" />
                    expect(err).toBeDefined();
                    expect(err.message.indexOf('Security violation:')).toBe(0);
                });

            spyOn(PlatformJson.prototype, 'isPluginInstalled').andReturn(false);
            install('android', project, plugins['org.test.invalid.engine.script'])
                .then(success)
                .fail(fail)
                .fin(function() {
                    expect(success).not.toHaveBeenCalled();
                    expect(fail).toHaveBeenCalled();
                    done();
                });
        });
        it('should throw if a non-default cordova engine platform attribute is not defined.', function(done) {
            var success = jasmine.createSpy('success'),
                fail = jasmine.createSpy('fail');
            spyOn(PlatformJson.prototype, 'isPluginInstalled').andReturn(false);
            install('android', project, plugins['org.test.invalid.engine.no.platform'])
                .then(success)
                .fail(fail)
                .fin(function() {
                    expect(success).not.toHaveBeenCalled();
                    expect(fail).toHaveBeenCalled();
                    done();
                });
        });
        it('should throw if a non-default cordova engine scriptSrc attribute is not defined.', function(done) {
            var success = jasmine.createSpy('success'),
                fail = jasmine.createSpy('fail');
            spyOn(PlatformJson.prototype, 'isPluginInstalled').andReturn(false);
            install('android', project, plugins['org.test.invalid.engine.no.scriptSrc'])
                .then(success)
                .fail(fail)
                .fin(function() {
                    expect(success).not.toHaveBeenCalled();
                    expect(fail).toHaveBeenCalled();
                    done();
                });
        });
    });
});

describe('end', function() {

    it('end', function() {
        done = false;

        promise.fin(function(err){
            if(err)
                events.emit('error', err);

            shell.rm('-rf', temp_dir);
            done = true;
        });

        waitsFor(function() { return done; }, 'promise never resolved', 500);
    });
});


text:
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.db import connection

from bluebottle.wallposts.models import MediaWallpost, TextWallpost

from bluebottle.common.tasks import _post_to_facebook

@receiver(post_save, sender=MediaWallpost)
@receiver(post_save, sender=TextWallpost)
def post_to_facebook(sender, instance, created, **kwargs):

    try:
        tenant = connection.tenant
    except AttributeError:
        tenant = None

    if created and instance.share_with_facebook:
        _post_to_facebook.apply_async(
            args=[instance],
            kwargs={'tenant': tenant},
            countdown=5
        )


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

<TITLE>
P - Ë÷Òý
</TITLE>

<META NAME="date" CONTENT="2014-04-14">

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

      ¸ÅÊö
      Èí¼þ°ü
      Àà
      ʹÓÃ
      Ê÷
    Ë÷Òý
      °ïÖú

 ÉÏÒ»¸ö×Öĸ
 ÏÂÒ»¸ö×Öĸ

  ¿ò¼Ü
 ÎÞ¿ò¼Ü

  ËùÓÐÀà

A B C D E F G H I J K L M N O P R S T U V W

P

parseConvertor() -
Àà darks.log.pattern.parser.PatternParser Öеķ½·¨

Get PatternConvertor object

PatternConvertor - darks.log.pattern.parser ÖÐµÄ Àà
Indicate to convert message by pattern

 PatternConvertor.java
PatternConvertor() -
Àà darks.log.pattern.parser.PatternConvertor µÄ¹¹Ôì·½·¨

PatternException - darks.log.exceptions ÖÐµÄ Òì³£
PatternException.java
PatternException() -
Òì³£ darks.log.exceptions.PatternException µÄ¹¹Ôì·½·¨

PatternException(String, Throwable) -
Òì³£ darks.log.exceptions.PatternException µÄ¹¹Ôì·½·¨

PatternException(String) -
Òì³£ darks.log.exceptions.PatternException µÄ¹¹Ôì·½·¨

PatternException(Throwable) -
Òì³£ darks.log.exceptions.PatternException µÄ¹¹Ôì·½·¨

PatternLayout - darks.log.layout ÖÐµÄ Àà
Indicate that use pattern to format message.
PatternLayout() -
Àà darks.log.layout.PatternLayout µÄ¹¹Ôì·½·¨

PatternParser - darks.log.pattern.parser ÖÐµÄ Àà
PatternParser.java
PatternParser() -
Àà darks.log.pattern.parser.PatternParser µÄ¹¹Ôì·½·¨

PatternParser(String) -
Àà darks.log.pattern.parser.PatternParser µÄ¹¹Ôì·½·¨

PropertiesLoader - darks.log.loader ÖÐµÄ Àà
Indicate to load config file from properties file.
PropertiesLoader(InputStream) -
Àà darks.log.loader.PropertiesLoader µÄ¹¹Ôì·½·¨

      ¸ÅÊö
      Èí¼þ°ü
      Àà
      ʹÓÃ
      Ê÷
    Ë÷Òý
      °ïÖú

 ÉÏÒ»¸ö×Öĸ
 ÏÂÒ»¸ö×Öĸ

  ¿ò¼Ü
 ÎÞ¿ò¼Ü

  ËùÓÐÀà

A B C D E F G H I J K L M N O P R S T U V W


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Habit Tracker</string>
    <string name="action_habit_add">Add Habit</string>
    <string name="title_activity_edit_habit">EditHabit</string>
    <string name="edit_habit_title">Title:</string>
    <string name="edit_habit_title_hint">The name of the habit</string>
    <string name="edit_habit_description">Description:</string>
    <string name="edit_habit_description_hint">A short description</string>
    <string name="edit_habit_positive_title">Positive</string>
    <string name="occurrences_count">Count:</string>
    <string name="occurrences_last">Last:</string>
    <string name="occurrences_details">Details</string>
    <string name="never">Never</string>
    <string name="title_activity_occurrence_list">All Occurrences</string>
    <string name="delete_occurrence">Do you want delete this occurrence?</string>
    <string name="delete">Delete</string>
    <string name="yes">YES</string>
    <string name="cancel">CANCEL</string>
    <string name="action_occurrence_add">Add Occurrence</string>
    <string name="title_activity_quick_add_occurrence">QuickAddOccurrenceActivity</string>
    <string name="title_activity_add_occurrence_tag">AddOccurrenceTag</string>
    <string name="add_occurrence_tag_text">Write Tag</string>
    <string name="delete_habit_dialog">Are you sure you want to delete this habit?</string>
    <string name="mimeTypeNdef">application/ch.isageek.tyderion.habittracker.occurrence.add</string>
    <string name="not_valid_habit">Not a valid habit</string>
    <string name="action_export">Export / Import</string>
    <string name="title_activity_data_export">Export / Import</string>
    <string name="backup_export_button_title">Export to File</string>
    <string name="backup_import_button_title">Import from File</string>
    <string name="backup_write_error">Error while writing to backup file</string>
    <string name="backup_export_complete">Backup complete</string>
    <string name="backup_export_start">Starting export</string>
    <string name="backup_import_start">Starting import</string>
    <string name="backup_import_complete">Import complete</string>
    <string name="backup_import_error">Error while loading the data</string>
    <string name="title_item_list">Habits</string>
    <string name="title_item_detail">Habit Detail</string>
    <string name="save_item_button">Save Item</string>
    <string name="action_item_detail_title">Write NFC Tag</string>
    <string name="placholder">Placeholder</string>
    <string name="item_detail_occurences_title">Occurrences: </string>
    <string name="edit_habit">Edit Habit</string>
    <string name="action_item_search">Search Habits</string>
    <string name="item_search_hint">Type to filter habits</string>
    <string name="item_refresh">Refresh</string>
    <string name="item_detail_show_occurrences_list">Show Occurrences List</string>

</resources>


text:
package com.linkedin.norbert
package network
package netty

import org.jboss.netty.bootstrap.ServerBootstrap
import java.net.InetSocketAddress
import org.jboss.netty.channel.{ChannelException, Channel}
import org.jboss.netty.channel.group.ChannelGroup
import server.ClusterIoServerComponent
import logging.Logging
import cluster.Node

trait NettyClusterIoServerComponent extends ClusterIoServerComponent {
  class NettyClusterIoServer(bootstrap: ServerBootstrap, channelGroup: ChannelGroup) extends ClusterIoServer with UrlParser with Logging {
    private var serverChannel: Channel = _

    def bind(node: Node, wildcard: Boolean) = {
      val (_, port) = parseUrl(node.url)
      try {
        val address = new InetSocketAddress(port)
        log.debug("Binding server socket to %s".format(address))
        serverChannel = bootstrap.bind(address)
      } catch {
        case ex: ChannelException => throw new NetworkingException("Unable to bind to %s".format(node), ex)
      }
    }

    def shutdown = if (serverChannel != null) {
      serverChannel.close.awaitUninterruptibly
      channelGroup.close.awaitUninterruptibly
      bootstrap.releaseExternalResources
    }
  }
}


text:
package io.github.gballet.osmpbf;

import java.util.List;

public class OsmPrimitive {
	public boolean isNode;
	public boolean isWay;
	public double lon;
	public double lat;
	public long id;
	public String tags;
	public List<Long> wayNodeList;

	public boolean isNode()
	{
		return isNode;
	}

	public boolean isWay()
	{
		return isWay;
	}

	public OsmPrimitive(long id_, double lon_, double lat_, String tags_)
	{
		id = id_;
		lon = lon_;
		lat = lat_;
		tags = tags_;

		isNode = true;
		isWay = false;
	}

	//way contstructor
	public OsmPrimitive(long id_, List<Long> nodeIDList, String allWayTags) {
		id = id_;
		wayNodeList = nodeIDList;
		tags = allWayTags;

		isNode = false;
		isWay = true;
	}

	public OsmPrimitive() {
		isNode = false;
	}

}


text:
from __future__ import unicode_literals
from .local import *

# DATABASE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'pycones_2016',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    }
}
# END DATABASE CONFIGURATION

NOTEBOOK_ARGUMENTS = [
    '--port=8000',
]


text:
layout: data_model
title: MutexObjectType
this_version: 4.1
---

MutexObjectTypeMutex Object Schema

      <form id="nav-version">
        <select>

            <option value="4.1" selected="selected">MAEC 4.1</option>

        </select>
      </form>

The MutexObjectType type is intended to characterize generic mutual exclusion (mutex) objects.

      Field Name
      Type
      Description

      @object_referenceoptional

          QName

The object_reference field specifies a unique ID reference to an Object defined elsewhere. This construct allows for the re-use of the defined Properties of one Object within another, without the need to embed the full Object in the location from which it is being referenced. Thus, this ID reference is intended to resolve to the Properties of the Object that it points to.

      Custom_Properties0..1

          CustomPropertiesType

The Custom_Properties construct is optional and enables the specification of a set of custom Object Properties that may not be defined in existing Properties schemas.

      @namedoptional

          boolean

The named field specifies whether the Mutex is named.

      Name0..1

          StringObjectPropertyType

The Name field specifies the name for a named mutex object.


text:
import os

class InheritedRecipeMixin:

    def get_recipe_dir(self):
        """This is used to replace pythonforandroid.recipe.Recipe.get_recipe_dir.
        If one of our local recipes inherits from a built-in p4a recipe, this override
        ensures that potential patches and other local files used by the recipe will
        be looked for in the built-in recipe's folder.
        """
        return os.path.join(self.ctx.root_dir, 'recipes', self.name)