text:
(function ($) {
    var DEBUG = false;
    var version = "1.1";
    $.fn.nailthumb = function (options) {
        var opts = $.extend({}, $.fn.nailthumb.defaults, options);
        return this.each(function () {
            var $this = $(this);
            var o = $.metadata ? $.extend({}, opts, $this.metadata()) : opts;
            thumbize($this, o);
        });
    };
    function thumbize(element, options) {
        var image = setImage(element, options);
        var container = setContainer(element, options);
        if (options.serverSideParams) {
            $.fn.nailthumb.setServerSideParams(image, container, options);
        }
        debugObject("image", image);
        debugObject("container", container);
        if (options.onStart) {
            options.onStart(container, options);
        }
        if (options.loadingClass) {
            container.addClass(options.loadingClass);
        }
        if (options.preload || image.data("nailthumb.replaceto")) {
            debug("wait on load");
            image.one("load", function () {
                debugObject("before check", image);
                if (!image.data("nailthumb.working") && !image.data("nailthumb.replacing")) {
                    image.data("nailthumb.working", true);
                    debugObject("inside check", image);
                    doThumb(image, container, options);
                }
            });
            var src = image.attr("src");
            image.attr("src", null).attr("src", src);
        } else {
            debug("nail thumb directly");
            image.data("nailthumb.working", true);
            doThumb(image, container, options);
        }
    }

    function doThumb(image, container, options) {
        resetImage(image, options);
        resetContainer(container, options);
        var imageDims = getImageDims(image, options);
        debugObject("image", image);
        debugObject("imageDims", imageDims);
        if (imageDims.width == 0 || imageDims.height == 0) {
            imageDims = getHiddenCloneDims(image);
            debugObject("imageCloneDims", imageDims);
        }
        var containerDims = getContainerDims(container, options);
        debugObject("container", container);
        debugObject("containerDims", containerDims);
        var prop = getProportion(containerDims, imageDims, options);
        debug("proportions", prop);
        resize(image, imageDims, container, containerDims, prop, options);
    }

    function setImage(element, options) {
        var image = element.find("img").first();
        var finder = options.imageCustomFinder;
        if (!finder && options.imageUrl) {
            finder = imageUrlFinder;
        } else {
            if (!finder && options.imageFromWrappingLink) {
                finder = imageFromWrappingLinkFinder;
            }
        }
        if (finder) {
            var img = finder(element, options);
            debugObject("finder", img);
            if (!img) {
                img = [];
            }
            if (img.length > 0) {
                image = img;
                image.css("display", "none");
                if (!image.data("nailthumb.replaceto")) {
                    image.data("nailthumb.replaceto", element);
                }
                image.data("nailthumb.originalImageDims", null);
            }
        }
        if (image.length == 0) {
            if (element.is("img")) {
                image = element;
            }
        }
        return image;
    }

    function imageUrlFinder(element, options) {
        var image = $("").attr("src", options.imageUrl).css("display", "none").data("nailthumb.replaceto", element);
        element.append(image);
        return image;
    }

    function imageFromWrappingLinkFinder(element, options) {
        var image;
        var link = element.find("a").first();
        if (link.length == 0 && element.is("a")) {
            link = element;
        }
        if (link.attr("href")) {
            image = $("").attr("src", link.attr("href")).css("display", "none").data("nailthumb.replaceto", link);
            if (link.attr("title")) {
                image.attr("title", link.attr("title"));
            }
            link.append(image);
        }
        return image;
    }

    function resetImage(image, options) {
        if (!options.nostyle) {
            image.css({"position": "relative"});
        }
        if (!image.data("nailthumb.originalImageDims")) {
            image.css({
                "width": "auto",
                "height": "auto",
                "top": 0,
                "left": 0
            }).removeAttr("width").removeAttr("height");
        }
    }

    function setContainer(element, options) {
        var container = element;
        if (element.is("img")) {
            if (options.ifImageAddContainer) {
                var c = $("

");
                element.wrap(c);
            }
            container = element.parent();
        }
        return container;
    }

    function resetContainer(container, options) {
        if (options.containerClass) {
            container.addClass(options.containerClass);
        }
        if (!options.nostyle) {
            container.css({"overflow": "hidden", "padding": "0px"});
        }
        if (options.replaceAnimation == "animate") {
            if (options.width || options.height) {
                container.animate({
                    "width": options.width,
                    "height": options.height
                }, options.animationTime, options.animation);
            }
        } else {
            if (options.width) {
                container.width(options.width);
            }
            if (options.height) {
                container.height(options.height);
            }
        }
        container.find("span." + options.titleClass).remove();
    }

    function resize(image, imageDims, container, containerDims, prop, options) {
        var iw = imageDims.width * prop;
        var ih = imageDims.height * prop;
        var top = 0, left = 0, diff;
        var direction = getDirections(options.fitDirection);
        if (ih < containerDims.innerHeight) {
            switch (direction.v) {
                case"center":
                    top = -(ih - containerDims.innerHeight) / 2;
                    break;
                case"bottom":
                    top = -(ih - containerDims.innerHeight);
                    diff = "bottom";
                    break;
                case"top":
                    top = 0;
                    diff = "top";
                    break;
                default:
                    break;
            }
        } else {
            if (ih > containerDims.innerHeight) {
                switch (direction.v) {
                    case"center":
                        top = -(ih - containerDims.innerHeight) / 2;
                        break;
                    case"bottom":
                        top = -(ih - containerDims.innerHeight);
                        break;
                    default:
                        break;
                }
            }
        }
        if (iw < containerDims.innerWidth) {
            switch (direction.h) {
                case"center":
                    left = -(iw - containerDims.innerWidth) / 2;
                    break;
                case"right":
                    left = -(iw - containerDims.innerWidth);
                    break;
                default:
                    break;
            }
        } else {
            if (iw > containerDims.innerWidth) {
                switch (direction.h) {
                    case"center":
                        left = -(iw - containerDims.innerWidth) / 2;
                        break;
                    case"right":
                        left = -(iw - containerDims.innerWidth);
                        break;
                    default:
                        break;
                }
            }
        }
        image.addClass(options.imageClass);
        if (image.data("nailthumb.replaceto")) {
            replaceImage(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
        } else {
            showImage(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
        }
    }

    function replaceImage(image, imageDims, container, containerDims, ih, iw, left, top, diff, options) {
        var element = image.data("nailthumb.replaceto");
        var replaceto = findReplaceTo(element, options);
        image.data("nailthumb.replacing", true);
        image.load(function () {
            image.data("nailthumb.replacing", null);
        });
        if (replaceto) {
            replaceto.replaceWith(image);
        } else {
            element.append(image);
        }
        if (options.afterReplace) {
            options.afterReplace(container, image, options);
        }
        showImage(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
    }

    function showImage(image, imageDims, container, containerDims, ih, iw, left, top, diff, options) {
        if (options.replaceAnimation == "animate") {
            image.css("display", "inline");
            container.animate({
                "width": containerDims.innerWidth,
                "height": containerDims.innerHeight
            }, options.animationTime, options.animation);
            image.animate({
                "width": iw,
                "height": ih,
                "top": top,
                "left": left
            }, options.animationTime, options.animation, function () {
                afterAppear(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
            });
        } else {
            container.css({"width": containerDims.innerWidth, "height": containerDims.innerHeight});
            if (options.replaceAnimation) {
                image.css("display", "none");
            }
            image.css({"width": iw, "height": ih, "top": top, "left": left});
            if (options.replaceAnimation == "fade") {
                image.fadeIn(options.animationTime, options.animation, function () {
                    afterAppear(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
                });
            } else {
                if (options.replaceAnimation == "slide") {
                    image.slideDown(options.animationTime, options.animation, function () {
                        afterAppear(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
                    });
                } else {
                    if (options.replaceAnimation && options.replaceAnimation instanceof Function) {
                        options.replaceAnimation(image, function () {
                            afterAppear(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
                        }, options);
                        if (!options.selfStartAfterAppear) {
                            afterAppear(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
                        }
                    } else {
                        image.css("display", "inline");
                        afterAppear(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
                    }
                }
            }
        }
    }

    function afterAppear(image, imageDims, container, containerDims, ih, iw, left, top, diff, options) {
        if (options.afterAppear) {
            options.afterAppear(container, image, options);
        }
        image.data("nailthumb.replaceto", null);
        decorate(image, imageDims, container, containerDims, ih, iw, left, top, diff, options);
    }

    function findReplaceTo(element, options) {
        var rep = null;
        element.find("img").each(function () {
            if (!rep && !$(this).data("nailthumb.replaceto")) {
                rep = $(this);
            }
        });
        return rep;
    }

    function decorate(image, imageDims, container, containerDims, ih, iw, left, top, diff, options) {
        if (options.title || (options.titleAttr && image.attr(options.titleAttr))) {
            var title = options.title ? options.title : image.attr(options.titleAttr);
            if (title) {
                var span = $('' + title + "");
                if (containerDims.innerHeight > ih) {
                    span.css("top", containerDims.innerHeight - ih);
                } else {
                    span.css("top", "0px");
                }
                container.append(span);
                var tit = getHiddenDims(span);
                var im = getHiddenDims(image);
                debugObject("decorate containerDims", containerDims);
                debugObject("decorate imageDims", imageDims);
                debugObject("decorate imageDims", im);
                debugObject("decorate tit", tit);
                var outbound = containerDims.offsetTop + containerDims.innerHeight - tit.offsetTop;
                if (containerDims.height > containerDims.innerHeight) {
                    outbound += (containerDims.height - containerDims.innerHeight) / 2;
                }
                span.css("top", "+=" + outbound);
                if (iw < tit.width) {
                    span.css("width", iw);
                }
                if (left > 0) {
                    span.css("left", left);
                }
                var delta = tit.height;
                if (containerDims.innerHeight > ih && diff != "bottom") {
                    delta += (containerDims.innerHeight - ih) / ((diff == "top") ? 1 : 2);
                }
                var clone = span.clone();
                clone.css("width", "auto").css("display", "none").css("position", "absolute");
                container.append(clone);
                var cloneDims = getHiddenDims(clone);
                clone.remove();
                debugObject("decorate cloneDims", cloneDims);
                if (options.titleWhen == "hover") {
                    container.unbind("mouseenter mouseleave").hover(function () {
                        span.find("span." + options.titleScrollerClass).css("left", 0);
                        containerDims = getHiddenDims(container);
                        tit = getHiddenDims(span);
                        outbound = containerDims.offsetTop + containerDims.innerHeight - tit.offsetTop;
                        if (containerDims.height > containerDims.innerHeight) {
                            outbound += (containerDims.height - containerDims.innerHeight) / 2;
                        }
                        debugObject("decorate hover tit", tit);
                        debug("decorate hover outbound", tit);
                        var doubleDelta = 0;
                        if (outbound < 0) {
                            span.css("top", "+=" + outbound);
                            doubleDelta = delta;
                        } else {
                            doubleDelta = delta - outbound;
                        }
                        if (options.animateTitle) {
                            resetScrollTitle(span, options);
                            span.stop(true).animate({top: "-=" + doubleDelta}, options.titleAnimationTime, options.titleAnimation, function () {
                                scrollTitle(span, cloneDims.width, containerDims.innerWidth, options);
                            });
                        } else {
                            span.css({top: "-=" + doubleDelta});
                            scrollTitle(span, cloneDims.width, containerDims.innerWidth, options);
                        }
                    }, function () {
                        if (options.animateTitle) {
                            resetScrollTitle(span, options);
                            span.animate({top: "+=" + delta}, options.titleAnimationTime, options.titleAnimation, function () {
                                resetScrollTitle(span, options);
                            });
                        } else {
                            resetScrollTitle(span, options);
                            span.css({top: "+=" + delta});
                        }
                    });
                } else {
                    if (options.animateTitle) {
                        span.animate({top: "-=" + delta}, options.titleAnimationTime, options.titleAnimation, function () {
                            scrollTitle(span, cloneDims.width, containerDims.innerWidth, options);
                        });
                    } else {
                        span.css({top: "-=" + delta});
                        scrollTitle(span, cloneDims.width, containerDims.innerWidth, options);
                    }
                }
            }
        }
        if (options.onFinish) {
            options.onFinish(container, options);
        }
        if (options.loadingClass) {
            container.removeClass(options.loadingClass);
        }
        image.data("nailthumb.working", null);
    }

    function resetScrollTitle(span, options) {
        span.find("span." + options.titleScrollerClass).stop();
    }

    function scrollTitle(span, width, visibleWidth, options) {
        if (width > visibleWidth && options.titleScrolling) {
            if (span.find("span." + options.titleScrollerClass).length == 0) {
                span.wrapInner('');
                span.find("span." + options.titleScrollerClass).width(width).css("position", "relative").css("white-space", "nowrap");
            }
            span.find("span." + options.titleScrollerClass).css("left", 0);
            setTimeout(scrollFunction(span, width, visibleWidth, options), 1000);
        }
    }

    function scrollFunction(span, width, visibleWidth, options) {
        return function () {
            var indent = Number(span.find("span." + options.titleScrollerClass).css("left").replace(/[^-\d]/g, ""));
            debug("indent", indent);
            debug("width", width);
            debug("visibleWidth", visibleWidth);
            debug("width <= -indent", (width <= -indent));
            var delta = width + indent;
            if (delta <= 0) {
                span.find("span." + options.titleScrollerClass).css("left", visibleWidth);
                delta = width + visibleWidth;
            }
            delta += 10;
            span.find("span." + options.titleScrollerClass).animate({"left": "-=" + delta}, width * 1000 / 30, "linear", scrollFunction(span, width, visibleWidth, options));
        };
    }

    function getProportion(containerDims, imageDims, options) {
        if (options.proportions != null && options.proportions > 0) {
            return options.proportions;
        } else {
            var prop = containerDims.innerWidth / imageDims.width;
            if (options.method && options.method == "resize") {
                if (containerDims.innerHeight / imageDims.height < prop) {
                    prop = containerDims.innerHeight / imageDims.height;
                }
            } else {
                if (containerDims.innerHeight / imageDims.height > prop) {
                    prop = containerDims.innerHeight / imageDims.height;
                }
            }
            if (options.maxEnlargement && options.maxEnlargement < prop) {
                prop = options.maxEnlargement;
            }
            if (options.maxShrink && options.maxShrink > prop) {
                prop = options.maxShrink;
            }
            return prop;
        }
    }

    function getDirections(option) {
        var dir = {h: "center", v: "center"};
        if (option) {
            var opts = option.split(" ");
            if (opts.length > 0) {
                dir = getDirection(opts[0], dir);
            }
            if (opts.length > 1) {
                dir = getDirection(opts[1], dir);
            }
        }
        return dir;
    }

    function getDirection(str, d) {
        switch (str) {
            case"top":
                d.v = "top";
                break;
            case"bottom":
                d.v = "bottom";
                break;
            case"left":
                d.h = "left";
                break;
            case"right":
                d.h = "right";
                break;
            default:
                break;
        }
        return d;
    }

    function getImageDims(image, options) {
        var imageDims;
        if (!image.data("nailthumb.originalImageDims")) {
            imageDims = getHiddenDims(image);
            image.data("nailthumb.originalImageDims", imageDims);
            if (!options.keepImageDimensions) {
                image.one("load", function () {
                    image.data("nailthumb.originalImageDims", null);
                });
            }
        } else {
            imageDims = image.data("nailthumb.originalImageDims");
        }
        return imageDims;
    }

    function getContainerDims(container, options) {
        var containerDims = getHiddenDims(container);
        if (options.width) {
            containerDims.innerWidth = options.width;
        }
        if (options.height) {
            containerDims.innerHeight = options.height;
        }
        return containerDims;
    }

    function getDims(elem) {
        var offset = $(elem).offset();
        return {
            offsetTop: offset.top,
            offsetLeft: offset.left,
            width: $(elem).outerWidth(),
            height: $(elem).outerHeight(),
            innerWidth: $(elem).innerWidth(),
            innerHeight: $(elem).innerHeight()
        };
    }

    function getHiddenDims(elems) {
        var dims = null, i = 0, offset, elem;
        while ((elem = elems[i++])) {
            var hiddenElems = $(elem).parents().andSelf().filter(":hidden");
            if (!hiddenElems.length) {
                dims = getDims(elem);
            } else {
                var backupStyle = [];
                hiddenElems.each(function () {
                    var style = $(this).attr("style");
                    style = typeof style == "undefined" ? "" : style;
                    backupStyle.push(style);
                    $(this).attr("style", style + " display: block !important;");
                });
                hiddenElems.eq(0).css("left", -10000);
                dims = getDims(elem);
                hiddenElems.each(function () {
                    $(this).attr("style", backupStyle.shift());
                });
            }
        }
        return dims;
    }

    function getHiddenCloneDims(elems) {
        var dims = null, i = 0, offset, elem;
        while ((elem = elems[i++])) {
            var hiddenElems = $(elem).parents().andSelf().filter(":hidden");
            if (!hiddenElems.length) {
                dims = getDims(elem);
            } else {
                var backupStyle = [];
                hiddenElems.each(function () {
                    var style = $(this).attr("style");
                    style = typeof style == "undefined" ? "" : style;
                    backupStyle.push(style);
                    $(this).attr("style", style + " display: block !important;");
                });
                hiddenElems.eq(0).css("left", -10000);
                var clone = hiddenElems.eq(0).clone();
                $("body").append(clone);
                dims = getDims(clone);
                hiddenElems.each(function () {
                    $(this).attr("style", backupStyle.shift());
                });
                clone.remove();
            }
        }
        return dims;
    }

    $.fn.nailthumb.evalServerSideParams = function (image, container, options) {
        if (options.serverSideParams) {
            var params = {};
            if (!options.serverSideParams.noServerResize) {
                var w = null, h = null;
                if (options.serverSideParams.width) {
                    w = options.serverSideParams.width;
                } else {
                    if (options.width) {
                        w = options.width;
                    }
                }
                if (options.serverSideParams.height) {
                    h = options.serverSideParams.height;
                } else {
                    if (options.height) {
                        h = options.height;
                    }
                }
                if (!(w && h)) {
                    resetContainer(container, options);
                    var containerDims = getContainerDims(container, options);
                    w = containerDims.innerWidth;
                    h = containerDims.innerHeight;
                }
                if (w && h) {
                    params.w = w;
                    params.h = h;
                    if (options.serverSideParams.mode != "resize") {
                        if (options.method == "crop") {
                            params.mode = "crop";
                        }
                        if (options.serverSideParams.mode) {
                            params.mode = options.serverSideParams.mode;
                        }
                    }
                }
            }
            $.each(options.serverSideParams, function (key, val) {
                if (key != "width" && key != "height" && key != "mode" && key != "noServerResize" && val) {
                    params[key] = val;
                }
            });
            var pars = "";
            $.each(params, function (key, val) {
                pars += ";" + key + "=" + val;
            });
            debug(pars, params);
            return pars;
        } else {
            return "";
        }
    };
    $.fn.nailthumb.setServerSideParams = function (image, container, options) {
        if (options.serverSideParams) {
            var url = image.attr("src");
            if (image.data("nailthumb.originalImageUrl")) {
                url = image.data("nailthumb.originalImageUrl");
            }
            image.data("nailthumb.originalImageUrl", url);
            var pars = $.fn.nailthumb.evalServerSideParams(image, container, options);
            url += pars;
            image.attr("src", url);
        }
    };
    $.fn.nailthumb.toggleDebug = function () {
        DEBUG = !DEBUG;
    };
    $.fn.nailthumb.doThumb = function (image, container, options) {
        doThumb(image, container, options);
    };
    $.fn.nailthumb.defaults = {
        onStart: null,
        onFinish: null,
        loadingClass: "nailthumb-loading",
        imageUrl: null,
        imageFromWrappingLink: false,
        imageCustomFinder: null,
        imageClass: "nailthumb-image",
        afterReplace: null,
        afterAppear: null,
        replaceAnimation: "fade",
        selfStartAfterAppear: false,
        animationTime: 1000,
        animation: "swing",
        keepImageDimensions: false,
        method: "crop",
        fitDirection: null,
        proportions: null,
        ifImageAddContainer: true,
        containerClass: "nailthumb-container",
        maxEnlargement: null,
        maxShrink: null,
        preload: true,
        nostyle: false,
        width: null,
        height: null,
        title: null,
        titleClass: "nailthumb-title",
        titleAttr: "title",
        titleWhen: "hover",
        titleScrolling: true,
        titleScrollerClass: "nailthumb-title-scroller",
        animateTitle: true,
        titleAnimationTime: 500,
        titleAnimation: "swing",
        serverSideParams: null
    };
    function log(log, jQueryobj) {
        try {
            debug(log, jQueryobj, true);
        } catch (ex) {
        }
    }

    function debug(log, jQueryobj, force) {
        try {
            if ((DEBUG && window.console && window.console.log) || force) {
                window.console.log(log + ": " + jQueryobj);
            }
        } catch (ex) {
        }
    }

    function debugObject(log, jQueryobj, force) {
        try {
            if (!jQueryobj) {
                jQueryobj = log;
            }
            debug(log, jQueryobj);
            if ((DEBUG && window.console && window.console.log) || force) {
                window.console.debug(jQueryobj);
            }
        } catch (ex) {
        }
    }
})(jQuery);


text:
@extends('layouts.app')

@section('content')

     View List

General

        <form class="form-horizontal" action="{{ url('/orders/' . $order->id) }}" method="post">
            {!! csrf_field() !!}
            {!! method_field('PATCH') !!}
            @include('commons.error')
            @include('commons.success')

has('name') ? ' has-error' : '' }}">
                Name

                    <input type="text" name="name" id="order-name" class="form-control" value="{{ isset($order->name) ? $order->name : old('name') }}">
                    @if ($errors->has('name'))

                            {{ $errors->first('name') }}

                    @endif

has('address') ? ' has-error' : '' }}">
                Address

                    <input type="text" name="address" id="order-address" class="form-control" value="{{ isset($order->address) ? $order->address : old('address') }}">
                    @if ($errors->has('address'))

                            {{ $errors->first('address') }}

                    @endif

has('email') ? ' has-error' : '' }}">
                Email

                    <input type="email" name="email" id="order-email" class="form-control" value="{{ isset($order->email) ? $order->email : old('email') }}">
                    @if ($errors->has('email'))

                            {{ $errors->first('email') }}

                    @endif

has('handphone') ? ' has-error' : '' }}">
                Handphone

                    <input type="text" name="handphone" id="order-handphone" class="form-control" value="{{ isset($order->handphone) ? $order->handphone : old('handphone') }}">
                    @if ($errors->has('handphone'))

                            {{ $errors->first('handphone') }}

                    @endif

has('id_no') ? ' has-error' : '' }}">
                ID Number

                    <input type="text" name="id_no" id="order-id_no" class="form-control" value="{{ isset($order->id_no) ? $order->id_no : old('id_no') }}">
                    @if ($errors->has('id_no'))

                            {{ $errors->first('id_no') }}

                    @endif

                    <button type="submit" name="button" class="btn btn-success"> Save</button>

        </form>

@endsection

redpajama_set_name: RedPajamaGithub


text:
Spree::Core::Engine.routes.draw do
  match '/ajax_cart', :to => 'orders#ajax_cart', :via => :get, :as => :ajax_cart
end


text:
namespace Bitcraft
{
    namespace StateMachine
    {
        /// <summary>
        /// Represents a state machine action.
        /// </summary>
        class ActionToken : public Token
        {
        public:
            /// <summary>
            /// Initializes the ActionToken instance.
            /// </summary>
            ActionToken()
                : Token()
            {
            }

            /// <summary>
            /// Initializes the ActionToken instance.
            /// </summary>
            /// <param name="name">Name of the action token.</param>
            ActionToken(wchar_t* name)
                : Token(name)
            {
            }
        };
    }
}

#endif // __BITCRAFT_STATEMACHINE_ACTION_TOKEN_H__


text:
using System;

namespace MessageBus.Core.API
{
    public interface ISerializer
    {
        string ContentType { get; }

        byte[] Serialize(RawBusMessage data);

        object Deserialize(Type dataType, byte[] body);
    }
}


text:
var searchData=
[
  ['ebootstrap',['EBootstrap',['../classZero_1_1EBootstrap.html',1,'Zero']]],
  ['echkarginvalido',['EChkArgInvalido',['../classZero_1_1EChkArgInvalido.html',1,'Zero']]],
  ['echkerror',['EChkError',['../classZero_1_1EChkError.html',1,'Zero']]],
  ['echketqnodefinida',['EChkEtqNoDefinida',['../classZero_1_1EChkEtqNoDefinida.html',1,'Zero']]],
  ['echketqredefinida',['EChkEtqRedefinida',['../classZero_1_1EChkEtqRedefinida.html',1,'Zero']]],
  ['echkherenciaciclica',['EChkHerenciaCiclica',['../classZero_1_1EChkHerenciaCiclica.html',1,'Zero']]],
  ['echkmetainvalido',['EChkMetaInvalido',['../classZero_1_1EChkMetaInvalido.html',1,'Zero']]],
  ['echksaltoinvalido',['EChkSaltoInvalido',['../classZero_1_1EChkSaltoInvalido.html',1,'Zero']]],
  ['ecompilacion',['ECompilacion',['../classZero_1_1ECompilacion.html',1,'Zero']]],
  ['edivisionporcero',['EDivisionPorCero',['../classZero_1_1EDivisionPorCero.html',1,'Zero']]],
  ['eduplicado',['EDuplicado',['../classZero_1_1EDuplicado.html',1,'Zero']]],
  ['eejecucion',['EEjecucion',['../classZero_1_1EEjecucion.html',1,'Zero']]],
  ['egestionmemoria',['EGestionMemoria',['../classZero_1_1EGestionMemoria.html',1,'Zero']]],
  ['eilegal',['EIlegal',['../classZero_1_1EIlegal.html',1,'Zero']]],
  ['einputoutput',['EInputOutput',['../classZero_1_1EInputOutput.html',1,'Zero']]],
  ['einterno',['EInterno',['../classZero_1_1EInterno.html',1,'Zero']]],
  ['elibilegal',['ELibIlegal',['../classZero_1_1ELibIlegal.html',1,'Zero']]],
  ['elibnoenps',['ELibNoEnPS',['../classZero_1_1ELibNoEnPS.html',1,'Zero']]],
  ['emedionoencontrado',['EMedioNoEncontrado',['../classZero_1_1EMedioNoEncontrado.html',1,'Zero']]],
  ['emempaginaerronea',['EMemPaginaErronea',['../classZero_1_1EMemPaginaErronea.html',1,'Zero']]],
  ['enadaquehacer',['ENadaQueHacer',['../classENadaQueHacer.html',1,'']]],
  ['enoesnumero',['ENoEsNumero',['../classZero_1_1ENoEsNumero.html',1,'Zero']]],
  ['enoeszero',['ENoEsZero',['../classZero_1_1ENoEsZero.html',1,'Zero']]],
  ['enohaymemoria',['ENoHayMemoria',['../classZero_1_1ENoHayMemoria.html',1,'Zero']]],
  ['ensamz',['EnsamZ',['../classEnsamZ.html',1,'']]],
  ['eopcodeilegal',['EOpcodeIlegal',['../classZero_1_1EOpcodeIlegal.html',1,'Zero']]],
  ['epersistencia',['EPersistencia',['../classZero_1_1EPersistencia.html',1,'Zero']]],
  ['erutainvalida',['ERutaInvalida',['../classZero_1_1ERutaInvalida.html',1,'Zero']]],
  ['eseccpersnoexiste',['ESeccPersNoExiste',['../classZero_1_1ESeccPersNoExiste.html',1,'Zero']]],
  ['esemantico',['ESemantico',['../classZero_1_1ESemantico.html',1,'Zero']]],
  ['esintaxis',['ESintaxis',['../classZero_1_1ESintaxis.html',1,'Zero']]],
  ['esintaxisinvocacion',['ESintaxisInvocacion',['../classESintaxisInvocacion.html',1,'']]],
  ['esintxanidamiento',['ESintxAnidamiento',['../classZero_1_1ESintxAnidamiento.html',1,'Zero']]],
  ['esintxasgnopermitido',['ESintxAsgNoPermitido',['../classZero_1_1ESintxAsgNoPermitido.html',1,'Zero']]],
  ['esintxatrnopermitido',['ESintxAtrNoPermitido',['../classZero_1_1ESintxAtrNoPermitido.html',1,'Zero']]],
  ['esintxcomillasesperadas',['ESintxComillasEsperadas',['../classZero_1_1ESintxComillasEsperadas.html',1,'Zero']]],
  ['esintxdefnopermitido',['ESintxDefNoPermitido',['../classZero_1_1ESintxDefNoPermitido.html',1,'Zero']]],
  ['esintxenmnopermitido',['ESintxEnmNoPermitido',['../classZero_1_1ESintxEnmNoPermitido.html',1,'Zero']]],
  ['esintxenonopermitido',['ESintxEnoNoPermitido',['../classZero_1_1ESintxEnoNoPermitido.html',1,'Zero']]],
  ['esintxetqnopermitido',['ESintxEtqNoPermitido',['../classZero_1_1ESintxEtqNoPermitido.html',1,'Zero']]],
  ['esintxfltnopermitido',['ESintxFltNoPermitido',['../classZero_1_1ESintxFltNoPermitido.html',1,'Zero']]],
  ['esintxfltnovalido',['ESintxFltNoValido',['../classZero_1_1ESintxFltNoValido.html',1,'Zero']]],
  ['esintxidnovalido',['ESintxIdNoValido',['../classZero_1_1ESintxIdNoValido.html',1,'Zero']]],
  ['esintxintnopermitido',['ESintxIntNoPermitido',['../classZero_1_1ESintxIntNoPermitido.html',1,'Zero']]],
  ['esintxiofnopermitido',['ESintxIofNoPermitido',['../classZero_1_1ESintxIofNoPermitido.html',1,'Zero']]],
  ['esintxjmpnopermitido',['ESintxJmpNoPermitido',['../classZero_1_1ESintxJmpNoPermitido.html',1,'Zero']]],
  ['esintxjofnopermitido',['ESintxJofNoPermitido',['../classZero_1_1ESintxJofNoPermitido.html',1,'Zero']]],
  ['esintxjotnopermitido',['ESintxJotNoPermitido',['../classZero_1_1ESintxJotNoPermitido.html',1,'Zero']]],
  ['esintxmnemoinvalido',['ESintxMnemoInvalido',['../classZero_1_1ESintxMnemoInvalido.html',1,'Zero']]],
  ['esintxmsgnopermitido',['ESintxMsgNoPermitido',['../classZero_1_1ESintxMsgNoPermitido.html',1,'Zero']]],
  ['esintxmtanopermitido',['ESintxMtaNoPermitido',['../classZero_1_1ESintxMtaNoPermitido.html',1,'Zero']]],
  ['esintxmthnopermitido',['ESintxMthNoPermitido',['../classZero_1_1ESintxMthNoPermitido.html',1,'Zero']]],
  ['esintxnopnopermitido',['ESintxNopNoPermitido',['../classZero_1_1ESintxNopNoPermitido.html',1,'Zero']]],
  ['esintxnumnovalido',['ESintxNumNoValido',['../classZero_1_1ESintxNumNoValido.html',1,'Zero']]],
  ['esintxobjnopermitido',['ESintxObjNoPermitido',['../classZero_1_1ESintxObjNoPermitido.html',1,'Zero']]],
  ['esintxretnopermitido',['ESintxRetNoPermitido',['../classZero_1_1ESintxRetNoPermitido.html',1,'Zero']]],
  ['esintxsetnopermitido',['ESintxSetNoPermitido',['../classZero_1_1ESintxSetNoPermitido.html',1,'Zero']]],
  ['esintxstrnopermitido',['ESintxStrNoPermitido',['../classZero_1_1ESintxStrNoPermitido.html',1,'Zero']]],
  ['esintxtrwnopermitido',['ESintxTrwNoPermitido',['../classZero_1_1ESintxTrwNoPermitido.html',1,'Zero']]],
  ['eversionilegal',['EVersionIlegal',['../classZero_1_1EVersionIlegal.html',1,'Zero']]],
  ['excepcion',['Excepcion',['../classZero_1_1Excepcion.html',1,'Zero']]]
];


text:
'use strict';

require('mocha');
require('should');
var assert = require('assert');
var generate = require('..');
var app, len;

describe('app', function() {
  beforeEach(function() {
    app = generate();
    if (typeof app.include === 'undefined') {
      app.create('include');
    }
    len = Object.keys(app.views.includes).length;
  });

  describe('add include', function() {
    it('should add includes to `app.views.includes`:', function() {
      app.include('a.hbs', {path: 'a.hbs', content: 'a'});
      app.include('b.hbs', {path: 'b.hbs', content: 'b'});
      app.include('c.hbs', {path: 'c.hbs', content: 'c'});
      assert((Object.keys(app.views.includes).length - len) === 3);
    });
  });
});


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
        <link href="css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">

        <title>Contact List</title>

Список контактов

                    Id
                    ФИО
                    Телефон
                    Эл.почта

            <button class="btn">Добавить контакт</button>

        <form class="form-horizontal">

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

Добавить контакт

                        ФИО:

                            <input type="text" name="inputFIO" placeholder="Иванов И.И." required>

                        Телефон:

                            <input type="text" name="inputPhone" placeholder="+7 812 123 45 67" required>

                        Эл.почта:

                            <input type="email" name="inputEmail" placeholder="username@domain.ru" required>

                    <button class="btn btn-primary" onclick="addBtn();">Добавить</button>

        </form>


text:
namespace google {
namespace cloud {
namespace dataproc_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

std::shared_ptr<ClusterControllerStub> CreateDefaultClusterControllerStub(
    google::cloud::CompletionQueue cq, Options const& options) {
  auto auth = google::cloud::internal::CreateAuthenticationStrategy(
      std::move(cq), options);
  auto channel = auth->CreateChannel(options.get<EndpointOption>(),
                                     internal::MakeChannelArguments(options));
  auto service_grpc_stub =
      google::cloud::dataproc::v1::ClusterController::NewStub(channel);
  std::shared_ptr<ClusterControllerStub> stub =
      std::make_shared<DefaultClusterControllerStub>(
          std::move(service_grpc_stub),
          google::longrunning::Operations::NewStub(channel));

  if (auth->RequiresConfigureContext()) {
    stub = std::make_shared<ClusterControllerAuth>(std::move(auth),
                                                   std::move(stub));
  }
  stub = std::make_shared<ClusterControllerMetadata>(std::move(stub));
  if (internal::Contains(options.get<TracingComponentsOption>(), "rpc")) {
    GCP_LOG(INFO) << "Enabled logging for gRPC calls";
    stub = std::make_shared<ClusterControllerLogging>(
        std::move(stub), options.get<GrpcTracingOptionsOption>(),
        options.get<TracingComponentsOption>());
  }
  return stub;
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace dataproc_internal
}  // namespace cloud
}  // namespace google


text:
@interface MLSUserFormPhoneCell ()
@property(nonatomic, strong) QMUIButton *countryCodeView;
@property(nonatomic, strong) NBPhoneNumberUtil *phoneNumUtil;
@end

@implementation MLSUserFormPhoneCell
- (void)setUp
{
        [super setUp];

        [self.leftView setImage:[UIImage login_phone] forState:(UIControlStateNormal)];
        [self.leftView setImage:[UIImage login_phone] forState:(UIControlStateSelected)];

        @weakify(self);
        [self.countryCodeView jk_addActionHandler:^(NSInteger tag) {
                @strongify(self);
                if (self.field.action)
                {
                        self.field.action(self);
                }
        }];

        self.textField.validator = [MLSPhoneValidator validator];

        [self.contentView addSubview:self.countryCodeView];

        [self.KVOController observe:WGUserManager keyPath:@keypath(WGUserManager,country_code) options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial) block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSString *,id> * _Nonnull change) {
                @strongify(self);
                [self.countryCodeView setTitle:WGUserFormCountryCodeFmt([change jk_stringForKey:NSKeyValueChangeNewKey]) forState:(UIControlStateNormal)];
        }];
}
- (void)textFieldValid:(BOOL)valid
{
        if (valid)
        {
                NSError *error = nil;
                NBPhoneNumber *phoneNumber = [self.phoneNumUtil parseWithPhoneCarrierRegion:[NSString stringWithFormat:@"+%@%@",WGUserManager.country_code,self.textField.text] error:&error];
                NSString *fmtCountryCode = WGUserFormCountryCodeFmt(phoneNumber.countryCode.stringValue);
                if (phoneNumber.countryCode && ![self.countryCodeView.currentTitle isEqualToString:fmtCountryCode])
                {
                        [self.countryCodeView setTitle:fmtCountryCode forState:(UIControlStateNormal)];
                        WGUserManager.country_code = phoneNumber.countryCode.stringValue;
                }
        }
}
- (void)layout
{
        [self.leftView mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.contentView).offset(UserFormLeftMargin);
                make.size.mas_equalTo(UserFormleftViewSize);
                make.centerY.equalTo(self.contentView);
        }];

        [self.countryCodeView mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.leftView.mas_right);
                make.centerY.equalTo(self.contentView);
                make.width.mas_equalTo(70);
        }];

        [self.textField mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.countryCodeView.mas_right).offset(UserFormTextFieldInsets.left);
                make.right.equalTo(self.contentView.mas_right).offset(-UserFormRightMargin);
                make.centerY.equalTo(self.contentView);
                make.top.equalTo(self.contentView).offset(UserFormTextFieldInsets.top);
                make.bottom.equalTo(self.contentView).offset(-UserFormTextFieldInsets.bottom);
        }];
        [self.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(self.leftView.mas_left);
                make.right.equalTo(self.textField.mas_right);
                make.bottom.equalTo(self.contentView);
                make.height.mas_equalTo(UserFormBootomLineHeight);
        }];
}

- (QMUIButton *)countryCodeView
{
        if (!_countryCodeView) {
                _countryCodeView = [[QMUIButton alloc] initWithImage:[UIImage account_btn_up] title:WGUserFormCountryCodeFmt(WGUserManager.country_code)];
                [_countryCodeView setTitleColor:UIColorGrayDarken forState:(UIControlStateNormal)];
                _countryCodeView.titleLabel.font = WGSystem14Font;
                _countryCodeView.imagePosition = QMUIButtonImagePositionRight;
                _countryCodeView.spacingBetweenImageAndTitle = 8;
        }
        return _countryCodeView;
}
- (NBPhoneNumberUtil *)phoneNumUtil
{
        if (!_phoneNumUtil) {
                _phoneNumUtil = [[NBPhoneNumberUtil alloc] init];
        }
        return _phoneNumUtil;
}
@end


text:
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
using Nest.Queryify.Abstractions;
using Nest.Queryify.Tests.Extensions;
using Nest.Queryify.Tests.Queries.Fixtures;
using Nest.Queryify.Tests.TestData;
using Xunit;

namespace Nest.Queryify.UnitTests.Repository
{
    public class ElasticsearchRepositoryBulkSpecs
    {
        private readonly IElasticsearchRepository _repository;
        private readonly IElasticClient _client;

        public ElasticsearchRepositoryBulkSpecs()
        {
            var settings = new ConnectionSettings();
            settings.SetDefaultIndex("test-index");

            var output =
                "Nest.Queryify.Tests.TestData.ValidBulkResponse.json".ReadAsStringFromEmbeddedResource<ElasticClientQueryObjectTestFixture>();
            _client = new ElasticClient(settings, new InMemoryConnection(settings, output));
            _repository = new ElasticsearchRepository(_client);
        }

        [Fact]
        public void ShouldRun()
        {
            var response = _repository.Bulk(new [] {
                new Person() { Id = 1 },
                new Person() { Id = 2 },
                new Person() { Id = 3 }
            });

            response.Took.Should().Be(7);
            response.Items.Count().Should().Be(3);
            response.Infer.DefaultIndex.Should().Be("test-index");
        }

        [Fact]
        public async Task ShouldRunAsync()
        {
            var response = await _repository.BulkAsync(new[] {
                new Person() { Id = 1 },
                new Person() { Id = 2 },
                new Person() { Id = 3 }
            });

            response.Took.Should().Be(7);
            response.Items.Count().Should().Be(3);
            response.Infer.DefaultIndex.Should().Be("test-index");
        }
    }
}


text:
package oceanbasepro

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

// DiskSizeInDescribeTenant is a nested struct in oceanbasepro response
type DiskSizeInDescribeTenant struct {
	UsedDiskSize float64 `json:"UsedDiskSize" xml:"UsedDiskSize"`
}


text:
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16sp</dimen>
    <dimen name="activity_vertical_margin">16sp</dimen>
    <dimen name="fab_margin">16sp</dimen>
    <dimen name="app_bar_height">60sp</dimen>
    <dimen name="text_margin">16sp</dimen>
    <dimen name="title_size">18sp</dimen>
    <dimen name="text_size">16sp</dimen>
</resources>


text:
--------------------------------
-- @function [parent=#TransitionFadeTR] actionWithSize
-- @param self
-- @param #size_table size
-- @return ActionInterval#ActionInterval ret (return value: cc.ActionInterval)

--------------------------------
-- @function [parent=#TransitionFadeTR] create
-- @param self
-- @param #float float
-- @param #cc.Scene scene
-- @return TransitionFadeTR#TransitionFadeTR ret (return value: cc.TransitionFadeTR)

--------------------------------
-- @function [parent=#TransitionFadeTR] draw
-- @param self
-- @param #cc.Renderer renderer
-- @param #cc.Mat4 mat4
-- @param #bool bool

return nil


text:
class ProgrammingLanguage < ActiveRecord::Base
  attr_accessible :name, :version, :codemirror_mode, :cmd

  def title
    "#{name} #{version}"
  end
end


text:
<?php

namespace App\Http\ViewComposers;

use App\Interfaces\BookshelfInterface;
use Illuminate\View\View;

class BookshelfComposer
{
    //
    protected $bookshelfRepository;

    /**
     * [__construct description]
     * @param BookselfInterface $bookselfRepository [description]
     */
    public function __construct(BookshelfInterface $bookshelfRepository)
    {

        $this->bookshelfRepository = $bookshelfRepository;
    }

    /**
     * [compose description]
     * @param  View   $view [description]
     * @return [type]       [description]
     */
    public function compose(View $view)
    {
        $view->with('bookshelves', $this->bookshelfRepository->getListReadyBookshelf());
    }
}


text:
gitlab = node['gitlab']

# Make sure we have all common paths included in our environment
magic_shell_environment 'PATH' do
  value '/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin'
end

# 1. Packages / Dependencies
include_recipe "apt" if platform?("ubuntu", "debian")
include_recipe "yum-epel" if platform_family?("rhel")
include_recipe "gitlab::git"
include_recipe "redisio::install"
include_recipe "redisio::enable"

## Install the required packages.
gitlab['packages'].each do |pkg|
  package pkg
end

# Upgrade the openssl package to the latest version in the repository to prevent bundle install failures due to invalid certs
package "openssl" do
  action :upgrade
end


text:
> IndexedDB schema manager.

[![](https://saucelabs.com/browser-matrix/idb-schema.svg)](https://saucelabs.com/u/idb-schema)

[![](https://img.shields.io/npm/v/idb-schema.svg)](https://npmjs.org/package/idb-schema)
[![](https://img.shields.io/travis/treojs/idb-schema.svg)](https://travis-ci.org/treojs/idb-schema)
[![](http://img.shields.io/npm/dm/idb-schema.svg)](https://npmjs.org/package/idb-schema)

This modules provides declarative schema management API for IndexedDB.
And it also fixes inconsistency between browsers:
- [Incorrect value of oldVersion in Safari](https://bugs.webkit.org/show_bug.cgi?id=136888) during `onupgradeneeded` event
- [InvalidAccessError in Internet Explorer](https://msdn.microsoft.com/en-us/library/hh772493(v=vs.85).aspx), when autoIncrement or keyPath are `false`

## Installation

    npm install --save idb-schema

Use [IndexedDBShim](https://github.com/axemclion/IndexedDBShim) to fallback to WebSQL.

## Example

```js
import Schema from 'idb-schema'

// define schema
const schema = new Schema()
.version(1)
  .addStore('books', { key: 'isbn' })
  .addIndex('byTitle', 'title', { unique: true })
  .addIndex('byAuthor', 'author')
.version(2)
  .getStore('books')
  .addIndex('byDate', ['year', 'month'])
.version(3)
  .addStore('magazines')
  .addIndex('byPublisher', 'publisher')
  .addIndex('byFrequency', 'frequency')
.version(4)
  .getStore('magazines')
  .delIndex('byPublisher')
  .addCallback((upgradeNeededEvent) => {
    // do something custom
  })

// get schema version
schema.version() // 4

// generate callback for db.onupgradeneeded event
schema.callback()

// get description of stores
schema.stores()
// [{ name: 'books', indexes: [{..}, {..}, {..}], keyPath: 'isbn' },
//  { name: 'magazines', indexes: [{..}] }]
```

## API

### schema.callback()

Generate `onupgradeneeded` callback.

```js
const req = indexedDB.open('mydb', schema.version())
req.onupgradeneeded = schema.callback()
req.onsuccess = (e) => {
  const db = e.target.result
}
```

### schema.stores()

Get JSON representation of database schema.

```json
[
  {
    "name": "books",
    "indexes": [
      {
        "name": "byTitle",
        "field": "title",
        "multiEntry": false,
        "unique": true
      },
      {
        "name": "byAuthor",
        "field": "author",
        "multiEntry": false,
        "unique": false
      },
      {
        "name": "byDate",
        "field": [
          "year",
          "month"
        ],
        "multiEntry": false,
        "unique": false
      }
    ],
    "keyPath": "isbn",
    "autoIncrement": false
  },
  {
    "name": "magazines",
    "indexes": [
      {
        "name": "byFrequency",
        "field": "frequency",
        "multiEntry": false,
        "unique": false
      }
    ],
    "keyPath": null,
    "autoIncrement": false
  }
]
```

### schema.version([number])

Get current version or set new version to `number` and reset current store.
Use it to separate migrations on time.

### schema.addStore(name, [opts])

Create object store with `name`.

Options:
* `key` || `keyPath` - primary key (default: null)
* `increment` || `autoIncrement` - increment key automatically (default: false)

### schema.delStore(name)

Delete store by `name`.

### schema.getStore(name)

Switch current store.
Use it to make operations with indexes.

### schema.addIndex(name, field, [opts])

Create index with `name` and to `field` (or array of fields).

Options:
* `unique` - (default: false)
* `multi` || `multiEntry` - (default: false)

### schema.delIndex(name)

Delete index by `name` from current store.

### schema.addCallback(cb)

Add `cb` to be executed at the end of the `upgradeneeded` event.

```js
new Schema()
.addStore('users', { increment: true, keyPath: 'id' })
.addIndex('byName', 'name')
.addCallback((e) => {
  const users = e.target.transaction.objectStore('users')
  users.put({ name: 'Fred' })
  users.put({ name: 'Barney' })
})
```

### schema.clone()

Return a deep clone of current schema.

## License

[MIT](./LICENSE)


text:
define(['backbone', 'underscore', 'jquery', 'eproxy', 'config', 'logger'],
function(Backbone, _, $, P, config, logger)
{
    'use strict';

    var mainApiUrl = config.apiUrl;

    function makePath(){
        var parts = _.toArray(arguments);
        // Remove leading and trailing slashes
        parts = _.map(parts, function (part) {
            return part.replace(/^\/|\/$/g, '');
        }, this);
        return parts.join('/');
    };

    function FragmentException(msg){
        this.message = msg;
        this.name = "FragmentException";
    };

    function objectHash(o){
        var ks = _.keys(o).sort();
        var ret = '..';
        _.each(ks, function(k){
            ret += k + '..' + JSON.stringify(o[k]);
        });
        return ret;
    };

    /**
     * Fragment constructor
     *
     * Fragment objects manage Backbone collections and allow us to iterate trough page of results for a given
     * collection.
     * Please note that next must be called on the fragment object before you are able to iterate over the results.
     *
     * @param options
     * @constructor
     */
    function Fragment(options){
        if(!('query' in options)
            || !('collection' in options)){
                throw new FragmentException('A fragment needs to be instantiated with a query and a collection');
            }
        this.qname = objectHash(options.query);
        this.current = -1;
        this.totalPages = 0;
        this.totalItems = 0;
        this.ready = false;

        _.extend(this, options);

        this.initialize();
    };

    _.extend(Fragment.prototype, {

        _endInit: function(page){
            this.totalPages = page.pageCount;
            this.totalItems = page.nodeCount;
            this.ready = true;
            this.trigger('ready');
        },

        initialize: function(){
            this.collection.queryPage(
                this.qname,
                this.query,
                0,
                this._endInit,
                this
               );
        },

        rewind: function(){
            this.current = 0;
            return this;
        },

        next: function(){
            if(!this.ready){
                this.once('ready', this.next, this);
                return this;
            }
            var pageReq = this.current + 1;
            if(pageReq <= this.totalPages){
                this.collection.queryPage(this.qname, this.query, pageReq,
                                          _.partial(this._end, 'next'), this);
            }
            else if(0 === this.totalPages
                && 0 === this.current){
                if(this.callback
                    && 'function' === typeof(this.callback)){
                        this.callback.apply(this.context, [{ "number": 0, "count": 0, "num_pages": 0, "results": [] }]);
                }
                else{
                    this.trigger('next', { "number": 0, "count": 0, "num_pages": 0, "results": [] });
                }
            }
        },

        /**
        * Retreives previous page, and triggers callback when data is available
        */
        previous: function(){
            if(!this.ready){
                this.once('ready', this.previous, this);
                return this;
            }
            var pageReq = this.current - 1;
            if(pageReq > 0){
                this.collection.queryPage(this.qname, this.query, pageReq,
                                          _.partial(this._end, 'previous'), this);
            }
            return this;
        },

        /**
        * Does an API-call for the requested page. Callback is invoked
        * when data is available. If no callback is available, the 'at'
        * event is triggered
        *
        * Does not
        *
        * @param pageReq int requested page
        * @return Cursor
        */
        at: function(pageReq){
            if(!this.ready){
                this.once('ready', _.partial(this.at, pageReq), this);
                return this;
            }
            if(pageReq <= this.totalPages){
                this.collection.queryPage(this.qname, this.query, pageReq,
                                          _.partial(this._end, 'at'), this);
            }
            return this;
        },

        /**
        * Callback, invoked after a query. If the fragment
        * has a callback the callback is invoked. Otherwise
        * an event with eventName is triggered
        *
        * @param eventName string
        * @param page
        */
        _end: function(eventName, page) {
            if(this.callback
                && 'function' === typeof(this.callback)){
                    this.callback.apply(this.context, [page]);
            }
            else{
                this.trigger(eventName, page);
            }
        },

    }, Backbone.Events);

    var Collection = Backbone.Collection.extend({

        constructor: function(){
            Backbone.Collection.apply(this, arguments);
            this._create = this.create;
            this.create = this.graphCreate;
            this.fragments = {};
        },

        initialize:function(options){
            this.fragmentPointer = {};
            if(this.proxyName)
            {
                 P.register(this.proxyName, this);
            }
            this._generateModel();
            this._generateRelationships();
        },

        /**
         * _generateModel
         *
         * generates corresponding model for this collection
         * based on declared model name and API call
         *
         */
        _generateModel: function(){
            this.model = Backbone.Model.extend({
                urlRoot: mainApiUrl + this.modelName + '/',
                idAttribute: 'id',
                synchronize: function (model, mapping){
                    var attrs = model;
                    if('toJSON' in model
                    && _.isFunction(model.toJSON)){
                        attrs = model.toJSON();
                    }

                    if (mapping){
                        _.each(mapping, function(v,k){
                            attrs[k] = attrs[v];
                            delete attrs[v];
                        });
                    }

                    this.set(attrs);
                    return this;
                },
            });
        },

        _generateRelationships: function(){
            var self = this;
            _.each(this.relationships, function(val, key){
                var f = function(id, callback, ctx){
                    var q = [self.modelName, id, key, val];
                    var options = {
                        query: q,
                        callback: callback,
                        ctx: ctx,
                    };

                    return self.getCursor(options);
                };
                self[key] = f;
            });
        },

        sync: function(method, model, options){
            var backboneOptions = _.omit(options, 'madeen');
            var madeenOptions = _.result(options, 'madeen') || {};
            var path = '';
            var params = '';

            if('params' in madeenOptions){
                params = '?' + $.param(madeenOptions.params);
            }

            if('query' in madeenOptions){
                var Q = _.clone(madeenOptions.query);
                if('read' === method){
                    var isListRequest = 'subject' in Q;
                    if(isListRequest){
                        backboneOptions.url = makePath(mainApiUrl,
                                                           Q.subject, Q.subjectId,
                                                           Q.predicate, this.modelName)
                                                    + params;
                    }
                    else{
                        logger.warning('hm, we should not end up here', method, model, options);
                    }
                }
                else{
                    logger.warning('Rien a foutre ici ?', method, this.modelName);
                }
            }
            return Backbone.sync.apply(this,[method, model, backboneOptions]);
        },

        /**
        * Used to store changes on the API
        */
        graphCreate: function(subject, predicate, obj, callback, ctx){
            var options = {};
            options.url = makePath(_.result(subject, 'url'), predicate, this.modelName);

            var collection = this;
            options.success = function () {
                collection.clearFragments();
                if (callback) callback.apply(ctx, arguments);
            };

            var model = new this.model(obj);
            model.save(null, options);
            return model;
        },

        parse: function(response, options){
            this.nodeCount = response.nodeCount;
            this.next = response.next;
            this.previous = response.previous;
            return response.results;
        },

        fetchAll: function(options){
            var self = this;
            options = options || {};
            var counter = 0;
            _.extend(options, {
                success:function(data){
                    self.trigger('sync:part');
                },
            });
            var _syncForward = function(){
                if(!this.nextPage(options))
                {
                    this.trigger('syncAll');
                    this.off('sync:part', _syncForward);
                };
            };
            this.on('sync:part', _syncForward, this);
            return this.fetch(options);
        },

        getCursor: function(options){
            var f = new Fragment(_.extend({collection:this}, options));
            return f.next();
        },

        nextPage: function(options) {
            if (!this.next) {
                return false;
            }
            _.extend(options, { url:this.next, });
            return this.fetch(options);
        },

        previousPage: function() {
            if (!this.previous) {
                return false;
            }
            return this.fetch({
                    url:this.previous,
            });
        },

        resetFragment: function(name){
            delete this.fragments[name];
            delete this.fragmentPointer[name];
        },

        clearFragments: function() {
            this.fragments = [];
        },

        addFragment: function(name, data, callback, ctx){
            if(!this.fragments[name])
            {
                this.fragments[name] = {};
            }

            var fragment = {};

            fragment.nodeCount = data.nodeCount;
            fragment.pageCount = data.pageCount;
            fragment.page = data.page;
            fragment.references = [];
            _.each(data.results, function(obj){
                var model = this.get(obj.id);
                fragment.references.push(model);
            }, this);

            this.fragments[name][data.page] = fragment;

            this.fragmentAvailable(fragment, callback, ctx);
        },

        queryPage: function(name, query, page, callback, ctx){
            logger.debug('queryPage', name, page);
            var self = this;

            if (name in this.fragments
                && page in this.fragments[name]) {
                this.fragmentAvailable(this.fragments[name][page], callback, ctx);
            }
            else {
                var params = _.extend({page:page}, _.result(query, 'params'));
                if('command' in query){
                    params.command = query.command;
                }
                this.fetch({
                    madeen: {
                        query: query,
                        params: params,
                    },
                    success:function(col, resp, opt){
                        self.addFragment(name, resp, callback, ctx);
                    }
                });
            }
        },

        fragmentAvailable: function(fragment, callback, ctx) {
            if(callback){
                callback.apply(ctx, [fragment]);
            }
            else{
                this.trigger(name, fragment);
            }
        },

        queryNext: function(qname, query, from, callback, ctx){
            var name = 'query:'+qname;
            from = from ? Number(from) : 0;
            var page  = from;
            if(this.fragmentPointer[name]
                &&  from < this.fragmentPointer[name].max)
            {
                this.trigger(name, this.fragments[name][page]);
                if(callback){
                    callback.apply(ctx, [this.fragments[name][page]]);
                }
            }
            else
            {
                this.queryPage(name, query, page, callback, ctx);
            }
            return this;
        },

        queryPrevious: function(qname, from){
            var name = 'query:'+qname;
            var page  = from - 1;
            if(page > -1)
            {
                this.trigger(name, this.fragments[name][page]);
            }
            return this;
        },

        searchPage: function(name, what, page, callback, ctx){
            var self = this;
            var url = this.url({
                search: what,
                page: page + 1,
            });
            this.fetch({
                url:url,
                success:function(col, resp, opt){
                    self.addFragment(name, resp, callback, ctx);
                },
            });
        },

        searchNext:function(what, from, callback, ctx){
            var name = 'search:'+what;
            from = from ? Number(from) : -1;
            var page  = from + 1;
            if(this.fragmentPointer[name]
                &&  from < this.fragmentPointer[name].max)
            {
                this.trigger(name, this.fragments[name][page]);
                if(callback){
                    callback.apply(ctx, [this.fragments[name][page]]);
                }
            }
            else
            {
                this.searchPage(name, what, page, callback, ctx);
            }
            return this;
        },

        searchPrevious: function(what, from){
            var name = 'search:'+what;
            var page  = from - 1;
            if(page > -1)
            {
                this.trigger(name, this.fragments[name][page]);
            }
            return this;
        },

        getOrCreate:function(id, callback, checkList, ctx){
            var model = this.get(id);
            if(!Array.isArray(checkList))
            {
                ctx = checkList;
                checkList = undefined;
            }
            if(!model)
            {
                model = new this.model({id:id});
                this.add(model);
                if(callback){
                    model.once('sync', function(){
                        callback.apply(ctx, [model]);
                    });
                }
                model.fetch();
            }
            else
            {
                if(callback){
                    if(checkList)
                    {
                        for(var cidx=0; cidx < checkList.length; cidx++)
                        {
                            if(!model.has(checkList[cidx]))
                            {
                                model.once('sync', function(){
                                    callback.apply(ctx, [model]);
                                });
                                model.fetch();
                                return model;
                            }
                        }
                        callback.apply(ctx, [model]);
                    }
                    else
                    {
                        callback.apply(ctx, [model]);
                    }
                }
            }
            return model;
        },
    });

	return {
		Collection: Collection,
		Fragment: Fragment,
	}

});


text:
package com.bigheart.byrtv.ui.view.fragment;

import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.bigheart.byrtv.R;
import com.bigheart.byrtv.ui.module.ChannelModule;
import com.bigheart.byrtv.ui.presenter.MyCollectionPresenter;
import com.bigheart.byrtv.ui.view.FragContactToAct;
import com.bigheart.byrtv.ui.view.MyCollectionView;

import java.util.ArrayList;

/**
 * Created by BigHeart on 15/12/6.
 */

public class MyCollectionFragment extends Fragment implements MyCollectionView {

    private static final String ITEM_SORT_TYPE = "itemSortType";

    private ListView lvCollection;
    private TextView tvNoCollection;
    private SwipeRefreshLayout refreshLayout;

    private ArrayList<ChannelModule> collectionChannels = new ArrayList<>();
    private CollectionAdapter collectionAdapter;
    private MyCollectionPresenter presenter;
    private static FragContactToAct collectionFragContactToAct;

    public static MyCollectionFragment newInstance(FragContactToAct contactToAct) {
        MyCollectionFragment fragment = new MyCollectionFragment();
        collectionFragContactToAct = contactToAct;
        return fragment;
    }

    public MyCollectionFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        presenter = new MyCollectionPresenter(getActivity(), this);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View layoutView = inflater.inflate(R.layout.fragment_channel, container, false);
        collectionAdapter = new CollectionAdapter(getActivity());
        lvCollection = (ListView) layoutView.findViewById(R.id.lv_all_channel);
        collectionChannels = new ArrayList<>();
        lvCollection.setAdapter(collectionAdapter);
        tvNoCollection = (TextView) layoutView.findViewById(R.id.tv_no_collection);

        refreshLayout = (SwipeRefreshLayout) layoutView.findViewById(R.id.srl_all_channel);
        refreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));
        refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                //不必更新
                stopRefresh();
            }
        });

        lvCollection.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                presenter.onItemClick(collectionChannels.get(position));
            }
        });

//        if (refreshLayout != null) {
        collectionFragContactToAct.fragmentInitOk();
//            LogUtil.d("refreshLayout", "ok");
//        }

        return layoutView;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {
            collectionFragContactToAct = (FragContactToAct) activity;
        } catch (ClassCastException e) {
            throw new ClassCastException(activity.toString()
                    + " must implement FragContactToAct");
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        collectionFragContactToAct = null;
    }

    @Override
    public void startRefresh() {
        refreshLayout.setRefreshing(true);
    }

    @Override
    public void stopRefresh() {
        refreshLayout.setRefreshing(false);

    }

    @Override
    public void updateData(ArrayList<ChannelModule> channels) {
        //拼音排序只需排一次
        this.collectionChannels = presenter.channelSort(channels);

        //处理视图
        if (collectionChannels.size() <= 0) {
            refreshLayout.setVisibility(View.GONE);
            tvNoCollection.setVisibility(View.VISIBLE);
        } else {
            if (!refreshLayout.isShown()) {
                refreshLayout.setVisibility(View.VISIBLE);
            }
            if (tvNoCollection.isShown()) {
                tvNoCollection.setVisibility(View.GONE);
            }
            collectionAdapter.notifyDataSetChanged();
        }
    }

    @Override
    public void updateData() {
        collectionAdapter.notifyDataSetChanged();
    }

    private class CollectionAdapter extends BaseAdapter {
        private LayoutInflater inflater;

        CollectionAdapter(Context context) {
            this.inflater = LayoutInflater.from(context);
        }

        @Override
        public int getCount() {
            return collectionChannels.size();
        }

        @Override
        public Object getItem(int position) {
            return collectionChannels.get(position);
        }

        @Override
        public long getItemId(int position) {
            return 0;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder;
            if (convertView == null) {
                convertView = inflater.inflate(R.layout.item_channel, null);
                holder = new ViewHolder((TextView) convertView.findViewById(R.id.tv_channel_name),
                        (TextView) convertView.findViewById(R.id.tv_people_num),
                        (TextView) convertView.findViewById(R.id.tv_chanel_short),
                        (ImageView) convertView.findViewById(R.id.iv_collection));
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }
            ChannelModule tmpChannel = collectionChannels.get(position);
            holder.tvChannelName.setText(tmpChannel.getChannelName());
            if (tmpChannel.getChannelName().startsWith("CC")) {
                holder.tvChannelShort.setText("央");
            } else {
                holder.tvChannelShort.setText(tmpChannel.getChannelName().charAt(0) + "");
            }
            return convertView;
        }

        class ViewHolder {
            TextView tvPeopleNum, tvChannelName, tvChannelShort;

            ViewHolder(TextView channelName, TextView peopleNum, TextView channelShort, ImageView collection) {
                tvChannelName = channelName;
                tvPeopleNum = peopleNum;
                tvChannelShort = channelShort;
                collection.setVisibility(View.VISIBLE);
            }
        }
    }

}


text:
/****************************************************************************

 Copyright (C) 2002-2013 Gilles Debunne. All rights reserved.

 This file is part of the QGLViewer library version 2.4.0.

 http://www.libqglviewer.com - contact@libqglviewer.com

 This file may be used under the terms of the GNU General Public License
 versions 2.0 or 3.0 as published by the Free Software Foundation and
 appearing in the LICENSE file included in the packaging of this file.
 In addition, as a special exception, Gilles Debunne gives you certain
 additional rights, described in the file GPL_EXCEPTION in this package.

 libQGLViewer uses dual licensing. Commercial/proprietary software must
 purchase a libQGLViewer Commercial License.

 This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

*****************************************************************************/

#ifndef _VRENDER_EXPORTER_H
#define _VRENDER_EXPORTER_H

// Set of classes for exporting in various formats, like EPS, XFig3.2, SVG.

#include "Primitive.h"

#include "../config.h"
#if QT_VERSION >= 0x040000
# include <QTextStream>
# include <QString>
#else
# include <qtextstream.h>
# include <qstring.h>
#endif

namespace vrender
{
	class VRenderParams ;
	class Exporter
	{
		public:
			Exporter() ;
			virtual ~Exporter() {};

			virtual void exportToFile(const QString& filename,const std::vector<PtrPrimitive>&,VRenderParams&) ;

			void setBoundingBox(float xmin,float ymin,float xmax,float ymax) ;
			void setClearColor(float r,float g,float b) ;
			void setClearBackground(bool b) ;
			void setBlackAndWhite(bool b) ;

		protected:
			virtual void spewPoint(const Point *, QTextStream& out) = 0 ;
			virtual void spewSegment(const Segment *, QTextStream& out) = 0 ;
			virtual void spewPolygone(const Polygone *, QTextStream& out) = 0 ;

			virtual void writeHeader(QTextStream& out) const = 0 ;
			virtual void writeFooter(QTextStream& out) const = 0 ;

			float _clearR,_clearG,_clearB ;
			float _pointSize ;
			float _lineWidth ;

			GLfloat _xmin,_xmax,_ymin,_ymax,_zmin,_zmax ;

			bool _clearBG,_blackAndWhite ;
	};

	// Exports to encapsulated postscript.

	class EPSExporter: public Exporter
	{
		public:
			EPSExporter() ;
			virtual ~EPSExporter() {};

		protected:
			virtual void spewPoint(const Point *, QTextStream& out) ;
			virtual void spewSegment(const Segment *, QTextStream& out) ;
			virtual void spewPolygone(const Polygone *, QTextStream& out) ;

			virtual void writeHeader(QTextStream& out) const ;
			virtual void writeFooter(QTextStream& out) const ;

		private:
			void setColor(QTextStream& out,float,float,float) ;

			static const double EPS_GOURAUD_THRESHOLD ;
			static const char *GOURAUD_TRIANGLE_EPS[] ;
			static const char *CREATOR ;

			static float last_r ;
			static float last_g ;
			static float last_b ;
	};

	//  Exports to postscript. The only difference is the filename extension and
	// the showpage at the end.

	class PSExporter: public EPSExporter
	{
		public:
			virtual ~PSExporter() {};
		protected:
			virtual void writeFooter(QTextStream& out) const ;
	};

	class FIGExporter: public Exporter
	{
		public:
			FIGExporter() ;
			virtual ~FIGExporter() {};

		protected:
			virtual void spewPoint(const Point *, QTextStream& out) ;
			virtual void spewSegment(const Segment *, QTextStream& out) ;
			virtual void spewPolygone(const Polygone *, QTextStream& out) ;

			virtual void writeHeader(QTextStream& out) const ;
			virtual void writeFooter(QTextStream& out) const ;

		private:
			mutable int _sizeX ;
			mutable int _sizeY ;
			mutable int _depth ;

			int FigCoordX(double) const ;
			int FigCoordY(double) const ;
			int FigGrayScaleIndex(float red, float green, float blue) const ;
	};
#ifdef A_FAIRE
	class SVGExporter: public Exporter
	{
		protected:
			virtual void spewPoint(const Point *, QTextStream& out) ;
			virtual void spewSegment(const Segment *, QTextStream& out) ;
			virtual void spewPolygone(const Polygone *, QTextStream& out) ;

			virtual void writeHeader(QTextStream& out) const ;
			virtual void writeFooter(QTextStream& out) const ;
	};
#endif
}

#endif


text:
package de.j4velin.mapsmeasure;

import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;

/**
 * Class for showing a list of saved traces and the ability to delete them
 *
 */
class DeleteAdapter extends BaseAdapter {

	private final ArrayList<File> files;
	private final LayoutInflater mInflater;
	private final OnClickListener deleteListener = new OnClickListener() {
		@Override
		public void onClick(final View v) {
            int file = (Integer) v.getTag();
            files.remove(file).delete();
			notifyDataSetChanged();
		}
	};

	/**
	 * @param f
	 *            the files to show
	 * @param c
	 *            the calling activity
	 */
	public DeleteAdapter(final File[] f, final Map c) {
		files = new ArrayList<>(Arrays.asList(f));
		mInflater = c.getLayoutInflater();
	}

	/**
	 * Gets a file from the list. Used to load the file when clicking on it.
	 *
	 * @param position
	 *            of the file in the list
	 * @return the corresponding file
	 */
	File getFile(int position) {
		return files.get(position);
	}

	@Override
	public int getCount() {
		return files.size();
	}

	@Override
	public Object getItem(int position) {
		return files.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@SuppressWarnings("deprecation")
	@Override
	public View getView(int position, View convertView, final ViewGroup parent) {
		ViewHolder holder;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.deletelistitem, null);
			holder = new ViewHolder();
			holder.iv = convertView.findViewById(R.id.icon);
			holder.tv = (TextView) convertView.findViewById(R.id.text);
			holder.iv.setOnClickListener(deleteListener);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		String filename = files.get(position).getName();
		if (filename.startsWith("MapsMeasure_")) {
			try {
				Date date = new Date(Long.parseLong(filename.substring(filename.lastIndexOf("_") + 1, filename.lastIndexOf("."))));
				filename = date.toLocaleString();
			} catch (NumberFormatException nfe) {
			}
		} else {
			filename = filename.substring(0, filename.lastIndexOf("."));
		}
		holder.tv.setText(filename);
		holder.iv.setTag(position);
		return convertView;
	}

	private static class ViewHolder {
		private TextView tv; // the TextView showing the name of the file
		private View iv; // the ImageView showing the delete icon
	}

}


text:
using namespace clang;
using namespace clang::serialization;

TestModuleFileExtension::Writer::~Writer() { }

void TestModuleFileExtension::Writer::writeExtensionContents(
       Sema &SemaRef,
       llvm::BitstreamWriter &Stream) {
  using namespace llvm;

  // Write an abbreviation for this record.
  auto Abv = std::make_shared<llvm::BitCodeAbbrev>();
  Abv->Add(BitCodeAbbrevOp(FIRST_EXTENSION_RECORD_ID));
  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // # of characters
  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));   // message
  auto Abbrev = Stream.EmitAbbrev(std::move(Abv));

  // Write a message into the extension block.
  SmallString<64> Message;
  {
    auto Ext = static_cast<TestModuleFileExtension *>(getExtension());
    raw_svector_ostream OS(Message);
    OS << "Hello from " << Ext->BlockName << " v" << Ext->MajorVersion << "."
       << Ext->MinorVersion;
  }
  uint64_t Record[] = {FIRST_EXTENSION_RECORD_ID, Message.size()};
  Stream.EmitRecordWithBlob(Abbrev, Record, Message);
}

TestModuleFileExtension::Reader::Reader(ModuleFileExtension *Ext,
                                        const llvm::BitstreamCursor &InStream)
  : ModuleFileExtensionReader(Ext), Stream(InStream)
{
  // Read the extension block.
  SmallVector<uint64_t, 4> Record;
  while (true) {
    llvm::Expected<llvm::BitstreamEntry> MaybeEntry =
        Stream.advanceSkippingSubblocks();
    if (!MaybeEntry)
      (void)MaybeEntry.takeError();
    llvm::BitstreamEntry Entry = MaybeEntry.get();

    switch (Entry.Kind) {
    case llvm::BitstreamEntry::SubBlock:
    case llvm::BitstreamEntry::EndBlock:
    case llvm::BitstreamEntry::Error:
      return;

    case llvm::BitstreamEntry::Record:
      break;
    }

    Record.clear();
    StringRef Blob;
    Expected<unsigned> MaybeRecCode =
        Stream.readRecord(Entry.ID, Record, &Blob);
    if (!MaybeRecCode)
      fprintf(stderr, "Failed reading rec code: %s\n",
              toString(MaybeRecCode.takeError()).c_str());
    switch (MaybeRecCode.get()) {
    case FIRST_EXTENSION_RECORD_ID: {
      StringRef Message = Blob.substr(0, Record[0]);
      fprintf(stderr, "Read extension block message: %s\n",
              Message.str().c_str());
      break;
    }
    }
  }
}

TestModuleFileExtension::Reader::~Reader() { }

TestModuleFileExtension::~TestModuleFileExtension() { }

ModuleFileExtensionMetadata
TestModuleFileExtension::getExtensionMetadata() const {
  return { BlockName, MajorVersion, MinorVersion, UserInfo };
}

llvm::hash_code TestModuleFileExtension::hashExtension(
                  llvm::hash_code Code) const {
  if (Hashed) {
    Code = llvm::hash_combine(Code, BlockName);
    Code = llvm::hash_combine(Code, MajorVersion);
    Code = llvm::hash_combine(Code, MinorVersion);
    Code = llvm::hash_combine(Code, UserInfo);
  }

  return Code;
}

std::unique_ptr<ModuleFileExtensionWriter>
TestModuleFileExtension::createExtensionWriter(ASTWriter &) {
  return std::unique_ptr<ModuleFileExtensionWriter>(new Writer(this));
}

std::unique_ptr<ModuleFileExtensionReader>
TestModuleFileExtension::createExtensionReader(
  const ModuleFileExtensionMetadata &Metadata,
  ASTReader &Reader, serialization::ModuleFile &Mod,
  const llvm::BitstreamCursor &Stream)
{
  assert(Metadata.BlockName == BlockName && "Wrong block name");
  if (std::make_pair(Metadata.MajorVersion, Metadata.MinorVersion) !=
        std::make_pair(MajorVersion, MinorVersion)) {
    Reader.getDiags().Report(Mod.ImportLoc,
                             diag::err_test_module_file_extension_version)
      << BlockName << Metadata.MajorVersion << Metadata.MinorVersion
      << MajorVersion << MinorVersion;
    return nullptr;
  }

  return std::unique_ptr<ModuleFileExtensionReader>(
                                                    new TestModuleFileExtension::Reader(this, Stream));
}


text:
require 'spec_helper'

describe LitmusPaper::Cache do
  before(:each) do
    @location = "/tmp/litmus_cache"
    @namespace = "test_cache"
    @ttl = -1
  end

  after(:each) do
    FileUtils.rm_rf(@location)
  end

  describe "initialize" do
    it "creates the directory structure" do
      File.exists?(@location).should be false
      LitmusPaper::Cache.new(@location, @namespace, @ttl)
      File.exists?(File.join(@location, @namespace)).should be true
    end
  end

  describe "get" do
    it "returns false if the key was not previously set" do
      cache = LitmusPaper::Cache.new(@location, @namespace, @ttl)
      cache.get("non-existant-key").should be_nil
    end

    context "when called with fresh entry" do
      it "returns the value set" do
        cache = LitmusPaper::Cache.new(@location, @namespace, 10)
        cache.set("key", "some value")
        cache.get("key").should == "some value"
      end
    end

    context "when called with expired entry" do
      it "returns nil" do
        cache = LitmusPaper::Cache.new(@location, @namespace, -1)
        cache.set("key", "some value")
        cache.get("key").should be_nil
      end
    end
  end

  describe "set" do
    context "when called with non-positive ttl" do
      it "does not store the value" do
        key = "key"
        cache = LitmusPaper::Cache.new(@location, @namespace, 0)
        cache.set(key, "some value")
        File.exists?(File.join(@location, @namespace, key)).should be false
      end
    end

    context "when called with positive ttl" do
      it "stores the value" do
        key = "key"
        cache = LitmusPaper::Cache.new(@location, @namespace, 1)
        cache.set(key, "some value")
        File.exists?(File.join(@location, @namespace, key)).should be true
      end
    end

    it "expires the entry after the ttl" do
      key = "key"
      ttl = 0.01
      cache = LitmusPaper::Cache.new(@location, @namespace, ttl)
      cache.set(key, "some value")
      cache.get(key).should == "some value"
      sleep ttl
      cache.get(key).should be_nil
    end
  end
end


text:
require "rubygems"
require "bundler/setup"

require 'redis-sentinel'
require 'sidekiq'
require 'sidekiq/api'
require 'redis'
require 'redis-namespace'
require 'graphite-api'
require 'graphite-api/core_ext/numeric'

module ConfigFile

  def self.load_yaml(object)
    return case object
    when Hash
      object = object.clone
      object.each do |key, value|
      object[key] = load_yaml(value)
    end
    OpenStruct.new(object)
    when Array
      object = object.clone
      object.map! { |i| load_yaml(i) }
    else
      object
    end
  end

end

module Collector

  class Poll

    def initialize
      settings = ConfigFile.load_yaml(
        YAML.load_file(File.dirname(Pathname.new(__FILE__).realpath)+'/config.yml'))
      sentinels = settings.redis.sentinels.map(&:marshal_dump)
      raise 'Missing sentinels config' if sentinels.empty?

      graphite = settings.graphite
      raise 'Missing graphite config' if graphite.nil?

      params = { graphite: "#{graphite.host}:#{graphite.port}", prefix: [graphite.prefix]}

      _redis = Redis.new(
        master_name: settings.redis.sentinel_master_name,
        sentinels: sentinels)

      if settings.redis.namespace
        @redis = ConnectionPool.new(size: 10) do
          Redis::Namespace.new(settings.redis.namespace, redis: _redis)
        end
      else
        @redis = ConnectionPool.new(size: 10) { _redis }
      end

      Sidekiq.configure_client do |config|
        config.redis = @redis
      end
      @graphite = GraphiteAPI.new( params )
      c = @graphite
      Zscheduler.every(settings.general.poll) do
        begin
          print '.'
          stats = Sidekiq::Stats.new
          workers = Sidekiq::Workers.new
          c.metrics('sidekiq.workers' => workers.size)
          c.metrics('sidekiq.jobs.pending' => stats.enqueued)
          c.metrics('sidekiq.jobs.processed' => stats.processed)
          c.metrics('sidekiq.jobs.failed' => stats.failed || 0)
          c.metrics('sidekiq.workers' => workers.size)
          c.metrics('sidekiq.workers' => workers.size)
          stats.queues.each do |name, jobs|
            c.metrics("sidekiq.queue.#{name}" => jobs)
            klasses = Sidekiq::Queue.new(name).map(&:klass).inject({}){|a,v| a[v] = (a[v]) ? a[v]+=1:1; a}
            klasses.each do |klass, cnt|
              c.metrics("sidekiq.klasses.queue.#{name}.klass.#{klass}" => cnt)
            end
          end
        rescue Redis::TimeoutError
          raise 'Redis server timeout'
        rescue  Redis::CannotConnectError, Redis::ConnectionError
          raise 'Could not connect to redis'
        rescue Exception => e
          raise 'Could not connect to redis'
        end
      end
      Zscheduler.join
    end

  end

  service = Collector::Poll.new

end


text:
/*
 * wpa_supplicant - WPA/RSN IE and KDE definitions
 * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Alternatively, this software may be distributed under the terms of BSD
 * license.
 *
 * See README and COPYING for more details.
 */

#ifndef WPA_IE_H
#define WPA_IE_H

struct wpa_eapol_ie_parse {
	const u8 *wpa_ie;
	size_t wpa_ie_len;
	const u8 *rsn_ie;
	size_t rsn_ie_len;
	const u8 *pmkid;
	const u8 *gtk;
	size_t gtk_len;
	const u8 *mac_addr;
	size_t mac_addr_len;
#ifdef CONFIG_PEERKEY
	const u8 *smk;
	size_t smk_len;
	const u8 *nonce;
	size_t nonce_len;
	const u8 *lifetime;
	size_t lifetime_len;
	const u8 *error;
	size_t error_len;
#endif /* CONFIG_PEERKEY */
#ifdef CONFIG_IEEE80211W
	const u8 *igtk;
	size_t igtk_len;
#endif /* CONFIG_IEEE80211W */
#ifdef CONFIG_IEEE80211R
	const u8 *mdie;
	size_t mdie_len;
	const u8 *ftie;
	size_t ftie_len;
	const u8 *reassoc_deadline;
	const u8 *key_lifetime;
#endif /* CONFIG_IEEE80211R */
};

int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
			     struct wpa_eapol_ie_parse *ie);
int wpa_gen_wpa_ie(struct wpa_sm *sm, u8 *wpa_ie, size_t wpa_ie_len);

#endif /* WPA_IE_H */