text:
@interface PodsDummy_Pods_Wundercast : NSObject
@end
@implementation PodsDummy_Pods_Wundercast
@end


text:
require 'mine/fetch/proxy/http_provider'

module Mine
  module Fetch
    module Proxy
      module Providers
        class Byteproxies < HttpProvider
          private

          def api_url
            "https://byteproxies.com/api.php?key=free&amount=1&type=http&anonymity=elite"
          end

          def values
            if hash = json_data&.first
              hash['response']&.values_at('ip', 'port')
            end
          end
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
module ActiveRecord
  module ConnectionAdapters
    module SQLServer
      module ColumnMethods
        def primary_key(name, type = :primary_key, **options)
          if [:integer, :bigint].include?(type)
            options[:is_identity] = true unless options.key?(:default)
          elsif type == :uuid
            options[:default] = options.fetch(:default, "NEWID()")
          end
          super
        end

        def primary_key_nonclustered(*names, **options)
          names.each { |name| column(name, :primary_key_nonclustered, **options) }
        end

        def real(*names, **options)
          names.each { |name| column(name, :real, **options) }
        end

        def money(*names, **options)
          names.each { |name| column(name, :money, **options) }
        end

        def smalldatetime(*names, **options)
          names.each { |name| column(name, :smalldatetime, **options) }
        end

        def datetime(*names, **options)
          names.each do |name|
            if options[:precision]
              datetime2(name, **options)
            else
              column(name, :datetime, **options)
            end
          end
        end

        def datetime2(*names, **options)
          names.each { |name| column(name, :datetime2, **options) }
        end

        def datetimeoffset(*names, **options)
          names.each { |name| column(name, :datetimeoffset, **options) }
        end

        def smallmoney(*names, **options)
          names.each { |name| column(name, :smallmoney, **options) }
        end

        def char(*names, **options)
          names.each { |name| column(name, :char, **options) }
        end

        def varchar(*names, **options)
          names.each { |name| column(name, :varchar, **options) }
        end

        def varchar_max(*names, **options)
          names.each { |name| column(name, :varchar_max, **options) }
        end

        def text_basic(*names, **options)
          names.each { |name| column(name, :text_basic, **options) }
        end

        def nchar(*names, **options)
          names.each { |name| column(name, :nchar, **options) }
        end

        def ntext(*names, **options)
          names.each { |name| column(name, :ntext, **options) }
        end

        def binary_basic(*names, **options)
          names.each { |name| column(name, :binary_basic, **options) }
        end

        def varbinary(*names, **options)
          names.each { |name| column(name, :varbinary, **options) }
        end

        def uuid(*names, **options)
          names.each { |name| column(name, :uniqueidentifier, **options) }
        end

        def ss_timestamp(*names, **options)
          names.each { |name| column(name, :ss_timestamp, **options) }
        end

        def json(*names, **options)
          names.each { |name| column(name, :text, **options) }
        end
      end

      class TableDefinition < ActiveRecord::ConnectionAdapters::TableDefinition
        include ColumnMethods

        def new_column_definition(name, type, **options)
          case type
          when :datetime
            type = :datetime2 if options[:precision]
          when :primary_key
            options[:is_identity] = true
          end
          super
        end
      end

      class Table < ActiveRecord::ConnectionAdapters::Table
        include ColumnMethods
      end
    end
  end
end


text:
namespace ExpressionFramework.WebUI
{
    using System;
    using System.Web.Mvc;
    using System.Web.Mvc.Html;
    using System.Web.UI;

    public class FormHtmlElement : HtmlElement, IFormHtmlElement
    {
        #region Constants

        public const string FormMethodAttributeName = "method";

        public const string FormActionAttributeName = "action";

        #endregion

        #region Fields

        private readonly Func<dynamic, object> contentTemplate;

        #endregion

        #region Constructors

        public FormHtmlElement(Func<dynamic, object> contentTemplate, HtmlComponentContext componentContext)
            : base(componentContext)
        {
            this.contentTemplate = contentTemplate;
            this.Method = FormMethod.Post;

            this.AddReservedHtmlAttributes(FormMethodAttributeName, FormActionAttributeName);
        }

        #endregion

        #region Properties

        public string ActionName { get; set; }

        public string ControllerName { get; set; }

        public object RouteValues { get; set; }

        public FormMethod Method { get; set; }

        protected Func<dynamic, object> ContentTemplate
        {
            get { return this.contentTemplate; }
        }

        #endregion

        #region Methods

        public override void WriteHtml(HtmlTextWriter htmlWriter)
        {
            var tagBuilder = new TagBuilder("form");

            tagBuilder.MergeAttributes(this.HtmlAttributes);

            var formAction = this.UrlHelper.Action(this.ActionName, this.ControllerName);

            tagBuilder.MergeAttribute("action", formAction);
            tagBuilder.MergeAttribute("method", HtmlHelper.GetFormMethodString(this.Method));

            htmlWriter.Write(tagBuilder.ToString(TagRenderMode.StartTag));
            htmlWriter.Write(this.contentTemplate(this));
            htmlWriter.Write(tagBuilder.ToString(TagRenderMode.EndTag));
        }

        #endregion
    }
}


text:
package systemd

import (
	"fmt"
	"io/ioutil"
	"path/filepath"
	"strings"
	"sync"

	systemd1 "github.com/coreos/go-systemd/dbus"
	"github.com/dotcloud/docker/pkg/cgroups"
	"github.com/dotcloud/docker/pkg/systemd"
	"github.com/godbus/dbus"
)

type systemdCgroup struct {
}

type DeviceAllow struct {
	Node        string
	Permissions string
}

var (
	connLock              sync.Mutex
	theConn               *systemd1.Conn
	hasStartTransientUnit bool
)

func UseSystemd() bool {
	if !systemd.SdBooted() {
		return false
	}

	connLock.Lock()
	defer connLock.Unlock()

	if theConn == nil {
		var err error
		theConn, err = systemd1.New()
		if err != nil {
			return false
		}

		// Assume we have StartTransientUnit
		hasStartTransientUnit = true

		// But if we get UnknownMethod error we don't
		if _, err := theConn.StartTransientUnit("test.scope", "invalid"); err != nil {
			if dbusError, ok := err.(dbus.Error); ok {
				if dbusError.Name == "org.freedesktop.DBus.Error.UnknownMethod" {
					hasStartTransientUnit = false
				}
			}
		}
	}
	return hasStartTransientUnit
}

func getIfaceForUnit(unitName string) string {
	if strings.HasSuffix(unitName, ".scope") {
		return "Scope"
	}
	if strings.HasSuffix(unitName, ".service") {
		return "Service"
	}
	return "Unit"
}

func Apply(c *cgroups.Cgroup, pid int) (cgroups.ActiveCgroup, error) {
	var (
		unitName   = c.Parent + "-" + c.Name + ".scope"
		slice      = "system.slice"
		properties []systemd1.Property
	)

	for _, v := range c.UnitProperties {
		switch v[0] {
		case "Slice":
			slice = v[1]
		default:
			return nil, fmt.Errorf("Unknown unit propery %s", v[0])
		}
	}

	properties = append(properties,
		systemd1.Property{"Slice", dbus.MakeVariant(slice)},
		systemd1.Property{"Description", dbus.MakeVariant("docker container " + c.Name)},
		systemd1.Property{"PIDs", dbus.MakeVariant([]uint32{uint32(pid)})},
	)

	if !c.DeviceAccess {
		properties = append(properties,
			systemd1.Property{"DevicePolicy", dbus.MakeVariant("strict")},
			systemd1.Property{"DeviceAllow", dbus.MakeVariant([]DeviceAllow{
				{"/dev/null", "rwm"},
				{"/dev/zero", "rwm"},
				{"/dev/full", "rwm"},
				{"/dev/random", "rwm"},
				{"/dev/urandom", "rwm"},
				{"/dev/tty", "rwm"},
				{"/dev/console", "rwm"},
				{"/dev/tty0", "rwm"},
				{"/dev/tty1", "rwm"},
				{"/dev/pts/ptmx", "rwm"},
				// There is no way to add /dev/pts/* here atm, so we hack this manually below
				// /dev/pts/* (how to add this?)
				// Same with tuntap, which doesn't exist as a node most of the time
			})})
	}

	// Always enable accounting, this gets us the same behaviour as the raw implementation,
	// plus the kernel has some problems with joining the memory cgroup at a later time.
	properties = append(properties,
		systemd1.Property{"MemoryAccounting", dbus.MakeVariant(true)},
		systemd1.Property{"CPUAccounting", dbus.MakeVariant(true)})

	if c.Memory != 0 {
		properties = append(properties,
			systemd1.Property{"MemoryLimit", dbus.MakeVariant(uint64(c.Memory))})
	}
	// TODO: MemorySwap not available in systemd

	if c.CpuShares != 0 {
		properties = append(properties,
			systemd1.Property{"CPUShares", dbus.MakeVariant(uint64(c.CpuShares))})
	}

	if _, err := theConn.StartTransientUnit(unitName, "replace", properties...); err != nil {
		return nil, err
	}

	// To work around the lack of /dev/pts/* support above we need to manually add these
	// so, ask systemd for the cgroup used
	props, err := theConn.GetUnitTypeProperties(unitName, getIfaceForUnit(unitName))
	if err != nil {
		return nil, err
	}

	cgroup := props["ControlGroup"].(string)

	if !c.DeviceAccess {
		mountpoint, err := cgroups.FindCgroupMountpoint("devices")
		if err != nil {
			return nil, err
		}

		path := filepath.Join(mountpoint, cgroup)

		// /dev/pts/*
		if err := ioutil.WriteFile(filepath.Join(path, "devices.allow"), []byte("c 136:* rwm"), 0700); err != nil {
			return nil, err
		}
		// tuntap
		if err := ioutil.WriteFile(filepath.Join(path, "devices.allow"), []byte("c 10:200 rwm"), 0700); err != nil {
			return nil, err
		}
	}
	return &systemdCgroup{}, nil
}

func (c *systemdCgroup) Cleanup() error {
	// systemd cleans up, we don't need to do anything
	return nil
}


text:
/*
 * Minio Cloud Storage, (C) 2015 Minio, Inc.
 *
 * 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.
 */

var gulp = require('gulp');
var util = require('gulp-util');
var del = require('del');
var browserify = require('browserify');
var babelify = require('babelify');
var server = require('gulp-webserver');
var source = require('vinyl-source-stream');
var eslint = require('gulp-eslint');
var minifyCSS = require('gulp-minify-css');
var less = require('gulp-less');

var paths = {
  main: ['app/*.js', 'app/modules/*.jsx', 'app/lib/*.js'],
  font: ['app/fonts/**/*'],
  html: ['app/*.html'],
  gulpfile: ['gulpfile.js'],
  less: ['app/less/**/*.less']
}

var production = !!util.env.production

gulp.task('less', function () {
  return gulp.src('app/less/app.less')
    .pipe(less())
    .pipe(production ? minifyCSS() : util.noop())
    .pipe(gulp.dest('dist'));
});

gulp.task('clean', function() {
    return del(['dist']);
});

gulp.task('main', function() {
    return browserify({entries: './app/app.jsx', extensions: ['.jsx']}).transform(babelify)
            .bundle()
            .pipe(source('main.js'))
            .pipe(gulp.dest('dist'))
});

gulp.task('font', function() {
    return gulp.src(paths.font)
        .pipe(gulp.dest('dist/fonts'))
});

gulp.task('html', function() {
    return gulp.src('app/index.html')
            .pipe(gulp.dest('dist'))
});

gulp.task('lint', function () {
  return gulp.src(paths.main)
  // eslint() attaches the lint output to the eslint property
  // of the file object so it can be used by other modules.
    .pipe(eslint({
        ecmaFeatures: {
            modules: true
        }
    }))
  // eslint.format() outputs the lint results to the console.
  // Alternatively use eslint.formatEach() (see Docs).
    .pipe(eslint.format())
  // To have the process exit with an error code (1) on
  // lint error, return the stream and pipe to failOnError last.
    .pipe(eslint.failOnError());
});

gulp.task('watch', function() {
    gulp.watch(paths.main, ['main']);
    gulp.watch(paths.html, ['html']);
    gulp.watch(paths.less, ['less']);
});

gulp.task('serve', ['build', 'watch'], function() {
    gulp.src('dist')
      .pipe(server({
        livereload: true,
        open: true,
        proxies: [{
          source: '/rpc',
          target: 'http://localhost:9001/rpc'
        }]
    }));
});

gulp.task('build', ['main', 'less', 'font', 'html', 'lint']);

gulp.task('default', ['build']);


text:
package cn.aezo.demo.betwixt.write;

import cn.aezo.utils.base.MiscU;
import org.apache.commons.betwixt.io.BeanWriter;

import java.io.StringWriter;
import java.util.List;
import java.util.Map;

/**
 * Created by smalle on 2017/3/23.
 */
public class WriteExampleApp {

    /**
     * 转换javaBean为xml数据
     * 默认先读取要解析的javaBean(Person)所在目录是否有对应的.betwixt文件(Person.betwixt),如果有则按照此模板解析,否则默认解析(如example目录)
     */
    public static final void main(String [] args) throws Exception {
        StringWriter outputWriter = new StringWriter();

        outputWriter.write("<?xml version='1.0' encoding='UTF-8' ?>\n");

        BeanWriter beanWriter = new BeanWriter(outputWriter);

        beanWriter.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false);
        beanWriter.getBindingConfiguration().setMapIDs(false);
        beanWriter.enablePrettyPrint();

        List<String> list = MiscU.Instance.toList("game", "music");
        Map<String, Object> map = MiscU.Instance.toMap("hair", "blank");
        beanWriter.write(new Person("Smalle", 18, list, map));

        System.out.println(outputWriter.toString());

        outputWriter.close();

    }

    /*
     <?xml version='1.0' encoding='UTF-8' ?>
     <一个Person对象 这个配置文件中定义的值="1.0" String类型对象_姓名="Smalle">
         <int类型对象_年龄>18</int类型对象_年龄>
         <ArrayList类型对象_爱好>
             <ArrayList中的值>game</ArrayList中的值>
             <ArrayList中的值>music</ArrayList中的值>
         </ArrayList类型对象_爱好>
         <Map类型对象_特征>
             <Map中的值>
                 <key>hair</key>
                 <value>blank</value>
             </Map中的值>
         </Map类型对象_特征>
     </一个Person对象>
     */

}


text:
/*jslint */
/*global require */

var url = require("url");
console.log(url.parse("http://sdfsfd.com/sfsd/sdfsdf/sdfsdf.html?sdfsdf=123"));
return;

var fs                   = require("fs"),
    http                 = require("http"),
    path                 = require("path"),
    url                  = require("url"),
    colors               = require('colors'),
    ts                   = require("./typescript"),
    project,
    cwd                  = process.env.PWD,
    types                = require("./lib/types"),
    lock                 = require("./lib/lock"),
    deferred             = require("./lib/deferred"),
    parallel             = require("./lib/parallel"),
    configure            = require("./lib/configure"),
    processingTypescript = false,
    processingLess       = true,
    processingStylus     = true,
    processingSass       = false,
    processingSoy        = false,
    spawn                = require("child_process").spawn,
    charset;

var display = require("./lib/displayException");
var Static = require("./lib/static/client/Client.js");
var inst = new Static({
    location: "/home/rodzewich/Projects/playground/temp/static.sock"
});

function loop() {
    inst.getContent("index.html", function (errors, response) {
        if (errors && errors.length) {
            errors.forEach(function (error) {
                display(error);
            });
        } else {
            console.log("response", response);
        }
        setTimeout(loop, 1000).ref();
    });
}
loop();

return;

require('source-map-support').install({
    retrieveSourceMap : function (source) {
        if (fs.existsSync(source + ".map")) {
            return {
                url : source,
                map : fs.readFileSync(source + ".map", 'utf8')
            };
        }
        return null;
    }
});

var less   = require("./lib/routers/less"),
    stylus = require("./lib/routers/stylus"),
    sass   = require("./lib/routers/sass");

/*var routers = {
        /!*typescript : require("./routers/typescript"),*!/
        /!*stylus     : require("./routers/stylus"),*!/
        less       : require("./routers/less"),
        /!*soy        : require("./routers/soy")*!/
    },*/
var initialization = {
    memory : require("./lib/memory/initialization")
};

var staticContent = require("./lib/staticContent");

function htmlEntities(str) {
    return String(str).
        replace(/&/g, '&').
        replace(/</g, '<').
        replace(/>/g, '>').
        replace(/"/g, '"');
}

function cleanTemp(callback) {
    var temp = path.join(project, "temp");
    deferred([
        function (next) {
            var rm = spawn("rm", ["-rf", temp], {});
            rm.on('close', function (code) {
                console.log('remove temp with code: ' + code);
                next();
            });
        },
        function () {
            fs.mkdir(temp, function () {
                console.log('create temp');
                callback();
            });
        }
    ]);
}

charset = "utf-8";
//project = "../Class";
project = "../playground";

var temporaryDirectory = "/home/rodzewich/Projects/playground/temp";
var memorySocketAddress = path.join(temporaryDirectory, "memory.sock");

function initTypescript(callback) {
    if (processingTypescript) {
        routers.typescript.init({
            numberOfProcesses  : 4,
            sourcesDirectory   : "/home/rodzewich/Projects/playground",
            temporaryDirectory : temporaryDirectory,
            memorySocketLocation: memorySocketAddress,
            scriptsTarget      : "es5",
            useCache           : false
        }, function (errors) {
            // todo: обрабатывать ошибки
            if (errors && errors.length) {
                errors.forEach(function (error) {
                    console.log(error);
                });
            }
            console.log("Typescript sockets created!");
            callback();
        });
    } else {
        callback();
    }
}

function initSoy(callback) {
    if (processingSoy) {
        routers.soy.init({
            numberOfProcesses    : 4,
            sourcesDirectory     : "/home/rodzewich/Projects/playground/views",
            temporaryDirectory   : temporaryDirectory,
            memorySocketLocation : memorySocketAddress,
            useCache             : false
        }, function (errors) {
            // todo: обрабатывать ошибки
            if (errors && errors.length) {
                errors.forEach(function (error) {
                    console.log(error);
                });
            } else {
                console.log("Soy inited!");
                callback();
            }
        });
    } else {
        callback();
    }
}

deferred([

    cleanTemp,

    function (next) {
        parallel([
                function (done) {
                    initialization.memory(memorySocketAddress, function (error) {
                        // todo: обрабатывать ошибки
                        if (!error) {
                            done();
                        }
                    });
                },
                /*initTypescript,*/
                function (done) {
                    if (processingLess) {
                        less.init({
                            temporaryDirectory   : temporaryDirectory,
                            memoryLocation       : memorySocketAddress,
                            sourcesDirectory     : path.join(__dirname, "styles"),
                            includeDirectories   : [path.join(__dirname, "less_include_dir")],
                            brandSpecificLogic   : true,
                            supportLanguages     : true,
                            throwErrors          : false,
                            usedPostProcessing   : true,
                            webRootDirectory     : "/",
                            useCache             : false,
                            errorBackgroundColor : "#ffff00",
                            errorTextColor       : "#000000",
                            errorBlockPadding    : "10px",
                            errorFontSize        : "13px",
                            numberOfProcesses    : 5
                        }, done);
                    } else {
                        done();
                    }
                },
                function (done) {
                    if (processingStylus) {
                        stylus.init({
                            temporaryDirectory   : temporaryDirectory,
                            memoryLocation       : memorySocketAddress,
                            sourcesDirectory     : path.join(__dirname, "styles"),
                            includeDirectories   : [path.join(__dirname, "less_include_dir")],
                            webRootDirectory     : "/",
                            useCache             : false,
                            errorBackgroundColor : "#ffff00",
                            errorTextColor       : "#000000",
                            errorBlockPadding    : "10px",
                            errorFontSize        : "13px",
                            numberOfProcesses    : 5
                        }, done);
                    } else {
                        done();
                    }
                },
                function (done) {
                    if (processingSass) {
                        sass.init({
                            temporaryDirectory   : temporaryDirectory,
                            memoryLocation       : memorySocketAddress,
                            sourcesDirectory     : path.join(__dirname, "styles"),
                            includeDirectories   : [path.join(__dirname, "less_include_dir")],
                            webRootDirectory     : "/",
                            useCache             : false,
                            errorBackgroundColor : "#ffff00",
                            errorTextColor       : "#000000",
                            errorBlockPadding    : "10px",
                            errorFontSize        : "13px",
                            numberOfProcesses    : 5
                        }, done);
                    } else {
                        done();
                    }
                },
                /*initSoy*/
            ],
            function () {
                console.log("server inited!!!");
                next();
            });
    },

    /*function (next) {
        configure({cwd: cwd}, function (error, result) {
            if (!error) {
                charset = result.charset;
                project = result.project;
                next();
            } else {
                console.log(error);
            }
        });
    },*/
    function () {

        var contentDirectory = path.join(__dirname, "."),
            tempDirectory = path.join(__dirname, "temp"),
            libDirectory = path.join(__dirname, "xlib");

        http.createServer(function (request, response) {

            var address  = request.url;
            var options  = url.parse(address, true) || {};
            var method   = request.method || "GET";
            var query    = options.query || {};
            var filename = options.pathname || "/";
            var dirname  = path.dirname(filename);
            var extname  = path.extname(filename).toLowerCase();
            var basename = path.basename(filename, extname);

            function displayError(code, errors) {
                var list, content;
                if (errors && errors.length) {
                    list = "

" + errors.map(function (error) {
                        return [
                            "
", htmlEntities(error.message), "
",
                            "
",
                            htmlEntities(error.stack),
                            "
"
                        ].join("");
                    }).join("

") + "

";
                }
                content = [
                    "<!DOCTYPE html>",
                    "",
                    "",
                    "<title>", code, " ", http.STATUS_CODES[code], "</title>",
                    "",
                    "",
                    "
", code, " ", http.STATUS_CODES[code], "
",
                    list,
                    "
",
                    "phantom 0.0.1",
                    "",
                    ""
                ];
                response.writeHead(code, {"Content-Type": [types.text.html, "; charset=", charset].join("")});
                response.end(content.join(""));

            }

            deferred([

                // processing *.ts files
                /*function (next) {
                    if (processingTypescript) {
                        routers.typescript.route({
                            rootDirectory    : "",
                            tempDirectory    : tempDirectory,
                            sourcesDirectory : contentDirectory, // todo: ???
                            httpRequest      : request,
                            httpResponse     : response,
                            errorHandler     : displayError,
                            httpServer       : http
                        }, next);
                    } else {
                        next();
                    }
                },*/

                // processing *.less files
                function (next) {
                    if (processingLess) {
                        less.route({
                            accessLog   : true,
                            request          : request,
                            response         : response,
                            webRootDirectory : "/",
                            useCache         : false
                        }, next);
                    } else {
                        next();
                    }
                },

                // processing *.styl files
                function (next) {
                    if (processingStylus) {
                        stylus.route({
                            accessLog   : true,
                            request          : request,
                            response         : response,
                            webRootDirectory : "/",
                            useCache         : false
                        }, next);
                    } else {
                        next();
                    }
                },

                // processing *.sass files
                function (next) {
                    if (processingSass) {
                        sass.route({
                            accessLog   : true,
                            request          : request,
                            response         : response,
                            webRootDirectory : "/",
                            useCache         : false
                        }, next);
                    } else {
                        next();
                    }
                },

                // processing *.soy files
                /*function (next) {
                    if (processingSoy) {
                        routers.soy.route({
                            rootDirectory : "/",
                            httpRequest   : request,
                            httpResponse  : response,
                            httpServer    : http
                        }, next);
                    } else {
                        next();
                    }
                },*/

                // static
                function (next) {
                    staticContent({
                        charset      : charset,
                        filename     : filename,
                        basedir      : contentDirectory,
                        useMemory    : true,
                        useDebugger  : true,
                        useCache     : false
                    }, function (error, result) {
                        if (!error) {
                            if (result) {
                                var modified = Date.parse(request.headers["if-modified-since"]),
                                    date     = 1000 * parseInt(String(Number(result.date) / 1000), 10);
                                if (modified && modified === date) {
                                    response.writeHead(304, http.STATUS_CODES[304]);
                                    response.end();
                                } else {
                                    response.writeHead(200, http.STATUS_CODES[200], {
                                        "Content-Type"  : result.type,
                                        "Last-Modified" : result.date.toUTCString()
                                    });
                                    response.end(result.content);
                                }
                            } else {
                                next();
                            }
                        } else {
                            if (error.code === "EACCES") {
                                displayError(403);
                            } else {
                                displayError(500, [error]);
                            }
                        }
                    });
                },

                // not found
                function () {
                    displayError(404);
                },

                function () {
                    console.log(String(method).magenta + " " + String(address).gray);
                    if (Object.keys(query).length !== 0) {
                        console.log("query".green + ": ".gray + JSON.stringify(query, true, 2).gray);
                    }

                    function displayTypeScript() {
                        var sourceName = null;
                        var references = null;
                        var sourceExists = false;
                        deferred([
                            function (callback) {
                                sourceName = path.join(project, "public", dirname, basename + ".ts");
                                callback();
                            },
                            function (callback) {
                                fs.exists(sourceName, function (exists) {
                                    sourceExists = exists;
                                    callback();
                                });
                            },
                            function (callback) {
                                fs.readFile(sourceName, function (error, content) {
                                    if (error) {
                                        displayError(500);
                                    } else {
                                        try {
                                            references = ts.preProcessFile(content.toString("utf8"), false).referencedFiles.map(function (item) {
                                                return path.resolve(dirname, path.join(path.dirname(item.fileName), path.basename(item.fileName, path.extname(item.fileName)) + ".js"));
                                            });
                                            callback();
                                        } catch (e) {
                                            displayError(500);
                                        }
                                    }
                                });
                            },
                            function (callback) {

                            },
                            function () {
                                var content = [];
                                if (!sourceExists) {
                                    displayError(404);
                                } else {
                                    response.writeHead(200, {"Content-Type": "application/javascript"});
                                    response.end(
                                        "(function () {\n" +
                                        "   var adapter = xlib.utils.require.scripts;\n" +
                                        "   adapter.load([" + references.map(function (element) { return JSON.stringify(String(element)); }).join(",") + "], function () {\n" +
                                        "       %code%\n" +
                                        "       adapter.fireListeners(\"loaded\", " + JSON.stringify(address) + ");\n" +
                                        "   }});\n" +
                                        "})();"
                                    );
                                }
                            }
                        ]);
                    }

                    if (method === "GET" && extname === "") {
                        response.writeHead(200, {"Content-Type": "text/html"});
                        response.end("<!DOCTYPE html>\n<title></title>");
                    } else if (method === "GET" && extname === ".js") {
                        /*displayTypeScript();*/
                    } else {
                        displayError(404);
                    }
                }

            ]);

        }).listen(1337, '127.0.0.1');

    }
]);


text:
package camelinaction;

import java.util.concurrent.ExecutorService;

import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @version $Revision$
 */
public class SpringThreadPoolTest extends CamelSpringTestSupport {

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("META-INF/spring/ThreadPoolTest.xml");
    }

    @Test
    public void testThreadPool() throws Exception {
        ExecutorService myPool = context.getRegistry().lookupByNameAndType("myPool", ExecutorService.class);
        assertNotNull(myPool);

        getMockEndpoint("mock:result").expectedMessageCount(1);

        template.sendBody("direct:start", "Hello Camel");

        assertMockEndpointsSatisfied();
    }

}


text:
typedef void(^createAudioQueBuff)(AudioQueueBufferRef buff);

@interface VoiceReceiver : NSObject {

}

- (void)play:(createAudioQueBuff)createFunc;
- (void)record:(NSOutputStream*)outStrem;
- (void)stopPlay;
- (void)stopRecord;

//Play
- (void)playEnqueueBuffer:(AudioQueueBufferRef)buff;

@end


text:
import re

"""
Guidelines for writing new hacking checks

 - Use only for Nova specific tests. OpenStack general tests
   should be submitted to the common 'hacking' module.
 - Pick numbers in the range N3xx. Find the current test with
   the highest allocated number and then pick the next value.
 - Keep the test method code in the source file ordered based
   on the N3xx value.
 - List the new rule in the top level HACKING.rst file
 - Add test cases for each new rule to nova/tests/test_hacking.py

"""

session_check = re.compile(r"\w*def [a-zA-Z0-9].*[(].*session.*[)]")
cfg_re = re.compile(r".*\scfg\.")
vi_header_re = re.compile(r"^#\s+vim?:.+")
virt_file_re = re.compile(r"\./nova/(?:tests/)?virt/(\w+)/")
virt_import_re = re.compile(
    r"^\s*(?:import|from) nova\.(?:tests\.)?virt\.(\w+)")
virt_config_re = re.compile(
    r"CONF\.import_opt\('.*?', 'nova\.virt\.(\w+)('|.)")
author_tag_re = (re.compile("^\s*#\s*@?(a|A)uthor:"),
                 re.compile("^\.\.\s+moduleauthor::"))
asse_trueinst_re = re.compile(
                     r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
                     "(\w|\.|\'|\"|\[|\])+\)\)")
asse_equal_type_re = re.compile(
                       r"(.)*assertEqual\(type\((\w|\.|\'|\"|\[|\])+\), "
                       "(\w|\.|\'|\"|\[|\])+\)")
asse_equal_end_with_none_re = re.compile(
                           r"(.)*assertEqual\((\w|\.|\'|\"|\[|\])+, None\)")
asse_equal_start_with_none_re = re.compile(
                           r"(.)*assertEqual\(None, (\w|\.|\'|\"|\[|\])+\)")
conf_attribute_set_re = re.compile(r"CONF\.[a-z0-9_.]+\s*=\s*\w")

def import_no_db_in_virt(logical_line, filename):
    """Check for db calls from nova/virt

    As of grizzly-2 all the database calls have been removed from
    nova/virt, and we want to keep it that way.

    N307
    """
    if "nova/virt" in filename and not filename.endswith("fake.py"):
        if logical_line.startswith("from nova import db"):
            yield (0, "N307: nova.db import not allowed in nova/virt/*")

def no_db_session_in_public_api(logical_line, filename):
    if "db/api.py" in filename or "db/sqlalchemy/api.py" in filename:
        if session_check.match(logical_line):
            yield (0, "N309: public db api methods may not accept session")

def use_timeutils_utcnow(logical_line):
    msg = "N310: timeutils.utcnow() must be used instead of datetime.%s()"

    datetime_funcs = ['now', 'utcnow']
    for f in datetime_funcs:
        pos = logical_line.find('datetime.%s' % f)
        if pos != -1:
            yield (pos, msg % f)

def _get_virt_name(regex, data):
    m = regex.match(data)
    if m is None:
        return None
    driver = m.group(1)
    # Ignore things we mis-detect as virt drivers in the regex
    if driver in ["test_virt_drivers", "driver", "firewall",
                  "disk", "api", "imagecache", "cpu"]:
        return None
    # TODO(berrange): remove once bugs 1261826 and 126182 are
    # fixed, or baremetal driver is removed, which is first.
    if driver == "baremetal":
        return None
    return driver

def import_no_virt_driver_import_deps(physical_line, filename):
    """Check virt drivers' modules aren't imported by other drivers

    Modules under each virt driver's directory are
    considered private to that virt driver. Other drivers
    in Nova must not access those drivers. Any code that
    is to be shared should be refactored into a common
    module

    N311
    """
    thisdriver = _get_virt_name(virt_file_re, filename)
    thatdriver = _get_virt_name(virt_import_re, physical_line)
    if (thatdriver is not None and
        thisdriver is not None and
        thisdriver != thatdriver):
        return (0, "N311: importing code from other virt drivers forbidden")

def import_no_virt_driver_config_deps(physical_line, filename):
    """Check virt drivers' config vars aren't used by other drivers

    Modules under each virt driver's directory are
    considered private to that virt driver. Other drivers
    in Nova must not use their config vars. Any config vars
    that are to be shared should be moved into a common module

    N312
    """
    thisdriver = _get_virt_name(virt_file_re, filename)
    thatdriver = _get_virt_name(virt_config_re, physical_line)
    if (thatdriver is not None and
        thisdriver is not None and
        thisdriver != thatdriver):
        return (0, "N312: using config vars from other virt drivers forbidden")

def capital_cfg_help(logical_line, tokens):
    msg = "N313: capitalize help string"

    if cfg_re.match(logical_line):
        for t in range(len(tokens)):
            if tokens[t][1] == "help":
                txt = tokens[t + 2][1]
                if len(txt) > 1 and txt[1].islower():
                    yield(0, msg)

def no_vi_headers(physical_line, line_number, lines):
    """Check for vi editor configuration in source files.

    By default vi modelines can only appear in the first or
    last 5 lines of a source file.

    N314
    """
    # NOTE(gilliard): line_number is 1-indexed
    if line_number <= 5 or line_number > len(lines) - 5:
        if vi_header_re.match(physical_line):
            return 0, "N314: Don't put vi configuration in source files"

def no_author_tags(physical_line):
    for regex in author_tag_re:
        if regex.match(physical_line):
            physical_line = physical_line.lower()
            pos = physical_line.find('moduleauthor')
            if pos < 0:
                pos = physical_line.find('author')
            return pos, "N315: Don't use author tags"

def assert_true_instance(logical_line):
    """Check for assertTrue(isinstance(a, b)) sentences

    N316
    """
    if asse_trueinst_re.match(logical_line):
        yield (0, "N316: assertTrue(isinstance(a, b)) sentences not allowed")

def assert_equal_type(logical_line):
    """Check for assertEqual(type(A), B) sentences

    N317
    """
    if asse_equal_type_re.match(logical_line):
        yield (0, "N317: assertEqual(type(A), B) sentences not allowed")

def assert_equal_none(logical_line):
    """Check for assertEqual(A, None) or assertEqual(None, A) sentences

    N318
    """
    res = (asse_equal_start_with_none_re.match(logical_line) or
           asse_equal_end_with_none_re.match(logical_line))
    if res:
        yield (0, "N318: assertEqual(A, None) or assertEqual(None, A) "
               "sentences not allowed")

def no_translate_debug_logs(logical_line, filename):
    """Check for 'LOG.debug(_('

    As per our translation policy,
    https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation
    we shouldn't translate debug level logs.

    * This check assumes that 'LOG' is a logger.
    * Use filename so we can start enforcing this in specific folders instead
      of needing to do so all at once.

    N319
    """
    dirs = ["nova/scheduler",
            "nova/network",
            "nova/volume",
            "nova/api",
            "nova/cells",
            "nova/conductor",
            "nova/compute",
            "nova/objects",
            "nova/cmd",
            "nova/db",
            "nova/cert",
            "nova/console",
            "nova/consoleauth",
            "nova/cloudpipe",
            "nova/image",
            "nova/hacking",
            "nova/ipv6",
            "nova/keymgr",
            "nova/objectstore",
            "nova/pci",
            "nova/rdp",
            "nova/servicegroup",
            "nova/spice",
            "nova/storage",
            "nova/tests",
            "nova/vnc",
           ]
    if max([name in filename for name in dirs]):
        if logical_line.startswith("LOG.debug(_("):
            yield(0, "N319 Don't translate debug level logs")

def no_setting_conf_directly_in_tests(logical_line, filename):
    """Check for setting CONF.* attributes directly in tests

    The value can leak out of tests affecting how subsequent tests run.
    Using self.flags(option=value) is the preferred method to temporarily
    set config options in tests.

    N320
    """
    if 'nova/tests/' in filename:
        res = conf_attribute_set_re.match(logical_line)
        if res:
            yield (0, "N320: Setting CONF.* attributes directly in tests is "
                      "forbidden. Use self.flags(option=value) instead")

def factory(register):
    register(import_no_db_in_virt)
    register(no_db_session_in_public_api)
    register(use_timeutils_utcnow)
    register(import_no_virt_driver_import_deps)
    register(import_no_virt_driver_config_deps)
    register(capital_cfg_help)
    register(no_vi_headers)
    register(no_author_tags)
    register(assert_true_instance)
    register(assert_equal_type)
    register(assert_equal_none)
    register(no_translate_debug_logs)
    register(no_setting_conf_directly_in_tests)


text:
"use strict"
if(typeof Object.freeze != 'function') Object.freeze = function(v){return v;};
if(!String.prototype.trim) (function(){
	var trim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
	String.prototype.trim = function(){return this.replace(trim, '');};
})();
if(!window.Symbol || bsTest)(function(){
	var uuid = 0,
		getId = function(){
			return '@@Symbol:' + (+new Date) + ':' + (uuid++) + ':' + (Math.random() + '').substr(0, 5);
		},
		ID = getId(),
		Sym = function(id){
			this[ID] = id;
			return Object.freeze(this);
		},
		Symbol = function(){return new Sym(getId());},
		keys = {},
		syms = {};
	Sym.prototype.toString = function(){return this[ID];},
	Symbol['for'] = function(k) {
		if(!keys[k]) syms[keys[k] = Symbol()] = k;
		return keys[k];
	};
	Symbol.keyFor = function(s){return syms[s];};
	Symbol.iterator = Object.freeze(new Sym('@@iterator'));
	window.Symbol = Object.freeze(Symbol);
})();