text:
window.Slides = {};

Slides.getUUID = function (object) {
    if (!object.__UUID) {
        object.__UUID = Math.random().toString(36).substr(2,9);
    }
    return object.__UUID;
};

Slides.hasTouch = function () {
    return document.documentElement && document.documentElement.hasOwnProperty('ontouchstart');
};
if (Slides.hasTouch()) {
    Slides.events = {click: "click", down: "touchstart", up: "touchend", move: "touchmove"};
} else {
    Slides.events = {click: "click", down: "mousedown", up: "mouseup", move: "mousemove"};
}

Slides.log = function (message) {
    Slides.Logger.getInstance().log(message);
};

Slides.removeClass = function (element, className) {
    var classObject = Slides.buildClassObject(element);
    delete classObject[className];
    var classString = Slides.buildClassString(classObject)
    if (classString.length === 0) {
        element.removeAttribute("class");
    } else {
        element.setAttribute("class", classString);
    }
};

Slides.addClass = function (element, className) {
    var classObject = Slides.buildClassObject(element);
    classObject[className] = true;
    element.setAttribute("class", Slides.buildClassString(classObject));
};

Slides.buildClassObject = function (element) {
    var classesString = element.getAttribute("class") || "";
    var classList = classesString.split(" ");
    var classObject = {};
    var index;
    for (index = 0; index < classList.length; index++) {
        classObject[classList[index]] = true;
    }
    return classObject;
};

Slides.buildClassString = function (classObject) {
    var className;
    var classList = [];
    for (className in classObject) {
        if (!classObject.hasOwnProperty(className)) {
            continue;
        }
        classList.push(className);
    }
    return classList.join(" ").trim();
};

Slides.Builder = function () {
    var MDPlus = require('md-plus');

    // Initialize this generator.
    this.initialize = function () {
        this._buildDefinitions();
    };

    // Consume the contents of container, building the stories
    this.consume = function (container) {
        var deck;
        var parser = new MDPlus.Parser(container, this._definitions);
        this._deck = new Deck();
        parser.parse();
        this._deck.build();

        return new Show(this._deck, container);
    }

    // Creates the parser definition object for use by the parser.
    this._buildDefinitions = function () {
        var builder = new MDPlus.Definition.Builder();
        this._definitions = builder.build([{
            tag: 'HR', ref: 'divider',
            handler: this._addSlide, context: this
        }]);
    };

    this._addSlide = function (span, definition) {
        var slideElements = [];
        span.eachShallow(function (element) {
            if (element.tagName !== 'HR') {
                slideElements.push(element);
            }
        });

        this._deck.push(new Slide(slideElements));
    };

    this.initialize.apply(this, arguments);

    // A collection of Slides
    function Deck () {
        this._slides = [];

        this.push = function (slide) {
            var index = this._slides.length;
            this._slides.push(slide);

            slide.index = index;
            if (index === 0) {
                slide.isFirst = true;
            }
            slide.isLast = true;
            if (index > 0) {
                this._slides[index - 1].isLast = false;
            }
        };

        this.build = function () {
            var index;
            var hrElements, hrElement;
            for (index = this._slides.length; index--;) {
                this._slides[index].build();
            }
            hrElements = document.getElementsByTagName('HR');
            for (index = hrElements.length; index--;) {
                hrElement = hrElements[index];
                hrElement.parentNode.removeChild(hrElement);
            }
        };

        this.getLength = function () {
            return this._slides.length;
        };

        this.getSlide = function (index) {
            return this._slides[index];
        };
    };

    // A single slide containing content
    function Slide (elements) {
        this.build = function () {
            var index, elementsLength;;

            this.div = document.createElement('DIV');
            this.div.setAttribute('class', 'slide');

            elementsLength = elements.length;
            for (index = 0; index < elementsLength; index++) {
                this.div.appendChild(elements[index]);
            }
        };

        this.place = function (percent) {
            var distance = 20;
            var threshold = 0.00001;
            var opacity;
            var divStyle;
            this.percent = percent;
            if (percent >= 1 || percent <= -1) {
                this.div.setAttribute('style', 'display: none;');
            } else if (-threshold < percent && percent < threshold) {
                this.div.setAttribute('style', "-webkit-transform: translateX(0em);");
            } else {
                opacity = Math.min(1, Math.max(0.01, 3 * (1 - Math.abs(percent))));
                divStyle = [
                    "-webkit-transform: translateX(" + (-distance * percent) + "em);"
                ]
                if (!(this.isFirst && percent < 0) &&
                    !(this.isLast && percent > 0)) {
                    divStyle.push("opacity: " + opacity);
                }
                this.div.setAttribute('style', divStyle.join(" "));
            }
        };

        this.isVisible = function () {
            return this.percent > -1 && this.percent < 1;
        };

        this.isTextless = function () {
            var textContent = this.div.textContent.trim();
            if (textContent.length === 0) {
                return true;
            }
            var headline = this.div.getElementsByTagName('h1')[0];
            if (headline && headline.textContent.trim() === textContent) {
                return true;
            }
        };
    };

    // The controller for a slide deck, emitting events on slide change.
    function Show (deck, container) {
        this._currentSlideIndex;
        this._currentSlide;

        this._appendSlides = function () {
            var index, slide;
            var slidesLength = deck.getLength();
            for (index = 0; index < slidesLength; index++) {
                slide = deck.getSlide(index);
                slide.place(-10);
                container.appendChild(slide.div);
            };
        };
        this._appendSlides();

        this.getSlide = function (index, force) {
            if (!force && (!index || index === 0)) {
                index = this._currentSlideIndex;
            }
            return deck.getSlide(index);
        };

        this.getCurrentSlideIndex = function () {
            return this._currentSlideIndex;
        };

        this.gotoSlide = function(index) {
            if (index === this._currentSlideIndex) {
                return;
            }
            if (index < 0) {
                index = 0;
            }
            if (index >= deck.getLength()) {
                index = deck.getLength() - 1;
            }
            this._currentSlideIndex = index;
            this.emit('slideIndex', this._currentSlideIndex);
        };

        this.gotoNextSlide = function () {
            var nextIndex = this._currentSlideIndex + 1;
            if (isNaN(nextIndex)) {
                nextIndex = 0;
            }
            this.gotoSlide(nextIndex);
        };

        this.gotoPrevSlide = function () {
            var prevIndex = this._currentSlideIndex - 1;
            if (isNaN(prevIndex)) {
                prevIndex = 0;
            }
            this.gotoSlide(prevIndex);
        };

        this.getLength = function () {
            return deck.getLength();
        };

        this.getContainer = function () {
            return container;
        };
    };
    emittable(Show);

    // A mixin allowing an entity to emit events to listeners.
    function emittable (classFunction) {
        var proto = classFunction.prototype;

        var getHash = function (method, context) {
            return Slides.getUUID(method) + "_" + context && Slides.getUUID(context);
        };

        proto.on = function (eventName, method, context) {
            var uuid;
            if (!method) {
                throw new Error("no method passed to bind for: '" + eventName + "' event.");
            }
            if (!this._emitableListeners) {
                this._emitableListeners = {};
            }
            if (!this._emitableListeners[eventName]) {
                this._emitableListeners[eventName] = {};
            }
            hash = getHash(method, context);
            this._emitableListeners[eventName][hash] = {
                method: method,
                context: context
            };
        };

        proto.removeListener = function (eventName, method, context) {
            var hash;

            if (!this._emitableListeners || !this._emitableListeners[eventName]) {
                return;
            }

            hash = getHash(method, context);
            delete this._emitableListeners[eventName][hash];
            if (this._emitableListeners[eventName].length === 0) {
                delete this._emitableListeners[eventName];
            }
        };

        proto.emit = function (eventName) {
            var methodArguments;
            var callbacks;
            var hash, callback;
            var context;

            if (!this._emitableListeners || !this._emitableListeners[eventName]) {
                return;
            }

            callbacks = this._emitableListeners[eventName];
            if (!callbacks || callbacks.length === 0) {
                return;
            }
            methodArguments = Array.prototype.slice.apply(arguments, [1]);
            for (hash in callbacks) {
                if (!callbacks.hasOwnProperty(hash)) {
                    continue;
                }
                callback = callbacks[hash];
                context = callback.context || this;

                callback.method.apply(context, methodArguments);
            }
        };
    };
};

// A presenter controlling the slide you are viewingfrom the URL
Slides.URLPresenter = function (show) {
    this.getQuerySet = function (search) {
        var pairStrings;
        var index, pair;
        var slideIndex;
        var querySet = {};
        search = search.replace(/^\?/, "");
        pairStrings = search.split("&");
        for (index = 0; index < pairStrings.length; index++) {
            pair = pairStrings[index].split("=");
            querySet[pair[0]] = pair[1];
        }
        return querySet;
    };

    this.buildSearch = function (querySet) {
        var key, value;
        var pairStrings = [];
        var pair;
        for (key in querySet) {
            if (!querySet.hasOwnProperty(key)) {
                continue;
            }
            pair = [key];
            value = querySet[key];
            if (typeof value !== "undefined") {
                pair.push(value);
            }
            pairStrings.push(pair.join("="));
        }
        return "?" + pairStrings.join("&");
    };

    this.setFromURL = function (search) {
        var querySet = this.getQuerySet(search);
        slideIndex = parseInt(querySet['slide'], 10) - 1 || 0;
        show.gotoSlide(slideIndex);
    };

    this.setCurrentSlideIndex = function (slideIndex) {
        var querySet = this.getQuerySet(document.location.search);
        querySet["slide"] = (slideIndex + 1);
        if (history.replaceState) {
            history.replaceState(null, null, this.buildSearch(querySet));
        }
    };
    show.on('slideIndex', this.setCurrentSlideIndex, this);

    this.setFromURL(document.location.search);
};

// A presenter controlling the slide you are on from the keyboard.
Slides.KeyboardPresenter = function (show) {
    document.addEventListener('keydown', function (event) {
        if (event.keyCode === 39 ||
            event.keyCode === 70 ||
            event.keyCode === 78) {
            show.gotoNextSlide();
        } else if (event.keyCode === 37 ||
                   event.keyCode === 66 ||
                   event.keyCode === 80) {
            show.gotoPrevSlide();
        }
    });
};

Slides.ActiveSlides = function (show) {
    this._activeList = {};

    this._addNewSlides = function (percent) {
        var newSlideA, newSlideB;
        var index = Math.round(percent);
        newSlideA = show.getSlide(index);
        if (index > percent) {
            newSlideB = show.getSlide(index - 1);
        } else {
            newSlideB = show.getSlide(index + 1);
        }

        if (newSlideA) {
            this._activeList[newSlideA.index] = newSlideA;
        }
        if (newSlideB) {
            this._activeList[newSlideB.index] = newSlideB;
        }
    };

    this._updateSlidePercents = function (percent) {
        var index, slide;
        var toRemoveIndex, toRemove = [];
        for (index in this._activeList) {
            slide = this._activeList[index];
            slide.place(percent - slide.index);
            if (!slide.isVisible()) {
                toRemove.push(index);
            }
        }
        for (toRemoveIndex = 0; toRemoveIndex < toRemove.length; toRemoveIndex++) {
            index = toRemove[toRemoveIndex];
            delete this._activeList[index];
        }
    };

    this.setLocation = function (percent) {
        this._addNewSlides(percent);
        this._updateSlidePercents(percent);
    };
};

Slides.DraggingPresenter = function (show) {
    var self = this;
    this.activeSlides = new Slides.ActiveSlides(show);
    this.location = {
        currentPercent: show.getCurrentSlideIndex(),
        targetPercent: show.getCurrentSlideIndex(),
        multiplier: 0.005,
        max: show.getLength(),
        min: -1
    };
    this.animation = {
        speed: .1
    };
    this.touch = {
        startX: undefined,
        startLocation: undefined,
        isDragging: false
    };
    this.touchStart = function (event) {
        if (self.touch.isDragging) {
            return;
        }
        self.touch.startX = event.pageX;
        self.touch.startLocation = self.location.currentPercent;
        self.touch.isDragging = true;
        self.bindDragEvents();
    };
    this.setLocation = function (percent, options) {
        var max = this.location.max;
        var min = this.location.min;
        if (options && options.snapToSlide) {
            max -= 1;
            min += 1;
        }
        if (percent > max) {
            precent = max;
        }
        if (percent < min) {
            percent = min;
        }
        self.location.targetPercent = percent;
        if (self.location.targetPercent !== self.location.currentPercent ||
            options && options.forceUpdate) {
            Slides.AnimationManager.getInstance().requiresUpdate(self);
        }
    };
    this.setCurrentSlideIndex = function (slideIndex) {
        if (this.touch.isDragging) {
            return;
        }
        this.setLocation(slideIndex, {forceUpdate: true});
    };
    this.tick = function () {
        isComplete = false;
        if (self.touch.isDragging) {
            isComplete = this._snapToLocation();
        } else {
            isComplete = this._tweenToLocation();
        }
        this._updatePlacement();
        if (self.touch.isDragging) {
            this._updateSlideIndex();
        }
        return isComplete;
    };
    this._snapToLocation = function () {
        self.location.currentPercent = self.location.targetPercent;
        return true;
    };
    this._tweenToLocation = function () {
        var direction = self.location.targetPercent > self.location.currentPercent ? 1 : -1;
        var isComplete = false;
        self.location.currentPercent += direction * self.animation.speed;
        if (direction === 1 && self.location.currentPercent > self.location.targetPercent) {
            self.location.currentPercent = self.location.targetPercent;
            isComplete = true;
        } else if (direction === -1 && self.location.currentPercent < self.location.targetPercent) {
            self.location.currentPercent = self.location.targetPercent;
            isComplete = true;
        }
        return isComplete;
    };
    this._updatePlacement = function () {
        this.activeSlides.setLocation(this.location.currentPercent);
    };
    this._updateSlideIndex = function () {
        show.gotoSlide(Math.round(this.location.currentPercent));
    };
    this.touchMove = function (event) {
        event.preventDefault();
        self.touch.offset = self.touch.startX - event.pageX;
        self.setLocation(self.touch.startLocation + self.touch.offset * self.location.multiplier);
    };
    this.touchEnd = function (event) {
        self.touch.isDragging = false;
        self.setLocation(Math.round(self.location.targetPercent), {snapToSlide: true});
        self.unbindDragEvents();
    };
    this.unbindDragEvents = function () {
        document.removeEventListener(Slides.events.move, this.touchMove)
    };
    this.bindDragEvents = function () {
        document.addEventListener(Slides.events.move, this.touchMove);
    };
    document.addEventListener(Slides.events.down, this.touchStart);
    document.addEventListener(Slides.events.up, this.touchEnd);

    show.on('slideIndex', this.setCurrentSlideIndex, this);
    this.setCurrentSlideIndex(show.getCurrentSlideIndex());
};

Slides.AnimationManager = function () {
    var self = this;
    this._updateObjects = {};

    this.requiresUpdate = function (object) {
        this._updateObjects[Slides.getUUID(object)] = object;
        this.wakeup();
    };

    this.wakeup = function () {
        if (!this._isAwake) {
            this._isAwake = true;
            this.tick();
        }
    };

    this.tick = function () {
        var uuid, object;
        var isComplete = true;
        var objectIsComplete;
        var toRemove = [];
        for (uuid in self._updateObjects) {
            if (!self._updateObjects.hasOwnProperty(uuid)) {
                continue;
            }
            object = self._updateObjects[uuid];
            objectIsComplete = object.tick();
            if (!objectIsComplete) {
                isComplete = false;
            } else {
                toRemove.push(uuid);
            }
        }

        for (index = toRemove.length; index--;) {
            uuid = toRemove[index];
            delete self._updateObjects[uuid];
        }

        if (!isComplete) {
            requestAnimationFrame(self.tick);
        } else {
            self._isAwake = false;
        }
    };
};
Slides.AnimationManager.getInstance = function() {
    if (!Slides.AnimationManager._instance) {
        Slides.AnimationManager._instance = new Slides.AnimationManager();
    }
    return Slides.AnimationManager._instance;
};

// A presenter controlling the slide you are on from unobtrusive thumbnails.
Slides.ThumbnailPresenter = function (show, itemWidth, unit) {
    this.thumbnails = [];

    this._buildThumbnails = function (show) {
        var index, slidesLength, slide;
        var div = document.createElement('DIV');
        var ul = document.createElement('UL');
        var li;
        slidesLength = show.getLength();
        div.setAttribute('class', 'thumbnails');
        ul.setAttribute('style', 'max-width: ' + (slidesLength * itemWidth) + unit + ';');
        for (index = 0; index < slidesLength; index++) {
            slide = show.getSlide(index, true);
            li = document.createElement('LI');
            li.setAttribute('id', 'thumb-' + index);
            if (slide.isTextless()) {
                li.setAttribute("class", "textless");
            }
            this.thumbnails.push(li);
            ul.appendChild(li);
        }
        div.appendChild(ul);
        show.getContainer().appendChild(div);
    };

    this.setCurrentSlideIndex = function (slideIndex) {
        if (this.currentThumb) {
            Slides.removeClass(this.currentThumb, 'current');
        }
        this.currentThumb = this.thumbnails[slideIndex];
        if (this.currentThumb) {
            Slides.addClass(this.currentThumb, 'current');
        }
    };
    show.on('slideIndex', this.setCurrentSlideIndex, this);

    this._buildThumbnails(show);
    this.setCurrentSlideIndex(show.getCurrentSlideIndex());
};

Slides.InstantPresenter = function (show) {
    this.setCurrentSlideIndex = function (slideIndex) {
        if (this._currentSlide) {
            this._currentSlide.place(-10);
        }
        this._currentSlide = show.getSlide(slideIndex);
        if (this._currentSlide) {
            this._currentSlide.place(0);
        }
    };
    show.on('slideIndex', this.setCurrentSlideIndex, this);
    this.setCurrentSlideIndex(show.getCurrentSlideIndex());
};

Slides.Logger = function () {
    this.getElement = function () {
        if (!this._element) {
            if (!this._container) {
                this._container = document.getElementsByTagName('body')[0];
            }
            this._element = document.createElement('DIV');
            this._element.setAttribute('class', 'log');
            this._container.appendChild(this._element);
        }
        return this._element;
    };
    this.appendClass = function (className) {
        var element = this.getElement();
        var classNames = element.getAttribute('class') || "";
        var classNameList = classNames.split(/\W+/);
        if (classNameList.indexOf(className) === -1) {
            classNameList.push(className);
        }
        element.setAttribute('class', classNameList.join(" "));
    };
    this.log = function (message, className) {
        var entry = document.createElement('P');
        if (className) {
            entry.setAttribute('class', className);
            if (className && className === 'error') {
                this.appendClass('hasError');
            }
        }
        entry.innerHTML = message;
        this.getElement().appendChild(entry);
    };
};
Slides.Logger.getInstance = function () {
    if (!Slides.Logger._instance) {
        Slides.Logger._instance = new Slides.Logger();
    }
    return Slides.Logger._instance;
};

// Abstract base class for Viewers and Speakers.
Slides.FayePresenter = function () {};
(function (proto) {
    proto.initialize = function (show, fayeClient) {
        this.CHANNEL = "/slides";

        this.show = show;
        this.fayeClient = fayeClient;

        this.isConnected = false;

        this.subscribe();
    };

    proto.subscribe = function () {
        var self = this;
        this.subscription = this.fayeClient.subscribe(this.CHANNEL, this.slidesMessage);

        this.subscription.callback(function () {
            self.isConnected = true;
            Slides.log('connected', 'info');
        });

        self.subscription.errback(function (error) {
            self.error = error;
            Slides.log('connected', 'error');
        });
    };

    proto.slidesMessage = function (message) {
        console.log(message);
    };

    proto.isMessageValid = function (message) {
        return message.hasOwnProperty("slideIndex");
    };
} (Slides.FayePresenter.prototype));

Slides.FayeViewerPresenter = function () {
    var self = this;

    this.setCurrentSlideIndex = function (slideIndex) {
        if (this.isConnected) {
            this.fayeClient.publish(this.CHANNEL, { slideIndex: slideIndex });
        }
    };

    this.slidesMessage = function (message) {
        if (self.isMessageValid(message)) {
            self.show.gotoSlide(message.slideIndex);
        } else {
            self.slidesMessage("invalid message!");
        }
    };

    this.initialize.apply(this, arguments);
};
Slides.FayeViewerPresenter.prototype = new Slides.FayePresenter();

Slides.FayeSpeakerPresenter = function () {
    this.setCurrentSlideIndex = function (slideIndex) {
        if (this.isConnected) {
            this.fayeClient.publish(this.CHANNEL, { slideIndex: slideIndex });
        }
    };

    this.initialize.apply(this, arguments);
    this.show.on('slideIndex', this.setCurrentSlideIndex, this);
};
Slides.FayeSpeakerPresenter.prototype = new Slides.FayePresenter();

Slides.TOCNode = function () {
    this._children = [];

    this.build = function (span, definition) {
        this._headerElement = span.getMatchingElement();
        this.label = this._headerElement.textContent;
        this.anchorName = this.label.toLowerCase().replace(/([^a-z0-9]+)/g, "_");
    };

    this.push = function (child) {
        child.parent = this;
        this._children.push(child);
    };

    this.getString = function () {
        var index;
        var buffer = []
        for (index = 0; index < this._children.length; index++) {
            buffer.push(this._children[index].label);
        }
        return buffer.join(" < ");
    };
};

Slides.OutlinePresenter = function (show) {
    var self = this;

    this._getSlideTOC = function (slide) {
        var MDPlus = require('md-plus');

        var defBuilder = new MDPlus.Definition.Builder();
        var definition = defBuilder.build([{ ref: 'header', tag: /^h[0-9]$/i }]);
        var treeBuilder = new MDPlus.TreeBuilder({classRef: Slides.TOCNode}, definition);
        treeBuilder.bakeDefinitions();
        var parser = new MDPlus.Parser(slide.div, definition);
        parser.parse();

        return treeBuilder.getObjects();
    }

    this.getOutline = function () {
        var index, slide, toc;
        var outline = [];

        var showLength = show.getLength();
        for (index = 0; index < showLength; index++) {
            slide = show.getSlide(index, true);
            toc = this._getSlideTOC(slide);
            outline.push(toc);
        }

        return outline;
    };

    this.buildOutlineRow = function (slideTOC) {
        var outlineRow = document.createElement('TR');
        var index, header;
        var buffer = [];
        var cell;
        if (slideTOC.length === 0) {
            cell = document.createElement('TD');
            cell.setAttribute('class', 'blank-row');
            cell.innerHTML = "<image>";
            outlineRow.appendChild(cell);
        } else {
            for (index = 0; index < slideTOC.length; index++) {
                cell = document.createElement('TD');
                header = slideTOC[index];
                cell.innerHTML = header.label;
                outlineRow.appendChild(cell);
            }
        }
        return outlineRow;
    };

    this.buildOutlineDiv = function () {
        var outlineDiv = document.createElement('TABLE');
        outlineDiv.setAttribute("class", "outline");

        var outline = this.getOutline();
        var index, outlineLength, slideTOC;
        var outlineRow;

        this._rows = [];
        outlineLength = outline.length;
        for (index = 0; index < outlineLength; index++) {
            slideTOC = outline[index];
            outlineRow = self.buildOutlineRow(slideTOC);
            this._rows.push(outlineRow);
            outlineDiv.appendChild(outlineRow);
        }

        return outlineDiv;
    };

    this.reveal = function () {
        var body = document.getElementsByTagName('body')[0];
        body.appendChild(this.outlineDiv);
    };

    this.setCurrentSlideIndex = function (slideIndex) {
        if (this._currentRow) {
            Slides.removeClass(this._currentRow, "current");
        }
        this._currentRow = this._rows[slideIndex];
        Slides.addClass(this._currentRow, "current");
    };

    this.outlineDiv = this.buildOutlineDiv();
    show.on('slideIndex', this.setCurrentSlideIndex, this);
};

/* Autoplay all videos on a slide when it appears */
Slides.VideoPresenter = function (show) {
    var self = this;

    this.setCurrentSlideIndex = function (slideIndex) {
        var slide;

        this.eachVideo(function (video) {
            video.currentTime = 0;
            video.pause && video.pause();
        });
        slide = show.getSlide(slideIndex);
        this._currentVideos = slide.div.getElementsByTagName('video');

        this.eachVideo(function (video) {
            video.currentTime = 0;
            video.play && video.play();
        });
    };

    this.eachVideo = function (callback) {
        var index;
        if (!this._currentVideos) {
            return;
        }
        for (index = 0; index < this._currentVideos.length; index++) {
            callback(this._currentVideos[index]);
        }
    };

    show.on('slideIndex', this.setCurrentSlideIndex, this);
};

(function( win ){
    var doc = win.document;

    // If there's a hash, or addEventListener is undefined, stop here
    if( !location.hash && win.addEventListener ){

	//scroll to 1
	window.scrollTo( 0, 1 );
	var scrollTop = 1,
	getScrollTop = function(){
	    return win.pageYOffset || doc.compatMode === "CSS1Compat" && doc.documentElement.scrollTop || doc.body.scrollTop || 0;
	},

	//reset to 0 on bodyready, if needed
	bodycheck = setInterval(function(){
	    if( doc.body ){
		clearInterval( bodycheck );
		scrollTop = getScrollTop();
		win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
	    }
	}, 15 );

	win.addEventListener( "load", function(){
	    setTimeout(function(){
		//at load, if user hasn't scrolled more than 20 or so...
		if( getScrollTop() < 20 ){
		    //reset to hide addr bar at onload
		    win.scrollTo( 0, scrollTop === 1 ? 0 : 1 );
		}
	    }, 0);
	} );
    }
})(this);


text:
package com.android.notificationstudio.editor;

import android.view.View;
import android.view.ViewStub;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Switch;

import com.android.notificationstudio.R;
import com.android.notificationstudio.editor.Editors.Editor;
import com.android.notificationstudio.model.EditableItem;

public class BooleanEditor implements Editor {

    public Runnable bindEditor(View v, final EditableItem item, final Runnable afterChange) {
        final ViewStub booleanEditorStub = (ViewStub) v.findViewById(R.id.boolean_editor_stub);
        booleanEditorStub.setLayoutResource(R.layout.boolean_editor);
        final Switch booleanEditor = (Switch) booleanEditorStub.inflate();
        Runnable updateSwitch = new Runnable() {
            public void run() {
                booleanEditor.setChecked(item.hasValue() && item.getValueBool());
            }};
        booleanEditor.setVisibility(View.VISIBLE);
        updateSwitch.run();
        booleanEditor.setOnCheckedChangeListener(new OnCheckedChangeListener(){
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                item.setValue(isChecked);
                afterChange.run();
            }});
        return updateSwitch;
    }

}

redpajama_set_name: RedPajamaGithub


text:
const util = require('../../helpers/util.helper');
const db = require('../../helpers/db.helper');
const mail = require('../../helpers/mail.helper');
const crypto = require('../../helpers/crypto.helper');
const scrypt = require("scrypt");
const NodeRSA = require('node-rsa');
const async = require('async');
require('dotenv').config();
const ROOT_SPACE = process.env.ROOT_SPACE;
const ROOT_CURRENCY = process.env.ROOT_CURRENCY;
const ADMIN_USERNAME = process.env.ADMIN_USERNAME;

exports.stewardsPost = function (args, res, next) {
    /**
     * parameters expected in the args:
     * registerRequest (Register_request)
     **/

    var examples = {};

    examples['application/json'] = {
        "spaces": "",
        "accounts": "",
        "stewards": "",
        "currencies": ""
    };

    var request = {};
    request.stewardname = args.register_request.value.stewardname;
    request.password = args.register_request.value.password;
    request.publicKey = args.register_request.value.publicKey;
    if (typeof args.register_request.value.email != 'undefined') {
        request.email = args.register_request.value.email;
    }
    if (typeof args.register_request.value.email_notifications != 'undefined') {
        request.email_notifications = args.register_request.value.email_notifications;
    }

    handleStewardsPost(request, function (err, result) {
        if (err) {
            // throw error
            var examples = {};
            examples['application/json'] = err;
            res.setHeader('Content-Type', 'application/json');
            res.statusCode = util.setStatus(err);
            res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
        } else {
            res.setHeader('Content-Type', 'application/json');
            res.end(result);
        }
    });
};

function handleStewardsPost(steward_request, registerPostCallback){
    var stewards = [];
    var spaces = [];
    var currencies = [];
    var accounts = [];

    var steward = {};
    steward.password = scrypt.kdfSync(steward_request.password, crypto.scryptParameters).toString('base64');
    steward.publicKey = steward_request.publicKey;
    steward.stewardname = steward_request.stewardname.toLowerCase();
    if(typeof steward_request.email != 'undefined')
    steward.email = steward_request.email;
    if(typeof steward_request.email_notifications != 'undefined')
    steward.email_notifications = steward_request.email_notifications;

    if(steward.publicKey == null){
        //generate one for the steward
        var key = new NodeRSA({b: 1024});
        steward.publicKey = key.exportKey('pkcs8-public-pem');
        steward.privateKey = key.exportKey('pkcs8-private-pem');
    }

    steward.id = 'stewards~' + steward.stewardname.toLowerCase();
    stewards.push(steward);

    var steward_bucket = {};
    steward_bucket.stewards = [ steward.id ];
    steward_bucket.namespaces = [];
    steward_bucket.currencies = [];
    steward_bucket.accounts = [];
    steward_bucket.type = "steward_bucket";
    steward_bucket.id = steward_bucket.type + "~" + crypto.getHash(steward.publicKey);

    // stewards view of default accounts

    var admin_steward = {
        id: `stewards~${ADMIN_USERNAME || 'admin'}`
    };

    var stewards_space = ROOT_SPACE;
    var space_currency = ROOT_CURRENCY;
    if(steward.stewardname.indexOf('.') !== -1){

        //this is buggy
        //var numberOfSpaces = (steward.stewardname.match(new RegExp(".", "g")) || []).length;
        var spaces_array = steward.stewardname.toLowerCase().split('.');
        var numberOfSpaces = spaces_array.length;

        var space_root = steward.stewardname.toLowerCase().substring(steward.stewardname.toLowerCase().indexOf('.') + 1, steward.stewardname.toLowerCase().length);

        if (space_root == ROOT_SPACE){
            // these are the pre-programmed root spaces that are allowed.

            //iterate through the spaces starting with the root.
            for(var i = spaces_array.length; i > 0; i--) {

                var space_parent = ''; //steward.stewardname.toLowerCase().substring(indexOf(steward.stewardname, '.'), steward.stewardname.length);
                //build the parent space
                for (var j = i; j < spaces_array.length; j++){
                    space_parent += '.' + spaces_array[j]
                }
                //remove leading dot.
                space_parent = space_parent.substring(1,space_parent.length);

                //update the stewards space variable for their main cc account.
                stewards_space = space_parent;

                if (space_parent.indexOf('.' === -1)){
                    stewards_bucket.namespaces.push(`namespaces~${space_parent}`);
                } else {
                    stewards_bucket.namespaces.push(`namespaces~${space_parent}`);
                    // add last item in namespace
                    const parts = space_parent.split('.');
                    stewards_bucket.namespaces.push(`namespaces~${parts[parts.length - 1]}`);
                }

                var steward_space = {};
                //get middle part of steward name .myname.thispart.cc
                steward_space.namespace = steward.stewardname.toLowerCase();
                steward_space.parent_namespace = space_parent.toLowerCase();
                steward_space.created = new Date().getTime();
                steward_space.stewards = [ steward.id ];
                steward_space.type = "namespaces";
                steward_space.id = 'namespaces~' + steward_space.namespace;
                steward_space.private = true;
                steward_space.disabled = false;
                spaces.push( steward_space );
                steward_bucket.namespaces.push(steward_space.id);

                space_currency = steward_space.parent_namespace;
                //check if currency exists with the same space name
                //if exists add currency and account
                //this is a blocking operation because it involves a lookup, so this has to be done before submit.
            }//for spaces
        } else {
          return registerPostCallback({status:400,code:1050, message: 'trying to register for a non registerable namespace root:' + space_root});
        }
    } else { // else dot in stewardname
      var steward_space = {};
      steward_space.namespace = steward.stewardname.toLowerCase() + `.${ROOT_SPACE}`;
      steward_space.parent_namespace = ROOT_SPACE;
      steward_space.created = new Date().getTime();
      steward_space.stewards = [ steward.id ];
      steward_space.type = 'namespaces';
      steward_space.id = 'namespaces~' + steward_space.namespace;
      steward_space.private = true;
      steward_space.disabled = false;
      spaces.push( steward_space );
      steward_bucket.namespaces.push(steward_space.id);
    }

    //The root space cc stands for community currency or creative commons. It is the root namespace each steward gets in an account.
    var space = {};
    // space.namespace = "cc";
    // space.parent_namespace = ""; //references the parent space building a tree graph from the root.
    // space.created = new Date().getTime(); //static
    // space.stewards = [ deefactorial.id, michael.id ];
    // space.type = "namespaces";
    space.id = 'namespaces~cc';
    // spaces.push( space );
    steward_bucket.namespaces.push(space.id);

    //This is the community currency all stewards get an account in this currency when they use the register api.
    var currency = {};
    currency.currency = "cc";
    currency.currency_namespace = ""; //currencies have thier own spaces as well cc is the root.
    currency.created = new Date().getTime(); //static
    // currency.stewards = [ deefactorial.id , michael.id ];
    currency.stewards = [ admin_steward.id ];
    currency.type = "currencies";
    currency.id = 'currencies~' + currency.currency;
    currencies.push( currency );
    steward_bucket.currencies.push(currency.id);

    // accounts don't store journal entries, journal entries reference accounts.
    var account = {};
    if(steward.stewardname.toLowerCase().indexOf('.') !== -1){
      account.account = steward.stewardname.toLowerCase().substring(0, steward.stewardname.toLowerCase().indexOf('.'));
    } else {
      account.account = steward.stewardname.toLowerCase();
    }
    account.account_namespace = stewards_space;
    account.currency = "cc";
    account.currency_namespace = "";
    account.stewards = [ steward.id ];
    account.type = "accounts";
    account.id = 'accounts~' + account.account.toLowerCase() + '.' + account.account_namespace.toLowerCase() + '~' + account.currency.toLowerCase();
    accounts.push(account);
    steward_bucket.accounts.push(account.id);

    //access doc to get listing of accounts under that account name and space.
    var accounts_list = {};
    accounts_list.id = 'accountsList~' + account.account.toLowerCase() + '.' + account.account_namespace.toLowerCase();
    accounts_list.type = "accountsList";
    accounts_list.list = [ account.id ];

    var key = new NodeRSA();

    //key.importKey(steward.publicKey, 'pkcs8-public');
    key.importKey(steward.publicKey);

    if(!key.isPublic()) {

        var err = {
            "status": 401,
            "code": 1004,
            "message": 'Failed public key evaluation!'
        };
        registerPostCallback(err, false);

    } else {
        // Check all assumptions with models:
        var parallelTasks = {};
        parallelTasks.steward_global = function(callback) {
            db.openmoney_bucket.get("stewards~" + steward.stewardname.toLowerCase(), function (err, res) {
                if (err) {
                    // doc doesn't exist insert it.
                    callback(null, false);
                } else {
                    // steward already exists
                    callback({status:400,code:1010, message: "Steward exists with stewardname: " + steward.stewardname.toLowerCase()}, true);
                }
            });
        };
        parallelTasks.steward_local = function(callback) {
            db.stewards_bucket.get("steward_bucket~" + crypto.getHash(steward.publicKey), function (err, res) {
                if (err) {
                    // doc doesn't exist insert it.
                    callback(null, false);
                } else {
                    // steward already exists
                    callback({status:400,code:1011, message: "You already submitted your registration."}, true);
                }
            });
        };
        parallelTasks.stewards_publicKey = function(callback) {
            db.openmoney_bucket.get("steward_bucket~" + crypto.getHash(steward.publicKey), function (err, res) {
                if (err) {
                    // doc doesn't exist insert it.
                    callback(null, false);
                } else {
                    // Steward already exists
                    callback({status:400, code:1012, message: "Public key exists: " + steward.publicKey}, true);
                }
            });
        };

        spaces.forEach(function(space){
            if(space.id != 'namespaces~cc' && space.id != 'namespaces~uk' && space.id != 'namespaces~ca') {
                parallelTasks[space.id] = function (callback) {
                    db.openmoney_bucket.get(space.id, function (err, res) {
                        if (err) {
                            // doc doesn't exist insert it.
                            callback(null, false);
                        } else {
                            // space already exists through error
                            callback({status: 400, code: 1013, message: "A space exists with the name: " + space.id}, true);
                        }
                    });
                };
            }
        });
        currencies.forEach(function(currency){
            if(currency.id != 'currencies~cc') {
                parallelTasks[currency.currency] = function (callback) {
                    db.openmoney_bucket.get(currency.id, function (err, res) {
                        if (err) {
                            // doc doesn't exist insert it.
                            callback(null, false);
                        } else {
                            // doc already exists through error
                            callback({
                                status: 400,
                                code: 1014,
                                message: "A currency exists with the name: " + currency.currency.toLowerCase() + "." + currency.currency_namespace.toLowerCase()
                            }, true);
                        }
                    });
                };
            }
        });

        if (space_currency != 'cc') {
            parallelTasks[space_currency] = function (callback) {
                db.openmoney_bucket.get("currencies~" + space_currency.toLowerCase(), function (err, res) {
                    if (err) {
                        // doc doesn't exist insert it.
                        callback(null, false);
                    } else {

                        //no error just add the result the stewards list of known currencies and add an account in that currency.
                        var currency = res.value;
                        currencies.push(currency);
                        steward_bucket.currencies.push(currency.id);

                        var account = {};
                        account.account = steward.stewardname.toLowerCase();
                        account.account_namespace = stewards_space;
                        account.currency = space_currency.toLowerCase().substring(0,indexOf(space_currency,"."));
                        account.currency_namespace = space_currency.toLowerCase().substring(indexOf(space_currency,"."),space_currency.length);
                        account.stewards = [ steward.id ];
                        account.type = "accounts";
                        account.id = 'accounts~' + account.account.toLowerCase() + '.' + account.account_namespace.toLowerCase() + '~' + account.currency.toLowerCase() + '.' + account.currency_namespace.toLowerCase();
                        accounts.push(account);
                        steward_bucket.accounts.push(account.id);

                        callback(null, false);
                    }
                });
            };
        }
        accounts.forEach(function(account){
            if(account.stewards[0] == steward.id) {
                var account_currency = account.currency_namespace == '' ? account.currency.toLowerCase() : account.currency.toLowerCase() + "." + account.currency_namespace.toLowerCase();
                parallelTasks[account.account] = function (callback) {
                    db.openmoney_bucket.get("accounts~" + account.account.toLowerCase() + "." + account.account_namespace.toLowerCase() + "~" + account_currency , function (err, res) {
                        if (err) {
                            // doc doesn't exist insert it.
                            callback(null, false);
                        } else {
                            // doc already exists through error
                            callback({status:400, code:1015, message: "Account exists with the name: " + account.account.toLowerCase() + "." + account.account_namespace.toLowerCase() + "~" + account_currency}, true);
                        }
                    });
                };
            }
        });

        async.parallel(parallelTasks,
            function(err, results) {
                // results is now equals to: {steward: false, spacename: false}
                if(err) {

                    registerPostCallback(err);

                } else {
                    //we are a go to insert the records.
                    var insertTasks = {};

                    if (steward.email)
                        insertTasks.stewards_emailList = function(callback){
                            db.openmoney_bucket.get("stewards_emailList~" + steward.email.toLowerCase(), function(err, emailList){
                              if(err){
                                if(err.code == 13){
                                  //not found create the doc.
                                  var emailList = {};
                                  emailList.type = 'stewards_emailList';
                                  emailList.email = steward.email.toLowerCase();
                                  emailList.stewards = [ steward.stewardname.toLowerCase() ];
                                  emailList.id = emailList.type + '~' + emailList.email.toLowerCase();
                                  db.openmoney_bucket.insert(emailList.id, emailList, function(err, ok){
                                    callback(err, ok);
                                  })
                                } else {
                                  callback(err);
                                }
                              } else {
                                //found update the doc.
                                emailList.value.stewards.push(steward.stewardname.toLowerCase());
                                db.openmoney_bucket.replace(emailList.value.id, emailList.value, {cas: emailList.cas}, function(err, ok){
                                  if(err){
                                    if(err.code == 12){
                                      //retry
                                      insertTasks.stewards_emailList(callback);
                                    } else {
                                      callback(err);
                                    }
                                  } else {
                                    callback(null, ok);
                                  }
                                })
                              }
                            })
                        };

                    var value_references = {};
                    value_references.type = "value_reference";
                    value_references.documents = ["steward_bucket~" + crypto.getHash(steward.publicKey)];

                    //update stewards
                    steward_bucket.stewards.forEach(function(stewardID){
                        insertTasks[stewardID + "val_ref"] = function(callback) {
                            db.stewards_bucket.get(stewardID, function(err, val_ref){
                                if(err) {
                                    if(err.code == "13"){
                                        value_references.id = stewardID;
                                        db.stewards_bucket.insert(stewardID, value_references, function(err, ok){
                                            if(err) {
                                                callback(err, false);
                                            } else {
                                                callback(null, ok);
                                            }
                                        });
                                    } else {
                                        callback(err, false);
                                    }
                                } else {
                                    val_ref.value.documents.push("steward_bucket~" + crypto.getHash(steward.publicKey));
                                    db.stewards_bucket.replace(stewardID, val_ref.value, {cas: val_ref.cas}, function(err, ok){
                                        if(err) {
                                            callback(err, false);
                                        } else {
                                            callback(null, ok);
                                        }
                                    });
                                }
                            })
                        };
                    });

                    // //update namespaces
                    // steward_bucket.namespaces.forEach(function(namespaceID){
                    //     insertTasks[namespaceID + "val_ref"] = function(callback) {
                    //         db.stewards_bucket.get(namespaceID, function(err, val_ref){
                    //             if(err) {
                    //                 if(err.code == "13"){
                    //                     value_references.id = namespaceID;
                    //                     db.stewards_bucket.insert(namespaceID, value_references, function(err, ok){
                    //                         if(err) {
                    //                             callback(err);
                    //                         } else {
                    //                             callback(null, ok);
                    //                         }
                    //                     });
                    //                 } else {
                    //                     callback(err);
                    //                 }
                    //             } else {
                    //                 val_ref.value.documents.push("steward_bucket~" + crypto.getHash(steward.publicKey));
                    //                 db.stewards_bucket.replace(namespaceID, val_ref.value, {cas: val_ref.cas}, function(err, ok){
                    //                     if(err) {
                    //                       if(err.code == 12){
                    //                         insertTasks[namespaceID + "val_ref"](callback);
                    //                       } else {
                    //                         callback(err);
                    //                       }
                    //                     } else {
                    //                         callback(null, ok);
                    //                     }
                    //                 });
                    //             }
                    //         })
                    //     };
                    // });

                    //update currencies
                    steward_bucket.currencies.forEach(function(currencyID){
                        insertTasks[currencyID + "val_ref"] = function(callback) {
                            db.stewards_bucket.get(currencyID, function(err, val_ref){
                                if(err) {
                                    if(err.code == "13"){
                                        value_references.id = currencyID;
                                        db.stewards_bucket.insert(currencyID, value_references, function(err, ok){
                                            if(err) {
                                                callback(err);
                                            } else {
                                                callback(null, ok);
                                            }
                                        });
                                    } else {
                                        callback(err);
                                    }
                                } else {
                                    val_ref.value.documents.push("steward_bucket~" + crypto.getHash(steward.publicKey));
                                    db.stewards_bucket.replace(currencyID, val_ref.value, {cas: val_ref.cas},function(err, ok){
                                        if(err) {
                                            callback(err);
                                        } else {
                                            callback(null, ok);
                                        }
                                    });
                                }
                            })
                        };
                    });

                    //update accounts
                    steward_bucket.accounts.forEach(function(accountID){
                        insertTasks[accountID + "val_ref"] = function(callback) {
                            db.stewards_bucket.get(accountID, function(err, val_ref){
                                if(err) {
                                    if(err.code == "13"){
                                        value_references.id = accountID;
                                        db.stewards_bucket.insert(accountID, value_references, function(err, ok){
                                            if(err) {
                                                callback(err);
                                            } else {
                                                callback(null, ok);
                                            }
                                        });

                                    } else {
                                        callback(err, false);
                                    }
                                } else {
                                    val_ref.value.documents.push("steward_bucket~" + crypto.getHash(steward.publicKey));
                                    db.stewards_bucket.replace(accountID, val_ref.value, {cas : val_ref.cas}, function(err, ok){
                                        if(err) {
                                            callback(err, false);
                                        } else {
                                            callback(null, ok);
                                        }
                                    });
                                }
                            })
                        };
                    });

                    //access doc to get listing of accounts under that account name and space.
                    insertTasks.accounts_list = function(callback) {
                        db.openmoney_bucket.insert(accounts_list.id, accounts_list, function(err, res){
                            if (err) {
                                callback(err, null);
                            } else {
                                callback(null, res);
                            }
                        })
                    };

                    insertTasks.stewards_global = function(callback) {
                        var steward_global = util.clone(steward);
                        steward_global.id = "stewards~" + steward.stewardname.toLowerCase();
                        db.openmoney_bucket.insert(steward_global.id, steward_global, function (err, res) {
                            if (err) {
                                // doc doesn't exist insert it.
                                callback(err);
                            } else {
                                // success
                                callback(null, res);
                            }
                        });
                    };

                    insertTasks.steward_publicKey = function(callback) {
                        var steward_publicKey = {};
                        steward_publicKey.id = "steward_bucket~" + crypto.getHash(steward.publicKey);
                        steward_publicKey.type = "steward_bucket";
                        steward_publicKey.stewardname = steward.stewardname;
                        if(steward.privateKey != null){
                            steward_publicKey.privateKey = steward.privateKey;
                        }
                        db.openmoney_bucket.insert(steward_publicKey.id, steward_publicKey, function (err, res) {
                            if (err) {
                                // doc doesn't exist insert it.
                                callback(err);
                            } else {
                                // success
                                callback(null, res);
                            }
                        });
                    };

                    // persist the stewards view of steward accounts
                    insertTasks.steward_bucket = function(callback) {
                        //insert the steward account
                        db.stewards_bucket.insert("steward_bucket~" + crypto.getHash(steward.publicKey) , steward_bucket, function (err, res) {
                            if (err) {
                                // doc doesn't exist insert it.
                                callback(err);
                            } else {
                                // success
                                callback(null, res);
                            }
                        });
                    };

                    // persist the spaces, currencies, and accounts for the steward.
                    spaces.forEach(function(space){
                        if(space.id != 'namespaces~cc' && space.id != 'namespaces~uk' && space.id != 'namespaces~ca') {
                            insertTasks[space.id] = function (callback) {
                                db.openmoney_bucket.insert(space.id, space, function (err, res) {
                                    if (err) {
                                        callback(err);
                                    } else {
                                        // success
                                        callback(null, res);
                                    }
                                });
                            };
                        }
                    });
                    currencies.forEach(function(currency) {
                        if(currency.id != 'currencies~cc') {
                            insertTasks[currency.id] = function (callback) {
                                db.openmoney_bucket.insert(currency.id, currency, function (err, res) {
                                    if (err) {
                                        callback(err);
                                    } else {
                                        // success
                                        callback(null, res);
                                    }
                                });
                            };
                        }
                    });
                    accounts.forEach(function(account){
                        insertTasks[account.id] = function(callback) {
                            db.openmoney_bucket.insert(account.id, account, function (err, res) {
                                if (err) {
                                    callback(err);
                                } else {
                                    // success
                                    callback(null, res);
                                }
                            });
                        };
                    });

                    async.parallel(insertTasks,
                        function(err, results) {
                            // results is now equals to: {stewards: false, spacename: false}
                            if (err) {
                                registerPostCallback(err, false);
                            } else {
                                //send the response to the steward

                                var response = {
                                  ok: true,
                                  stewards: {}
                                };

                                for(var i = 0; i < stewards.length; i++){
                                    delete(stewards[i].password);
                                    //need to return the privateKey in order to decrypt journals
                                    if(stewards[i].stewardname != steward.stewardname){
                                      delete(stewards[i].privateKey);
                                    }
                                }

                                response.stewards = stewards;
                                // response.namespaces = spaces;
                                // response.currencies = currencies;
                                // response.accounts = accounts;

                                var to = '"' + steward.stewardname + '"<' + steward.email + '>';
                                if(typeof steward.email_notifications !== 'undefined' && steward.email_notifications === false){
                                  to = null;
                                }

                                var subject = 'Welcome to Openmoney Network: "' + steward.stewardname + '"<' + steward.email + '>';
                                var messageHTML = '<h3>Welcome to Openmoney Network: "' + steward.stewardname + '"<' + steward.email + '>.</h3>';
                                messageHTML += '<b>Your stewardname is "' + steward.stewardname + '". You can log in here: <a href="' + process.env.API_HOST + '#login">' + process.env.API_HOST + '/#login</a></b> .';
                                messageHTML += '<h5>If you forgot your password you can reset it here: <a href="' + process.env.API_HOST + '/#forgot">' + process.env.API_HOST + '/#forgot</a>.</h5>';
                                mail.sendmail(to, null, process.env.MONITOR_ADDRESSES, subject, messageHTML, function(err, ok){
                                  console.info('sendmail:', err, ok);
                                  registerPostCallback(null, response);
                                });
                            }
                        });
                }
            });
    }
};


text:
<?php

include_once __DIR__ . '/_common.php';

bad_request_if(empty($_GET['id']));

no_access_if_not_allowed('documentation*');

$query = <<<SQL
SELECT doc.id, doc.title, doc.description, dev.name AS device, m.name AS machine, f.name AS factory, doc.machine AS machineId
FROM documentations doc
LEFT JOIN engines dev
  ON dev.id=doc.device
LEFT JOIN machines m
  ON m.id=doc.machine
LEFT JOIN factories f
  ON f.id=m.factory
WHERE doc.id=:id
ORDER BY doc.title ASC
SQL;

$doc = fetch_one($query, array(':id' => $_GET['id']));

not_found_if(empty($doc));

no_access_if_not(has_access_to_machine($doc->machineId));

$files = fetch_all('SELECT id, name FROM documentation_files WHERE documentation=:id ORDER BY name ASC', array(':id' => $doc->id));

escape_vars($doc->title, $doc->description);

$canEdit = is_allowed_to('documentation/edit');
$canDelete = is_allowed_to('documentation/delete');

?>
<? begin_slot('head') ?>

<? append_slot() ?>
<? begin_slot('submenu') ?>

  <? if ($canEdit): ?>
<a href="<?= url_for('documentation/edit.php?id=' . $doc->id) ?>">Edytuj dokumentację<? endif ?>
  <? if ($canDelete): ?>
<a href="<?= url_for('documentation/delete.php?id=' . $doc->id) ?>">Usuń dokumentację<? endif ?>

<? append_slot() ?>

<? decorate("Dokumentacja") ?>

<?= $doc->title ?>

Dotyczy

<?= doc_features($doc) ?>

    <?= markdown($doc->description) ?>
    <? if (!empty($files)): ?>

Dostępne pliki
      <? foreach ($files as $file): ?>

<a target="_blank" href="<?= url_for('documentation/download.php?id=' . $file->id) ?>"><?= $file->name ?>
      <? endforeach ?>

    <? endif ?>


text:
class Model
  def initialize(hash = {})
    @attributes = hash
  end

  def read_attribute_for_serialization(name)
    if name == :id || name == 'id'
      object_id
    elsif respond_to?(name)
      send name
    else
      @attributes[name]
    end
  end
end

###
## Models
###
class User < Model
  def profile
    @profile ||= Profile.new(name: 'N1', description: 'D1')
  end
end

class UserInfo < Model
  def user
    @user ||= User.new(name: 'N1', email: 'E1')
  end
end

class Profile < Model
end

class Category < Model
  def posts
    @posts ||= [Post.new(title: 'T1', body: 'B1'),
                Post.new(title: 'T2', body: 'B2')]
  end
end

class Post < Model
  def comments
    @comments ||= [Comment.new(content: 'C1'),
                   Comment.new(content: 'C2')]
  end
end

class SpecialPost < Post
  def special_comment
    @speical_comment ||= Comment.new(content: 'special')
  end
end

class Comment < Model
end

class WebLog < Model
end

class Interview < Model
  def attachment
    @attachment ||= Image.new(url: 'U1')
  end
end

class Mail < Model
  def attachments
    @attachments ||= [Image.new(url: 'U1'),
                      Video.new(html: 'H1')]
  end
end

class Image < Model
end

class Video < Model
end

###
## Serializers
###
class UserSerializer < ActiveModel::Serializer
  attributes :name, :email

  has_one :profile
end

class UserInfoSerializer < ActiveModel::Serializer
  has_one :user
end

class ProfileSerializer < ActiveModel::Serializer
  def description
    description = object.read_attribute_for_serialization(:description)
    scope ? "#{description} - #{scope}" : description
  end

  attributes :name, :description
end

class CategorySerializer < ActiveModel::Serializer
  attributes :name

  has_many :posts
end

class PostSerializer < ActiveModel::Serializer
  attributes :title, :body

  has_many :comments
end

class SpecialPostSerializer < ActiveModel::Serializer
  attributes :title, :body
  has_many :comments, root: :comments, embed_in_root: true, embed: :ids
  has_one :special_comment, root: :comments, embed_in_root: true, embed: :ids
end

class CommentSerializer < ActiveModel::Serializer
  attributes :content
end

class WebLogSerializer < ActiveModel::Serializer
  attributes :name, :display_name
end

class WebLogLowerCamelSerializer < WebLogSerializer
  format_keys :lower_camel
end

class InterviewSerializer < ActiveModel::Serializer
  attributes :text

  has_one :attachment, polymorphic: true
end

class MailSerializer < ActiveModel::Serializer
  attributes :body

  has_many :attachments, polymorphic: true
end

class ImageSerializer < ActiveModel::Serializer
  attributes :url
end

class VideoSerializer < ActiveModel::Serializer
  attributes :html
end

class ShortProfileSerializer < ::ProfileSerializer; end

module TestNamespace
  class ProfileSerializer < ::ProfileSerializer; end
  class UserSerializer    < ::UserSerializer;    end
end

ActiveModel::Serializer.setup do |config|
  config.default_key_type = :name
end

class NameKeyUserSerializer < ActiveModel::Serializer
  attributes :name, :email

  has_one :profile
end

class NameKeyPostSerializer < ActiveModel::Serializer
  attributes :title, :body

  has_many :comments
end

ActiveModel::Serializer.setup do |config|
  config.default_key_type = nil
end


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2013, Redsolution LTD. All rights reserved.

     This file is part of Xabber project; you can redistribute it and/or
     modify it under the terms of the GNU General Public License, Version 3.

     Xabber is distributed in the hope that it will be useful, but
     WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     See the GNU General Public License for more details.

     You should have received a copy of the GNU General Public License,
     along with this program. If not, see http://www.gnu.org/licenses/.
-->
<resources>
    <string-array name="chat_message_quantity">
        <item>@string/chat_message_quantity_1</item>
        <item>@string/chat_message_quantity_2</item>
    </string-array>
    <string-array name="chat_contact_quantity">
        <item>@string/chat_contact_quantity_1</item>
        <item>@string/chat_contact_quantity_2</item>
    </string-array>
    <string-array name="account_quantity">
        <item>@string/account_quantity_1</item>
        <item>@string/account_quantity_2</item>
    </string-array>
    <string-array name="account_quantity_offline">
        <item>@string/account_quantity_offline_1</item>
        <item>@string/account_quantity_offline_2</item>
    </string-array>
    <string-array name="connection_state_connected">
        <item>@string/connection_state_connected_1</item>
        <item>@string/connection_state_connected_2</item>
    </string-array>
    <string-array name="connection_state_connecting">
        <item>@string/connection_state_connecting_1</item>
        <item>@string/connection_state_connecting_2</item>
    </string-array>
    <string-array name="connection_state_waiting">
        <item>@string/connection_state_waiting_1</item>
        <item>@string/connection_state_waiting_2</item>
    </string-array>
</resources>


text:
<?php

namespace Galerija\ImagesBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Galerija\ImagesBundle\Entity\Album;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
 * Class Albumų sąrašo kontroleris (pagrindinis puslapis)
 * @package Galerija\ImagesBundle\Controller
 */
class AlbumListController extends Controller
{
    /**
     * Atvaizduojamas pagrindinis pulsapis, ir jei pareikalauta (post metodas) sukuriamas naujas albumas.
     * Kurimo atveju, tikrinama, ar vartotojas prisijungęs.
     *
     * @param Request $request užklausa
     * @return mixed suformuotas puslapis
     */
    public function indexAction(Request $request)
    {
        $album = new Album();
        /* @var \Galerija\ImagesBundle\Services\AlbumManager $am */
        $am = $this->get("album_manager");
        $form = $am->getForm($album);
        $user = $this->container->get('security.context')->getToken()->getUser();

        if ($request->isMethod('POST'))
        {
            $securityContext = $this->container->get('security.context');
            if(!$securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED'))
            {
                $this->get('session')->getFlashBag()->add('error', 'Kurti albumus gali tik prisijungę vartotojai.');
                return $this->redirect($this->generateUrl('galerija_album_homepage'));
            }
            $form->handleRequest($request);
            if ($form->isValid()) {
                $album->setUser($user);
                $am->save($album);
                $this->get('session')->getFlashBag()->add('success', 'Albumas sukurtas sėkmingai!');
                return $this->redirect($this->generateUrl('galerija_album_homepage'));
            }
            else
            {
                $result = $this->get("errors")->getErrors($album);
                $this->get('session')->getFlashBag()->add('error',$result);
                return $this->redirect($this->generateUrl('galerija_album_homepage'));
            }
        }

        $album_array = $am->findAll();
        return $this->render('GalerijaImagesBundle:Albums:albums.html.twig', array(
            'album_array' => $album_array,
            'form' => $form->createView(),
            'user' => $user
        ));
    }

    /**
     * Albumų trinimmo veiksmas.
     * Kadangi šiuo atveju nesinaudojama Symfony formomis, patikrinamas gautas csf token'as.
     * Patikrinama ar albumas priklauso vartotojui, ar pats albumas rastas.
     *
     * @param Request $request užklausa, id nurodo trinamo albumo id
     * @return JsonResponse atsakas, kuris apdorojamas DeleteWidget.js faile
     */
    public function deleteAction(Request $request)
    {
        $response = new JsonResponse();
        /* @var \Galerija\ImagesBundle\Services\AlbumManager $am */
        $am = $this->get("album_manager");
        $aid = (int)$request->request->get('ID');
        $album = $am->findById($aid);

        if($album == null)
        {
            $response->setData(array(
                "success" => false,
                "message" => 'Tokio albumo nerasta'
            ));
            return $response;
        }

        if (!$this->get('form.csrf_provider')->isCsrfTokenValid("album".$aid, $request->request->get('csrf_token')))
        {
            $response->setData(array(
                "success" => false,
                "message" => 'Neteisingas CSRF.'
            ));
            return $response;
        }

        if(!$this->get("user_extension")->belongsFilter($album))
        {
            $response->setData(array(
                "success" => false,
                "message" => 'Galima trinti tik savo albumus.'
            ));
            return $response;
        }

        $am->delete($album);
        $response->setData(array(
            "success" => true,
            "message" => 'Albumas ištrintas sėkmingai!'
        ));
        return $response;
    }

    /**
     * Titulinės nuotraukos nustatymo veiksmas.
     * Patikrinama ar vartotojas prisijungęs ir ar jam priklauso nurodytas albumas.
     * Taip pat tikrinama ar paveiksliukas ir albumas egzistuoja.
     *
     * @param Request $request užklausa. aID nurodo albumo iD, ID nurodo nuotraukos I
     * @return JsonResponse atsakas, kuri apdorojamas DefaultImageWidget.js faile
     */
    public function setDefaultAction(Request $request)
    {
        $response = new JsonResponse();
        $aid = (int)$request->request->get('aID');
        $id = (int)$request->request->get('ID');
        /* @var Album $album */
        $album = $this->get("album_manager")->findById($aid);
        $image = $this->get("image_manager")->findById($id);

        if($album == null || $album->getAlbumId() == 0)
        {
            $response->setData(array(
                "success" => false,
                "message" => 'Tokio albumo nerasta'
            ));
            return $response;
        }

        if($image == null)
        {
            $response->setData(array(
                    "success" => false,
                    "message" => 'Tokio paveiksliuko nerasta'
                ));
            return $response;
        }

        if (!$this->get('form.csrf_provider')->isCsrfTokenValid("default_image", $request->request->get('csrf_token')))
        {
            $response->setData(array(
                "success" => false,
                "message" => 'Neteisingas CSRF.'
            ));
            return $response;
        }

        if(!$this->get("user_extension")->belongsFilter($album))
        {
            $response->setData(array(
                "success" => false,
                "message" => 'Nustatyti titulines nuotraukas galima tik savo albumams.'
            ));
            return $response;
        }

        $album->setDefaultImage($image);
        $this->getDoctrine()->getManager()->flush();
        $response->setData(array(
            "success" => true,
            "message" => 'Titulinė nuotrauka pakeista.'
        ));
        return $response;
    }

    /**
     * Albumo redagavimas. Patikrinama ar albumas vartotojui priklauso,
     * ar ji egzistuoja ir sugeneruojama forma vartotojui.
     * Jei metodas yra post, vadinasi submitinamas redagavimas, dėl ko patikrinama forma ir gražinamas rezultatas
     *
     * @param Request $request užklausa
     * @param int $albumId albumo id
     * @return mixed rezuktatas
     */
    public function editAction(Request $request, $albumId)
    {
        /* @var \Galerija\ImagesBundle\Services\AlbumManager $am */
        $am = $this->get("album_manager");
        $album = $am->findById($albumId);
        $form = $am->getEditForm($album);

        if($album == null || $album->getAlbumId() == 0)
        {
            $this->get('session')->getFlashBag()->add('error', 'Tokio albumo nerasta.');
            return $this->redirect($this->generateUrl('galerija_album_homepage'));
        }

        if(!$this->container->get('security.context')->isGranted('IS_AUTHENTICATED_REMEMBERED'))
        {
            $this->get('session')->getFlashBag()->add('success', 'Redaguoti albumus gali tik prisijungę vartotojai.');
            return $this->redirect($request->headers->get('referer'));
        }

        if(!$this->get("user_extension")->belongsFilter($album))
        {
            $this->get('session')->getFlashBag()->add('error', 'Šis albumas nepriklauso jums');
            return $this->redirect($request->headers->get('referer'));
        }

        if ($request->isMethod('POST'))
        {

            $form->handleRequest($request);
            if ($form->isValid()) {
                $this->getDoctrine()->getManager()->flush();
                $this->get('session')->getFlashBag()->add('success', 'Albumas sėkmingai atnaujintas.');
                return $this->redirect($request->headers->get('referer'));
            }
            else
            {
                $result = $this->get("errors")->getErrors($album);
                $this->get('session')->getFlashBag()->add('error',$result);
                return $this->redirect($request->headers->get('referer'));
            }
        }

        return $this->render('GalerijaImagesBundle:Forms:album.html.twig', array(
            'form' => $form->createView(),
            'edit' => true
        ));
    }
}


text:
package com.nominanuda.apikey;

import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.zip.CRC32;

public class Crc32Signer implements Signer {

	public static final String CRC32 = "crc32";

	@Override
	public byte[] sign(byte[] msg) {
		CRC32 crc = new CRC32();
		crc.update(msg);
		return toBytes(new Long(crc.getValue()).intValue());
	}

	private byte[] toBytes(int value) {
		return ByteBuffer.allocate(4).putInt(value).array();
	}

	@Override
	public boolean verify(byte[] msg, byte[] signature) {
		byte[] sig2 = sign(msg);
		boolean verified = Arrays.equals(signature, sig2);
		return verified;
	}

}


text:
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
    <title>iron-doc-viewer tests</title>

    <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
    <script src="../../web-component-tester/browser.js"></script>
    <script src="../../test-fixture/test-fixture-mocha.js"></script>

    <link rel="import" href="../../polymer/polymer.html">
    <link rel="import" href="../../test-fixture/test-fixture.html">

    <link rel="import" href="../iron-doc-viewer.html">
  </head>
  <body>

    <dom-module id="bound-fixture">
      <template>
        <iron-doc-viewer
            id="doc"
            descriptor="[[descriptor]]"
            demo-src-prefix="/demo-dir/"
            path="[[path]]">
        </iron-doc-viewer>
      </template>
      <script>
        window.addEventListener('WebComponentsReady', function() {
          Polymer({is: 'bound-fixture'});
        });
      </script>
    </dom-module>

    <test-fixture id="bound">
      <template>
        <bound-fixture></bound-fixture>
      </template>
    </test-fixture>

    <script>
      var descriptor = {
        'elements': [{
          'name': 'my-element',
          'description': 'I am an element',
          'demos':
              [{'url': 'demo/fancy-demo.html', 'description': 'My Fancy Demo'}]
        }],
        'mixins': [{'name': 'my-mixin', 'description': 'I am a mixin'}],
        'classes': [{'name': 'my-class', 'description': 'I am a class'}],
        'metadata': {
          'polymer': {
            'behaviors':
                [{'name': 'my-behavior', 'description': 'I am a behavior'}]
          }
        }
      };

      describe('<iron-doc-viewer>', function() {
        var page;
        beforeEach(function() {
          page = fixture('bound');
          page.descriptor = descriptor;
        });

        it('renders top-level namespace', function() {
          page.path = '/';
          Polymer.dom.flush();
          var view = page.$$('iron-doc-viewer')
                         .$$('iron-doc-namespace')
                         .$$('iron-doc-summary');
          var text = Polymer.dom(view.root).textContent;
          expect(text).contains('my-element');
        });

        it('renders element', function() {
          page.path = '/elements/my-element';
          Polymer.dom.flush();
          var view = page.$$('iron-doc-viewer').$$('iron-doc-element');
          var text = Polymer.dom(view.root).textContent;
          expect(text).contains('my-element');
        });

        it('renders mixin', function() {
          page.path = '/mixins/my-mixin';
          Polymer.dom.flush();
          var view = page.$$('iron-doc-viewer').$$('iron-doc-mixin');
          var text = Polymer.dom(view.root).textContent;
          expect(text).contains('my-mixin');
        });

        it('renders class', function() {
          page.path = '/classes/my-class';
          Polymer.dom.flush();
          var view = page.$$('iron-doc-viewer').$$('iron-doc-class');
          var text = Polymer.dom(view.root).textContent;
          expect(text).contains('my-class');
        });

        it('renders behavior', function() {
          page.path = '/behaviors/my-behavior';
          Polymer.dom.flush();
          var view = page.$$('iron-doc-viewer').$$('iron-doc-behavior');
          var text = Polymer.dom(view.root).textContent;
          expect(text).contains('my-behavior');
        });

        it('renders demo by short name', function() {
          page.path = '/elements/my-element/demos/my-fancy-demo';
          Polymer.dom.flush();
          var iframe = page.$$('iron-doc-viewer').$$('iron-doc-demo').$$('iframe');
          expect(iframe.getAttribute('src')).equals('/demo-dir/demo/fancy-demo.html');
        });

        it('renders demo by path', function() {
          page.path = '/elements/my-element/demos/demo/fancy-demo.html';
          Polymer.dom.flush();
          var iframe = page.$$('iron-doc-viewer').$$('iron-doc-demo').$$('iframe');
          expect(iframe.getAttribute('src')).equals('/demo-dir/demo/fancy-demo.html');
        });
      });
    </script>

  </body>
</html>


text:
package com.h6ah4i.android.example.advrecyclerview.common.data;

public abstract class AbstractExpandableDataProvider {
    public static abstract class BaseData {

        public abstract int getSwipeReactionType();

        public abstract String getText();

        public abstract void setPinnedToSwipeLeft(boolean pinned);

        public abstract boolean isPinnedToSwipeLeft();
    }

    public static abstract class GroupData extends BaseData {
        public abstract boolean isSectionHeader();
        public abstract long getGroupId();
    }

    public static abstract class ChildData extends BaseData {
        public abstract long getChildId();
    }

    public abstract int getGroupCount();
    public abstract int getChildCount(int groupPosition);

    public abstract GroupData getGroupItem(int groupPosition);
    public abstract ChildData getChildItem(int groupPosition, int childPosition);

    public abstract void moveGroupItem(int fromGroupPosition, int toGroupPosition);
    public abstract void moveChildItem(int fromGroupPosition, int fromChildPosition, int toGroupPosition, int toChildPosition);

    public abstract void removeGroupItem(int groupPosition);
    public abstract void removeChildItem(int groupPosition, int childPosition);

    public abstract long undoLastRemoval();
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <TITLE>Generic Image Library: Member List</TITLE>
    <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
    <LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/>

Modules
                  | Alphabetical List
                  | Class List
                  | Directories
                  | File List
                  | GIL Home Page

tiff_read_support Member List
This is the complete list of members for tiff_read_support, including all inherited members.

BOOST_STATIC_CONSTANT(bool, is_supported=(detail::tiff_read_support_private< typename channel_type< View >::type, typename color_space_type< View >::type >::is_supported)) (defined in tiff_read_support)	tiff_read_support

BOOST_STATIC_CONSTANT(int, bit_depth=(detail::tiff_read_support_private< typename channel_type< View >::type, typename color_space_type< View >::type >::bit_depth)) (defined in tiff_read_support)	tiff_read_support

BOOST_STATIC_CONSTANT(int, color_type=(detail::tiff_read_support_private< typename channel_type< View >::type, typename color_space_type< View >::type >::color_type)) (defined in tiff_read_support)	tiff_read_support

<address style="text-align: right;">Generated on Sat May 2 13:50:18 2009 for Generic Image Library by

 1.5.6 </address>


text:
package com.github.tx.archetype.modules.sys.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name = "sys_resource")
public class Resource extends IdEntity {

	@Column(name = "resource_name")
	private String resourceName;

	private String description;

	private String href;

	private Integer sort;

	private Integer type;

	@ManyToMany(mappedBy = "resources")
	private Set<Role> roles = new HashSet<>();// 对应角色列表

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	private Resource parent;// 父资源

	@OneToMany(mappedBy = "parent", cascade = { CascadeType.REMOVE })//级联删除子资源
	private Set<Resource> children = new HashSet<>();// 子资源列表

	public String getResourceName() {
		return resourceName;
	}

	public void setResourceName(String resourceName) {
		this.resourceName = resourceName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getHref() {
		return href;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public Resource getParent() {
		return parent;
	}

	public void setParent(Resource parent) {
		this.parent = parent;
	}

	public Set<Resource> getChildren() {
		return children;
	}

	public void setChildren(Set<Resource> children) {
		this.children = children;
	}

}


text:
$ErrorActionPreference = 'Stop'

npm run build
# Change this to "yarn pack" once #1114 is fixed
npm pack
if (Test-Path dist) {
  rm dist -Recurse
}
mkdir dist
mv yarn-*.tgz dist/pack.tgz

cd dist
tar -xzf pack.tgz --strip 1
rm pack.tgz
# Change this to "yarn install --production" once #1115 is fixed
npm install --production
rm node_modules/*/test -Recurse
rm node_modules/*/dist -Recurse
cd ..


text:
<?php

/**
 * Sets a value
 *
 * @phpstub
 *
 * @param resource $pxdoc
 * @param string $name
 * @param float $value
 *
 * @return bool
 */
function px_set_value($pxdoc, $name, $value)
{
}