text:
package org.jbpm.workbench.pr.model;

import java.util.Collection;
import java.util.Map;

import org.jboss.errai.common.client.api.annotations.Portable;
import org.jbpm.workbench.common.model.GenericSummary;

@Portable
public class ProcessSummary extends GenericSummary<String> {

    private String processDefId;
    private String processDefName;
    private String version;
    private String deploymentId;
    private boolean dynamic;
    private Map<String, String[]> associatedEntities;
    private Map<String, String> serviceTasks;
    private Map<String, String> processVariables;
    private Collection<String> reusableSubProcesses;

    public ProcessSummary() {
    }

    public ProcessSummary(String processDefId,
                          String processDefName,
                          String deploymentId,
                          String version,
                          boolean dynamic) {
        super(processDefId,
              processDefName);
        this.processDefId = processDefId;
        this.processDefName = processDefName;
        this.deploymentId = deploymentId;
        this.version = version;
        this.dynamic = dynamic;
    }

    public String getProcessDefId() {
        return processDefId;
    }

    public void setProcessDefId(String processDefId) {
        this.processDefId = processDefId;
    }

    public String getProcessDefName() {
        return processDefName;
    }

    public void setProcessDefName(String processDefName) {
        this.processDefName = processDefName;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getDeploymentId() {
        return deploymentId;
    }

    public void setDeploymentId(String deploymentId) {
        this.deploymentId = deploymentId;
    }

    public Map<String, String[]> getAssociatedEntities() {
        return associatedEntities;
    }

    public void setAssociatedEntities(Map<String, String[]> associatedEntities) {
        this.associatedEntities = associatedEntities;
    }

    public Map<String, String> getServiceTasks() {
        return serviceTasks;
    }

    public void setServiceTasks(Map<String, String> serviceTasks) {
        this.serviceTasks = serviceTasks;
    }

    public Map<String, String> getProcessVariables() {
        return processVariables;
    }

    public void setProcessVariables(Map<String, String> processVariables) {
        this.processVariables = processVariables;
    }

    public Collection<String> getReusableSubProcesses() {
        return reusableSubProcesses;
    }

    public void setReusableSubProcesses(Collection<String> reusableSubProcesses) {
        this.reusableSubProcesses = reusableSubProcesses;
    }

    public boolean isDynamic() {
        return dynamic;
    }

    public void setDynamic(Boolean dynamic) {
        this.dynamic = dynamic;
    }

    @Override
    public String toString() {
        return "ProcessSummary{" +
                "processDefId='" + processDefId + '\'' +
                ", processDefName='" + processDefName + '\'' +
                ", version='" + version + '\'' +
                ", deploymentId='" + deploymentId + '\'' +
                ", dynamic=" + dynamic +
                ", associatedEntities=" + associatedEntities +
                ", serviceTasks=" + serviceTasks +
                ", processVariables=" + processVariables +
                ", reusableSubProcesses=" + reusableSubProcesses +
                '}';
    }
}


text:
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var http_1 = require("@angular/http");
require("rxjs/add/operator/map");
var globals = require("../globals");
var FormsService = /** @class */ (function () {
    function FormsService(_http) {
        this._http = _http;
        this.url = globals.app_url;
    }
    FormsService.prototype.populateForms = function (token, forms) {
        var json = JSON.stringify(forms);
        var params = "json=" + json + "&authorization=" + token;
        var headers = new http_1.Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
        return this._http.post(this.url + "/soporte/forms", params, { headers: headers })
            .map(function (res) { return res.json(); });
    };
    FormsService = __decorate([
        core_1.Injectable(),
        __metadata("design:paramtypes", [http_1.Http])
    ], FormsService);
    return FormsService;
}());
exports.FormsService = FormsService;
//# sourceMappingURL=forms.service.js.map

redpajama_set_name: RedPajamaGithub


text:
module.exports = {
    startAsync: function (success, fail, args) {
        try {
            var uri = new Windows.Foundation.Uri(args[0]),
                resultFilePath = args[1];

            // Forward slashes (/) are not accepted by getFileFromPathAsync
            // http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.storagefile.getfilefrompathasync
            resultFilePath = resultFilePath.split('/').join('\\');

            var completeHandler = function() {
                success();
            };
            var errorHandler = function(err) {
                fail(err);
            };
            var progressHandler = function (operation) {

                var progress = {
                    bytesReceived: operation.progress.bytesReceived,
                    totalBytesToReceive: operation.progress.totalBytesToReceive
                };

                success({
                    progress: progress,
                    keepCallback: true
                });
            };

            var downloadLocation;

            var downloadPromise = Windows.Storage.StorageFile.getFileFromPathAsync(resultFilePath).then(
                function (file) {
                    downloadLocation = file;
                }, errorHandler).then(function () {
                    return Windows.Networking.BackgroundTransfer.BackgroundDownloader.getCurrentDownloadsAsync();
                }, errorHandler).then(function (downloads) {
                    // After app termination, an app should enumerate all existing DownloadOperation instances at next start-up using
                    // GetCurrentDownloadsAsync. When a Windows Store app using Background Transfer is terminated, incomplete downloads
                    // will persist in the background. If the app is restarted after termination and operations from the previous
                    // session are not enumerated and re-attached to the current session, they will remain incomplete and continue to occupy resources
                    // http://msdn.microsoft.com/library/windows/apps/br207126
                    for (var i = 0; i < downloads.size; i++) {
                        if (downloads[i].requestedUri.absoluteUri == uri.absoluteUri) {
                            // resume download
                            return downloads[i].attachAsync();
                        }
                    }
                    // new download
                    return Windows.Networking.BackgroundTransfer.BackgroundDownloader().createDownload(uri, downloadLocation).startAsync();
                }, errorHandler);

            // attach callbacks
            downloadPromise.then(completeHandler, errorHandler, progressHandler);
            // save operation promise to be able to stop it later
            BackgroundTransfer.activeDownloads = BackgroundTransfer.activeDownloads || [];
            BackgroundTransfer.activeDownloads[uri.absoluteUri] = downloadPromise;

        } catch(ex) {
            fail(ex);
        }

    },
    stop: function (success, fail, args) {
        try {
            var uri = new Windows.Foundation.Uri(args[0]);

            if (BackgroundTransfer.activeDownloads && BackgroundTransfer.activeDownloads[uri.absoluteUri]) {
                BackgroundTransfer.activeDownloads[uri.absoluteUri].cancel();
                BackgroundTransfer.activeDownloads[uri.absoluteUri] = null;
            }

            success();

        } catch(ex) {
            fail(ex);
        }
    }
};
require("cordova/windows8/commandProxy").add("BackgroundDownload", module.exports);


text:
"use strict";
import { defineReadOnly } from "@ethersproject/properties";
import { WebSocketProvider } from "./websocket-provider";
import { showThrottleMessage } from "./formatter";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
const defaultProjectId = "84842078b09946638c03157f83405213";
export class InfuraWebSocketProvider extends WebSocketProvider {
    constructor(network, apiKey) {
        const provider = new InfuraProvider(network, apiKey);
        const connection = provider.connection;
        if (connection.password) {
            logger.throwError("INFURA WebSocket project secrets unsupported", Logger.errors.UNSUPPORTED_OPERATION, {
                operation: "InfuraProvider.getWebSocketProvider()"
            });
        }
        const url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
        super(url, network);
        defineReadOnly(this, "apiKey", provider.projectId);
        defineReadOnly(this, "projectId", provider.projectId);
        defineReadOnly(this, "projectSecret", provider.projectSecret);
    }
    isCommunityResource() {
        return (this.projectId === defaultProjectId);
    }
}
export class InfuraProvider extends UrlJsonRpcProvider {
    static getWebSocketProvider(network, apiKey) {
        return new InfuraWebSocketProvider(network, apiKey);
    }
    static getApiKey(apiKey) {
        const apiKeyObj = {
            apiKey: defaultProjectId,
            projectId: defaultProjectId,
            projectSecret: null
        };
        if (apiKey == null) {
            return apiKeyObj;
        }
        if (typeof (apiKey) === "string") {
            apiKeyObj.projectId = apiKey;
        }
        else if (apiKey.projectSecret != null) {
            logger.assertArgument((typeof (apiKey.projectId) === "string"), "projectSecret requires a projectId", "projectId", apiKey.projectId);
            logger.assertArgument((typeof (apiKey.projectSecret) === "string"), "invalid projectSecret", "projectSecret", "[REDACTED]");
            apiKeyObj.projectId = apiKey.projectId;
            apiKeyObj.projectSecret = apiKey.projectSecret;
        }
        else if (apiKey.projectId) {
            apiKeyObj.projectId = apiKey.projectId;
        }
        apiKeyObj.apiKey = apiKeyObj.projectId;
        return apiKeyObj;
    }
    static getUrl(network, apiKey) {
        let host = null;
        switch (network ? network.name : "unknown") {
            case "homestead":
                host = "mainnet.infura.io";
                break;
            case "goerli":
                host = "goerli.infura.io";
                break;
            case "sepolia":
                host = "sepolia.infura.io";
                break;
            case "matic":
                host = "polygon-mainnet.infura.io";
                break;
            case "maticmum":
                host = "polygon-mumbai.infura.io";
                break;
            case "optimism":
                host = "optimism-mainnet.infura.io";
                break;
            case "optimism-goerli":
                host = "optimism-goerli.infura.io";
                break;
            case "arbitrum":
                host = "arbitrum-mainnet.infura.io";
                break;
            case "arbitrum-goerli":
                host = "arbitrum-goerli.infura.io";
                break;
            default:
                logger.throwError("unsupported network", Logger.errors.INVALID_ARGUMENT, {
                    argument: "network",
                    value: network
                });
        }
        const connection = {
            allowGzip: true,
            url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
            throttleCallback: (attempt, url) => {
                if (apiKey.projectId === defaultProjectId) {
                    showThrottleMessage();
                }
                return Promise.resolve(true);
            }
        };
        if (apiKey.projectSecret != null) {
            connection.user = "";
            connection.password = apiKey.projectSecret;
        }
        return connection;
    }
    isCommunityResource() {
        return (this.projectId === defaultProjectId);
    }
}
//# sourceMappingURL=infura-provider.js.map


text:
/*jshint unused:vars */
/*jslint unparam: true*/
/*exported  promotionFixture */
var promotionFixture = (function () {
    "use strict";

    function getStompClient() {
        var StompClient = function StompClient() {return this; };
        StompClient.prototype = {
            connect : function (header, callback) {
                callback();
            },
            subscribe : function (destination, callback) {
                if ("/user/queue/updates" === destination) {
                    this.userSubscribe = callback;
                } else {
                    this.topicSubscribe = callback;
                }
            },
            send : function (destination, priority, message) {
                return {
                    destination : destination,
                    priority : priority,
                    message : message
                };
            },
            getUserSubscribe : function () {
                return this.userSubscribe;
            },
            getTopicSubscribe : function () {
                return this.topicSubscribe;
            }
        };

        return new StompClient();
    }

    function setUp(promotionModule, promotionAction) {
        var stompClient = getStompClient(),
            message = {
                headers : {
                    TYPE : "STATUS"
                },
                body : "PAWN_PROMOTION (A,1)"
            },
            connection;

        connection = new promotionModule.OneViewStompConnection();
        connection.stompClient = stompClient;
        connection.setUpStompConnection(promotionAction.handleUserInteract);

        return {
            message : message,
            stompClient : stompClient
        };
    }

    function sendStatusMessageToUser(promotionModule, promotionAction) {
        var squareOfPawn,
            obj = setUp(promotionModule, promotionAction);
        squareOfPawn =  obj.stompClient.getUserSubscribe().call(obj.stompClient, obj.message);
        return squareOfPawn;
    }

    function sendStatusMessageToTopic(promotionModule, promotionAction) {
        var squareOfPawn,
            obj = setUp(promotionModule, promotionAction);

        squareOfPawn =  obj.stompClient.getTopicSubscribe().call(obj.stompClient, obj.message);
        return squareOfPawn;
    }

    function sendErrorMessageToTopic(promotionModule, promotionAction) {
        var squareOfPawn,
            obj = setUp(promotionModule, promotionAction),
            message = {
                headers : { TYPE : "ERROR" },
                body : "Error can't promoted other player piece"
            };

        squareOfPawn =  obj.stompClient.getTopicSubscribe().call(obj.stompClient, message);

        return squareOfPawn;
    }

    function sendErrorMessageToUser(promotionModule, promotionAction) {
        var squareOfPawn,
            obj = setUp(promotionModule, promotionAction),
            message = {
                headers : {
                    TYPE : "ERROR"
                },
                body : "Error can't promoted other player piece"
            };

        squareOfPawn =  obj.stompClient.getUserSubscribe().call(obj.stompClient, message);
        return squareOfPawn;
    }

    function sendStatusMessageToTwoViewTopic(promotionModule, promotionAction) {
        var squareOfPawn,
            stompClient = getStompClient(),
            message = {
                headers : {
                    TYPE : "STATUS"
                },
                body : "PAWN_PROMOTION (A,1)"
            },
            connection;

        connection = new promotionModule.TwoViewStompConnection();
        connection.stompClient = stompClient;
        connection.setUpStompConnection(promotionAction.handleUserInteract);

        squareOfPawn =  stompClient.getTopicSubscribe().call(stompClient, message);
        return squareOfPawn;
    }
    return {
        sendStatusMessageToUser : sendStatusMessageToUser,
        sendStatusMessageToTopic : sendStatusMessageToTopic,
        sendErrorMessageToTopic : sendErrorMessageToTopic,
        sendErrorMessageToUser : sendErrorMessageToUser,
        sendStatusMessageToTwoViewTopic : sendStatusMessageToTwoViewTopic,
        getStompClient : getStompClient
    };
}());


text:
import EventDispatcher from "../events/EventDispatcher";

import $ from "../utils/DOMUtils"
import app from "../app";

export default class Theme extends EventDispatcher {
	constructor (el) {
		super();
		this.el = el;
		this.urlTemplate = "./assets/themes/%name%.css";
		this.targetNode = this._node = null;
		this._dark = false;
		this._initUI();
		this.dark = !!app.prefs.read("dark");
	}

	set dark(val) {
		val = !!val;
		if (this._dark === val) { return; }
		this._dark = val;
		this._load(val ? "dark" : null);
		$.toggleClass(this.themeBtn, "selected", val);
		app.prefs.write("dark", val);
	}

	get dark() {
		return this._dark;
	}

	_initUI() {
		this.themeBtn = $.query(".header .button.theme", this.el);
		this.themeBtn.addEventListener("click", (evt) => this._toggleTheme());
	}

	_load(id) {
		if (id === this._id) { return; }
		this._id = id;
		if (this._node) { this._node.remove(); }
		if (!id) { this._change(); return; }
		let tmpl = this.urlTemplate, n = $.create("link");
		n.addEventListener("load", () => this._change());
		n.rel = "stylesheet";
		n.type = "text/css";
		n.href = tmpl ? tmpl.replace(/%name%/g, id) : id;
		this._node = (this.targetNode || document.head).appendChild(n);
	}

	_change() {
		this.dispatchEvent("change");
	}

	_toggleTheme() {
		this.dark = !this.dark;
	}

}


text:
'use strict';

var PuchamonService = angular.module('PuchamonService', []);

PuchamonService.factory('PuchamonData', function ($http) {
	var obj = {};

    obj.getPuchamons = function () {
    	/*
		Data returns:
			{
				attack: 49
				curve: 1.3
				defense: 49
				evolveLevel: 16
				evolveTo: "2"
				levels: Array[2]
				moves: Array[2]
				name: "Bulbasaur"
				probability: 3
				type: "grass"
			}
		*/
        return $http.get('models/pokemons.json');
    }

    obj.seePuchamon = function(puchamons) {};

 	return obj;
});

PuchamonService.factory("PuchamonDetail", function ($http) {
	var obj = {};

    obj.puchamonDetail = function (puchamonNumber) {
    	var pokeUrl = 'http://pokeapi.co/api/v1/pokemon/';

    	return $http.get(pokeUrl + parseInt(puchamonNumber));
    }

    obj.returnToListView = function () {};

 	return obj;
});


text:
'use strict';

angular.module('mean.translate').factory('Translate', [
    function() {
        return {
            name: 'translate'
        };
    }
]);


text:
require 'json'

module Reality::Describers::Wikidata::Impl
  # Thin wrapper around MediaWiki API response.
  #
  # It provides services for separating metadata of response of its essential data, continuing multi-
  # page responses, and converting response errors into exceptions.
  #
  # You should not instantiate this class, it is obtained by some {Actions Action}'s {Actions::Base#response #response}.
  class Response
    # Response fail was returned by target MediaWiki API.
    Error = Class.new(RuntimeError)

    # @private
    METADATA_KEYS = %w[error warnings batchcomplete continue success limits].freeze

    # @private
    def self.parse(action, response_body)
      new(action, JSON.parse(response_body))
    end

    # Entire response "as is", including contents and metadata parts.
    #
    # See {#to_h} for content part of the response and {#metadata} for metadata part.
    #
    # @return [Hash]
    attr_reader :raw

    # Metadata part of the response, keys like "error", "warnings", "continue".
    #
    # See {#to_h} for content part of the response and {#raw} for entire response.
    #
    # @return [Hash]
    attr_reader :metadata

    # @private
    def initialize(action, response_hash)
      @action = action
      @raw = response_hash.freeze
      @metadata, @data = response_hash.partition { |key, _| METADATA_KEYS.include?(key) }.map(&:to_h).map(&:freeze)
      error! if @metadata['error']
    end

    # "Content" part of the response as a plain Ruby Hash.
    #
    # @return [Hash]
    def to_h
      # For most of actions, like query, all response is inside additional "query" key,
      # ...but not for all.
      @data.key?(@action.name) ? @data.fetch(@action.name) : @data
    end

    # Fetches a key from response content.
    #
    # @param key [String] Key name.
    def [](key)
      to_h[key]
    end

    # Digs for a keys from response content.
    #
    # @param keys [Array<String>] Key names.
    def dig(*keys)
      hash_dig(to_h, *keys)
    end

    # Returns `true` if there is next pages of response. See also {#continue}
    def continue?
      @metadata.key?('continue')
    end

    # Continues current request and returns current & next pages merged. (Merging is necessary
    # because MediaWiki tends to return the same object's data continued on the next request page.)
    #
    # @return [Response]
    def continue
      fail 'This is the last page' unless continue?

      action = @action.merge(@metadata.fetch('continue'))

      self.class.new(action, merge_responses(JSON.parse(action.perform)))
    end

    # @return [String]
    def inspect
      "#<#{self.class.name}(#{@action.name}): #{to_h.keys.join(', ')}#{' (can continue)' if continue?}>"
    end

    private

    def merge_responses(new_response)
      merger = lambda do |_k, v1, v2|
        if v1.is_a?(Hash) && v2.is_a?(Hash)
          v1.merge(v2, &merger)
        elsif v1.is_a?(Array) && v2.is_a?(Array)
          v1 + v2
        else
          v2
        end
      end

      # Newest page is responsible for all metadata, so we take entire new response and only data
      # part of old one.
      #
      # Deep recursive merge is necessary because MediaWiki could split response in parts unpredicatably
      # (like ['query']['pages'][some_page_id] can be present on several pages, providing different
      # parts of a page).
      @data.merge(new_response, &merger)
    end

    def error!
      fail Error, hash_dig(@metadata, 'error', 'info')
    end

    # TODO: replace with Hash#dig when minimal Ruby version would be 2.3
    def hash_dig(hash, *keys)
      keys.inject(hash) { |res, key| res[key] or return nil }
    end
  end
end


text:
package jp.co.seattleconsulting.dto;

import java.util.ArrayList;
import java.util.List;

import jp.co.seattleconsulting.entity.Employees;

/**
 * relationship-buildingのDtoクラス
 *
 * @author Endo
 */
public class RelationshipViewDto {

	public List<RelationshipDto> relationshipDtos = new ArrayList<>();

	public static class RelationshipDto {
		public RelationshipDto() {}

		public RelationshipDto(Integer empNo, String empName, String empFurigana, String birthday, String tel, String note,Integer deleteFlag, Integer status) {
			this.empNo = empNo;
			this.empName = empName;
			this.empFurigana = empFurigana;
			this.birthday = birthday;
			this.tel = tel;
			this.note = note;
			this.deleteFlag = deleteFlag;
			this.status = status;
		}

		public RelationshipDto(Employees employees) {
			this.empNo = employees.empNo;
			this.empName = employees.empName;
			this.empFurigana = employees.empFurigana;
			this.birthday = employees.birthday;
			this.tel = employees.tel;
			this.note = employees.note;
			this.deleteFlag = employees.deleteFlag;
			this.status = employees.status;
		}

		public Integer empNo;
		public String empName;
		public String empFurigana;
		public String birthday;
		public String tel;
		public String note;
		public Integer deleteFlag;
		public Integer status;

		public String birthYear;
		public String birthMonth;
		public String birthDay;
	}

}


text:
package max.waitzman.oopshelpme;

import android.content.Context;
import android.os.Handler;
import android.support.multidex.MultiDexApplication;

import com.facebook.FacebookSdk;
import com.firebase.client.Firebase;

import max.waitzman.oopshelpme.utils.AppStartProfiles;

/*import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;*/

public class ApplicationMy extends MultiDexApplication {//Application
    private static Context context;
    private static Firebase firebase;

    private static Context mAppContext;
    private static Handler mUIhanlder;

    @Override
    public void onCreate() {
        super.onCreate();
        Firebase.setAndroidContext(this);
        firebase = new Firebase(getString(R.string.firebase_url));
        FacebookSdk.sdkInitialize(getApplicationContext());
        /*new Runnable() {
            @Override
            public void run() {
                //Your code
            }
        }.run();*/

        context = this;

	    mAppContext = getApplicationContext();
	    mUIhanlder = new Handler();

        //AppStartProfiles appStartProfiles= new AppStartProfiles();
        switch ( new AppStartProfiles().checkAppStart()) {
            case NORMAL:
                // We don't want to get on the user's nerves
                break;
            case FIRST_TIME_VERSION:
                // TODO show what's new
                //ReceiverAdvisoryNotification.scheduleAdvisoryNotification(getApplicationContext());
                break;
            case FIRST_TIME:
                // TODO show a tutorial
                //ReceiverAdvisoryNotification.scheduleAdvisoryNotification(getApplicationContext());
                break;
            default:
                break;
        }

    }

    /**
     * Set the base context for this ContextWrapper.  All calls will then be
     * delegated to the base context.  Throws
     * IllegalStateException if a base context has already been set.
     *
     * @param //base The new base context for this wrapper.
     */
    /*@Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }*/

    public static Context getContext(){
        return context;
    }

    public static Context getAppContext() {
        return mAppContext;
    }

    public static Handler getUIhanlder() {
        return mUIhanlder;
    }

    public static Firebase getFirebase() {
        return firebase;
    }

    /*public static ApiClient getApiClient()
    {
        return apiClient;
    }*/
}


text:
package de.lsem.simulation.property;

import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.graphiti.ui.platform.GFPropertySection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;

import de.lsem.repository.model.simulation.Activity;
import de.lsem.repository.model.simulation.IActivity;
import de.lsem.simulation.util.ElementConstants;

public class SinkMainSection extends GFPropertySection implements ITabbedPropertyConstants {

	private Text nameText;

	@Override
	public void createControls(Composite parent,
			TabbedPropertySheetPage tabbedPropertySheetPage) {
		super.createControls(parent, tabbedPropertySheetPage);

		TabbedPropertySheetWidgetFactory factory = getWidgetFactory();
		Composite composite = factory.createFlatFormComposite(parent);
		FormData data;

		nameText = factory.createText(composite, ElementConstants.LABEL_EMPTY);
		data = new FormData();
		data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
		data.right = new FormAttachment(100, 0);
		data.top = new FormAttachment(0, VSPACE);
		nameText.setLayoutData(data);
		nameText.addModifyListener(modifyActivityListener);

		CLabel valueLabel = factory.createCLabel(composite,
				ElementConstants.LABEL_NAME);
		data = new FormData();
		data.left = new FormAttachment(0, 0);
		data.right = new FormAttachment(nameText, -HSPACE);
		data.top = new FormAttachment(nameText, 0, SWT.CENTER);
		valueLabel.setLayoutData(data);
	}

	@Override
	public void refresh() {
		PictogramElement pe = getSelectedPictogramElement();
		nameText.removeModifyListener(modifyActivityListener);
		if (pe != null) {
			Object bo = Graphiti.getLinkService()
					.getBusinessObjectForLinkedPictogramElement(pe);

			if (bo == null)
				return;
			final IActivity act = (IActivity)bo;
			//			TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(getDiagram());
			String name = act.getName();
			nameText.setText(name == null ? ElementConstants.LABEL_EMPTY : name);
		}
		nameText.addModifyListener(modifyActivityListener);
	}

	private ModifyListener modifyActivityListener = new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			TransactionalEditingDomain ted =
					getDiagramContainer().getDiagramBehavior().getEditingDomain();

			ted.getCommandStack().execute(new RecordingCommand(ted) {

				@Override
				protected void doExecute() {
					Activity activity = (Activity)Graphiti.getLinkService()
							.getBusinessObjectForLinkedPictogramElement(getSelectedPictogramElement());
					activity.setName(nameText.getText());
				}
			});
		}
	};
}


text:
<?php

namespace Enm\Transformer\Validation\ArrayConstraints;

use Symfony\Component\Validator\Constraints\Regex;

class ArrayRegex extends Regex
{

}


text:
// Gulp dependencies
var gulp = require('gulp')
var sass = require('gulp-ruby-sass')
var minifyCSS = require('gulp-minify-css')
var htmlMin = require('gulp-html-minifier')
var rename = require("gulp-rename")
var gulpif = require('gulp-if')
var gutil = require('gulp-util')

// Webpack
var webpackreg = require("webpack")
var webpack = require('gulp-webpack')
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin')

var path = require('path')
var argv = require('yargs').argv

var pkg = require('./package.json')

var scssPath = 'scss/**/*.scss'

// A display error function, to format and make custom errors more uniform
// Could be combined with gulp-util or npm colors for nicer output
function displayError(error) {

    // Initial building up of the error
    var errorString = '[' + error.plugin + ']'
    errorString += ' ' + error.message.replace("\n", '') // Removes new line at the end

    // If the error contains the filename or line number add it to the string
    if (error.fileName)
        errorString += ' in ' + error.fileName

    if (error.lineNumber)
        errorString += ' on line ' + error.lineNumber

    // This will output an error like the following:
    // [gulp-sass] error message in file_name on line 1
    console.error(errorString)
}

gulp.task("webpack", function() {
    var webpackConfig = {
        output: {
            // Import this in your html it will contain all our js
            // note you can break this up into chunks if you need to
            // refer to their docs for more info
            filename: 'bundle.js'
        },
        module: {
            loaders: [{
                    test: /\.css$/,
                    loaders: ["style", "css"]
                },
                // the url-loader uses DataUrls.
                // the file-loader emits files.
                {
                    test: /\.woff$/,
                    loader: "url-loader?limit=10000&minetype=application/font-woff"
                }, {
                    test: /\.ttf$/,
                    loader: "file-loader"
                }, {
                    test: /\.eot$/,
                    loader: "file-loader"
                }, {
                    test: /\.svg$/,
                    loader: "file-loader"
                }
            ]
        },
        resolve: {
            alias: {
                css: path.join(__dirname, "src/css"),
                moment: path.join(__dirname, "bower_components/moment/moment.js"),
                hammer: path.join(__dirname, "bower_components/hammerjs/hammer.js"),
                material: path.join(__dirname, "bower_components/angular-material/angular-material"),
                // If you prefix all js imports with app this will fix any import duplication issues
                // caused by relative imports
                app: path.join(__dirname, "src/app")
            },
            // Makes webpack look in these directories which is nice
            "modulesDirectories": ["node_modules", "bower_components"]
        },
        externals: {
            angular: "angular"
        },
        plugins: [
            // Adds the given requires to every module even if they dont require() them
            new webpackreg.ProvidePlugin({
                // ngMaterial requires hammerjs but doesnt use webpack so we need this
                Hammer: "hammer"
            })
        ]
    }

    var buildInfo = {
        VERSION: JSON.stringify(pkg.version),
        DEVMODE: false
    }

    if (argv.dev) {
        // Development
        buildInfo.DEVMODE = true

    } else {
        // Production
        console.log("Building production js")
        webpackConfig.plugins = webpackConfig.plugins.concat([
            new ngAnnotatePlugin(),
            new webpackreg.optimize.UglifyJsPlugin()
        ])
    }

    webpackConfig.plugins.push(new webpackreg.DefinePlugin(buildInfo))

    return gulp.src('src/app/app.js')
        .pipe(webpack(webpackConfig))
        .pipe(gulp.dest('dist/app/'))
})

gulp.task("html", function() {
    return gulp.src('src/**/*.html')
        .pipe(htmlMin({
            collapseWhitespace: true,
            conservativeCollapse: true
        }))
        .pipe(gulp.dest('dist/'))
})

gulp.task('scss', function() {
    //take all files from scss compile then minify then put them in www/css folder
    return gulp.src(scssPath)
        .on('error', function(err) {
            displayError(err)
        })
        .pipe(sass({
            //for bootstrap to work correctly
            // this may not be required anymore isnce we use angular-material now
            precision: 10,
            sourcemap: false
        }))
        // if devmode do nothing otherwise minify
        // note !argv.dev doesnt work
        .pipe(gulpif(argv.dev, gutil.noop(), minifyCSS()))
        .pipe(gulp.dest('dist/css/'))
})

// Copies angular-material css files to scss/material/*.scss since you cant @import css files in scss
gulp.task('prep-material', function() {
    return gulp.src('bower_components/angular-material/*.css')
        .pipe(rename({
            // Make it a partial
            prefix: "_",
            extname: ".scss"
        }))
        .pipe(gulp.dest('scss/material'))
})

//copy image files over to dist folder
gulp.task('img', function() {
    gulp.src('src/favicon.ico')
        .pipe(gulp.dest('dist/'))
    return gulp.src('src/img/**/*')
        .pipe(gulp.dest('dist/img/'))
})

// Rerun the task when a file changes
gulp.task('watch', function() {
    gulp.watch(scssPath, ['scss'])
    gulp.watch('src/**/*.js', ['webpack'])
    gulp.watch('src/**/*.html', ['html'])
    gulp.watch('src/img/*', ['img'])
})

// The default task (called when you run `gulp` from cli)
gulp.task('default', ['prep-material', 'scss', 'html', 'webpack', 'img'])

// Copy our static files into the right places
gulp.task('static', ['prep-material'])


text:
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Gonzalo Barba, personal website.">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>gon250</title>

    <link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.red-teal.min.css" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="./assets/css/theme.css" />


text:
from flask import Blueprint

bp = Blueprint('user', __name__,url_prefix='/user')

@bp.route('/')
def index():
    return 'User\'s Index Page'


text:
#include "mitkImageStatisticsHolder.h"

#include "mitkHistogramGenerator.h"
#include <mitkProperties.h>

mitk::ImageStatisticsHolder::ImageStatisticsHolder(mitk::Image *image)
  : m_Image(image)
{
  m_CountOfMinValuedVoxels.resize(1, 0);
  m_CountOfMaxValuedVoxels.resize(1, 0);
  m_ScalarMin.resize(1, itk::NumericTraits<ScalarType>::max());
  m_ScalarMax.resize(1, itk::NumericTraits<ScalarType>::NonpositiveMin());
  m_Scalar2ndMin.resize(1, itk::NumericTraits<ScalarType>::max());
  m_Scalar2ndMax.resize(1, itk::NumericTraits<ScalarType>::NonpositiveMin());

  mitk::HistogramGenerator::Pointer generator = mitk::HistogramGenerator::New();
  m_HistogramGeneratorObject = generator;
}

mitk::ImageStatisticsHolder::~ImageStatisticsHolder()
{
  m_HistogramGeneratorObject = nullptr;
}

const mitk::ImageStatisticsHolder::HistogramType *mitk::ImageStatisticsHolder::GetScalarHistogram(
  int t, unsigned int /*component*/)
{
  mitk::ImageTimeSelector *timeSelector = this->GetTimeSelector();
  if (timeSelector != nullptr)
  {
    timeSelector->SetTimeNr(t);
    timeSelector->UpdateLargestPossibleRegion();

    auto *generator =
      static_cast<mitk::HistogramGenerator *>(m_HistogramGeneratorObject.GetPointer());
    generator->SetImage(timeSelector->GetOutput());
    generator->ComputeHistogram();
    return static_cast<const mitk::ImageStatisticsHolder::HistogramType *>(generator->GetHistogram());
  }
  return nullptr;
}

bool mitk::ImageStatisticsHolder::IsValidTimeStep(int t) const
{
  return m_Image->IsValidTimeStep(t);
}

mitk::ImageTimeSelector::Pointer mitk::ImageStatisticsHolder::GetTimeSelector()
{
  ImageTimeSelector::Pointer timeSelector =
    ImageTimeSelector::New();
  timeSelector->SetInput(m_Image);

  return timeSelector;
}

void mitk::ImageStatisticsHolder::Expand(unsigned int timeSteps)
{
  if (!m_Image->IsValidTimeStep(timeSteps - 1))
    return;

  // The BaseData needs to be expanded, call the mitk::Image::Expand() method
  m_Image->Expand(timeSteps);

  if (timeSteps > m_ScalarMin.size())
  {
    m_ScalarMin.resize(timeSteps, itk::NumericTraits<ScalarType>::max());
    m_ScalarMax.resize(timeSteps, itk::NumericTraits<ScalarType>::NonpositiveMin());
    m_Scalar2ndMin.resize(timeSteps, itk::NumericTraits<ScalarType>::max());
    m_Scalar2ndMax.resize(timeSteps, itk::NumericTraits<ScalarType>::NonpositiveMin());
    m_CountOfMinValuedVoxels.resize(timeSteps, 0);
    m_CountOfMaxValuedVoxels.resize(timeSteps, 0);
  }
}

void mitk::ImageStatisticsHolder::ResetImageStatistics()
{
  m_ScalarMin.assign(1, itk::NumericTraits<ScalarType>::max());
  m_ScalarMax.assign(1, itk::NumericTraits<ScalarType>::NonpositiveMin());
  m_Scalar2ndMin.assign(1, itk::NumericTraits<ScalarType>::max());
  m_Scalar2ndMax.assign(1, itk::NumericTraits<ScalarType>::NonpositiveMin());
  m_CountOfMinValuedVoxels.assign(1, 0);
  m_CountOfMaxValuedVoxels.assign(1, 0);
}

#include "mitkImageAccessByItk.h"

//#define BOUNDINGOBJECT_IGNORE

template <typename ItkImageType>
void mitk::_ComputeExtremaInItkImage(const ItkImageType *itkImage, mitk::ImageStatisticsHolder *statisticsHolder, int t)
{
  typename ItkImageType::RegionType region;
  region = itkImage->GetBufferedRegion();
  if (region.Crop(itkImage->GetRequestedRegion()) == false)
    return;
  if (region != itkImage->GetRequestedRegion())
    return;

  itk::ImageRegionConstIterator<ItkImageType> it(itkImage, region);
  typedef typename ItkImageType::PixelType TPixel;
  TPixel value = 0;

  if (statisticsHolder == nullptr || !statisticsHolder->IsValidTimeStep(t))
    return;
  statisticsHolder->Expand(t + 1); // make sure we have initialized all arrays
  statisticsHolder->m_CountOfMinValuedVoxels[t] = 0;
  statisticsHolder->m_CountOfMaxValuedVoxels[t] = 0;

  statisticsHolder->m_Scalar2ndMin[t] = statisticsHolder->m_ScalarMin[t] = itk::NumericTraits<ScalarType>::max();
  statisticsHolder->m_Scalar2ndMax[t] = statisticsHolder->m_ScalarMax[t] =
    itk::NumericTraits<ScalarType>::NonpositiveMin();

  while (!it.IsAtEnd())
  {
    value = it.Get();
#ifdef BOUNDINGOBJECT_IGNORE
    if (value > -32765)
    {
#endif
      // update min
      if (value < statisticsHolder->m_ScalarMin[t])
      {
        statisticsHolder->m_Scalar2ndMin[t] = statisticsHolder->m_ScalarMin[t];
        statisticsHolder->m_ScalarMin[t] = value;
        statisticsHolder->m_CountOfMinValuedVoxels[t] = 1;
      }
      else if (value == statisticsHolder->m_ScalarMin[t])
      {
        ++statisticsHolder->m_CountOfMinValuedVoxels[t];
      }
      else if (value < statisticsHolder->m_Scalar2ndMin[t])
      {
        statisticsHolder->m_Scalar2ndMin[t] = value;
      }

      // update max
      if (value > statisticsHolder->m_ScalarMax[t])
      {
        statisticsHolder->m_Scalar2ndMax[t] = statisticsHolder->m_ScalarMax[t];
        statisticsHolder->m_ScalarMax[t] = value;
        statisticsHolder->m_CountOfMaxValuedVoxels[t] = 1;
      }
      else if (value == statisticsHolder->m_ScalarMax[t])
      {
        ++statisticsHolder->m_CountOfMaxValuedVoxels[t];
      }
      else if (value > statisticsHolder->m_Scalar2ndMax[t])
      {
        statisticsHolder->m_Scalar2ndMax[t] = value;
      }
#ifdef BOUNDINGOBJECT_IGNORE
    }
#endif

    ++it;
  }

  //// guard for wrong 2dMin/Max on single constant value images
  if (statisticsHolder->m_ScalarMax[t] == statisticsHolder->m_ScalarMin[t])
  {
    statisticsHolder->m_Scalar2ndMax[t] = statisticsHolder->m_Scalar2ndMin[t] = statisticsHolder->m_ScalarMax[t];
  }
  statisticsHolder->m_LastRecomputeTimeStamp.Modified();
}

template <typename ItkImageType>
void mitk::_ComputeExtremaInItkVectorImage(const ItkImageType *itkImage,
                                           mitk::ImageStatisticsHolder *statisticsHolder,
                                           int t,
                                           unsigned int component)
{
  typename ItkImageType::RegionType region;
  region = itkImage->GetBufferedRegion();
  if (region.Crop(itkImage->GetRequestedRegion()) == false)
    return;
  if (region != itkImage->GetRequestedRegion())
    return;

  itk::ImageRegionConstIterator<ItkImageType> it(itkImage, region);

  if (statisticsHolder == nullptr || !statisticsHolder->IsValidTimeStep(t))
    return;
  statisticsHolder->Expand(t + 1); // make sure we have initialized all arrays
  statisticsHolder->m_CountOfMinValuedVoxels[t] = 0;
  statisticsHolder->m_CountOfMaxValuedVoxels[t] = 0;

  statisticsHolder->m_Scalar2ndMin[t] = statisticsHolder->m_ScalarMin[t] = itk::NumericTraits<ScalarType>::max();
  statisticsHolder->m_Scalar2ndMax[t] = statisticsHolder->m_ScalarMax[t] =
    itk::NumericTraits<ScalarType>::NonpositiveMin();

  while (!it.IsAtEnd())
  {
    double value = it.Get()[component];
#ifdef BOUNDINGOBJECT_IGNORE
    if (value > -32765)
    {
#endif
      // update min
      if (value < statisticsHolder->m_ScalarMin[t])
      {
        statisticsHolder->m_Scalar2ndMin[t] = statisticsHolder->m_ScalarMin[t];
        statisticsHolder->m_ScalarMin[t] = value;
        statisticsHolder->m_CountOfMinValuedVoxels[t] = 1;
      }
      else if (value == statisticsHolder->m_ScalarMin[t])
      {
        ++statisticsHolder->m_CountOfMinValuedVoxels[t];
      }
      else if (value < statisticsHolder->m_Scalar2ndMin[t])
      {
        statisticsHolder->m_Scalar2ndMin[t] = value;
      }

      // update max
      if (value > statisticsHolder->m_ScalarMax[t])
      {
        statisticsHolder->m_Scalar2ndMax[t] = statisticsHolder->m_ScalarMax[t];
        statisticsHolder->m_ScalarMax[t] = value;
        statisticsHolder->m_CountOfMaxValuedVoxels[t] = 1;
      }
      else if (value == statisticsHolder->m_ScalarMax[t])
      {
        ++statisticsHolder->m_CountOfMaxValuedVoxels[t];
      }
      else if (value > statisticsHolder->m_Scalar2ndMax[t])
      {
        statisticsHolder->m_Scalar2ndMax[t] = value;
      }
#ifdef BOUNDINGOBJECT_IGNORE
    }
#endif

    ++it;
  }

  //// guard for wrong 2dMin/Max on single constant value images
  if (statisticsHolder->m_ScalarMax[t] == statisticsHolder->m_ScalarMin[t])
  {
    statisticsHolder->m_Scalar2ndMax[t] = statisticsHolder->m_Scalar2ndMin[t] = statisticsHolder->m_ScalarMax[t];
  }
  statisticsHolder->m_LastRecomputeTimeStamp.Modified();
}

void mitk::ImageStatisticsHolder::ComputeImageStatistics(int t, unsigned int component)
{
  // timestep valid?
  if (!m_Image->IsValidTimeStep(t))
    return;

  // image modified?
  if (this->m_Image->GetMTime() > m_LastRecomputeTimeStamp.GetMTime())
    this->ResetImageStatistics();

  Expand(t + 1);

  // do we have valid information already?
  if (m_ScalarMin[t] != itk::NumericTraits<ScalarType>::max() ||
      m_Scalar2ndMin[t] != itk::NumericTraits<ScalarType>::max())
    return; // Values already calculated before...

  // used to avoid statistics calculation on Odf images. property will be replaced as soons as bug 17928 is merged and
  // the diffusion image refactoring is complete.
  mitk::BoolProperty *isSh = dynamic_cast<mitk::BoolProperty *>(m_Image->GetProperty("IsShImage").GetPointer());
  mitk::BoolProperty *isOdf = dynamic_cast<mitk::BoolProperty *>(m_Image->GetProperty("IsOdfImage").GetPointer());
  const mitk::PixelType pType = m_Image->GetPixelType(0);
  if (pType.GetNumberOfComponents() == 1 && (pType.GetPixelType() != itk::ImageIOBase::UNKNOWNPIXELTYPE) &&
      (pType.GetPixelType() != itk::ImageIOBase::VECTOR))
  {
    // recompute
    mitk::ImageTimeSelector::Pointer timeSelector = this->GetTimeSelector();
    if (timeSelector.IsNotNull())
    {
      timeSelector->SetTimeNr(t);
      timeSelector->UpdateLargestPossibleRegion();
      const mitk::Image *image = timeSelector->GetOutput();
      AccessByItk_2(image, _ComputeExtremaInItkImage, this, t);
    }
  }
  else if (pType.GetPixelType() == itk::ImageIOBase::VECTOR &&
           (!isOdf || !isOdf->GetValue()) && (!isSh || !isSh->GetValue())) // we have a vector image
  {
    // recompute
    mitk::ImageTimeSelector::Pointer timeSelector = this->GetTimeSelector();
    if (timeSelector.IsNotNull())
    {
      timeSelector->SetTimeNr(t);
      timeSelector->UpdateLargestPossibleRegion();
      const mitk::Image *image = timeSelector->GetOutput();
      AccessVectorPixelTypeByItk_n(image, _ComputeExtremaInItkVectorImage, (this, t, component));
    }
  }
  else
  {
    m_ScalarMin[t] = 0;
    m_ScalarMax[t] = 255;
    m_Scalar2ndMin[t] = 0;
    m_Scalar2ndMax[t] = 255;
  }
}

mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValueMin(int t, unsigned int component)
{
  ComputeImageStatistics(t, component);
  return m_ScalarMin[t];
}

mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValueMax(int t, unsigned int component)
{
  ComputeImageStatistics(t, component);
  return m_ScalarMax[t];
}

mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValue2ndMin(int t, unsigned int component)
{
  ComputeImageStatistics(t, component);
  return m_Scalar2ndMin[t];
}

mitk::ScalarType mitk::ImageStatisticsHolder::GetScalarValue2ndMax(int t, unsigned int component)
{
  ComputeImageStatistics(t, component);
  return m_Scalar2ndMax[t];
}

mitk::ScalarType mitk::ImageStatisticsHolder::GetCountOfMinValuedVoxels(int t, unsigned int component)
{
  ComputeImageStatistics(t, component);
  return m_CountOfMinValuedVoxels[t];
}

mitk::ScalarType mitk::ImageStatisticsHolder::GetCountOfMaxValuedVoxels(int t, unsigned int component)
{
  ComputeImageStatistics(t, component);
  return m_CountOfMaxValuedVoxels[t];
}


text:
.note-grid-content {
  display: grid;
  grid-template-columns: 1.5rem 1fr 4rem;
  grid-template-rows: 1.5rem 1.5rem;
  grid-gap: 0.5rem;
  padding: 1rem;
  grid-template-areas:
    'icon title actions '
    'arrow head head'
    '. body body';
}

.note-grid-no-content {
  display: grid;
  width: 100%;
  padding: 1rem;
  grid-template-columns: 3.5rem 1fr 4rem;
  grid-column-gap: 0.75rem;
  align-items: center;
  grid-template-areas:
    'icon  title actions'
    'icon  head head';
}
.note-grid-title {
  grid-area: title;
}

.note-grid-icon {
  grid-area: icon;
}

.note-grid-body {
  grid-area: body;
}

.note-grid-head {
  grid-area: head;
}

.note-grid-arrow {
  grid-area: arrow;
}

.note-grid-actions {
  grid-area: actions;
}

@media (min-width: 640px) {
  .note-grid-content {
    grid-template-columns: 1.5rem 1fr 6rem;
    grid-template-rows: 1.5rem 1.5rem;
    grid-template-areas:
      'icon title actions '
      'arrow head actions'
      '. body actions';
  }

  .note-grid-no-content {
    grid-template-rows: 1.75rem 1.75rem;
    grid-template-columns: 3.5rem 1fr 6rem;
    grid-template-areas:
      'icon  title actions'
      'icon  head actions';
  }
}


text:
{% extends "base.html" %}

{% block title %}
Password reset
{% endblock %}

{% block content %}

        Your password has been changed.

{% endblock %}


text:
namespace bookmarks {
class BookmarkModel;
}

@protocol BrowserCommands;
class GURL;
class PrefService;

// Activity that adds the page to bookmarks.
@interface BookmarkActivity : UIActivity

// Initializes the bookmark activity with the |URL| to check to know if the page
// is already bookmarked in the |bookmarkModel|. The |handler| is used to add
// the page to the bookmarks. The |prefService| is used to verify if the user
// can edit their bookmarks or not.
- (instancetype)initWithURL:(const GURL&)URL
              bookmarkModel:(bookmarks::BookmarkModel*)bookmarkModel
                    handler:(id<BrowserCommands>)handler
                prefService:(PrefService*)prefService;
- (instancetype)init NS_UNAVAILABLE;

@end

#endif  // IOS_CHROME_BROWSER_UI_ACTIVITY_SERVICES_ACTIVITIES_BOOKMARK_ACTIVITY_H_


text:
input.form-control {
	margin-bottom: 10px;
}


text:
<?php
namespace SoliDry\Extension;

use Illuminate\Database\Eloquent\Collection;

/**
 * Class BitMaskTrait
 * @package SoliDry\Extension
 * @property BitMask bitMask
 */
trait BitMaskTrait
{
    /**
     * @param Collection $data
     * @return Collection
     * @throws \SoliDry\Exceptions\AttributesException
     */
    protected function setFlagsIndex(Collection $data)
    {
        $data->map(function($v) {
            $field = $this->bitMask->getField();
            if(isset($v[$field])) {
                $flags = $this->bitMask->getFlags();
                $mask  = $v[$field];
                foreach($flags as $flag => $fVal) {
                    $v[$flag] = (bool)($fVal & $mask);
                }
            }
            return $v;
        });
        return $data;
    }

    /**
     * @param BaseModel $data
     * @return BaseModel
     * @throws \SoliDry\Exceptions\AttributesException
     */
    protected function setFlagsView(BaseModel $data)
    {
        $field = $this->bitMask->getField();
        if(isset($data[$field])) {
            $flags = $this->bitMask->getFlags();
            $mask  = $data[$field];
            foreach($flags as $flag => $fVal) {
                $data[$flag] = ($fVal & $mask) ? true : false;
            }
        }
        return $data;
    }

    /**
     * Creates bit mask based on bit flags and unset those flags to save via model
     * @param array $jsonProps
     * @throws \SoliDry\Exceptions\AttributesException
     */
    protected function setMaskCreate(array $jsonProps)
    {
        $field = $this->bitMask->getField();
        $flags = $this->bitMask->getFlags();
        foreach($flags as $flag => $fVal) {
            if (isset($jsonProps[$flag])) {
                if ((bool) $jsonProps[$flag] === true) {
                    $this->model->$field |= $fVal;
                } else if ((bool) $jsonProps[$flag] === false) {
                    $this->model->$field &= ~$fVal;
                }
            }
            unset($this->model->$flag);
        }
    }

    /**
     * Sets flags on model to pass them through json api processing
     * @throws \SoliDry\Exceptions\AttributesException
     */
    protected function setFlagsCreate()
    {
        $field = $this->bitMask->getField();
        if(isset($this->model->$field)) {
            $flags = $this->bitMask->getFlags();
            $mask  = $this->model->$field;
            foreach($flags as $flag => $fVal) {
                $this->model->$flag = (bool)($fVal & $mask);
            }
        }
        return $this->model;
    }

    /**
     * Updates bit mask based on bit flags and unset those flags to save via model
     * @param $model
     * @param array $jsonProps
     * @return mixed
     * @throws \SoliDry\Exceptions\AttributesException
     */
    protected function setMaskUpdate(&$model, array $jsonProps)
    {
        $field = $this->bitMask->getField();
        $flags = $this->bitMask->getFlags();
        foreach($flags as $flag => $fVal) {
            if (isset($jsonProps[$flag])) {
                if ((bool) $jsonProps[$flag] === true) {
                    $model->$field |= $fVal;
                } else if ((bool) $jsonProps[$flag] === false) {
                    $model->$field &= ~$fVal;
                }
            }
        }
        return $model;
    }

    /**
     * Sets flags on model to pass them through json api processing
     * @param $model
     * @throws \SoliDry\Exceptions\AttributesException
     */
    protected function setFlagsUpdate(&$model) : void
    {
        $field = $this->bitMask->getField();
        if(isset($model[$field])) {
            $flags = $this->bitMask->getFlags();
            $mask  = $model[$field];
            foreach($flags as $flag => $fVal) {
                $model[$flag] = (bool)($fVal & $mask);
            }
        }
    }
}


text:
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Security.AccessControl;
using UnityEngine;
using UnityEditor;
using NUnit.Framework;
using Doubility3D.Resource.Downloader;
using Ionic.Zip;

namespace UnitTest.Doubility3D.Resource.Downloader
{
	[TestFixture]
	public class PacketDownloaderWhenError
	{
		const string packetName = "test_packet";
		string bassPacketPath;

		[TestFixtureSetUp]
		public void Init ()
		{
			// 拷贝底包
			bassPacketPath = System.IO.Path.Combine (Application.streamingAssetsPath, packetName + "_bass.pak").Replace ("\\", "/");
		}

		[TearDown]
		public void CleanUp ()
		{
			DownloaderFactory.Dispose ();
			try {
				System.IO.File.Delete (bassPacketPath);
			} catch (Exception e) {
				Debug.Log (e.Message);
			}
		}

		[Test]
		public void ZeroBytes ()
		{
			// 创建文件
			FileStream writeStream = new FileStream (bassPacketPath, FileMode.CreateNew, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
			writeStream.Dispose ();

			Assert.Throws<PacketException> (new TestDelegate (() => {
				DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			}));
		}

		[Test]
		public void NotZip ()
		{
			// 创建文件
			FileStream writeStream = new FileStream (bassPacketPath, FileMode.CreateNew, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
			byte[] bytes = RandomData.Build (2048, 512);
			writeStream.Write (bytes, 0, bytes.Length);
			writeStream.Dispose ();

			// 写入文件
			bool writed = RandomData.WriteToFile (bytes, bassPacketPath);
			Assert.IsTrue (writed);

			Assert.Throws<PacketException> (new TestDelegate (() => {
				DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			}));
		}

		[Test]
		public void BadZip ()
		{
			MemoryStream ms = new MemoryStream ();

			ZipFile zip = new ZipFile ();
			byte[] bytes = RandomData.Build (2048, 512);
			zip.AddEntry ("OneFileInBadZip.data", bytes);
			zip.Save (ms);
			zip.Dispose ();

			bytes = new byte[ms.Length];
			Array.Copy (ms.GetBuffer (), bytes, ms.Length);
			for (int i = 0; i < 10; i++) {
				bytes [bytes.Length - 1 - i] = 0xff;
			}
			FileStream writeStream = new FileStream (bassPacketPath, FileMode.CreateNew, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
			writeStream.Write (bytes, 0, bytes.Length);
			writeStream.Dispose ();

			Assert.Throws<PacketException> (new TestDelegate (() => {
				DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			}));
		}

		[Test]
		public void BadEntry ()
		{
			const string fileName = "OneFileInBadZip.Data";

			MemoryStream ms = new MemoryStream ();

			ZipFile zip = new ZipFile ();
			byte[] bytes = RandomData.Build (2048, 512);
			zip.AddEntry (fileName, bytes);
			zip.Save (ms);
			zip.Dispose ();

			bytes = new byte[ms.Length];
			Array.Copy (ms.GetBuffer (), bytes, ms.Length);
			// make entry bad
			for (int i = 30; i < 51; i++) {
				bytes [i] = 0xff;
			}
			FileStream writeStream = new FileStream (bassPacketPath, FileMode.CreateNew, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
			writeStream.Write (bytes, 0, bytes.Length);
			writeStream.Dispose ();

			Assert.DoesNotThrow (new TestDelegate (() => {
				DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			}));

			Assert.Throws<PacketException> (new TestDelegate (() => {
				IDownloader fd = DownloaderFactory.Instance.Downloader;
				Assert.IsNotNull (fd);

				IEnumerator enumerator = fd.ResourceTask (fileName, null);
				bool completed = enumerator.RunCoroutineWithoutYields (int.MaxValue);
				Assert.IsTrue (completed);
			}));
		}

		[Test]
		public void NoVersionNumber ()
		{
			ZipFile zip = new ZipFile ();
			byte[] bytes = RandomData.Build (2048, 512);
			zip.AddEntry ("OneFileInBadZip.data", bytes);
			zip.Save (bassPacketPath);
			zip.Dispose ();

			Assert.Throws<PacketException> (new TestDelegate (() => {
				DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			}));

		}

		[Test]
		public void WrongVersionNumber ()
		{
			ZipFile zip = new ZipFile ();
			byte[] bytes = RandomData.Build (2048, 512);
			zip.AddEntry ("OneFileInBadZip.data", bytes);
			zip.Comment = "NotAInt";
			zip.Save (bassPacketPath);
			zip.Dispose ();

			Assert.Throws<PacketException> (new TestDelegate (() => {
				DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			}));

		}

		private void MakeEntryBad (byte[] bytes)
		{
			for (int i = 30; i < 51; i++) {
				bytes [i] = 0xff;
			}
		}
	}

	/// <summary>
	/// Packet downloader test.
	/// todo:文件名也随机
	/// </summary>
	[TestFixture]
	public class PacketDownloaderNoDuplicate
	{
		const string packetName = "test_packet";
		const string filePrefix = "file_{0}.dat";

		IDownloader downloader;

		string[] packetPath;
		Dictionary<string,byte[]>[] dictPacket;
		int[] versions;

		[TestFixtureSetUp]
		public void Init ()
		{
			int packets = RandomData.Random.Next (3, 6);
			packetPath = new string[packets];
			dictPacket = new Dictionary<string, byte[]>[packets];
			versions = new int[packets];

			int fileOffset = 0;
			for (int i = 0; i < packets; i++) {
				dictPacket [i] = new Dictionary<string, byte[]> ();

				string where = (i == 0) ? Application.streamingAssetsPath : Application.persistentDataPath;
				string postFix = (i == 0) ? "_bass.pak" : string.Format ("_update_{0}.pak", i);

				versions [i] = RandomData.Random.Next ();
				packetPath [i] = System.IO.Path.Combine (where, packetName + postFix).Replace ("\\", "/");
				PreparePacket (dictPacket [i], packetPath [i], versions [i], fileOffset);

				fileOffset += dictPacket [i].Count;
			}

			// 初始化时,数据包必须已经存在。
			DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			downloader = DownloaderFactory.Instance.Downloader;
		}

		void PreparePacket (Dictionary<string,byte[]> dict, string packetPath, int version, int startIndex)
		{
			ZipFile zip = new ZipFile ();

			/// 随机文件数
			int files = RandomData.Random.Next (2, 5);
			for (int i = 0; i < files; i++) {
				/// 每个随机文件内容
				string fileName = string.Format (filePrefix, i + 1 + startIndex);
				byte[] bytes = RandomData.Build (2048, 512);
				dict.Add (fileName, bytes);

				zip.AddEntry (fileName, bytes);
			}
			zip.Comment = version.ToString ();
			zip.Save (packetPath);
			zip.Dispose ();
		}

		[TestFixtureTearDown]
		public void Clear ()
		{
			DownloaderFactory.Dispose ();
			downloader = null;
			try {
				for (int i = 0; i < packetPath.Length; i++) {
					System.IO.File.Delete (packetPath [i]);
					dictPacket [i].Clear ();
				}
				packetPath = null;
				dictPacket = null;
			} catch (Exception e) {
				Debug.Log (e.Message);
			}
		}

		[Test]
		public void HomeVar ()
		{
			Assert.IsInstanceOf<PacketDownloader> (downloader);
			Assert.AreEqual ((downloader as PacketDownloader).Home, packetName);
		}

		[Test]
		public void PacketMustHasVersionNumber ()
		{
		}

		[Test]
		public void ReadError ()
		{
			PacketDownloader fd = downloader as PacketDownloader;
			Assert.IsNotNull (fd);

			IEnumerator enumerator = fd.ResourceTask ("NotExistFile.Dat", (bytes, error) => {
				Assert.IsNull (bytes);
				Assert.IsFalse (string.IsNullOrEmpty (error));
			});
			bool completed = enumerator.RunCoroutineWithoutYields (int.MaxValue);
			Assert.IsTrue (completed);
		}

		[Test]
		public void DataValidEveryPacket ()
		{
			for (int i = 0; i < packetPath.Length; i++) {
				DataValid (dictPacket [i]);
			}
		}

		[Test]
		public void AllPacketsExist ()
		{
			PacketDownloader fd = downloader as PacketDownloader;
			Assert.IsNotNull (fd);
			PacketInfo[] ps = fd.Packets;
			Assert.AreEqual (ps.Length, packetPath.Length);
			for (int i = 0; i < packetPath.Length; i++) {
				int index = Array.FindIndex<PacketInfo> (ps, new Predicate<PacketInfo> ((p) => {
					return p.File.Name == packetPath [i];
				}));
				Assert.GreaterOrEqual (index, 0);
			}
		}

		[Test]
		public void AllVersionValid ()
		{
			PacketDownloader fd = downloader as PacketDownloader;
			Assert.IsNotNull (fd);
			PacketInfo[] ps = fd.Packets;
			Assert.AreEqual (ps.Length, packetPath.Length);
			for (int i = 0; i < packetPath.Length; i++) {
				int index = Array.FindIndex<PacketInfo> (ps, new Predicate<PacketInfo> ((p) => {
					return p.File.Name == packetPath [i];
				}));
				Assert.GreaterOrEqual (index, 0);
				Assert.AreEqual (versions [i], ps [index].Version);
			}
		}

		[Test]
		public void VersionSorted ()
		{
			PacketDownloader fd = downloader as PacketDownloader;
			Assert.IsNotNull (fd);
			PacketInfo[] ps = fd.Packets;
			for (int i = 0; i < ps.Length - 2; i++) {
				Assert.Greater (ps [i].Version, ps [i + 1].Version);
			}
		}

		void DataValid (Dictionary<string,byte[]> dict)
		{
			PacketDownloader fd = downloader as PacketDownloader;
			Assert.IsNotNull (fd);

			Dictionary<string,byte[]>.Enumerator e = dict.GetEnumerator ();
			while (e.MoveNext ()) {
				string targetPath = e.Current.Key;
				byte[] bytes = e.Current.Value;

				IEnumerator enumerator = fd.ResourceTask (targetPath, (results, error) => {
					Assert.IsNotNull (results);
					Assert.AreEqual (bytes.Length, results.Length);
					Assert.IsTrue (string.IsNullOrEmpty (error));
					for (int i = 0; i < bytes.Length; i++) {
						Assert.AreEqual (bytes [i], results [i]);
					}
				});
				bool completed = enumerator.RunCoroutineWithoutYields (int.MaxValue);
				Assert.IsTrue (completed);
			}
		}
	}

	[TestFixture]
	public class PacketDownloaderDuplicated
	{
		const string packetName = "test_packet";
		const string filePrefix = "file_{0}.dat";

		IDownloader downloader;

		string[] packetPath;
		Dictionary<string,byte[]>[] dictPacket;
		int[] versions;
		Dictionary<string,byte[]> dictNewestPacket = new Dictionary<string, byte[]> ();

		[TestFixtureSetUp]
		public void Init ()
		{
			int packets = RandomData.Random.Next (3, 6);
			packetPath = new string[packets];
			dictPacket = new Dictionary<string, byte[]>[packets];
			versions = new int[packets];

			int fileOffset = 0;
			int version = 0;
			for (int i = 0; i < packets; i++) {
				dictPacket [i] = new Dictionary<string, byte[]> ();

				string where = (i == 0) ? Application.streamingAssetsPath : Application.persistentDataPath;
				string postFix = (i == 0) ? "_bass.pak" : string.Format ("_update_{0}.pak", i);

				versions [i] = version;
				packetPath [i] = System.IO.Path.Combine (where, packetName + postFix).Replace ("\\", "/");
				PreparePacket (dictPacket [i], packetPath [i], versions [i], fileOffset);

				int adder = RandomData.Random.Next (1, dictPacket [i].Count - 1);
				fileOffset += adder;
				version++;
			}

			// 初始化时,数据包必须已经存在。
			DownloaderFactory.Instance.Initialize (DownloadMode.Packet, packetName);
			downloader = DownloaderFactory.Instance.Downloader;

			// 收集最新版本的文件字典。版本号是按照从小到大排列好的。
			for (int i = dictPacket.Length - 1; i >= 0; i--) {
				Dictionary<string,byte[]>.Enumerator e = dictPacket [i].GetEnumerator ();
				while (e.MoveNext ()) {
					string f = e.Current.Key;
					byte[] d = e.Current.Value;
					if (!dictNewestPacket.ContainsKey (f)) {
						dictNewestPacket.Add (f, d);
					}
				}
			}
		}

		void PreparePacket (Dictionary<string,byte[]> dict, string packetPath, int version, int startIndex)
		{
			ZipFile zip = new ZipFile ();

			/// 随机文件数
			int files = RandomData.Random.Next (2, 5);
			for (int i = 0; i < files; i++) {
				/// 每个随机文件内容
				string fileName = string.Format (filePrefix, i + 1 + startIndex);
				byte[] bytes = RandomData.Build (2048, 512);
				dict.Add (fileName, bytes);

				zip.AddEntry (fileName, bytes);
			}
			zip.Comment = version.ToString ();
			zip.Save (packetPath);
			zip.Dispose ();
		}

		[TestFixtureTearDown]
		public void Clear ()
		{
			DownloaderFactory.Dispose ();
			downloader = null;
			try {
				for (int i = 0; i < packetPath.Length; i++) {
					System.IO.File.Delete (packetPath [i]);
					dictPacket [i].Clear ();
				}
				packetPath = null;
				dictPacket = null;
			} catch (Exception e) {
				Debug.Log (e.Message);
			}
		}

		[Test]
		public void DataValid ()
		{
			PacketDownloader fd = downloader as PacketDownloader;
			Assert.IsNotNull (fd);

			Dictionary<string,byte[]>.Enumerator e = dictNewestPacket.GetEnumerator ();
			while (e.MoveNext ()) {
				string targetPath = e.Current.Key;
				byte[] bytes = e.Current.Value;

				IEnumerator enumerator = fd.ResourceTask (targetPath, (results, error) => {
					Assert.IsNotNull (results);
					Assert.AreEqual (bytes.Length, results.Length);
					Assert.IsTrue (string.IsNullOrEmpty (error));
					for (int i = 0; i < bytes.Length; i++) {
						Assert.AreEqual (bytes [i], results [i]);
					}
				});
				bool completed = enumerator.RunCoroutineWithoutYields (int.MaxValue);
				Assert.IsTrue (completed);
			}
		}
	}
}


text:
#region Using

using System.Collections.ObjectModel;
using Noside.Wyvern.Common.Interfaces;

#endregion

namespace Noside.Wyvern.CoinCounter.ViewModels {
	internal class AddCoinViewModel {

		#region Constructors and Destructors

		public AddCoinViewModel(ICoinDatabase database) {
			this.CoinList = new ObservableCollection<ICoin>(database.CoinList);
		}

		#endregion

		#region Properties

		public ObservableCollection<ICoin> CoinList { get; set; }

		#endregion
	}
}


text:
<?php

namespace PMI\TestBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Security\Core\User\UserInterface;
use Doctrine\ORM\Mapping as ORM;

use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity
 * @ORM\Table(name="product")
 */
class Product
{

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     *
     * @var integer $id
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length="255")
     * @var string $firstName
     *
     */
    protected $name;

    /**
     * @ORM\OneToMany(targetEntity="ProductOrder" , mappedBy="product" , cascade={"all"} , orphanRemoval=true)
     * */
    protected $po;

    public function __construct()
    {

    }

    public function getId()
    {
        return $this->id;
    }

    public function setId($id)
    {
        $this->id = $id;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function getPo()
    {
        return $this->po;
    }

    public function setPo($po)
    {
        $this->po = $po;
    }

    public function __toString()
    {
        return $this->name;
    }

}


text:
package com.mycompany.scalcium.keyextract

import org.junit.Test

class KeaClientTest {

  val trainDir = "/home/sujit/Projects/mlia-examples/data/mtcrawler/kea/train"
  val testDir = "/home/sujit/Projects/mlia-examples/data/mtcrawler/kea/test"
  val modelFile = "/tmp/model"
  val valKeysDir = "/home/sujit/Projects/mlia-examples/data/mtcrawler/kea/test/keys"

  @Test
  def testRunKeaClient(): Unit = {
    val kc = new KeaClient()
    kc.train(trainDir, modelFile)
    kc.test(modelFile, testDir)
  }
}


text:
/**
 * Controls View
 *
 * View to render the controls toolbar
 * See templates/controls.hbs
 *
 * (c) 2014 João Portela. The Analytics Interceptor extension may be freely
 * distributed under the MIT license.
 */

var Backbone = require('backbone');
var Handlebars = require('handlebars');
var templates = require('../../templates/templates')(Handlebars);

module.exports = Backbone.View.extend({
  tagName: 'div',
  className: 'toolbox',
  template: templates['templates/controls.hbs'],
  events: {
    'click #intercept': 'interceptEvents',
    'click #clear': 'clearEvents'
  },

  initialize: function () {
    this.render();
  },

  render: function () {
    this.$el.html(this.template(this.model.toJSON()));
    return this;
  },

  /* Handler for click on the Enable/Disable button */
  interceptEvents: function () {
    var target = this.$("#intercept");

    // enables the interceptor
    if (target.val() === 'on') {
      this.enableInterceptor();
    }
    else {
      this.disableInterceptor();
    }

  },

  clearEvents: function () {
    this.model.eventList.reset();
  },

  enableInterceptor: function () {
    this.model.set('enabled', true);
  },

  disableInterceptor: function () {
    this.model.set('enabled', false);
  },

});


text:
<?php
namespace Xetaravel\Models\Validators;

use Illuminate\Support\Facades\Validator as FacadeValidator;
use Illuminate\Validation\Validator;

class DiscussPostValidator
{
    /**
     * Get a validator for an incoming create request.
     *
     * @param array $data The data to validate.
     *
     * @return \Illuminate\Validation\Validator
     */
    public static function create(array $data): Validator
    {
        $rules = [
            'content' => 'required|min:10',
            'conversation_id' => 'required|integer|exists:discuss_conversations,id'
        ];

        return FacadeValidator::make($data, $rules);
    }

    /**
     * Get a validator for an incoming create request.
     *
     * @param array $data The data to validate.
     *
     * @return \Illuminate\Validation\Validator
     */
    public static function edit(array $data) : Validator
    {
        $rules = [
            'content' => 'required|min:10'
        ];

        return FacadeValidator::make($data, $rules);
    }
}


text:
function y = cvx_isconstant( x )
y = testall( @cvx_isconstant, x );

% Copyright 2010 Michael C. Grant and Stephen P. Boyd.
% See the file COPYING.txt for full copyright information.
% The command 'cvx_where' will show where this file is located.


text:
<?xml version="1.0" encoding="UTF-8"?>
<objects serializationModel="Studio.01.08.00">
    <object class="EncodableAsset" id="{21538f43-477f-46bc-9722-2b19430fd275}">
        <property name="assetPath">
            <value>FootSteps/Wood/</value>
        </property>
        <relationship name="masterAssetFolder">
            <destination>{cbdaacbf-f328-457b-bedb-8c33cacc0690}</destination>
        </relationship>
    </object>
</objects>


text:
import path from 'path'
import PATH from 'path-name'

export function makeEnv (
  opts: {
    extraEnv?: NodeJS.ProcessEnv
    userAgent?: string
    prependPaths: string[]
  }
) {
  return {
    ...process.env,
    ...opts.extraEnv,
    npm_config_user_agent: opts.userAgent ?? 'pnpm',
    [PATH]: [
      ...opts.prependPaths,
      process.env[PATH],
    ].join(path.delimiter),
  }
}


text:
// -----------------------------------------------------------------------
// <copyright file="PerUserRoamingAndLocalConfigurationManager.cs" company="Matthieu Klotz">
// Copyright (c) 2013, Matthieu Klotz
// All rights reserved.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
// - Neither the name of Matthieu Klotz nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// </copyright>
// -----------------------------------------------------------------------

namespace AppFabric.Admin.Common.Configuration
{
    using System.Configuration;
    using SysConfigurationManager = System.Configuration.ConfigurationManager;

    /// <summary>
    /// ConfigurationManager that uses <see cref="System.Configuration.ConfigurationManager"/>.
    /// </summary>
    public class PerUserRoamingAndLocalConfigurationManager : ConfigurationManagerBase
    {
        public PerUserRoamingAndLocalConfigurationManager()
        {
            this.Configuration = SysConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
            this.AppSettings = SysConfigurationManager.AppSettings;
            this.ConnectionStrings = SysConfigurationManager.ConnectionStrings;
        }

        /// <inheritdoc />
        public override object GetSection(string sectionName)
        {
            return this.Configuration.GetSection(sectionName);
        }

        /// <inheritdoc />
        public override void AddSection(string sectionName, ConfigurationSection section)
        {
            this.Configuration.Sections.Add(sectionName, section);
        }

        /// <inheritdoc />
        public override void Save()
        {
            if (this.Configuration != null)
            {
                this.Configuration.Save(ConfigurationSaveMode.Modified);
                this.OnChanged();
            }
        }
    }
}


text:
/* buf.c - Buffer management */

/*
 * Copyright (c) 2015 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <stdio.h>
#include <errno.h>
#include <stddef.h>
#include <string.h>
#include <misc/byteorder.h>

#include <net/buf.h>

#if defined(CONFIG_NET_BUF_LOG)
#define SYS_LOG_DOMAIN "net/buf"
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_NET_BUF_LEVEL
#include <logging/sys_log.h>

#define NET_BUF_DBG(fmt, ...) SYS_LOG_DBG("(%p) " fmt, k_current_get(), \
					  ##__VA_ARGS__)
#define NET_BUF_ERR(fmt, ...) SYS_LOG_ERR(fmt, ##__VA_ARGS__)
#define NET_BUF_WARN(fmt, ...) SYS_LOG_WRN(fmt,	##__VA_ARGS__)
#define NET_BUF_INFO(fmt, ...) SYS_LOG_INF(fmt,  ##__VA_ARGS__)
#define NET_BUF_ASSERT(cond) do { if (!(cond)) {			  \
			NET_BUF_ERR("assert: '" #cond "' failed"); \
		} } while (0)
#else

#define NET_BUF_DBG(fmt, ...)
#define NET_BUF_ERR(fmt, ...)
#define NET_BUF_WARN(fmt, ...)
#define NET_BUF_INFO(fmt, ...)
#define NET_BUF_ASSERT(cond)
#endif /* CONFIG_NET_BUF_LOG */

#if CONFIG_NET_BUF_WARN_ALLOC_INTERVAL > 0
#define WARN_ALLOC_INTERVAL K_SECONDS(CONFIG_NET_BUF_WARN_ALLOC_INTERVAL)
#else
#define WARN_ALLOC_INTERVAL K_FOREVER
#endif

/* Helpers to access the storage array, since we don't have access to its
 * type at this point anymore.
 */
#define BUF_SIZE(pool) (sizeof(struct net_buf) + \
			ROUND_UP(pool->buf_size, 4) + \
			ROUND_UP(pool->user_data_size, 4))
#define UNINIT_BUF(pool, n) (struct net_buf *)(((u8_t *)(pool->__bufs)) + \
					       ((n) * BUF_SIZE(pool)))

static inline struct net_buf *pool_get_uninit(struct net_buf_pool *pool,
					      u16_t uninit_count)
{
	struct net_buf *buf;

	buf = UNINIT_BUF(pool, pool->buf_count - uninit_count);

	buf->pool = pool;
	buf->size = pool->buf_size;

	return buf;
}

void net_buf_reset(struct net_buf *buf)
{
	NET_BUF_ASSERT(buf->flags == 0);
	NET_BUF_ASSERT(buf->frags == NULL);

	buf->len   = 0;
	buf->data  = buf->__buf;
}

#if defined(CONFIG_NET_BUF_LOG)
struct net_buf *net_buf_alloc_debug(struct net_buf_pool *pool, s32_t timeout,
				    const char *func, int line)
#else
struct net_buf *net_buf_alloc(struct net_buf_pool *pool, s32_t timeout)
#endif
{
	struct net_buf *buf;
	unsigned int key;

	NET_BUF_ASSERT(pool);

	NET_BUF_DBG("%s():%d: pool %p timeout %d", func, line, pool, timeout);

	/* We need to lock interrupts temporarily to prevent race conditions
	 * when accessing pool->uninit_count.
	 */
	key = irq_lock();

	/* If there are uninitialized buffers we're guaranteed to succeed
	 * with the allocation one way or another.
	 */
	if (pool->uninit_count) {
		u16_t uninit_count;

		/* If this is not the first access to the pool, we can
		 * be opportunistic and try to fetch a previously used
		 * buffer from the LIFO with K_NO_WAIT.
		 */
		if (pool->uninit_count < pool->buf_count) {
			buf = k_lifo_get(&pool->free, K_NO_WAIT);
			if (buf) {
				irq_unlock(key);
				goto success;
			}
		}

		uninit_count = pool->uninit_count--;
		irq_unlock(key);

		buf = pool_get_uninit(pool, uninit_count);
		goto success;
	}

	irq_unlock(key);

#if defined(CONFIG_NET_BUF_LOG) && SYS_LOG_LEVEL >= SYS_LOG_LEVEL_WARNING
	if (timeout == K_FOREVER) {
		u32_t ref = k_uptime_get_32();
		buf = k_lifo_get(&pool->free, K_NO_WAIT);
		while (!buf) {
#if defined(CONFIG_NET_BUF_POOL_USAGE)
			NET_BUF_WARN("%s():%d: Pool %s low on buffers.",
				     func, line, pool->name);
#else
			NET_BUF_WARN("%s():%d: Pool %p low on buffers.",
				     func, line, pool);
#endif
			buf = k_lifo_get(&pool->free, WARN_ALLOC_INTERVAL);
#if defined(CONFIG_NET_BUF_POOL_USAGE)
			NET_BUF_WARN("%s():%d: Pool %s blocked for %u secs",
				     func, line, pool->name,
				     (k_uptime_get_32() - ref) / MSEC_PER_SEC);
#else
			NET_BUF_WARN("%s():%d: Pool %p blocked for %u secs",
				     func, line, pool,
				     (k_uptime_get_32() - ref) / MSEC_PER_SEC);
#endif
		}
	} else {
		buf = k_lifo_get(&pool->free, timeout);
	}
#else
	buf = k_lifo_get(&pool->free, timeout);
#endif
	if (!buf) {
		NET_BUF_ERR("%s():%d: Failed to get free buffer", func, line);
		return NULL;
	}

success:
	NET_BUF_DBG("allocated buf %p", buf);

	buf->ref   = 1;
	buf->flags = 0;
	buf->frags = NULL;
	net_buf_reset(buf);

#if defined(CONFIG_NET_BUF_POOL_USAGE)
	buf->pool->avail_count--;
	NET_BUF_ASSERT(buf->pool->avail_count >= 0);
#endif

	return buf;
}

#if defined(CONFIG_NET_BUF_LOG)
struct net_buf *net_buf_get_debug(struct k_fifo *fifo, s32_t timeout,
				  const char *func, int line)
#else
struct net_buf *net_buf_get(struct k_fifo *fifo, s32_t timeout)
#endif
{
	struct net_buf *buf, *frag;

	NET_BUF_DBG("%s():%d: fifo %p timeout %d", func, line, fifo, timeout);

	buf = k_fifo_get(fifo, timeout);
	if (!buf) {
		return NULL;
	}

	NET_BUF_DBG("%s():%d: buf %p fifo %p", func, line, buf, fifo);

	/* Get any fragments belonging to this buffer */
	for (frag = buf; (frag->flags & NET_BUF_FRAGS); frag = frag->frags) {
		frag->frags = k_fifo_get(fifo, K_NO_WAIT);
		NET_BUF_ASSERT(frag->frags);

		/* The fragments flag is only for FIFO-internal usage */
		frag->flags &= ~NET_BUF_FRAGS;
	}

	/* Mark the end of the fragment list */
	frag->frags = NULL;

	return buf;
}

void net_buf_reserve(struct net_buf *buf, size_t reserve)
{
	NET_BUF_ASSERT(buf);
	NET_BUF_ASSERT(buf->len == 0);
	NET_BUF_DBG("buf %p reserve %zu", buf, reserve);

	buf->data = buf->__buf + reserve;
}

void net_buf_put(struct k_fifo *fifo, struct net_buf *buf)
{
	struct net_buf *tail;

	NET_BUF_ASSERT(fifo);
	NET_BUF_ASSERT(buf);

	for (tail = buf; tail->frags; tail = tail->frags) {
		tail->flags |= NET_BUF_FRAGS;
	}

	k_fifo_put_list(fifo, buf, tail);
}

#if defined(CONFIG_NET_BUF_LOG)
void net_buf_unref_debug(struct net_buf *buf, const char *func, int line)
#else
void net_buf_unref(struct net_buf *buf)
#endif
{
	NET_BUF_ASSERT(buf);

	while (buf) {
		struct net_buf *frags = buf->frags;

#if defined(CONFIG_NET_BUF_LOG)
		if (!buf->ref) {
			NET_BUF_ERR("%s():%d: buf %p double free", func, line,
				    buf);
			return;
		}
#endif
		NET_BUF_DBG("buf %p ref %u pool %p frags %p", buf, buf->ref,
			    buf->pool, buf->frags);

		if (--buf->ref > 0) {
			return;
		}

		buf->frags = NULL;

#if defined(CONFIG_NET_BUF_POOL_USAGE)
		buf->pool->avail_count++;
		NET_BUF_ASSERT(buf->pool->avail_count <= buf->pool->buf_count);
#endif

		if (buf->pool->destroy) {
			buf->pool->destroy(buf);
		} else {
			net_buf_destroy(buf);
		}

		buf = frags;
	}
}

struct net_buf *net_buf_ref(struct net_buf *buf)
{
	NET_BUF_ASSERT(buf);

	NET_BUF_DBG("buf %p (old) ref %u pool %p",
		    buf, buf->ref, buf->pool);
	buf->ref++;
	return buf;
}

struct net_buf *net_buf_clone(struct net_buf *buf, s32_t timeout)
{
	struct net_buf *clone;

	NET_BUF_ASSERT(buf);

	clone = net_buf_alloc(buf->pool, timeout);
	if (!clone) {
		return NULL;
	}

	net_buf_reserve(clone, net_buf_headroom(buf));

	/* TODO: Add reference to the original buffer instead of copying it. */
	memcpy(net_buf_add(clone, buf->len), buf->data, buf->len);

	return clone;
}

struct net_buf *net_buf_frag_last(struct net_buf *buf)
{
	NET_BUF_ASSERT(buf);

	while (buf->frags) {
		buf = buf->frags;
	}

	return buf;
}

void net_buf_frag_insert(struct net_buf *parent, struct net_buf *frag)
{
	NET_BUF_ASSERT(parent);
	NET_BUF_ASSERT(frag);

	if (parent->frags) {
		net_buf_frag_last(frag)->frags = parent->frags;
	}
	/* Take ownership of the fragment reference */
	parent->frags = frag;
}

struct net_buf *net_buf_frag_add(struct net_buf *head, struct net_buf *frag)
{
	NET_BUF_ASSERT(frag);

	if (!head) {
		return net_buf_ref(frag);
	}

	net_buf_frag_insert(net_buf_frag_last(head), frag);

	return head;
}

#if defined(CONFIG_NET_BUF_LOG)
struct net_buf *net_buf_frag_del_debug(struct net_buf *parent,
				       struct net_buf *frag,
				       const char *func, int line)
#else
struct net_buf *net_buf_frag_del(struct net_buf *parent, struct net_buf *frag)
#endif
{
	struct net_buf *next_frag;

	NET_BUF_ASSERT(frag);

	if (parent) {
		NET_BUF_ASSERT(parent->frags);
		NET_BUF_ASSERT(parent->frags == frag);
		parent->frags = frag->frags;
	}

	next_frag = frag->frags;

	frag->frags = NULL;

#if defined(CONFIG_NET_BUF_LOG)
	net_buf_unref_debug(frag, func, line);
#else
	net_buf_unref(frag);
#endif

	return next_frag;
}

#if defined(CONFIG_NET_BUF_SIMPLE_LOG)
#define NET_BUF_SIMPLE_DBG(fmt, ...) NET_BUF_DBG(fmt, ##__VA_ARGS__)
#define NET_BUF_SIMPLE_ERR(fmt, ...) NET_BUF_ERR(fmt, ##__VA_ARGS__)
#define NET_BUF_SIMPLE_WARN(fmt, ...) NET_BUF_WARN(fmt, ##__VA_ARGS__)
#define NET_BUF_SIMPLE_INFO(fmt, ...) NET_BUF_INFO(fmt, ##__VA_ARGS__)
#define NET_BUF_SIMPLE_ASSERT(cond) NET_BUF_ASSERT(cond)
#else
#define NET_BUF_SIMPLE_DBG(fmt, ...)
#define NET_BUF_SIMPLE_ERR(fmt, ...)
#define NET_BUF_SIMPLE_WARN(fmt, ...)
#define NET_BUF_SIMPLE_INFO(fmt, ...)
#define NET_BUF_SIMPLE_ASSERT(cond)
#endif /* CONFIG_NET_BUF_SIMPLE_LOG */

void *net_buf_simple_add(struct net_buf_simple *buf, size_t len)
{
	u8_t *tail = net_buf_simple_tail(buf);

	NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len);

	NET_BUF_SIMPLE_ASSERT(net_buf_simple_tailroom(buf) >= len);

	buf->len += len;
	return tail;
}

void *net_buf_simple_add_mem(struct net_buf_simple *buf, const void *mem,
			     size_t len)
{
	NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len);

	return memcpy(net_buf_simple_add(buf, len), mem, len);
}

u8_t *net_buf_simple_add_u8(struct net_buf_simple *buf, u8_t val)
{
	u8_t *u8;

	NET_BUF_SIMPLE_DBG("buf %p val 0x%02x", buf, val);

	u8 = net_buf_simple_add(buf, 1);
	*u8 = val;

	return u8;
}

void net_buf_simple_add_le16(struct net_buf_simple *buf, u16_t val)
{
	NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);

	val = sys_cpu_to_le16(val);
	memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val));
}

void net_buf_simple_add_be16(struct net_buf_simple *buf, u16_t val)
{
	NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);

	val = sys_cpu_to_be16(val);
	memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val));
}

void net_buf_simple_add_le32(struct net_buf_simple *buf, u32_t val)
{
	NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);

	val = sys_cpu_to_le32(val);
	memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val));
}

void net_buf_simple_add_be32(struct net_buf_simple *buf, u32_t val)
{
	NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);

	val = sys_cpu_to_be32(val);
	memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val));
}

void *net_buf_simple_push(struct net_buf_simple *buf, size_t len)
{
	NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len);

	NET_BUF_SIMPLE_ASSERT(net_buf_simple_headroom(buf) >= len);

	buf->data -= len;
	buf->len += len;
	return buf->data;
}

void net_buf_simple_push_le16(struct net_buf_simple *buf, u16_t val)
{
	NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);

	val = sys_cpu_to_le16(val);
	memcpy(net_buf_simple_push(buf, sizeof(val)), &val, sizeof(val));
}

void net_buf_simple_push_be16(struct net_buf_simple *buf, u16_t val)
{
	NET_BUF_SIMPLE_DBG("buf %p val %u", buf, val);

	val = sys_cpu_to_be16(val);
	memcpy(net_buf_simple_push(buf, sizeof(val)), &val, sizeof(val));
}

void net_buf_simple_push_u8(struct net_buf_simple *buf, u8_t val)
{
	u8_t *data = net_buf_simple_push(buf, 1);

	*data = val;
}

void *net_buf_simple_pull(struct net_buf_simple *buf, size_t len)
{
	NET_BUF_SIMPLE_DBG("buf %p len %zu", buf, len);

	NET_BUF_SIMPLE_ASSERT(buf->len >= len);

	buf->len -= len;
	return buf->data += len;
}

u8_t net_buf_simple_pull_u8(struct net_buf_simple *buf)
{
	u8_t val;

	val = buf->data[0];
	net_buf_simple_pull(buf, 1);

	return val;
}

u16_t net_buf_simple_pull_le16(struct net_buf_simple *buf)
{
	u16_t val;

	val = UNALIGNED_GET((u16_t *)buf->data);
	net_buf_simple_pull(buf, sizeof(val));

	return sys_le16_to_cpu(val);
}

u16_t net_buf_simple_pull_be16(struct net_buf_simple *buf)
{
	u16_t val;

	val = UNALIGNED_GET((u16_t *)buf->data);
	net_buf_simple_pull(buf, sizeof(val));

	return sys_be16_to_cpu(val);
}

u32_t net_buf_simple_pull_le32(struct net_buf_simple *buf)
{
	u32_t val;

	val = UNALIGNED_GET((u32_t *)buf->data);
	net_buf_simple_pull(buf, sizeof(val));

	return sys_le32_to_cpu(val);
}

u32_t net_buf_simple_pull_be32(struct net_buf_simple *buf)
{
	u32_t val;

	val = UNALIGNED_GET((u32_t *)buf->data);
	net_buf_simple_pull(buf, sizeof(val));

	return sys_be32_to_cpu(val);
}

size_t net_buf_simple_headroom(struct net_buf_simple *buf)
{
	return buf->data - buf->__buf;
}

size_t net_buf_simple_tailroom(struct net_buf_simple *buf)
{
	return buf->size - net_buf_simple_headroom(buf) - buf->len;
}


text:
"""
Recipe sphinx

Based on https://pypi.python.org/pypi/collective.recipe.sphinxbuilder

Generate templates with command:

$ sphinx-quickstart --quiet -p \$\{project\} --dot=_ --sep -a \$\{author\} -v \$\{version\} --ext
-autodoc --ext-intersphinx --ext-todo --ext-viewcode --makefile --no-batchfile newdocs

Check the readthedocs docs:

http://docs.readthedocs.org/en/latest/faq.html

Sphinx extensions:
https://github.com/rtfd/sphinx-autoapi
http://sphinx-doc.org/ext/autodoc.html
http://sphinx-doc.org/ext/autosummary.html
"""

import os
import re
import sys
from mako.template import Template
from subprocess import check_call
import zc.buildout
import zc.recipe.egg
from fnmatch import fnmatch

import birdhousebuilder.recipe.conda

import logging
log = logging.getLogger(__name__)

makefile = Template(filename=os.path.join(os.path.dirname(__file__), "Makefile"))
conf_py = Template(filename=os.path.join(os.path.dirname(__file__), "conf_py"))
index_rst = Template(filename=os.path.join(os.path.dirname(__file__), "index.rst"))
rtd_txt = Template(filename=os.path.join(os.path.dirname(__file__), "rtd.txt"))

class Recipe(object):
    """buildout recipe to setup sphinx for birdhouse components"""

    def __init__(self, buildout, name, options):
        self.buildout, self.name, self.options = buildout, name, options
        self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
        self.buildout_dir = self.buildout['buildout']['directory']
        self.bin_dir = self.buildout['buildout']['bin-directory']

        self.src_dir = os.path.join(self.buildout_dir, options.get('src', '.'))
        self.options['src_dir'] = os.path.join('..', '..', options.get('src', '.'))
        self.docs_dir = os.path.join(self.buildout_dir, options.get('docs', 'docs'))
        self.build_dir = os.path.join(self.docs_dir, 'build')
        self.source_dir = os.path.join(self.docs_dir, 'source')
        self.extra_paths = self.options.get('extra-paths', 'eggs/* develop-eggs/*')

        # conda environment path
        self.options['env'] = self.options.get('env', '')
        self.options['pkgs'] = self.options.get('pkgs', 'sphinx sphinx_rtd_theme')
        self.options['channels'] = self.options.get('channels', 'defaults')
        self.conda = birdhousebuilder.recipe.conda.Recipe(self.buildout, self.name, {
            'env': self.options['env'],
            'pkgs': self.options['pkgs'],
            'channels': self.options['channels'] })
        self.options['conda-prefix'] = self.options['conda_prefix'] = self.conda.options['prefix']

        # config options
        self.options['project'] = self.options.get('project', 'MyBird')
        self.options['author'] = self.options.get('author', 'Birdhouse')
        self.options['version'] = self.options.get('version', '0.1')
        self.options['html_theme'] = self.options.get('html_theme', 'sphinx_rtd_theme')
        self.options['use_autoapi'] = self.options.get('use_autoapi', 'true')
        #self.outputs = options.get('outputs', 'html')
        #self.options['sphinxbuild'] = self.options.get('sphinxbuild', os.path.join(self.bin_dir, 'sphinx-build'))

    def install(self, update=False):
        """Installer"""
        installed = []
        installed += list(self.conda.install(update))
        installed += list(self.install_sphinx())
        installed += list(self.install_dir())
        installed += list(self.install_makefile())
        installed += list(self.install_config())
        installed += list(self.install_index())
        #installed += list(self.install_apidoc())
        installed += list(self.install_rtd())

        return installed

    def install_sphinx(self):
        # use extra paths .. eggs/* develop-eggs/*
        extra_paths = []
        if self.extra_paths:
            for extra_path in self.extra_paths.split():
                dir = os.path.dirname(extra_path)
                for filename in os.listdir(dir):
                    filename = os.path.join(dir, filename)
                    if fnmatch(filename, extra_path):
                        extra_paths.append(filename)

        egg_options = {}
        if extra_paths:
            log.info('inserting extra-paths..')
            egg_options['extra_paths'] = extra_paths

        self.egg.name = self.options['recipe']
        requirements, ws = self.egg.working_set([self.options['recipe'], 'docutils'])
        zc.buildout.easy_install.scripts([('sphinx-quickstart', 'sphinx.quickstart', 'main'),
                                          ('sphinx-build', 'sphinx', 'main'),
                                          ('sphinx-apidoc', 'sphinx.apidoc', 'main'),
                                          ('sphinx-autogen', 'sphinx.ext.autosummary.generate', 'main')], ws,
                                         self.buildout[self.buildout['buildout']['python']]['executable'],
                                         self.bin_dir, **egg_options)
        return tuple()

    def install_dir(self):
        # create build folder
        if not os.path.exists(self.build_dir):
            os.makedirs(self.build_dir)

        # create source folder
        if not os.path.exists(self.source_dir):
            os.makedirs(self.source_dir)

        static_dir = os.path.join(self.source_dir, '_static')
        if not os.path.exists(static_dir):
            os.makedirs(static_dir)

        templates_dir = os.path.join(self.source_dir, '_templates')
        if not os.path.exists(templates_dir):
            os.makedirs(templates_dir)

        return tuple()

    def install_makefile(self):
        content = makefile.render(**self.options)
        name = os.path.join(self.docs_dir, 'Makefile')
        self._write_file(name, content)
        return [name]

    def install_config(self):
        content = conf_py.render(**self.options)
        name = os.path.join(self.source_dir, 'conf.py')
        self._write_file(name, content)
        return [name]

    def install_index(self):
        name = os.path.join(self.source_dir, 'index.rst')
        # don't overwrite existing index.rst
        if not os.path.exists(name):
            content = index_rst.render(**self.options)
            self._write_file(name, content)
        return tuple()

    def install_apidoc(self):
        api_dir = os.path.join(self.source_dir, 'api')
        try:
            check_call(['sphinx-apidoc', '-f', '-o', api_dir, self.src_dir,
                        'setup.py', 'bootstrap.py', 'bootstrap-buildout.py'])
        except:
            log.exception('sphinx-apidoc failed.')
        return [api_dir]

    def install_rtd(self):
        """
        prepare readthedocs reqirements
        """
        name = os.path.join(self.buildout_dir, 'requirements', 'rtd.txt')
        if not os.path.exists(os.path.dirname(name)):
            os.makedirs(os.path.dirname(name))
        content = rtd_txt.render(**self.options)
        self._write_file(name, content)
        return [name]

    def update(self):
        return self.install(update=True)

    def _write_file(self, name, content):
        with open(name, 'w') as fp:
            fp.write(content)


text:
package subcmd

import (
	"github.com/kamichidu/go-hariti"
	"github.com/urfave/cli"
)

func rmAction(c *cli.Context) error {
	har := c.App.Metadata["hariti"].(*hariti.Hariti)

	for _, arg := range c.Args() {
		logger := har.Logger.WithPrefix(arg)

		if err := har.Remove(arg, c.Bool("force")); err != nil {
			logger.Error(err)
		}
	}
	return nil
}

func init() {
	Commands = append(Commands, cli.Command{
		Name:      "rm",
		Usage:     "Remove {repository}",
		ArgsUsage: "{repository}...",
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:  "force,f",
				Usage: "Force remove",
			},
		},
		Action: rmAction,
	})
}


text:
using IdentityServer3.Core.Configuration;

namespace IdentityServer3.Tests.Validation
{
    class TestIdentityServerOptions
    {
        public static IdentityServerOptions Create()
        {
            var options = new IdentityServerOptions
            {
                IssuerUri = "https://idsrv3.com",
                SiteName = "IdentityServer3 - test",
                DataProtector = new NoDataProtector(),
            };

            options.SigningCertificate = TestCert.Load();

            return options;
        }
    }
}


text:
- Powered by: Kohana PHP Framework, version 3.2 (development)
- Way too in progress..


text:
netstat -rn
sudo iptables -t nat -L
sudo ifconfig -a

IF_NAME=eth0
TUN_NAME=tun0
TUN_ADDR=10.77.255.254
#TUN_ADDR=10.77.0.2
#TUN_DSTADDR=10.77.0.1
#PRIVATE_ADDR=10.77.0.1

ADDR_PREFIX=10.77.0.0/16

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -D POSTROUTING -s $ADDR_PREFIX -o $IF_NAME -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s $ADDR_PREFIX -o $IF_NAME -j MASQUERADE
#sudo iptables -t nat -A POSTROUTING -s $ADDR_PREFIX -o $IF_NAME -j MASQUERADE -j LOG --log-level 7 --log-prefix "nat postrouting:"

sudo ip tuntap del dev $TUN_NAME mode tun
sudo ip tuntap add dev $TUN_NAME mode tun
#sudo ifconfig $TUN_NAME $TUN_ADDR dstaddr $TUN_DSTADDR up
sudo ifconfig $TUN_NAME $TUN_ADDR up
sudo route add -net $ADDR_PREFIX dev $TUN_NAME
#route del -net ...
#route del -host ...

echo "===========================split line=========================="
netstat -rn
sudo iptables -t nat -L

#设置dumpcap无需sudo方式
ls -l /usr/bin/dumpcap
sudo chmod 4755 /usr/bin/dumpcap
ls -l /usr/bin/dumpcap