text:
package com.qbao.catagent.processor;

import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;

import com.qbao.catagent.ClassPathPreSetProcessor;

/**
 * 负责在进行类加载前加载指定
 *
 * @author andersen
 *
 */
public abstract class AbstractClassPathPreSetProcessor implements ClassPathPreSetProcessor {
	// 保存已经加载过指定路径类的classloader
	private ConcurrentHashMap<ClassLoader, Method> invokedMethods = new ConcurrentHashMap<ClassLoader, Method>();
	// 配置文件中指定cat-client相关jar包位置的key
	private final String DEFAULT_CAT_CLIENT_PROPERTY_NAME = "cat.client.path";
	// 需加载的cat-client相关jar包
	private List<File> catClientJarFiles = new ArrayList<File>();
	// 配置文件中指定plugin相关jar包位置的key
	private final String DEFAULT_PLUGIN_PROPERTY_NAME = "cat.plugins.path";
	// 需加载的客户端plugin相关jar包
	private List<File> pluginJarFiles = new ArrayList<File>();
	// 默认方法
	private Method DEFAULT_METHOD = null;
	// 能否预设类路径
	private boolean enable = true;
	// 反射生成的classloader类名
	private final String deleLoader = "sun.reflect.DelegatingClassLoader";
	// 配置的忽略的classloader类名
	public List<String> loadersToSkip = null;
	// 跟aspectj保持一致,可配置跳过的classloader
	private final String LOADER_TO_SKIP_CLASSLOADER_PROPERTY_NAME = "aj.weaving.loadersToSkip";

	@Override
	public void initialize(Properties p) {
		if (p.getProperty(DEFAULT_CAT_CLIENT_PROPERTY_NAME) == null){
			System.out.println(String.format("Warn: CatAgent disabled , Missing %s in config file", DEFAULT_CAT_CLIENT_PROPERTY_NAME));
			enable = false;
			return;
		}
		if (p.getProperty(DEFAULT_PLUGIN_PROPERTY_NAME) == null){
			System.out.println(String.format("Warn: CatAgent disabled , Missing %s in config file", DEFAULT_PLUGIN_PROPERTY_NAME));
			enable = false;
			return;
		}

		// 组装忽略的classloader列表
		String loadersToSkipProperty = System.getProperty(LOADER_TO_SKIP_CLASSLOADER_PROPERTY_NAME, "");
		StringTokenizer st = new StringTokenizer(loadersToSkipProperty, ",");
		if (loadersToSkipProperty != null && loadersToSkip == null) {
			if (st.hasMoreTokens()) {
				loadersToSkip = new ArrayList<String>();
			}
			while (st.hasMoreTokens()) {
				String nextLoader = st.nextToken();
				loadersToSkip.add(nextLoader);
			}
		}

		// 初始化默认方法
		try {
			DEFAULT_METHOD = new Object().getClass().getMethod("toString");
		} catch (NoSuchMethodException e) {
			enable = false;
		} catch (SecurityException e) {
			enable = false;
		}

		// 初始化cat-client相关jar包路径
		File catClientPath = new File(p.getProperty(DEFAULT_CAT_CLIENT_PROPERTY_NAME));
		if (catClientPath.exists() == false) {
			System.out.println("Warn:  CatAgent disabled! file structure is not meet needs!");
			enable = false;
			return;
		}
		addJars(catClientPath, catClientJarFiles);

		// 初始化cat-plugins相关jar包路径
		File catPluginsPath = new File(p.getProperty(DEFAULT_PLUGIN_PROPERTY_NAME));
		if (catPluginsPath.exists() == false) {
			System.out.println("Warn:  CatAgent disabled! file structure is not meet needs!");
			enable = false;
			return;
		}
		addJars(catPluginsPath, pluginJarFiles);

		if (catClientJarFiles.isEmpty() && pluginJarFiles.isEmpty()) {
			enable = false;
			return;
		}

	}

	/**
	 * 把指定目录下所有jar包加入指定列表
	 *
	 * @param rootPath
	 * @param files
	 */
	private void addJars(File f, List<File> fileList) {
		if (f.isFile() && f.getName().endsWith(".jar")) {
			fileList.add(f);
		}
		if (f.isDirectory()) {
			for (File tmpF : f.listFiles()) {
				addJars(tmpF, fileList);
			}
		}
	}

	/**
	 * 在脂定classloader内加入cp路径
	 *
	 * @param classLoader
	 */
	private void loadPluginJars(ClassLoader classLoader) {
		Method method = null;
		if ((method = (Method) invokedMethods.get(classLoader)) == null) {
			try {
				if (classLoader != null) {
					if (classLoader instanceof URLClassLoader) {
						// javaagent的classloader一般是AppClassLoader
						ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();

						boolean shouldLoadCatJars = shouldLoadCatJars(classLoader, systemClassLoader);
						boolean shouldLoadPluginsJars = shouldLoadPluginsJars(classLoader, systemClassLoader);

						if (shouldLoadCatJars || shouldLoadPluginsJars){
							try {
								method = classLoader.getClass().getDeclaredMethod("addURL", new Class[] { URL.class });
							} catch (Throwable t) {
								method = classLoader.getClass().getSuperclass().getDeclaredMethod("addURL",
										new Class[] { URL.class });
							}
							if (method == null) {
								invokedMethods.put(classLoader, DEFAULT_METHOD);
								return;
							}
							method.setAccessible(true);
						}
						if (shouldLoadCatJars){
							for (File f : catClientJarFiles)
								method.invoke(classLoader, new Object[] { f.toURI().toURL() });
						}
						if (shouldLoadPluginsJars){
							for (File f : pluginJarFiles)
								method.invoke(classLoader, new Object[] { f.toURI().toURL() });
						}
						invokedMethods.put(classLoader, method == null ? DEFAULT_METHOD : method);
					}else{
						invokedMethods.put(classLoader, DEFAULT_METHOD);
					}
				}
			} catch (Exception e) {
				System.err.println("init ClassLoader path occured error");
			}
		}
	}

	@Override
	public byte[] preProcess(String className, byte[] bytes, ClassLoader classLoader,
			ProtectionDomain protectionDomain) {
		if (classLoader == null || className == null || deleLoader.equals(classLoader.getClass().getName())) {
			// skip boot loader, null classes (hibernate), or those from a
			// reflection loader
			return bytes;
		}
		// 忽略过指定classloader
		/*if (loadersToSkip != null) {
			if (loadersToSkip.contains(classLoader.getClass().getName())) {
				return bytes;
			}
		}*/

		// 如果没出问题,则加入预加载类
		if (enable) {
			loadPluginJars(classLoader);
		}
		return bytes;
	}

	/**
	 * 是否需要设置cat相关jar包路径
	 * @param preProcessLoader 正在加载的classloader
	 * @param systemClassLoader 本agent运行时系统loader
	 * @return true:需要加载  false:不需要加载
	 */
	protected abstract boolean shouldLoadCatJars(ClassLoader preProcessLoader, ClassLoader systemClassLoader);

	/**
	 * 是否需要设置plugin相关jar包路径
	 * @param preProcessLoader 正在加载的classloader
	 * @param systemClassLoader 本agent运行时系统loader
	 * @return true:需要加载  false:不需要加载
	 */
	protected abstract boolean shouldLoadPluginsJars(ClassLoader preProcessLoader, ClassLoader systemClassLoader);

}


text:
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;

namespace BookStore.Domain.Model
{
    public class ApplicationUser : IdentityUser
    {
    }
}

redpajama_set_name: RedPajamaGithub


text:
"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable strict-boolean-expressions prefer-template
// (wait on https://github.com/palantir/tslint/pull/2572)
var fs = require("fs");
var glob = require("glob");
var path = require("path");
var ts = require("typescript");
var configuration_1 = require("./configuration");
var error_1 = require("./error");
var Linter = require("./linter");
var test_1 = require("./test");
var Runner = (function () {
    function Runner(options, outputStream) {
        this.options = options;
        this.outputStream = outputStream;
    }
    Runner.trimSingleQuotes = function (str) {
        return str.replace(/^'|'$/g, "");
    };
    Runner.prototype.run = function (onComplete) {
        var _this = this;
        if (this.options.version) {
            this.outputStream.write(Linter.VERSION + "\n");
            return onComplete(0);
        }
        if (this.options.init) {
            if (fs.existsSync(configuration_1.CONFIG_FILENAME)) {
                console.error("Cannot generate " + configuration_1.CONFIG_FILENAME + ": file already exists");
                return onComplete(1);
            }
            var tslintJSON = JSON.stringify(configuration_1.DEFAULT_CONFIG, undefined, "    ");
            fs.writeFileSync(configuration_1.CONFIG_FILENAME, tslintJSON);
            return onComplete(0);
        }
        if (this.options.test) {
            var results = test_1.runTests((this.options.files || []).map(Runner.trimSingleQuotes), this.options.rulesDirectory);
            var didAllTestsPass = test_1.consoleTestResultsHandler(results);
            return onComplete(didAllTestsPass ? 0 : 1);
        }
        // when provided, it should point to an existing location
        if (this.options.config && !fs.existsSync(this.options.config)) {
            console.error("Invalid option for configuration: " + this.options.config);
            return onComplete(1);
        }
        // if both files and tsconfig are present, use files
        var files = this.options.files === undefined ? [] : this.options.files;
        var program;
        if (this.options.project != null) {
            var project = findTsconfig(this.options.project);
            if (project === undefined) {
                console.error("Invalid option for project: " + this.options.project);
                return onComplete(1);
            }
            program = Linter.createProgram(project);
            if (files.length === 0) {
                files = Linter.getFileNames(program);
            }
            if (this.options.typeCheck) {
                // if type checking, run the type checker
                var diagnostics = ts.getPreEmitDiagnostics(program);
                if (diagnostics.length > 0) {
                    var messages = diagnostics.map(function (diag) {
                        // emit any error messages
                        var message = ts.DiagnosticCategory[diag.category];
                        if (diag.file) {
                            var _a = diag.file.getLineAndCharacterOfPosition(diag.start), line = _a.line, character = _a.character;
                            var file = void 0;
                            var currentDirectory = program.getCurrentDirectory();
                            file = _this.options.outputAbsolutePaths
                                ? path.resolve(currentDirectory, diag.file.fileName)
                                : path.relative(currentDirectory, diag.file.fileName);
                            message += " at " + file + ":" + (line + 1) + ":" + (character + 1) + ":";
                        }
                        message += " " + ts.flattenDiagnosticMessageText(diag.messageText, "\n");
                        return message;
                    });
                    console.error(messages.join("\n"));
                    return onComplete(this.options.force ? 0 : 1);
                }
            }
            else {
                // if not type checking, we don't need to pass in a program object
                program = undefined;
            }
        }
        var ignorePatterns = [];
        if (this.options.exclude) {
            var excludeArguments = Array.isArray(this.options.exclude) ? this.options.exclude : [this.options.exclude];
            ignorePatterns = excludeArguments.map(Runner.trimSingleQuotes);
        }
        files = files
            .map(Runner.trimSingleQuotes)
            .map(function (file) { return glob.sync(file, { ignore: ignorePatterns, nodir: true }); })
            .reduce(function (a, b) { return a.concat(b); }, [])
            .map(function (file) {
            if (_this.options.outputAbsolutePaths) {
                return path.resolve(file);
            }
            return path.relative(process.cwd(), file);
        });
        try {
            this.processFiles(onComplete, files, program);
        }
        catch (error) {
            if (error.name === error_1.FatalError.NAME) {
                console.error(error.message);
                return onComplete(1);
            }
            // rethrow unhandled error
            throw error;
        }
    };
    Runner.prototype.processFiles = function (onComplete, files, program) {
        var _this = this;
        var possibleConfigAbsolutePath = this.options.config != null ? path.resolve(this.options.config) : null;
        var linter = new Linter({
            fix: !!this.options.fix,
            formatter: this.options.format,
            formattersDirectory: this.options.formattersDirectory || "",
            rulesDirectory: this.options.rulesDirectory || "",
        }, program);
        var lastFolder;
        var configFile;
        for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
            var file = files_1[_i];
            if (!fs.existsSync(file)) {
                console.error("Unable to open file: " + file);
                return onComplete(1);
            }
            var buffer = new Buffer(256);
            var fd = fs.openSync(file, "r");
            try {
                fs.readSync(fd, buffer, 0, 256, 0);
                if (buffer.readInt8(0, true) === 0x47 && buffer.readInt8(188, true) === 0x47) {
                    // MPEG transport streams use the '.ts' file extension. They use 0x47 as the frame
                    // separator, repeating every 188 bytes. It is unlikely to find that pattern in
                    // TypeScript source, so tslint ignores files with the specific pattern.
                    console.warn(file + ": ignoring MPEG transport stream");
                    continue;
                }
            }
            finally {
                fs.closeSync(fd);
            }
            var contents = fs.readFileSync(file, "utf8");
            var folder = path.dirname(file);
            if (lastFolder !== folder) {
                configFile = configuration_1.findConfiguration(possibleConfigAbsolutePath, folder).results;
                lastFolder = folder;
            }
            linter.lint(file, contents, configFile);
        }
        var lintResult = linter.getResult();
        this.outputStream.write(lintResult.output, function () {
            if (_this.options.force || lintResult.errorCount === 0) {
                onComplete(0);
            }
            else {
                onComplete(2);
            }
        });
    };
    return Runner;
}());
exports.Runner = Runner;
function findTsconfig(project) {
    try {
        var stats = fs.statSync(project); // throws if file does not exist
        if (stats.isDirectory()) {
            project = path.join(project, "tsconfig.json");
            fs.accessSync(project); // throws if file does not exist
        }
    }
    catch (e) {
        return undefined;
    }
    return project;
}


text:
require_relative '../../../../helper'

class Repositext
  class Process
    class Split
      class Subtitles

        describe TransferStsFromPAlignedSentences2FAlignedSentences do

          let(:default_split_instance) { Split::Subtitles.new('_', '_') }

          describe '#transfer_subtitles' do
            [
              [
                'Simple case',
                '@word word @word word',
                'ward ward ward ward',
                ['@ward ward @ward ward', 1.0]
              ],
            ].each do |(desc, p_s, f_s, xpect)|
              it "handles #{ desc }" do
                default_split_instance.transfer_subtitles(
                  p_s, f_s
                ).result.must_equal(xpect)
              end
            end
          end

          describe '#interpolate_subtitle_positions' do
            [
              [
                'Simple case',
                '@word word @word word',
                'ward ward ward ward',
                '@ward ward @ward ward',
              ],
              [
                'Double length',
                '@word word @word word',
                'wardward wardward wardward wardward',
                '@wardward wardward @wardward wardward',
              ],
              [
                'Moves subtitles to beginning of word',
                '@word word @word word',
                'ward wardwardward ward',
                '@ward @wardwardward ward',
              ],
              [
                'Moves subtitles to beginning of word with accented character',
                '@word word @word word',
                'ward ward wàrdward ward',
                '@ward ward @wàrdward ward',
              ],
              [
                'Moves subtitles to beginning of word with escaped character',
                '@word word @word word',
                'ward ward ward ward',
                '@ward @ward ward ward',
              ],
            ].each do |(desc, p_s, f_s, xpect)|
              it "handles #{ desc }" do
                default_split_instance.interpolate_subtitle_positions(
                  p_s, f_s
                ).must_equal(xpect)
              end
            end
          end

          describe '#snap_subtitles_to_punctuation_signature' do
            [
              [
                'Simple case',
                '@word word, @word word',
                '@ward ward, ward @ward',
                ['@ward ward, @ward ward', 1.0],
              ],
              [
                'Snaps to correct punctuation even if closer to wrong one.',
                '@word word word, @word word word, word word word',
                '@ward ward ward, ward ward @ward, ward ward ward',
                ['@ward ward ward, @ward ward ward, ward ward ward', 1.0],
              ],
              [
                'Correct punctuation type is further away',
                '@word word word, @word word word; word word word',
                '@ward ward ward, ward ward @ward; ward ward ward',
                ['@ward ward ward, @ward ward ward; ward ward ward', 1.0],
              ],
              [
                'Elipsis without trailing space',
                '@word word…@word word',
                '@ward ward…ward @ward',
                ['@ward ward…@ward ward', 1.0],
              ],
              [
                'Multiple adjacent punctuation chars',
                '@word word), @word word',
                '@ward ward), ward @ward',
                ['@ward ward), @ward ward', 1.0],
              ],
            ].each do |(desc, p_s, f_s, xpect)|
              it "handles #{ desc }" do
                default_split_instance.snap_subtitles_to_punctuation_signature(
                  p_s, f_s
                ).result.must_equal(xpect)
              end
            end

            # ImplementationTag #punctuation_characters
            punctuation_marks = ".,;:!?)]…"—".chars

            punctuation_marks.each do |p_punct|
              punctuation_marks.each do |f_punct|
                it "snaps primary #{ p_punct.inspect } to foreign #{ f_punct.inspect }" do
                  p_s = "@word word#{ p_punct } @word word"
                  f_s = "@ward ward#{ f_punct } ward @ward"
                  xpect = ["@ward ward#{ f_punct } @ward ward", 1.0]
                  default_split_instance.snap_subtitles_to_punctuation_signature(
                    p_s, f_s
                  ).result.must_equal(xpect)
                end
              end
            end
          end

          describe '#snap_subtitles_to_nearby_punctuation' do
            [
              [
                'Simple case',
                '@word word word, @word word word. @word word word:',
                '@ward ward ward, ward @ward ward; ward @ward ward:',
                ['@ward ward ward, @ward ward ward; @ward ward ward:', 0.6400000000000001]
              ],
              [
                'Complex punctuation signature, subtitles after sequences of punctuation.',
                "word…word, "word," [word, "word,"— word.] @"word;" ["word;"] "word," ["word,"] @"word." ["word."]",
                "ward…ward ward: "ward," [ward: "ward,"— @ward.] "ward;" ["ward;"] "ward," ["ward, @ward"] "ward." ["ward."]",
                [
                  "ward…ward ward: "ward," [ward: "ward,"— ward.] @"ward;" ["ward;"] "ward," ["ward, ward"] @"ward." ["ward."]",
                  0.6400000000000001
                ],
              ],
            ].each do |(desc, p_s, f_s, xpect)|
              it "handles #{ desc }" do
                default_split_instance.snap_subtitles_to_nearby_punctuation(
                  p_s, f_s
                ).result.must_equal(xpect)
              end
            end
          end

        end
      end
    end
  end
end


text:
require 'fog/openstack/models/collection'
require 'fog/volume/openstack/v1/models/availability_zone'
require 'fog/volume/openstack/models/availability_zones'

module Fog
  module Volume
    class OpenStack
      class V1
        class AvailabilityZones < Fog::OpenStack::Collection
          model Fog::Volume::OpenStack::V1::AvailabilityZone
          include Fog::Volume::OpenStack::AvailabilityZones
        end
      end
    end
  end
end


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CodeConnect.SyntaxFactoryVsParseText.Benchmark;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Syntax;

namespace CodeConnect.SyntaxFactoryVsParseText.Tests
{
    [TestClass]
    public class BasicTest
    {
        [TestMethod]
        public void ParseTextGeneratorCreatesCorrectType()
        {
            var parseTextGenerator = new ParseTextCodeGenerator();

            int numberOfMethods = 5;
            var typeSyntax = parseTextGenerator.GenerateType(numberOfMethods, true);

            var methods = typeSyntax.ChildNodes().OfType<MethodDeclarationSyntax>();
            Assert.AreEqual(numberOfMethods + 1, methods.Count());
            Assert.AreEqual("Run", methods.First().Identifier.ToString());
            Assert.IsTrue(TestHelpers.TypeDeclarationCompiles(typeSyntax));
        }

        [TestMethod]
        public void SyntaxFactoryGeneratorCreatesCorrectType()
        {
            var syntaxFactoryGenerator = new SyntaxFactoryCodeGenerator();

            int numberOfMethods = 5;
            var typeSyntax = syntaxFactoryGenerator.GenerateType(numberOfMethods, true);

            var methods = typeSyntax.ChildNodes().OfType<MethodDeclarationSyntax>();
            Assert.AreEqual(numberOfMethods + 1, methods.Count());
            Assert.AreEqual("Run", methods.First().Identifier.ToString());
            Assert.IsTrue(TestHelpers.TypeDeclarationCompiles(typeSyntax));
        }
    }
}


text:
require 'test_helper'

class VerticalFormTest < ActionView::TestCase
  setup do
    @user    = User.new
    @builder = SimpleForm::FormBuilder.new(:user, @user, self, wrapper: :vertical_form, wrapper_mappings: {})
  end

  def test_required_email_field
    actual = @builder.input(:email)
    expected = <<-HTML

        Email *
        <input class="form-control string email required" id="user_email" name="user[email]" placeholder="Enter email" type="email"/>
        We'll never share your email with anyone else.

    HTML
    assert_xml_equal expected, actual
  end

  def test_collection_as_radio_buttons_inline
    actual = @builder.input(:color, as: :radio_buttons, collection: [:a, :b], wrapper: :vertical_collection_inline)
    expected = <<-HTML
      <fieldset class="form-group radio_buttons required user_color">
        <legend class="col-form-label pt-0">Color *</legend>
        <input name="user[color]" type="hidden" value=""/>

          <input class="form-check-input radio_buttons required" id="user_color_a" name="user[color]" type="radio" value="a"/>
          a

          <input class="form-check-input radio_buttons required" id="user_color_b" name="user[color]" type="radio" value="b"/>
          b

        Collection as inline radio buttons example
      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_collection_as_radio_buttons
    actual = @builder.input(:pill, as: :radio_buttons, collection: [:a, :b])
    expected = <<-HTML
      <fieldset class="form-group radio_buttons optional user_pill">
        <legend class="col-form-label pt-0">Pill</legend>
        <input name="user[pill]" type="hidden" value=""/>

          <input class="form-check-input radio_buttons optional" id="user_pill_a" name="user[pill]" type="radio" value="a"/>
          a

          <input class="form-check-input radio_buttons optional" id="user_pill_b" name="user[pill]" type="radio" value="b"/>
          b

        Collection as radio buttons example
      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_collection_as_radio_buttons_without_label
    actual = @builder.input(:pill, as: :radio_buttons, collection: [:a, :b], legend_tag: false)
    expected = <<-HTML
      <fieldset class="form-group radio_buttons optional user_pill">
        <input name="user[pill]" type="hidden" value=""/>

          <input class="form-check-input radio_buttons optional" id="user_pill_a" name="user[pill]" type="radio" value="a"/>
          a

          <input class="form-check-input radio_buttons optional" id="user_pill_b" name="user[pill]" type="radio" value="b"/>
          b

        Collection as radio buttons example
      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_collection_as_check_boxes_inline
    actual = @builder.input(:fruit, as: :check_boxes, collection: [:a, :b], wrapper: :vertical_collection_inline)
    expected = <<-HTML
      <fieldset class="form-group check_boxes required user_fruit">
        <legend class="col-form-label pt-0">Fruit *</legend>
        <input name="user[fruit][]" type="hidden" value=""/>

          <input class="form-check-input check_boxes required" id="user_fruit_a" name="user[fruit][]" type="checkbox" value="a"/>
          a

          <input class="form-check-input check_boxes required" id="user_fruit_b" name="user[fruit][]" type="checkbox" value="b"/>
          b

        Collection as inline check boxes example
      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_collection_as_check_boxes
    actual = @builder.input(:choises, as: :check_boxes, collection: %w(a b))
    expected = <<-HTML
      <fieldset class="form-group check_boxes required user_choises">
        <legend class="col-form-label pt-0">Choises *</legend>
        <input name="user[choises][]" type="hidden" value=""/>

          <input class="form-check-input check_boxes required" id="user_choises_a" name="user[choises][]" type="checkbox" value="a"/>
          a

          <input class="form-check-input check_boxes required" id="user_choises_b" name="user[choises][]" type="checkbox" value="b"/>
          b

        Collection as check boxes example
      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_collection_as_check_boxes_without_legend
    actual = @builder.input(:choises, as: :check_boxes, collection: %w(a b), legend_tag: false)
    expected = <<-HTML
      <fieldset class="form-group check_boxes required user_choises">
        <input name="user[choises][]" type="hidden" value=""/>

          <input class="form-check-input check_boxes required" id="user_choises_a" name="user[choises][]" type="checkbox" value="a"/>
          a

          <input class="form-check-input check_boxes required" id="user_choises_b" name="user[choises][]" type="checkbox" value="b"/>
          b

        Collection as check boxes example
      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_boolean_as_radio_button
    actual = @builder.input(:active, as: :radio_buttons)
    expected = <<-HTML
      <fieldset class="form-group radio_buttons required user_active">
        <legend class="col-form-label pt-0">Active *</legend>
        <input name="user[active]" type="hidden" value=""/>

          <input class="form-check-input radio_buttons required" id="user_active_true" name="user[active]" type="radio" value="true"/>
          Yes

          <input class="form-check-input radio_buttons required" id="user_active_false" name="user[active]" readonly="readonly" type="radio" value="false"/>
          No

        Boolean as radio button example
      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_boolean_as_check_box
    actual = @builder.input(:terms)
    expected = <<-HTML
      <fieldset class="form-group boolean optional user_terms">

          <input name="user[terms]" type="hidden" value="0"/>
          <input class="form-check-input boolean optional" id="user_terms" name="user[terms]" type="checkbox" value="1"/>
          Terms
          Boolean as check box example

      </fieldset>
    HTML
    assert_xml_equal expected, actual
  end

  def test_file_field
    actual = @builder.input(:avatar, as: :file)
    expected = <<-HTML

        Avatar *
        <input class="form-control-file file required" id="user_avatar" name="user[avatar]" type="file"/>
        File input example

    HTML
    assert_xml_equal expected, actual
  end

  def test_number_field
    actual = @builder.input(:friends)
    expected = <<-HTML

        Friends
        <input class="form-control numeric integer optional" id="user_friends" name="user[friends]" placeholder="Number of Friends" step="1" type="number"/>
        Integer input example

    HTML
    assert_xml_equal expected, actual
  end

  def test_password_field
    actual = @builder.input(:password)
    expected = <<-HTML

        Password
        <input class="form-control password optional" id="user_password" name="user[password]" placeholder="Password" type="password"/>
        Password input example

    HTML
    assert_xml_equal expected, actual
  end

  def test_range_field
    actual = @builder.input(:mood, as: :range)
    expected = <<-HTML

        Mood
        <input class="form-control-range numeric range optional" id="user_mood" name="user[mood]" step="1" type="range"/>
        Integer range example

    HTML
    assert_xml_equal expected, actual
  end

  def test_select_field
    actual = @builder.input(:language, collection: %w(a b))
    expected = <<-HTML

        Language
        <select class="form-control select optional" id="user_language" name="user[language]">
          <option label=" " value=""/>
          <option value="a">a</option>
          <option value="b">b</option>
        </select>
        Collection select example

    HTML
    assert_xml_equal expected, actual
  end

  def test_select_multi_field
    actual = @builder.input(:music, collection: %w(a b), input_html: { multiple: true })
    expected = <<-HTML

        Music *
        <input name="user[music][]" type="hidden" value=""/>
        <select class="form-control select required" id="user_music" multiple="multiple" name="user[music][]">
          <option value="a">a</option>
          <option value="b">b</option>
        </select>
        Collection multiple select example

    HTML
    assert_xml_equal expected, actual
  end

  def test_text_field
    actual = @builder.input(:name)
    expected = <<-HTML

        Name *
        <input class="form-control string required" id="user_name" name="user[name]" placeholder="Your name" type="text"/>
        Text input example

    HTML
    assert_xml_equal expected, actual
  end

  def test_textarea_field
    actual = @builder.input(:bio)
    expected = <<-HTML

        Bio
        <textarea class="form-control text optional" id="user_bio" name="user[bio]" placeholder="Tell us your story"></textarea>
        Textarea input example

    HTML
    assert_xml_equal expected, actual
  end
end


text:
#pragma once

#include <string>
#include "ofImage.h"
#include "Utils.h"
#include "pugixml.h"

using namespace pugi;
using namespace std;

namespace Cog {

	/**
	* Collection of sprites that are a part of a sprite atlas
	* Each sprite atlas may contain more sprite shets with different names, on different offset and
	* with various frames.
	*
	* It is suitable for animations where each animated object has its all frames on one sprite sheet
	*/
	class SpriteSheet {
	private:
		int offsetX;		// x-axis offset in sprite atlas in pixels
		int offsetY;		// y-axis offset in sprite atlas in pixels
		int totalFrames;	// number of frames this sprite sheet contains
		int spriteWidth;	// width of one sprite in pixels
		int spriteHeight;	// height of one sprite in pixels
		int spriteSheetWidth; // width of the whole sprite sheet in pixels
		int spriteSheetHeight;// height of the whole sprite sheet in pixels

		// pointer to the sprite sheet
		spt<ofImage> spriteAtlas;
		// name of the sprite atlas
		string spriteAtlasName;

		// width of the sprite sheet
		int spriteAtlasWidth;
		// height of the sprite sheet
		int spriteAtlasHeight;
		// name of this sprite set
		string name;

	public:

		SpriteSheet() {

		}

		/**
		* Creates a new sprite sheet
		* @param spriteAtlas sprite atlas in which this sheet comprises
		* @param spriteAtlasName name of the sprite atlas
		* @param sheetName name of the sprite sheet
		* @param totalFrames number of frames in the sheet
		* @param spriteWidth width of one sprite in pixels
		* @param spriteHeight height of one sprite in pixels
		*/
		SpriteSheet(spt<ofImage> spriteAtlas, string spriteAtlasName, string sheetName, int totalFrames,
			int spriteWidth, int spriteHeight);

		/**
		* Creates a new sprite sheet
		* @param spriteAtlas sprite atlas in which this sheet comprises
		* @param spriteAtlasName name of the sprite atlas
		* @param sheetName name of the sprite sheet
		* @param totalFrames number of frames in the sheet
		* @param spriteWidth width of one sprite in pixels
		* @param spriteHeight height of one sprite in pixels
		* @param spriteSheetWidth width of the whole sprite sheet in pixels
		* @param spriteSheetHeight height of the whole sprite sheet in pixels
		*/
		SpriteSheet(spt<ofImage> spriteAtlas, string spriteAtlasName, string sheetName, int totalFrames,
			int spriteWidth, int spriteHeight, int spriteSheetWidth, int spriteSheetHeight);

		/**
		* Creates a new sprite sheet
		* @param spriteAtlas sprite atlas in which this sheet comprises
		* @param spriteAtlasName name of the sprite atlas
		* @param sheetName name of the sprite sheet
		* @param offsetX position in the atlas on the x axis where the sprite sheet starts
		* @param offsetY position in the atlas on the y axis where the sprite sheet starts
		* @param totalFrames number of frames in the sheet
		* @param spriteWidth width of one sprite in pixels
		* @param spriteHeight height of one sprite in pixels
		* @param spriteSheetWidth width of the whole sprite sheet in pixels
		* @param spriteSheetHeight height of the whole sprite sheet in pixels
		*/
		SpriteSheet(spt<ofImage> spriteAtlas, string spriteAtlasName, string sheetName, int offsetX, int offsetY, int totalFrames,
			int spriteWidth, int spriteHeight, int spriteSheetWidth, int spriteSheetHeight);

		/**
		 * Gets sprite sheet image
		 */
		spt<ofImage> GetSpriteAtlas() {
			return spriteAtlas;
		}

		/**
		* Gets name of the sprite atlas
		*/
		string GetSpriteAtlasName() {
			return spriteAtlasName;
		}

		/**
		 * Gets name of this sprite sheet
		 */
		string GetName() const {
			return name;
		}

		/**
		 * Gets x-axis offset int sprite atlas in pixels
		 */
		int GetOffsetX() const {
			return offsetX;
		}

		/**
		* Gets y-axis offset in sprite atlas in pixels
		*/
		int GetOffsetY() const {
			return offsetY;
		}

		/**
		 * Gets number of frames in the sheet
		 */
		int GetTotalFrames() const {
			return totalFrames;
		}

		/**
		 * Gets width of one sprite
		 */
		int GetSpriteWidth() const {
			return spriteWidth;
		}

		/**
		 * Gets height of one sprite
		 */
		int GetSpriteHeight() const {
			return spriteHeight;
		}

		/**
		 * Gets width of this sprite sheet
		 */
		int GetSpriteSheetWidth() const {
			return spriteSheetWidth;
		}

		/**
		 * Gets height of this sprite sheet
		 */
		int GetSpriteSheetHeight() const {
			return spriteSheetHeight;
		}

		/**
		 * Gets width of the sprite atlas
		 */
		int GetSpriteAtlasWidth() const {
			return spriteAtlasWidth;
		}

		/**
		 * Gets height of the sprite atlas
		 */
		int GetSpriteAtlasHeight() const {
			return spriteAtlasHeight;
		}
	};

} // namespace


text:
using System;
using System.Data;
using System.Collections.Generic;

namespace MonoDevelop.Database.Sql
{
	public class DeleteStatement : IStatement
	{
		protected FromClause from;
		protected WhereClause where;

		public DeleteStatement (FromClause from)
		{
			From = from;
		}

		public FromClause From {
			get { return from; }
			set {
				if (value == null)
					throw new ArgumentNullException ("from");
				this.from = value;
			}
		}

		public WhereClause Where {
			get { return where; }
			set { where = value; }
		}
	}
}


text:
/**
 * @jest-environment jsdom
 */
import { mocked } from 'ts-jest/utils';
import { Sdk } from './sdk';
import { Client } from './client';
import { fixtures } from './fixtures';
import { TraceLink } from './traceLink';

jest.mock('./client');
const mockClientCtor = mocked(Client);

describe('Sdk', () => {
  let sdk: Sdk;
  beforeEach(() => {
    mockClientCtor.mockClear();
    sdk = new Sdk({
      secret: {
        privateKey: fixtures.signingKey.pemPrivateKey
      },
      workflowId: fixtures.Sdk.workflowId,
      groupLabel: fixtures.traceLink.groupLabel
    });
  });

  it('instanciates a client', () => {
    expect(mockClientCtor).toHaveBeenCalledTimes(1);
  });

  it('concurrency', async () => {
    const mockClient = mocked(mockClientCtor.mock.instances[0]);
    const { configQueryRsp, createLinkMutationImpl } = fixtures.Sdk;
    const graphqlImpl = (query: string, variables: any) => {
      const trimmedQuery = query.trim();
      if (trimmedQuery.startsWith('query configQuery')) {
        return configQueryRsp;
      }
      if (trimmedQuery.startsWith('mutation createLinkMutation')) {
        return createLinkMutationImpl(variables);
      }
      throw new Error();
    };
    mockClient.graphql.mockImplementation(graphqlImpl as any);
    await Promise.all([
      sdk.newTrace({ actionKey: '42', data: {} }),
      sdk.newTrace({ actionKey: '43', data: {} }),
      sdk.newTrace({ actionKey: '44', data: {} }),
      sdk.newTrace({ actionKey: '45', data: {} })
    ]);
    expect(mockClient.graphql).toHaveBeenCalledTimes(5);
    expect(
      mockClient.graphql.mock.calls.map(([query]) => query.trim().split('(')[0])
    ).toEqual([
      'query configQuery',
      'mutation createLinkMutation',
      'mutation createLinkMutation',
      'mutation createLinkMutation',
      'mutation createLinkMutation'
    ]);
  });
});


text:
typedef SDLEnum SDLTBTState SDL_SWIFT_ENUM;

extern SDLTBTState const SDLTBTStateRouteUpdateRequest;
extern SDLTBTState const SDLTBTStateRouteAccepted;
extern SDLTBTState const SDLTBTStateRouteRefused;
extern SDLTBTState const SDLTBTStateRouteCancelled;
extern SDLTBTState const SDLTBTStateETARequest;
extern SDLTBTState const SDLTBTStateNextTurnRequest;
extern SDLTBTState const SDLTBTStateRouteStatusRequest;
extern SDLTBTState const SDLTBTStateRouteSummaryRequest;
extern SDLTBTState const SDLTBTStateTripStatusRequest;
extern SDLTBTState const SDLTBTStateRouteUpdateRequestTimeout;


text:
package dto;

import play.data.format.Formats;
import play.data.validation.Constraints;

public class Accept {

	@Constraints.Required
	@Formats.NonEmpty
	public Boolean accept;

	public Boolean getAccept() {
		return accept;
	}

	public void setAccept(Boolean accept) {
		this.accept = accept;
	}

}


text:
var expect = require('chai').expect;
var frp = require('../lib/frp');

describe('frp#cast', function() {
    it('should cast a given value to an accessor', function () {
        var b = true;
        var n = 2;
        var s = 'three';

        var obj = {
            one: true,
            two: 2,
            three: 'three'
        };

        var arr = [true, 2, 'three'];

        var state_bool = frp.cast(b);
        var state_number = frp.cast(n);
        var state_string = frp.cast(s);
        var state_obj = frp.cast(obj);
        var state_array = frp.cast(arr);

        expect(frp.isAccessor(state_bool)).to.be.true;
        expect(frp.isAccessor(state_number)).to.be.true;
        expect(frp.isAccessor(state_string)).to.be.true;
        expect(frp.isAccessor(state_obj)).to.be.true;
        expect(frp.isAccessor(state_array)).to.be.true;
    });

    it('should return an accessor as is', function () {
        var state = frp.state({
            one: true,
            two: 2,
            three: 'three',
            four: {
                five: ':)'
            }
        });

        var casted = frp.cast(state);

        expect(casted).to.eql(state);
    });
});


text:
package com.example.android.miwok;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;

import static android.R.attr.name;

public class PhrasesActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.word_list);

        ArrayList<Word> words = new ArrayList<Word>();

        words.add(new Word("Where are you going?","minto wuksus"));
        words.add(new Word("What is your name?","tinnә oyaase'nә"));
        words.add(new Word("My name is...","oyaaset..."));
        words.add(new Word("How are you feeling?", "michәksәs?"));
        words.add(new Word("I'm feeling good.","kuchi achit"));
        words.add(new Word("Are you coming?","әәnәs'aa?"));
        words.add(new Word("Yes, I'm coming.","hәә' әәnәm"));
        words.add(new Word("I'm coming.","әәnәm"));
        words.add(new Word("Let's go.", "yoowutis"));
        words.add(new Word("Come here.","әnni'nem"));

        WordAdapter adapter = new WordAdapter(this, words, R.color.category_phrases);

        ListView listView = (ListView) findViewById(R.id.list);

        listView.setAdapter(adapter);

    }
}


text:
// Copyright IBM Corp. 2015. All Rights Reserved.
// Node module: loopback-component-push
// This file is licensed under the Artistic License 2.0.
// License text available at https://opensource.org/licenses/Artistic-2.0

'use strict';

// mostly borrowed from
// https://github.com/strongloop/loopback-component-passport/blob/master/lib/index.js
var loopback = require('loopback');
var DataModel = loopback.PersistedModel || loopback.DataModel;

function loadModel(jsonFile) {
  var modelDefinition = require(jsonFile);
  return DataModel.extend(modelDefinition.name, modelDefinition.properties);
}

var InstallationModel = loadModel('./installation.json');
var NotificationModel = loadModel('./notification.json');

/**
 * Export two model classes as properties
 */
exports.Installation = require('./installation')(InstallationModel);
exports.Notification = require('./notification')(NotificationModel);

exports.Installation.autoAttach = 'db';
exports.Notification.autoAttach = 'db';


text:
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

删除标签?

确定要删除该标签?

                <form method="POST" action="{{ url('admin/tag/' . $data['id']) }}">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <input type="hidden" name="_method" value="DELETE">
                    <button type="button" class="btn btn-link" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-link btn-icon-text">
                         确定删除
                    </button>
                </form>


text:
<?php

namespace BabyMonitor\test\BabyMonitoryTest\Controller;

use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;
use Zend\Db\Resultset\Resultset;
use BabyMonitor\Model\FeedModel;

class ControllerTest extends AbstractHttpControllerTestCase
{
    protected $traceError = true;

    public function setUp()
    {
        $this->setApplicationConfig(
            include dirname(__DIR__) . '/../TestConfig.php.dist'
        );
        parent::setUp();
    }

    public function testFeedHomePageShowsNoRecordsMessageWhenNoRecordsArePresent()
    {
        $mockTable = \Mockery::mock('BabyMonitor\Tables\FeedTable');
        $mockTable->shouldReceive('fetchMostRecentFeeds')
            ->once()
            ->andReturn(new ResultSet());

        $serviceManager = $this->getApplicationServiceLocator();
        $serviceManager->setAllowOverride(true);
        $serviceManager->setService(
            'BabyMonitor\Tables\FeedTable', $mockTable
        );
        $serviceManager->setService(
            'BabyMonitor\Cache\Application', null
        );

        $this->dispatch('/baby-monitor');
        $this->assertResponseStatusCode(200);
        $this->assertModuleName('BabyMonitor');
        $this->assertControllerName(
            'BabyMonitor\Controller\Feeds'
        );
        $this->assertControllerClass(
            'FeedsController'
        );
        $this->assertActionName("Index");
        $this->assertMatchedRouteName('feeds/action');
        $this->assertQueryContentContains(
            "h1", "Feeds Home"
        );
        $this->assertQueryContentContains(
            "td", "No Records Available"
        );
    }

    public function testFeedHomePageCanBeAccessed()
    {
        $this->dispatch('/baby-monitor');
        $this->assertResponseStatusCode(200);
        $this->assertModuleName('BabyMonitor');
        $this->assertControllerName(
            'BabyMonitor\Controller\Feeds'
        );
        $this->assertControllerClass(
            'FeedsController'
        );
        $this->assertActionName("Index");
        $this->assertMatchedRouteName('feeds');
        $this->assertQueryContentContains(
            "h1", "Feeds Home"
        );

    }

    public function testFeedManagePageCanBeAccessed()
    {
        $this->dispatch('/baby-monitor/feeds/manage');
        $this->assertResponseStatusCode(200);
        $this->assertModuleName('BabyMonitor');
        $this->assertControllerName(
            'BabyMonitor\Controller\Feeds'
        );
        $this->assertControllerClass(
            'FeedsController'
        );
        $this->assertActionName("Manage");
        $this->assertMatchedRouteName('feeds/manage');
        $this->assertQueryContentContains(
            "h1", "Manage Feeds"
        );
    }

    public function testFeedHomePageShowsRecordsWhenRecordsArePresent()
    {
        $feed = new FeedModel();
        $feed->exchangeArray(array(
            'userId' => 2,
            'feedId' => 1,
            'feedDate' => "01-01-2014",
            'feedTime' => "19:00",
            'feedAmount' => 131,
            'feedTemperature' => 34,
            'feedNotes' => "Nothing to say really"
        ));

        $resultSet = new ResultSet();
        $resultSet->initialize(array($feed));

        $mockTable = \Mockery::mock('BabyMonitor\Tables\FeedTable');
        $mockTable->shouldReceive('fetchMostRecentFeeds')
            ->once()
            ->andReturn($resultSet);

        $serviceManager = $this->getApplicationServiceLocator();
        $serviceManager->setAllowOverride(true);
        $serviceManager->setService(
            'BabyMonitor\Tables\FeedTable', $mockTable
        );

        $this->dispatch('/baby-monitor/feeds');

        $this->assertResponseStatusCode(200);
        $this->assertModuleName('BabyMonitor');
        $this->assertControllerName(
            'BabyMonitor\Controller\Feeds'
        );
        $this->assertControllerClass(
            'FeedsController'
        );
        $this->assertActionName("Index");
        $this->assertMatchedRouteName('feeds/action');
        $this->assertQueryContentContains(
            "h1", "Feeds Home"
        );

        $this->assertQueryContentContains(
            "td[class='feed-date']", "Jan 1, 2014, 7:00:00 PM"
        );
        $this->assertQueryContentContains(
            "td[class='feed-amount']", "131"
        );
        $this->assertQueryContentContains(
            "td[class='feed-temperature']", "34"
        );
    }

}


text:
/**
 * \addtogroup cc2538
 * @{
 *
 * \defgroup cc2538-cfs-coffee-arch cc2538 Coffee port module
 *
 * Module for the cc2538 Coffee port
 * @{
 *
 * \file
 * Header file for the cc2538 Coffee port module
 */
#ifndef CFS_COFFEE_ARCH_H_
#define CFS_COFFEE_ARCH_H_

#include "contiki-conf.h"
#include "cfs/cfs-coffee.h"
#include "dev/cc2538-dev.h"
#include "dev/flash.h"

#include <stdint.h>

#ifdef COFFEE_CONF_CUSTOM_PORT
#include COFFEE_CONF_CUSTOM_PORT
#else
/*---------------------------------------------------------------------------*/
/** \name Coffee port constants
 * @{
 */
/** Logical sector size */
#ifdef COFFEE_CONF_SECTOR_SIZE
#define COFFEE_SECTOR_SIZE     COFFEE_CONF_SECTOR_SIZE
#else
#define COFFEE_SECTOR_SIZE     FLASH_PAGE_SIZE
#endif
/** Logical page size */
#ifdef COFFEE_CONF_PAGE_SIZE
#define COFFEE_PAGE_SIZE       COFFEE_CONF_PAGE_SIZE
#else
#define COFFEE_PAGE_SIZE       (COFFEE_SECTOR_SIZE / 8)
#endif
/** Start offset of the file system */
#ifdef COFFEE_CONF_START
#define COFFEE_START           COFFEE_CONF_START
#else
#define COFFEE_START           CC2538_DEV_FLASH_ADDR
#endif
/** Total size in bytes of the file system */
#ifdef COFFEE_CONF_SIZE
#define COFFEE_SIZE            COFFEE_CONF_SIZE
#else
#define COFFEE_SIZE            0
#endif
/** Maximal filename length */
#ifdef COFFEE_CONF_NAME_LENGTH
#define COFFEE_NAME_LENGTH     COFFEE_CONF_NAME_LENGTH
#else
#define COFFEE_NAME_LENGTH     40
#endif
/** Number of file cache entries */
#ifdef COFFEE_CONF_MAX_OPEN_FILES
#define COFFEE_MAX_OPEN_FILES  COFFEE_CONF_MAX_OPEN_FILES
#else
#define COFFEE_MAX_OPEN_FILES  5
#endif
/** Number of file descriptor entries */
#ifdef COFFEE_CONF_FD_SET_SIZE
#define COFFEE_FD_SET_SIZE     COFFEE_CONF_FD_SET_SIZE
#else
#define COFFEE_FD_SET_SIZE     5
#endif
/** Maximal amount of log table entries read in one batch */
#ifdef COFFEE_CONF_LOG_TABLE_LIMIT
#define COFFEE_LOG_TABLE_LIMIT COFFEE_CONF_LOG_TABLE_LIMIT
#else
#define COFFEE_LOG_TABLE_LIMIT 16
#endif
/** Default reserved file size */
#ifdef COFFEE_CONF_DYN_SIZE
#define COFFEE_DYN_SIZE        COFFEE_CONF_DYN_SIZE
#else
#define COFFEE_DYN_SIZE        (COFFEE_SECTOR_SIZE - 50)
#endif
/** Default micro-log size */
#ifdef COFFEE_CONF_LOG_SIZE
#define COFFEE_LOG_SIZE        COFFEE_CONF_LOG_SIZE
#else
#define COFFEE_LOG_SIZE        (4 * COFFEE_PAGE_SIZE)
#endif
/** Whether Coffee will use micro logs */
#ifdef COFFEE_CONF_MICRO_LOGS
#define COFFEE_MICRO_LOGS      COFFEE_CONF_MICRO_LOGS
#else
#define COFFEE_MICRO_LOGS      0
#endif
/** Whether files are expected to be appended to only */
#ifdef COFFEE_CONF_APPEND_ONLY
#define COFFEE_APPEND_ONLY     COFFEE_CONF_APPEND_ONLY
#else
#define COFFEE_APPEND_ONLY     1
#endif
/** @} */
/*---------------------------------------------------------------------------*/
/** \name Coffee port macros
 * @{
 */
/** Erase */
#define COFFEE_ERASE(sector) \
  cfs_coffee_arch_erase(sector)
/** Write */
#define COFFEE_WRITE(buf, size, offset) \
  cfs_coffee_arch_write((buf), (size), (offset))
/** Read */
#define COFFEE_READ(buf, size, offset) \
  cfs_coffee_arch_read((buf), (size), (offset))
/** @} */
/*---------------------------------------------------------------------------*/
/** \name Coffee port types
 * @{
 */
typedef int16_t coffee_page_t; /**< Page */
/** @} */
/*---------------------------------------------------------------------------*/
/** \name Coffee port functions
 * @{
 */

/** \brief Erases a device sector
 * \param sector Sector to erase
 */
void cfs_coffee_arch_erase(uint16_t sector);

/** \brief Writes a buffer to the device
 * \param buf Pointer to the buffer
 * \param size Byte size of the buffer
 * \param offset Device offset to write to
 */
void cfs_coffee_arch_write(const void *buf, unsigned int size,
                           cfs_offset_t offset);

/** \brief Reads from the device to a buffer
 * \param buf Pointer to the buffer
 * \param size Byte size of the buffer
 * \param offset Device offset to read from
 */
void cfs_coffee_arch_read(void *buf, unsigned int size, cfs_offset_t offset);

/** @} */

#endif /* COFFEE_CONF_CUSTOM_PORT */
#endif /* CFS_COFFEE_ARCH_H_ */

/**
 * @}
 * @}
 */


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>F. Biamonte | My bits</title>
    <link>http://lpantano.github.io/author/f.-biamonte/</link>
      <atom:link href="http://lpantano.github.io/author/f.-biamonte/index.xml" rel="self" type="application/rss+xml" />
    <description>F. Biamonte</description>
    <generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Wed, 01 Jan 2014 00:00:00 +0000</lastBuildDate>
    <image>
      <url>http://lpantano.github.io/images/icon_hu0b7a4cb9992c9ac0e91bd28ffd38dd00_9727_512x512_fill_lanczos_center_3.png</url>
      <title>F. Biamonte</title>
      <link>http://lpantano.github.io/author/f.-biamonte/</link>
    </image>

    <item>
      <title>Regulation of miRNA strand selection: follow the leader?</title>
      <link>http://lpantano.github.io/publication/meijer-2014/</link>
      <pubDate>Wed, 01 Jan 2014 00:00:00 +0000</pubDate>
      <guid>http://lpantano.github.io/publication/meijer-2014/</guid>
      <description></description>
    </item>

  </channel>
</rss>


text:
cask "clion" do
  version "2020.3.1,203.6682.181"
  sha256 "53ac84ce8c13be1fd560d5d96015173e2544a2b8f0b15424a04ba5fea969973a"

  url "https://download.jetbrains.com/cpp/CLion-#{version.before_comma}.dmg"
  appcast "https://data.services.jetbrains.com/products/releases?code=CL&latest=true&type=release"
  name "CLion"
  desc "C and C++ IDE"
  homepage "https://www.jetbrains.com/clion/"

  auto_updates true

  app "CLion.app"

  uninstall_postflight do
    ENV["PATH"].split(File::PATH_SEPARATOR).map { |path| File.join(path, "clion") }.each do |path|
      if File.exist?(path) &&
         File.readlines(path).grep(/# see com.intellij.idea.SocketLock for the server side of this interface/).any?
        File.delete(path)
      end
    end
  end

  zap trash: [
    "~/Library/Application Support/CLion#{version.major_minor}",
    "~/Library/Caches/CLion#{version.major_minor}",
    "~/Library/Logs/CLion#{version.major_minor}",
    "~/Library/Preferences/CLion#{version.major_minor}",
  ]
end


text:
import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;

/**
 * Created by xinmei on 16/1/5.
 */
public class DemoApp extends Application {

    public static Context applicationContext;
    private static DemoApp instance;
    private static boolean mIsLive;

    @Override
    public void onCreate() {
        super.onCreate();
        applicationContext = this;
        instance = this;

        //init demo helper
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    public static DemoApp getInstance() {
        return instance;
    }

    public static boolean isIsLive() {
        return mIsLive;
    }

    public static void setIsLive(boolean isLive) {
        mIsLive = isLive;
    }
}


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>
      <groupId>com.dianping.cat</groupId>
      <artifactId>parent</artifactId>
      <version>1.3.6-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>cat-agent</artifactId>
   <name>cat-agent</name>
   <packaging>war</packaging>
   <dependencies>
      <dependency>
         <groupId>org.unidal.framework</groupId>
         <artifactId>foundation-service</artifactId>
      </dependency>
      <dependency>
         <groupId>com.dianping.cat</groupId>
         <artifactId>cat-client</artifactId>
      </dependency>
      <dependency>
         <groupId>com.google.code.gson</groupId>
         <artifactId>gson</artifactId>
         <version>1.6</version>
      </dependency>
      <dependency>
         <groupId>org.unidal.webres</groupId>
         <artifactId>WebResServer</artifactId>
      </dependency>
      <dependency>
         <groupId>org.unidal.framework</groupId>
         <artifactId>web-framework</artifactId>
      </dependency>
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
      </dependency>
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>jstl</artifactId>
         <version>1.2</version>
      </dependency>
	 <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jsp-api-2.1</artifactId>
         <version>6.1.14</version>
         <scope>compile</scope>
      </dependency>
      <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jsp-2.1</artifactId>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jetty</artifactId>
      </dependency>
      <dependency>
         <groupId>org.unidal.framework</groupId>
         <artifactId>test-framework</artifactId>
      </dependency>
	  <dependency>
		<groupId>org.fusesource</groupId>
  		<artifactId>sigar</artifactId>
  		<version>1.6.4</version>
	  </dependency>
   </dependencies>
   <build>
      <resources>
         <resource>
            <directory>${basedir}/src/main/resources</directory>
            <filtering>true</filtering>
         </resource>
      </resources>
      <plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
	                <webResources>
	                    <resource>
	                        <directory>${basedir}/lib</directory>
	                        <targetPath>WEB-INF/lib</targetPath>
	                        <filtering>false</filtering>
	                        <includes>
	                            <include>**/*.so</include>
	                            <include>**/*.sl</include>
	                            <include>**/*.dylib</include>
	                            <include>**/*.dll</include>
	                            <include>**/*.lib</include>
	                        </includes>
	                    </resource>
	                </webResources>
	            </configuration>
		</plugin>
         <plugin>
            <groupId>org.unidal.maven.plugins</groupId>
            <artifactId>plexus-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>generate plexus component descriptor</id>
                  <phase>process-classes</phase>
                  <goals>
                     <goal>plexus</goal>
                  </goals>
                  <configuration>
                     <className>com.dianping.cat.agent.build.ComponentsConfigurator</className>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <properties>
      <packaging>war</packaging>
      <env>alpha</env>
      <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
   </properties>
</project>


text:
import { InjectionToken, Injector, Provider } from '@angular/core';
/**
 * An id that identifies a particular application being bootstrapped, that should
 * match across the client/server boundary.
 */
export declare const TRANSITION_ID: InjectionToken<{}>;
export declare function appInitializerFactory(transitionId: string, document: any, injector: Injector): () => void;
export declare const SERVER_TRANSITION_PROVIDERS: Provider[];


text:
from setuptools import setup, find_packages

setup(name='blog_frontend',
      version='v1.0.0',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=False,
      install_requires=[
          # -*- Extra requirements: -*-
          'pyramid',
      ],
      entry_points="""
        # -*- Entry points: -*-
        [paste.filter_app_factory]
        blog_frontend = blog_frontend:FrontendFilter
      """,
)


text:
SELECT t.table_catalog as database_name,
                              t.table_name, t.table_type,
                              c.column_name,
                              c.column_default as column_default_value,
                              c.is_nullable as column_nullable,
                              c.data_type as column_type,
                              c.character_maximum_length as
                              column_char_length,
                              c.numeric_precision as
                              column_numeric_precision
                            FROM information_schema.tables t
                                JOIN  information_schema.columns c
                                on c.table_name = t.table_name
                            WHERE t.table_schema NOT IN
                                ('mysql', 'information_schema',
                                 'performance_schema', 'sys')
                            AND c.table_schema NOT IN
                                ('mysql', 'information_schema',
                                 'performance_schema', 'sys')
                            ORDER BY t.table_name, c.column_name;