text:
require_relative 'spec_helper'

# check packages
describe 'my-base::_access' do
  before do
    stub_command('which sudo').and_return(false)
  end

  cached(:test_env_chef_run) do
    ChefSpec::ServerRunner.new do |node, server|
      stub_fixture_data_bags(server)
      stub_fixture_environments(server)
      stub_chef_environment(node, 'test')
    end.converge(described_recipe)
  end

  cached(:integration_env_chef_run) do
    ChefSpec::ServerRunner.new do |node, server|
      stub_fixture_data_bags(server)
      stub_fixture_environments(server)
      stub_chef_environment(node, 'integration')
    end.converge(described_recipe)
  end

  context 'user management' do
    it 'creates admin users in all environments' do
      [
        test_env_chef_run,
        integration_env_chef_run
      ].each do |env_run|
        expect(env_run).to create_users_manage('admin')
      end
    end

    it 'enables sudo all for admins in all environments' do
      [
        test_env_chef_run,
        integration_env_chef_run
      ].each do |env_run|
        expect(env_run).to install_sudo('admin').with(
          group: 'admin',
          commands: ['ALL'],
          defaults: ['!requiretty'],
          nopasswd: true
        )
      end
    end

    it 'creates environment specific users'  do
      expect(integration_env_chef_run).to create_users_manage('integration')
      expect(test_env_chef_run).to create_users_manage('test')
    end

    it 'skips users granted access to other environments' do
      expect(integration_env_chef_run).to_not create_users_manage('test')
      expect(test_env_chef_run).to_not create_users_manage('integration')
    end

    it 'creates the ci bot user' do
      expect(test_env_chef_run).to create_users_manage('jenkins')
    end

    it 'enables the ci bot user to sudo chef-client in all environments' do
      [
        test_env_chef_run,
        integration_env_chef_run
      ].each do |env_run|
        expect(env_run).to install_sudo('jenkins').with(
          user: 'jenkins',
          commands: ['/usr/bin/chef-client'],
          defaults: ['!requiretty'],
          nopasswd: true
        )
      end
    end
  end

  context 'sshd' do
    it 'creates sshd host keys by environment' do
      [
        test_env_chef_run,
        integration_env_chef_run
      ].each do |env_run|
        %w(
          rsa
          dsa
        ).each do |type|
          expect(env_run).to enable_service('sshd')
          expect(env_run).to start_service('sshd')

          filepath = "/etc/ssh/ssh_host_#{type}_key"

          expect(env_run).to create_file(filepath).with(
            sensitive: true
          )

          expect(env_run).to render_file(filepath).with_content(
            "-----BEGIN #{type.upcase} PRIVATE KEY-----"
          )

          expect(env_run).to render_file(filepath).with_content(
            "----END #{type.upcase} PRIVATE KEY-----"
          )

          expect(env_run).to render_file("#{filepath}.pub").with_content(
            'MOCK_SSH_HOST_KEY'
          )

          file_resource = env_run.file(filepath)
          expect(file_resource).to notify('service[sshd]').to(:restart).delayed
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
//
//  CMeshOGLES2_0.h
//  OpenJam
//
//  Created by Yevgeniy Logachev
//  Copyright (c) 2014 Yevgeniy Logachev. All rights reserved.
//
#if defined(RENDER_OGLES2_0)

#ifndef CMESHOGLES2_0_H
#define CMESHOGLES2_0_H

#include "CMeshOGLBase.h"

namespace jam {

class CMeshOGLES2_0 : public CMeshOGLBase {
public:
    CMeshOGLES2_0();
    virtual ~CMeshOGLES2_0();

    virtual void Bind() override;
    virtual void Unbind() override;
    virtual bool IsValid() const override;

private:
    uint32_t m_VAO;
};

}; // namespace jam

#endif /* CMESHOGLES2_0_H */

#endif /* defined(RENDER_OGLES2_0) */


text:
package emr

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// ClusterOperationHostTask is a nested struct in emr response
type ClusterOperationHostTask struct {
	TaskId     string `json:"TaskId" xml:"TaskId"`
	TaskName   string `json:"TaskName" xml:"TaskName"`
	Status     string `json:"Status" xml:"Status"`
	Percentage string `json:"Percentage" xml:"Percentage"`
}


text:
// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Load credentials and set region from JSON file
AWS.config.loadFromPath('./config.json');

// Create SQS service object
var sqs = new AWS.SQS({apiVersion: '2012-11-05'});

var params = {};

sqs.listQueues(params, function(err, data) {
  if (err) {
    console.log("Error", err);
  } else {
    console.log("Success", data.QueueUrls);
  }
});


text:
<fieldset>
    <legend>Subir Imagenes:</legend>
<?php
echo Form::open(URL::base().'imagenes/add', array('enctype' => 'multipart/form-data'));
?>

<?php
echo Form::label('imagen','Archivo:');
echo Form::file('imagen',array('id'=>'file','size'=>40));
?>

<?php
echo '
';
echo Form::button('submit', 'Subir',array('type'=>'submit','class'=>'submitbutton'));
echo ' ';
echo Form::close(); //fin del formulario
?>

</fieldset>


text: <script src="./web-animations.min.js"></script>


text:
package org.jclouds.dimensiondata.cloudcontroller.domain;

import java.util.List;

import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;

import com.google.auto.value.AutoValue;

@AutoValue
public abstract class ConsoleAccess {

    ConsoleAccess() {}

    @Nullable
    public abstract List<Property> properties();
    public abstract String maintenanceStatus();

    @SerializedNames({ "property", "maintenanceStatus" })
    public static ConsoleAccess create(List<Property> properties, String maintenanceStatus) {
        return builder().properties(properties).maintenanceStatus(maintenanceStatus).build();
    }

    public abstract Builder toBuilder();

    @AutoValue.Builder
    public abstract static class Builder {
        public abstract Builder properties(List<Property> properties);
        public abstract Builder maintenanceStatus(String maintenanceStatus);

        public abstract ConsoleAccess build();
    }

    public static Builder builder() {
        return new AutoValue_ConsoleAccess.Builder();
    }
}


text:
import unittest
import os
import socket

from tests.webserver import SimpleWebServer
from tests.config import Config

class BrowserTestCase(unittest.TestCase):
    def setUp(self):
        # testing webserver setup
        child_directory = self.current_directory
        os.chdir(child_directory + "/src")
        self.webserver = SimpleWebServer()
        self.webserver.start()

    def tearDown(self):
        self.webserver.stop()

    def load_page(self, name):
        self.driver.get(self.page_url(name))

    def get_local_ip(self):
        # what ip can selenium server see us
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect((Config.server, 0))
        ip = s.getsockname()[0]
        s.close()
        return ip

    def page_url(self, name):
        return "http://{address}:{port}/{page}.html".format(
            address=self.get_local_ip(),
            port=self.webserver.port,
            page=name
        )


text:
import fcntl
import logging
import os
import shlex
import signal
import socket
import struct

from eventlet.green import subprocess

LOG = logging.getLogger(__name__)

def _subprocess_setup():
    # Python installs a SIGPIPE handler by default. This is usually not what
    # non-Python subprocesses expect.
    signal.signal(signal.SIGPIPE, signal.SIG_DFL)

def execute(cmd, root_helper=None, process_input=None, addl_env=None,
            check_exit_code=True, return_stderr=False):
    if root_helper:
        cmd = shlex.split(root_helper) + cmd
    cmd = map(str, cmd)

    LOG.debug("Running command: " + " ".join(cmd))
    env = os.environ.copy()
    if addl_env:
        env.update(addl_env)
    obj = subprocess.Popen(cmd, shell=False, stdin=subprocess.PIPE,
                           stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                           preexec_fn=_subprocess_setup,
                           env=env)

    _stdout, _stderr = (process_input and
                        obj.communicate(process_input) or
                        obj.communicate())
    obj.stdin.close()
    m = ("\nCommand: %s\nExit code: %s\nStdout: %r\nStderr: %r" %
        (cmd, obj.returncode, _stdout, _stderr))
    LOG.debug(m)
    if obj.returncode and check_exit_code:
        raise RuntimeError(m)

    return return_stderr and (_stdout, _stderr) or _stdout

def get_interface_mac(interface):
    DEVICE_NAME_LEN = 15
    MAC_START = 18
    MAC_END = 24
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    info = fcntl.ioctl(s.fileno(), 0x8927,
                       struct.pack('256s', interface[:DEVICE_NAME_LEN]))
    return ''.join(['%02x:' % ord(char)
                   for char in info[MAC_START:MAC_END]])[:-1]


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

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>test page1</title>

Simple Camera controls

    Video Stream

    Home Position

    Pan Left

    Pan Right

    Pan Scan

    Tilt Up

    Tilt Down

    Tilt Scan

    Backlight On

    Backlight Off

    Brighter

    Darker

    Default Brightness


text:
'use strict';

var MailListCtrl = require('../../../../src/js/controller/app/mail-list'),
    EmailDAO = require('../../../../src/js/email/email'),
    KeychainDAO = require('../../../../src/js/service/keychain'),
    Status = require('../../../../src/js/util/status'),
    Dialog = require('../../../../src/js/util/dialog'),
    Search = require('../../../../src/js/email/search');

describe('Mail List controller unit test', function() {
    var scope, ctrl, statusMock, notificationMock, emailMock, keychainMock, dialogMock, searchMock,
        emailAddress, emails, location;

    beforeEach(function() {
        emails = [{
            unread: true
        }, {
            unread: true
        }, {
            unread: true
        }];

        emailAddress = 'fred@foo.com';

        notificationMock = {
            create: function() {},
            close: function() {}
        };

        statusMock = sinon.createStubInstance(Status);
        emailMock = sinon.createStubInstance(EmailDAO);
        keychainMock = sinon.createStubInstance(KeychainDAO);
        dialogMock = sinon.createStubInstance(Dialog);
        searchMock = sinon.createStubInstance(Search);

        angular.module('maillisttest', ['woEmail', 'woServices', 'woUtil']);
        angular.mock.module('maillisttest');
        angular.mock.inject(function($rootScope, $controller, $location) {
            scope = $rootScope.$new();
            location = $location;
            scope.state = {};

            scope.loadVisibleBodies = function() {};
            ctrl = $controller(MailListCtrl, {
                $scope: scope,
                $location: location,
                $q: window.qMock,
                status: statusMock,
                notification: notificationMock,
                email: emailMock,
                keychain: keychainMock,
                dialog: dialogMock,
                search: searchMock
            });
        });
    });

    afterEach(function() {});

    describe('displayMore', function() {
        beforeEach(function() {
            scope.state.nav = {
                currentFolder: {
                    messages: ['a', 'b']
                }
            };
        });
        it('should not do anything when display length equals messages length', function() {
            scope.displayMessages = ['a', 'b'];

            scope.displayMore();
            expect(scope.displayMessages.length).to.equal(scope.state.nav.currentFolder.messages.length);
        });
        it('should append next message interval', function() {
            scope.displayMessages = ['a'];

            scope.displayMore();
            expect(scope.displayMessages.length).to.equal(scope.state.nav.currentFolder.messages.length);
        });
    });

    describe('displaySearchResults', function() {
        var clock;

        beforeEach(function() {
            scope.state.nav = {
                currentFolder: {
                    messages: ['a', 'b']
                }
            };
            scope.watchMessages();
            scope.watchOnline();
            clock = sinon.useFakeTimers();
        });
        afterEach(function() {
            clock.restore();
        });

        it('should show initial message on empty', function() {
            scope.displaySearchResults();
            expect(statusMock.setSearching.withArgs(false).calledOnce).to.be.true;
            expect(statusMock.update.withArgs('Online').calledOnce).to.be.true;
            expect(scope.displayMessages.length).to.equal(2);
        });
        it('should show initial message on empty', function() {
            searchMock.filter.returns(['a']);

            scope.displaySearchResults('query');
            expect(statusMock.setSearching.withArgs(true).calledOnce).to.be.true;
            expect(statusMock.update.withArgs('Searching ...').calledOnce).to.be.true;
            clock.tick(500);

            expect(scope.displayMessages).to.deep.equal(['a']);
            expect(statusMock.setSearching.withArgs(false).calledOnce).to.be.true;
            expect(statusMock.update.withArgs('Matches in this folder').calledOnce).to.be.true;
        });
    });

    describe('scope variables', function() {
        it('should be set correctly', function() {
            expect(scope.select).to.exist;
            expect(scope.state.mailList).to.exist;
        });
    });

    describe('push notification', function() {
        beforeEach(function() {
            scope._stopWatchTask();
            sinon.stub(scope, 'navigate');
        });

        afterEach(function() {
            notificationMock.create.restore();
            scope.navigate.restore();
        });

        it('should succeed for single mail', function(done) {
            var mail = {
                uid: 123,
                from: [{
                    address: 'asd'
                }],
                subject: 'this is the subject!',
                unread: true
            };

            sinon.stub(notificationMock, 'create', function(opts) {
                expect(opts.title).to.equal(mail.from[0].address);
                expect(opts.message).to.equal(mail.subject);

                opts.onClick();
                expect(scope.navigate.withArgs(mail).calledOnce).to.be.true;
                done();
            });

            scope.state.nav = {
                currentFolder: {
                    type: 'asd',
                    messages: [mail]
                }
            };

            emailMock.onIncomingMessage([mail]);
        });

        it('should succeed for multiple mails', function(done) {
            var mails = [{
                uid: 1,
                from: [{
                    address: 'asd'
                }],
                subject: 'this is the subject!',
                unread: true
            }, {
                uid: 2,
                from: [{
                    address: 'qwe'
                }],
                subject: 'this is the other subject!',
                unread: true
            }, {
                uid: 3,
                from: [{
                    address: 'qwe'
                }],
                subject: 'this is the other subject!',
                unread: false
            }];

            sinon.stub(notificationMock, 'create', function(opts) {
                expect(opts.title).to.equal('2 new messages');
                expect(opts.message).to.equal(mails[0].subject + '\n' + mails[1].subject);

                opts.onClick();
                expect(scope.navigate.withArgs(mails[0]).calledOnce).to.be.true;
                done();
            });

            scope.state.nav = {
                currentFolder: {
                    type: 'asd',
                    messages: mails
                }
            };

            emailMock.onIncomingMessage(mails);
        });
    });

    describe('getBody', function() {
        it('should get the mail content', function(done) {
            scope.state.nav = {
                currentFolder: {
                    type: 'asd',
                }
            };

            scope.getBody().then(function() {
                expect(emailMock.getBody.calledOnce).to.be.true;
                done();
            });
        });
    });

    describe('flag', function() {
        it('should flag or unflag a message', function() {
            var mail = {
                from: [{
                    address: 'asd'
                }],
                flagged: true,
            };

            scope.state = {
                actionBar: {
                    flagMessage: function(mail, flagged) {
                        mail.flagged = flagged;
                    }
                }
            };

            scope.flag(mail, false);
            expect(mail.flagged).to.be.false;

            scope.flag(mail, true);
            expect(mail.flagged).to.be.true;
        });
    });

    describe('select', function() {
        it('should decrypt, focus mark an unread mail as read', function(done) {
            scope.pendingNotifications = ['asd'];
            sinon.stub(notificationMock, 'close');

            var mail = {
                from: [{
                    address: 'asd'
                }],
                unread: true,
            };
            scope.state = {
                nav: {
                    currentFolder: {
                        type: 'Inbox'
                    }
                },
                mailList: {},
                read: {
                    toggle: function() {}
                },
                actionBar: {
                    markMessage: function() {}
                }
            };

            keychainMock.refreshKeyForUserId.withArgs({
                userId: mail.from[0].address
            }).returns(resolves());

            scope.select(mail).then(function() {
                expect(emailMock.decryptBody.calledOnce).to.be.true;
                expect(keychainMock.refreshKeyForUserId.calledOnce).to.be.true;
                expect(scope.state.mailList.selected).to.equal(mail);
                expect(notificationMock.close.calledWith('asd')).to.be.true;
                expect(notificationMock.close.calledOnce).to.be.true;

                notificationMock.close.restore();
                done();
            });
        });

        it('should decrypt and focus a read mail', function(done) {
            var mail = {
                from: [{
                    address: 'asd'
                }],
                unread: false
            };

            scope.state = {
                mailList: {},
                read: {
                    toggle: function() {}
                },
                nav: {
                    currentFolder: {
                        type: 'asd'
                    }
                }
            };

            keychainMock.refreshKeyForUserId.withArgs({
                userId: mail.from[0].address
            }).returns(resolves());

            scope.select(mail).then(function() {
                expect(emailMock.decryptBody.calledOnce).to.be.true;
                expect(keychainMock.refreshKeyForUserId.calledOnce).to.be.true;
                expect(scope.state.mailList.selected).to.equal(mail);
                done();
            });
        });
    });

    describe('formatDate', function() {
        it('should output short time if date is today', angular.mock.inject(function($filter) {
            var now = new Date();
            var expected = $filter('date')(now, 'shortTime');
            expect(scope.formatDate(now)).to.equal(expected);
        }));
        it('should output date only if date is not today', angular.mock.inject(function($filter) {
            var yesterday = new Date();
            yesterday.setTime(yesterday.getTime() - 24 * 60 * 60 * 1000);

            var expected = $filter('date')(yesterday, 'mediumDate');
            expect(scope.formatDate(yesterday)).to.equal(expected);
        }));
    });
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.ComponentModel;

using NuiEngine.Core;
using NuiEngine.Utility;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace NuiEngine.NuiControl
{
    /// <summary>
    /// 窗体控件
    /// </summary>
    public class NuiForm:NuiFormBase
    {
        private int m_radius = 5;                                                   // 窗体圆角的半径
        private bool m_canResize = true;                                            // 是否允许窗体改变大小

        private Font m_textFont = new Font("微软雅黑", 10.0f, FontStyle.Bold);      // 绘制窗体标题的字体
        private Color m_textForeColor = Color.FromArgb(250, Color.White);           // 绘制窗体标题的颜色
        private bool m_isTextWithShadow = false;                                    // 是否绘制带有阴影的窗体标题
        private Color m_textShadowColor = Color.FromArgb(2, Color.Black);           // 标题的阴影颜色
        private int m_textShadowWidth = 4;                                          // 标题阴影的宽度

        private Image m_formFringe =Properties.Resources.form_fringe_bkg;           // 窗体边框图片
        private Image m_formBkg;                                                    // 窗体背景图片

        private SysBtnManager m_sysBtnManager;                                      // 系统按钮管理器

        public NuiForm()
        {
            InitializeComponent();
            NuiFormIni();
            m_sysBtnManager = new SysBtnManager(this);
        }

        #region Properties

        [Description("窗体圆角的半径")]
        public int Radius
        {
            get
            {
                return m_radius;
            }
            set
            {
                if (m_radius != value)
                {
                    m_radius = value;
                    this.Invalidate();
                }
            }
        }

        [Description("是否允许窗体改变大小")]
        public bool CanResize
        {
            get
            {
                return m_canResize;
            }
            set
            {
                if (m_canResize != value)
                {
                    m_canResize = value;
                }
            }
        }

        public override Image BackgroundImage
        {
            get
            {
                return m_formBkg;
            }
            set
            {
                if (m_formBkg != value)
                {
                    m_formBkg = value;
                    Invalidate();
                }
            }
        }

        [Description("用于绘制窗体标题的字体")]
        public Font TextFont
        {
            get { return m_textFont; }
            set
            {
                if (m_textFont != value)
                {
                    m_textFont = value;
                }
            }

        }

        [Description("用于绘制窗体标题的颜色")]
        public Color TextForeColor
        {
            get { return m_textForeColor; }
            set
            {
                if (m_textForeColor != value)
                { m_textForeColor = value; }
            }
        }

        [Description("是否绘制带有阴影的窗体标题")]
        public bool TextWithShadow
        {
            get { return m_isTextWithShadow; }
            set
            {
                if (m_isTextWithShadow != value)
                {
                    m_isTextWithShadow = value;
                }
            }
        }

        [Description("如果TextWithShadow属性为True,则使用该属性绘制阴影")]
        public Color TextShadowColor
        {
            get { return m_textShadowColor; }
            set
            {
                if (m_textShadowColor != value)
                {
                    m_textShadowColor = value;
                }
            }
        }

        [Description("如果TextWithShadow属性为True,则使用该属性获取或色泽阴影的宽度")]
        public int TextShadowWidth
        {
            get { return m_textShadowWidth; }
            set
            {
                if (m_textShadowWidth != value)
                {
                    m_textShadowWidth = value;
                }
            }
        }

        [Browsable(false)]
        [Description("返回窗体关闭系统按钮所在的坐标矩形")]
        public Rectangle CloseBoxRect
        {
            get { return SysBtnManager.SysButtonArray[0].LocationRect; }
        }

        [Browsable(false)]
        [Description("返回窗体最大化或者还原系统按钮所在的坐标矩形")]
        public Rectangle MaximiziBoxRect
        {
            get { return SysBtnManager.SysButtonArray[1].LocationRect; }
        }

        [Browsable(false)]
        [Description("返回窗体最小化系统按钮所在的坐标矩形")]
        public Rectangle MinimiziBoxRect
        {
            get { return SysBtnManager.SysButtonArray[2].LocationRect; }
        }

        internal Rectangle IconRect
        {
            get
            {
                if (base.ShowIcon && base.Icon != null)
                {
                    return new Rectangle(8, 6, SystemInformation.SmallIconSize.Width, SystemInformation.SmallIconSize.Width);
                }
                return Rectangle.Empty;
            }
        }

        internal Rectangle TextRect
        {
            get
            {
                if (base.Text.Length != 0)
                {
                    return new Rectangle(IconRect.Right + 2, 4, Width - (8 + IconRect.Width + 2), TextFont.Height);
                }
                return Rectangle.Empty;
            }
        }

        internal SysBtnManager SysBtnManager
        {
            get
            {
                if (m_sysBtnManager == null)
                {
                    m_sysBtnManager = new SysBtnManager(this);
                }
                return m_sysBtnManager;
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public new FormBorderStyle FormBorderStyle
        {
            get { return base.FormBorderStyle; }
            set { base.FormBorderStyle = value; }
        }

        #endregion

        #region Overrides

        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                if (!DesignMode)
                {
                    if (MaximizeBox) { cp.Style |= (int)WindowStyle.WS_MAXIMIZEBOX; }
                    if (MinimizeBox) { cp.Style |= (int)WindowStyle.WS_MINIMIZEBOX; }
                    //cp.ExStyle |= (int)WindowStyle.WS_CLIPCHILDREN;  //防止因窗体控件太多出现闪烁
                    cp.ClassStyle |= (int)ClassStyle.CS_DropSHADOW;  //实现窗体边框阴影效果
                }
                return cp;
            }
        }

        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            Render.SetFormRoundRectRgn(this, Radius);
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            UpdateSystemButtonRect();
        }

        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);
            Render.SetFormRoundRectRgn(this, Radius);
            UpdateSystemButtonRect();
            UpdateMaxButton();
        }

        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
                case Win32.WM_ERASEBKGND:
                    m.Result = IntPtr.Zero;
                    break;
                case Win32.WM_NCHITTEST:
                    WmNcHitTest(ref m);
                    break;
                default:
                    base.WndProc(ref m);
                    break;
            }
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            SysBtnManager.ProcessMouseOperate(e.Location, NuiMouseOperate.Move);
        }

        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            if (e.Button == MouseButtons.Left)
            {
                SysBtnManager.ProcessMouseOperate(e.Location, NuiMouseOperate.LeftDown);
            }
        }

        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            if (e.Button == MouseButtons.Left)
            {
                SysBtnManager.ProcessMouseOperate(e.Location, NuiMouseOperate.LeftUp);
            }
        }

        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            SysBtnManager.ProcessMouseOperate(Point.Empty, NuiMouseOperate.Leave);
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;

            //draw BackgroundImage
            if (BackgroundImage != null)
            {
                switch (BackgroundImageLayout)
                {
                    case ImageLayout.Stretch:
                    case ImageLayout.Zoom:
                        e.Graphics.DrawImage(
                            m_formBkg,
                            ClientRectangle,
                            new Rectangle(0, 0, m_formBkg.Width, m_formBkg.Height),
                            GraphicsUnit.Pixel);
                        break;
                    case ImageLayout.Center:
                    case ImageLayout.None:
                    case ImageLayout.Tile:
                        e.Graphics.DrawImage(
                            m_formBkg,
                            ClientRectangle,
                            ClientRectangle,
                            GraphicsUnit.Pixel);
                        break;
                }
            }

            //draw system buttons
            SysBtnManager.DrawSystemButtons(e.Graphics);

            //draw fringe
            Render.DrawFormFringe(this, e.Graphics, m_formFringe, Radius);

            //draw icon
            if (Icon != null && ShowIcon)
            {
                e.Graphics.DrawIcon(Icon, IconRect);
            }

            //draw text
            if (Text.Length != 0)
            {
                if (TextWithShadow)
                {
                    using (Image textImg = Render.GetStringImgWithShadowEffect(Text, TextFont, TextForeColor, TextShadowColor, TextShadowWidth))
                    {
                        e.Graphics.DrawImage(textImg,TextRect.Location);
                    }
                }
                else
                {
                    TextRenderer.DrawText(
                    e.Graphics,
                    Text, TextFont,
                    TextRect,
                    TextForeColor,
                    TextFormatFlags.SingleLine | TextFormatFlags.EndEllipsis);
                }
            }

        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (m_sysBtnManager != null)
                {
                    m_sysBtnManager.Dispose();
                    m_sysBtnManager = null;

                    m_formFringe.Dispose();
                    m_formFringe = null;

                    m_textFont.Dispose();
                    m_textFont = null;

                    if (m_formBkg != null)
                    {
                        m_formBkg.Dispose();
                        m_formBkg = null;
                    }
                }
            }
            base.Dispose(disposing);
        }

        #endregion

        #region Private Methods

        private void InitializeComponent()
        {
            this.SuspendLayout();
            //
            // NuiForm
            //
            this.ClientSize = new System.Drawing.Size(684, 402);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = " NuiForm";
            this.ResumeLayout(false);
        }

        private void NuiFormIni()
        {
            this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;
            SetStyles();
        }

        private void SetStyles()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            UpdateStyles();
        }

        private void WmNcHitTest(ref Message m)  //调整窗体大小
        {
            int wparam = m.LParam.ToInt32();
            Point mouseLocation = new Point(MethodHelper.LOWORD(wparam), MethodHelper.HIWORD(wparam));
            mouseLocation = PointToClient(mouseLocation);

            if (WindowState != FormWindowState.Maximized)
            {
                if (CanResize == true)
                {
                    if (mouseLocation.X < 5 && mouseLocation.Y < 5)
                    {
                        m.Result = new IntPtr(Win32.HTTOPLEFT);
                        return;
                    }

                    if (mouseLocation.X > Width - 5 && mouseLocation.Y < 5)
                    {
                        m.Result = new IntPtr(Win32.HTTOPRIGHT);
                        return;
                    }

                    if (mouseLocation.X < 5 && mouseLocation.Y > Height - 5)
                    {
                        m.Result = new IntPtr(Win32.HTBOTTOMLEFT);
                        return;
                    }

                    if (mouseLocation.X > Width - 5 && mouseLocation.Y > Height - 5)
                    {
                        m.Result = new IntPtr(Win32.HTBOTTOMRIGHT);
                        return;
                    }

                    if (mouseLocation.Y < 3)
                    {
                        m.Result = new IntPtr(Win32.HTTOP);
                        return;
                    }

                    if (mouseLocation.Y > Height - 3)
                    {
                        m.Result = new IntPtr(Win32.HTBOTTOM);
                        return;
                    }

                    if (mouseLocation.X < 3)
                    {
                        m.Result = new IntPtr(Win32.HTLEFT);
                        return;
                    }

                    if (mouseLocation.X > Width - 3)
                    {
                        m.Result = new IntPtr(Win32.HTRIGHT);
                        return;
                    }
                }
            }
            m.Result = new IntPtr(Win32.HTCLIENT);
        }

        private void UpdateMaxButton()
        {
            bool isMax = WindowState == FormWindowState.Maximized;
            if (isMax)
            {
                SysBtnManager.SysButtonArray[1].NormalImg = Properties.Resources.sys_restore_normal;
                SysBtnManager.SysButtonArray[1].HighLightImg = Properties.Resources.sys_restore_highlight;
                SysBtnManager.SysButtonArray[1].DownImg = Properties.Resources.sys_restore_down;
                SysBtnManager.SysButtonArray[1].ToolTip = "还原";
            }
            else
            {
                SysBtnManager.SysButtonArray[1].NormalImg = Properties.Resources.sys_max_normal;
                SysBtnManager.SysButtonArray[1].HighLightImg = Properties.Resources.sys_max_highlight;
                SysBtnManager.SysButtonArray[1].DownImg = Properties.Resources.sys_max_down;
                SysBtnManager.SysButtonArray[1].ToolTip = "最大化";
            }
        }

        protected void UpdateSystemButtonRect()
        {
            bool isShowMaxButton = MaximizeBox;
            bool isShowMinButton = MinimizeBox;
            Rectangle closeRect = new Rectangle(
                    Width - SysBtnManager.SysButtonArray[0].NormalImg.Width,
                    -1,
                    SysBtnManager.SysButtonArray[0].NormalImg.Width,
                    SysBtnManager.SysButtonArray[0].NormalImg.Height);

            //update close button location rect.
            SysBtnManager.SysButtonArray[0].LocationRect = closeRect;

            //Max
            if (isShowMaxButton)
            {
                SysBtnManager.SysButtonArray[1].LocationRect = new Rectangle(
                    closeRect.X - SysBtnManager.SysButtonArray[1].NormalImg.Width,
                    -1,
                    SysBtnManager.SysButtonArray[1].NormalImg.Width,
                    SysBtnManager.SysButtonArray[1].NormalImg.Height);
            }
            else
            {
                SysBtnManager.SysButtonArray[1].LocationRect = Rectangle.Empty;
            }

            //Min
            if (!isShowMinButton)
            {
                SysBtnManager.SysButtonArray[2].LocationRect = Rectangle.Empty;
                return;
            }
            if (isShowMaxButton)
            {
                SysBtnManager.SysButtonArray[2].LocationRect = new Rectangle(
                    SysBtnManager.SysButtonArray[1].LocationRect.X - SysBtnManager.SysButtonArray[2].NormalImg.Width,
                    -1,
                    SysBtnManager.SysButtonArray[2].NormalImg.Width,
                    SysBtnManager.SysButtonArray[2].NormalImg.Height);
            }
            else
            {
                SysBtnManager.SysButtonArray[2].LocationRect = new Rectangle(
                   closeRect.X - SysBtnManager.SysButtonArray[2].NormalImg.Width,
                   -1,
                   SysBtnManager.SysButtonArray[2].NormalImg.Width,
                   SysBtnManager.SysButtonArray[2].NormalImg.Height);
            }
        }

        #endregion
    }
}


text:
using System;
using System.ComponentModel;
using System.Configuration;

namespace Inga.Configuration
{
    public class Task : ConfigurationElement
    {
        [ConfigurationProperty("name", IsRequired = true)]
        public string Name => this["name"] as string;

        [ConfigurationProperty("type", IsRequired = true)]
        public Enums.TaskType Type => (Enums.TaskType)Enum.Parse(typeof(Enums.TaskType), this["type"].ToString());

        [ConfigurationProperty("in", IsRequired = false)]
        public string In => this["in"] as string;

        [ConfigurationProperty("out", IsRequired = false)]
        public string Out => this["out"] as string;

        [ConfigurationProperty("retention", IsRequired = false)]
        public int Retention => int.Parse(this["retention"].ToString());

        [ConfigurationProperty("skip", IsRequired = false)]
        [TypeConverter(typeof(CommaDelimitedStringCollectionConverter))]
        public CommaDelimitedStringCollection Skip => this["skip"] as CommaDelimitedStringCollection;

        [ConfigurationProperty("on", IsRequired = false)]
        [TypeConverter(typeof(CommaDelimitedStringCollectionConverter))]
        public CommaDelimitedStringCollection On => this["on"] as CommaDelimitedStringCollection;

        [ConfigurationProperty("connection", IsRequired = false)]
        public string Connection => this["connection"] as string;

        public Connection RealConnection => IngaSection.GetConfig().Connections[Connection];
    }
}


text:
//
//  LYTLocationMessageBody.h
//  LeYingTong
//
//  Created by admin on 16/12/26.
//  Copyright © 2016年 HHLY. All rights reserved.
//

#import "LYTMessageBody.h"

@interface LYTLocationMessageBody : LYTMessageBody

/** 地理位置 */
@property(nonatomic,copy) NSString * title;
/** 经度 */
@property(nonatomic,assign) NSString * lng;
/** 经度 */
@property(nonatomic,assign) NSString * lat;

@end


text:
module SingaporeCharitableDonations
  VERSION = "1.0.3"
end


text:
package org.gradle.tooling.internal.consumer.connection;

import org.gradle.api.Action;
import org.gradle.tooling.internal.adapter.ProtocolToModelAdapter;
import org.gradle.tooling.internal.adapter.SourceObjectMapping;
import org.gradle.tooling.internal.consumer.converters.TaskPropertyHandlerFactory;
import org.gradle.tooling.internal.consumer.parameters.ConsumerOperationParameters;
import org.gradle.tooling.internal.consumer.versioning.ModelMapping;
import org.gradle.tooling.internal.consumer.versioning.VersionDetails;
import org.gradle.tooling.internal.protocol.BuildResult;
import org.gradle.tooling.internal.protocol.InternalUnsupportedModelException;
import org.gradle.tooling.internal.protocol.ModelBuilder;
import org.gradle.tooling.internal.protocol.ModelIdentifier;
import org.gradle.tooling.model.internal.Exceptions;

public class ModelBuilderBackedModelProducer extends AbstractModelProducer {
    private final ModelBuilder builder;
    private final Action<SourceObjectMapping> mapper;

    public ModelBuilderBackedModelProducer(ProtocolToModelAdapter adapter, VersionDetails versionDetails, ModelMapping modelMapping, ModelBuilder builder) {
        super(adapter, versionDetails, modelMapping);
        this.builder = builder;
        mapper = new TaskPropertyHandlerFactory().forVersion(versionDetails);
    }

    public <T> T produceModel(Class<T> type, ConsumerOperationParameters operationParameters) {
        if (!versionDetails.maySupportModel(type)) {
            throw Exceptions.unsupportedModel(type, versionDetails.getVersion());
        }
        final ModelIdentifier modelIdentifier = modelMapping.getModelIdentifierFromModelType(type);
        BuildResult<?> result;
        try {
            result = builder.getModel(modelIdentifier, operationParameters);
        } catch (InternalUnsupportedModelException e) {
            throw Exceptions.unknownModel(type, e);
        }
        return adapter.adapt(type, result.getModel(), mapper);
    }
}


text:
import { rules } from '../react-a11y'

describe('react-a11y rules', () => {
  it('contains only react-a11y rules', () => {
    const keys = Object.keys(rules)
    const expected = Array.from(
      keys, () => expect.stringMatching(/^jsx-a11y\/.+$/),
    )

    expect(keys).toEqual(expected)
  })
})


text:
from pstats import *

import cmd
try:
    import readline
except ImportError:
    pass

class ProfileBrowser(cmd.Cmd):
    def __init__(self, profile=None):
        cmd.Cmd.__init__(self)
        self.prompt = "% "
        if profile is not None:
            self.stats = Stats(profile)
            self.stream = self.stats.stream
        else:
            self.stats = None
            self.stream = sys.stdout

    def generic(self, fn, line):
        args = line.split()
        processed = []
        for term in args:
            try:
                processed.append(int(term))
                continue
            except ValueError:
                pass
            try:
                frac = float(term)
                if frac > 1 or frac < 0:
                    print >> self.stream, "Fraction argument must be in [0, 1]"
                    continue
                processed.append(frac)
                continue
            except ValueError:
                pass
            processed.append(term)
        if self.stats:
            getattr(self.stats, fn)(*processed)
        else:
            print >> self.stream, "No statistics object is loaded."
        return 0
    def generic_help(self):
        print >> self.stream, "Arguments may be:"
        print >> self.stream, "* An integer maximum number of entries to print."
        print >> self.stream, "* A decimal fractional number between 0 and 1, controlling"
        print >> self.stream, "  what fraction of selected entries to print."
        print >> self.stream, "* A regular expression; only entries with function names"
        print >> self.stream, "  that match it are printed."

    def do_add(self, line):
        self.stats.add(line)
        return 0
    def help_add(self):
        print >> self.stream, "Add profile info from given file to current statistics object."

    def do_callees(self, line):
        return self.generic('print_callees', line)
    def help_callees(self):
        print >> self.stream, "Print callees statistics from the current stat object."
        self.generic_help()

    def do_callers(self, line):
        return self.generic('print_callers', line)
    def help_callers(self):
        print >> self.stream, "Print callers statistics from the current stat object."
        self.generic_help()

    def do_EOF(self, line):
        print >> self.stream, ""
        return 1
    def help_EOF(self):
        print >> self.stream, "Leave the profile brower."

    def do_quit(self, line):
        return 1
    def help_quit(self):
        print >> self.stream, "Leave the profile brower."

    def do_read(self, line):
        if line:
            try:
                self.stats = Stats(line)
            except IOError, args:
                print >> self.stream, args[1]
                return
            self.prompt = line + "% "
        elif len(self.prompt) > 2:
            line = self.prompt[-2:]
        else:
            print >> self.stream, "No statistics object is current -- cannot reload."
        return 0
    def help_read(self):
        print >> self.stream, "Read in profile data from a specified file."

    def do_reverse(self, line):
        self.stats.reverse_order()
        return 0
    def help_reverse(self):
        print >> self.stream, "Reverse the sort order of the profiling report."

    def do_sort(self, line):
        abbrevs = self.stats.get_sort_arg_defs()
        if line and not filter(lambda x,a=abbrevs: x not in a,line.split()):
            self.stats.sort_stats(*line.split())
        else:
            print >> self.stream, "Valid sort keys (unique prefixes are accepted):"
            for (key, value) in Stats.sort_arg_dict_default.iteritems():
                print >> self.stream, "%s -- %s" % (key, value[1])
        return 0
    def help_sort(self):
        print >> self.stream, "Sort profile data according to specified keys."
        print >> self.stream, "(Typing `sort' without arguments lists valid keys.)"
    def complete_sort(self, text, *args):
        return [a for a in Stats.sort_arg_dict_default if a.startswith(text)]

    def do_stats(self, line):
        return self.generic('print_stats', line)
    def help_stats(self):
        print >> self.stream, "Print statistics from the current stat object."
        self.generic_help()

    def do_strip(self, line):
        self.stats.strip_dirs()
        return 0
    def help_strip(self):
        print >> self.stream, "Strip leading path information from filenames in the report."

    def postcmd(self, stop, line):
        if stop:
            return stop
        return None


text:
package org.immopoly.appengine.actions;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.util.Map;
import java.util.logging.Logger;

public abstract class AbstractAction implements Action {

	public static enum RESPONSETYPE{
		HTML,JSON
	}

	static Logger LOG = Logger.getLogger(AbstractAction.class.getName());
	RESPONSETYPE responseType = RESPONSETYPE.JSON;

	protected AbstractAction(Map<String, Action> actions) {
		actions.put(getURI(), this);
	}

	protected String getTemplate(String template) {
		return readFileAsString(template);
	}

	static String readFileAsString(String filePath) {
		try {
			byte[] buffer = new byte[(int) new File(filePath).length()];
			BufferedInputStream f = new BufferedInputStream(new FileInputStream(filePath));
			f.read(buffer);
			return new String(buffer);
		} catch (Exception e) {
			LOG.severe("Konnte template " + filePath + " nich lesen " + e.getMessage());
			return "Konnte template " + filePath + " nich lesen " + e.getMessage();
		}
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <artifactId>powermock-examples</artifactId>
        <groupId>org.powermock.examples</groupId>
        <version>1.5.5-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.powermock.examples</groupId>
    <artifactId>powermock-examples-apachecli</artifactId>
    <name>ApacheCLIExample</name>
    <version>1.5.5-SNAPSHOT</version>

    <description>
		Example showing PowerMock testing classes that extend Object.
    </description>

    <dependencies>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-easymock</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>


text:
SPEC_BEGIN(UACWPutMetricAlarmResponseSpec)

describe(@"UACWPutMetricAlarmResponse", ^
{

	it(@"should encode to a query string.", ^
	{
	    NSString *xml = @"";
	    NSError *parseError = nil;
	    DDXMLDocument *xmlDictionary = [[DDXMLDocument alloc] initWithXMLString:xml options:0 error:&parseError];
	    [[parseError should] beNil];
	    [[xmlDictionary should] beNonNil];

	    NSError *serialisationError = nil;
	    UACWPutMetricAlarmResponse *putMetricAlarmResponse = [MTLXMLAdapter modelOfClass:[UACWPutMetricAlarmResponse class] fromXMLNode:xmlDictionary error:&serialisationError];
	    [[serialisationError should] beNil];
	    [[putMetricAlarmResponse should] beNonNil];

	    // additional verification
	});

});

SPEC_END


text:
import asyncWriter = require('async-writer');
import stream = require('stream');

class TestStream extends stream.Writable {
	constructor(public output: string) {
		super();
	}
	_write(data: string, encoding: string, callback: Function) {
		this.output += data;
		callback();
	}
}

// Simple usage
function simpleUsage(callback: () => void) {
	var output = '';
	let testStream = new TestStream(output);
	let out = asyncWriter.create(testStream)
	.on('error', (err: Error) => {
		console.error(err);
	})
	.on('finish', () => {
		console.log(testStream.output);
		callback();
	})

	out.write('A');
	out.write('B');
	out.write('C');
	out.end();
}

// Asynchronous, out-of-order writing
function asyncUsage(callback: () => void) {
	var output = '';
	let testStream = new TestStream(output);
	let out = asyncWriter.create(testStream)
	.on('error', (err: Error) => {
		console.error(err);
	})
	.on('finish', () => {
		console.log(testStream.output);
		callback();
	})

	out.write('A');

	let asyncOut = out.beginAsync();
	setTimeout(() => {
		asyncOut.write('B');
		asyncOut.end();
	}, 1000);

	out.write('C');
	out.end();
}

// run test
simpleUsage(() => {
	asyncUsage(() => {
		console.log('DONE');
	});
});


text:
// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es6id: 13.3.2.4
description: Assignment of function `name` attribute (FunctionExpression)
info: >
    VariableDeclaration : BindingIdentifier Initializer

    [...]
    7. If IsAnonymousFunctionDefinition(Initializer) is true, then
       a. Let hasNameProperty be HasOwnProperty(value, "name").
       b. ReturnIfAbrupt(hasNameProperty).
       c. If hasNameProperty is false, perform SetFunctionName(value,
          bindingId).
includes: [propertyHelper.js]
---*/

var xFn = function x() {};
var fn = function() {};

assert(xFn.name !== 'xFn');

assert.sameValue(fn.name, 'fn');
verifyNotEnumerable(fn, 'name');
verifyNotWritable(fn, 'name');
verifyConfigurable(fn, 'name');


text:
'use strict';

/**
 * @ngdoc function
 * @name kzStoreAngularApp.controller:PedidosCtrl
 * @description
 * # PedidosCtrl
 * Controller of the kzStoreAngularApp
 */
angular.module('kzStoreAngularApp')
  .controller('PedidosCtrl', function ($scope) {
    $scope.test = '';
  });