text:
/***

MochiKit.Async 1.4

See <http://mochikit.com/> for documentation, downloads, license, etc.

(c) 2005 Bob Ippolito.  All rights Reserved.

***/

if (typeof(dojo) != 'undefined') {
    dojo.provide("MochiKit.Async");
    dojo.require("MochiKit.Base");
}
if (typeof(JSAN) != 'undefined') {
    JSAN.use("MochiKit.Base", []);
}

try {
    if (typeof(MochiKit.Base) == 'undefined') {
        throw "";
    }
} catch (e) {
    throw "MochiKit.Async depends on MochiKit.Base!";
}

if (typeof(MochiKit.Async) == 'undefined') {
    MochiKit.Async = {};
}

MochiKit.Async.NAME = "MochiKit.Async";
MochiKit.Async.VERSION = "1.4";
MochiKit.Async.__repr__ = function () {
    return "[" + this.NAME + " " + this.VERSION + "]";
};
MochiKit.Async.toString = function () {
    return this.__repr__();
};

/** @id MochiKit.Async.Deferred */
MochiKit.Async.Deferred = function (/* optional */ canceller) {
    this.chain = [];
    this.id = this._nextId();
    this.fired = -1;
    this.paused = 0;
    this.results = [null, null];
    this.canceller = canceller;
    this.silentlyCancelled = false;
    this.chained = false;
};

MochiKit.Async.Deferred.prototype = {
    /** @id MochiKit.Async.Deferred.prototype.repr */
    repr: function () {
        var state;
        if (this.fired == -1) {
            state = 'unfired';
        } else if (this.fired === 0) {
            state = 'success';
        } else {
            state = 'error';
        }
        return 'Deferred(' + this.id + ', ' + state + ')';
    },

    toString: MochiKit.Base.forwardCall("repr"),

    _nextId: MochiKit.Base.counter(),

    /** @id MochiKit.Async.Deferred.prototype.cancel */
    cancel: function () {
        var self = MochiKit.Async;
        if (this.fired == -1) {
            if (this.canceller) {
                this.canceller(this);
            } else {
                this.silentlyCancelled = true;
            }
            if (this.fired == -1) {
                this.errback(new self.CancelledError(this));
            }
        } else if ((this.fired === 0) && (this.results[0] instanceof self.Deferred)) {
            this.results[0].cancel();
        }
    },

    _resback: function (res) {
        /***

        The primitive that means either callback or errback

        ***/
        this.fired = ((res instanceof Error) ? 1 : 0);
        this.results[this.fired] = res;
        this._fire();
    },

    _check: function () {
        if (this.fired != -1) {
            if (!this.silentlyCancelled) {
                throw new MochiKit.Async.AlreadyCalledError(this);
            }
            this.silentlyCancelled = false;
            return;
        }
    },

    /** @id MochiKit.Async.Deferred.prototype.callback */
    callback: function (res) {
        this._check();
        if (res instanceof MochiKit.Async.Deferred) {
            throw new Error("Deferred instances can only be chained if they are the result of a callback");
        }
        this._resback(res);
    },

    /** @id MochiKit.Async.Deferred.prototype.errback */
    errback: function (res) {
        this._check();
        var self = MochiKit.Async;
        if (res instanceof self.Deferred) {
            throw new Error("Deferred instances can only be chained if they are the result of a callback");
        }
        if (!(res instanceof Error)) {
            res = new self.GenericError(res);
        }
        this._resback(res);
    },

    /** @id MochiKit.Async.Deferred.prototype.addBoth */
    addBoth: function (fn) {
        if (arguments.length > 1) {
            fn = MochiKit.Base.partial.apply(null, arguments);
        }
        return this.addCallbacks(fn, fn);
    },

    /** @id MochiKit.Async.Deferred.prototype.addCallback */
    addCallback: function (fn) {
        if (arguments.length > 1) {
            fn = MochiKit.Base.partial.apply(null, arguments);
        }
        return this.addCallbacks(fn, null);
    },

    /** @id MochiKit.Async.Deferred.prototype.addErrback */
    addErrback: function (fn) {
        if (arguments.length > 1) {
            fn = MochiKit.Base.partial.apply(null, arguments);
        }
        return this.addCallbacks(null, fn);
    },

    /** @id MochiKit.Async.Deferred.prototype.addCallbacks */
    addCallbacks: function (cb, eb) {
        if (this.chained) {
            throw new Error("Chained Deferreds can not be re-used");
        }
        this.chain.push([cb, eb]);
        if (this.fired >= 0) {
            this._fire();
        }
        return this;
    },

    _fire: function () {
        /***

        Used internally to exhaust the callback sequence when a result
        is available.

        ***/
        var chain = this.chain;
        var fired = this.fired;
        var res = this.results[fired];
        var self = this;
        var cb = null;
        while (chain.length > 0 && this.paused === 0) {
            // Array
            var pair = chain.shift();
            var f = pair[fired];
            if (f === null) {
                continue;
            }
            try {
                res = f(res);
                fired = ((res instanceof Error) ? 1 : 0);
                if (res instanceof MochiKit.Async.Deferred) {
                    cb = function (res) {
                        self._resback(res);
                        self.paused--;
                        if ((self.paused === 0) && (self.fired >= 0)) {
                            self._fire();
                        }
                    };
                    this.paused++;
                }
            } catch (err) {
                fired = 1;
                if (!(err instanceof Error)) {
                    err = new MochiKit.Async.GenericError(err);
                }
                res = err;
            }
        }
        this.fired = fired;
        this.results[fired] = res;
        if (cb && this.paused) {
            // this is for "tail recursion" in case the dependent deferred
            // is already fired
            res.addBoth(cb);
            res.chained = true;
        }
    }
};

MochiKit.Base.update(MochiKit.Async, {
    /** @id MochiKit.Async.evalJSONRequest */
    evalJSONRequest: function (/* req */) {
        return eval('(' + arguments[0].responseText + ')');
    },

    /** @id MochiKit.Async.succeed */
    succeed: function (/* optional */result) {
        var d = new MochiKit.Async.Deferred();
        d.callback.apply(d, arguments);
        return d;
    },

    /** @id MochiKit.Async.fail */
    fail: function (/* optional */result) {
        var d = new MochiKit.Async.Deferred();
        d.errback.apply(d, arguments);
        return d;
    },

    /** @id MochiKit.Async.getXMLHttpRequest */
    getXMLHttpRequest: function () {
        var self = arguments.callee;
        if (!self.XMLHttpRequest) {
            var tryThese = [
                function () { return new XMLHttpRequest(); },
                function () { return new ActiveXObject('Msxml2.XMLHTTP'); },
                function () { return new ActiveXObject('Microsoft.XMLHTTP'); },
                function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); },
                function () {
                    throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest");
                }
            ];
            for (var i = 0; i < tryThese.length; i++) {
                var func = tryThese[i];
                try {
                    self.XMLHttpRequest = func;
                    return func();
                } catch (e) {
                    // pass
                }
            }
        }
        return self.XMLHttpRequest();
    },

    _xhr_onreadystatechange: function (d) {
        // MochiKit.Logging.logDebug('this.readyState', this.readyState);
        var m = MochiKit.Base;
        if (this.readyState == 4) {
            // IE SUCKS
            try {
                this.onreadystatechange = null;
            } catch (e) {
                try {
                    this.onreadystatechange = m.noop;
                } catch (e) {
                }
            }
            var status = null;
            try {
                status = this.status;
                if (!status && m.isNotEmpty(this.responseText)) {
                    // 0 or undefined seems to mean cached or local
                    status = 304;
                }
            } catch (e) {
                // pass
                // MochiKit.Logging.logDebug('error getting status?', repr(items(e)));
            }
            // 200 is OK, 201 is CREATED, 204 is NO CONTENT
            // 304 is NOT MODIFIED, 1223 is apparently a bug in IE
            if (status == 200 || status == 201 || status == 204 ||
                    status == 304 || status == 1223) {
                d.callback(this);
            } else {
                var err = new MochiKit.Async.XMLHttpRequestError(this, "Request failed");
                if (err.number) {
                    // XXX: This seems to happen on page change
                    d.errback(err);
                } else {
                    // XXX: this seems to happen when the server is unreachable
                    d.errback(err);
                }
            }
        }
    },

    _xhr_canceller: function (req) {
        // IE SUCKS
        try {
            req.onreadystatechange = null;
        } catch (e) {
            try {
                req.onreadystatechange = MochiKit.Base.noop;
            } catch (e) {
            }
        }
        req.abort();
    },

    /** @id MochiKit.Async.sendXMLHttpRequest */
    sendXMLHttpRequest: function (req, /* optional */ sendContent) {
        if (typeof(sendContent) == "undefined" || sendContent === null) {
            sendContent = "";
        }

        var m = MochiKit.Base;
        var self = MochiKit.Async;
        var d = new self.Deferred(m.partial(self._xhr_canceller, req));

        try {
            req.onreadystatechange = m.bind(self._xhr_onreadystatechange,
                req, d);
            req.send(sendContent);
        } catch (e) {
            try {
                req.onreadystatechange = null;
            } catch (ignore) {
                // pass
            }
            d.errback(e);
        }

        return d;

    },

    /** @id MochiKit.Async.doXHR */
    doXHR: function (url, opts) {
        var m = MochiKit.Base;
        opts = m.update({
            method: 'GET',
            sendContent: ''
            /*
            queryString: undefined,
            username: undefined,
            password: undefined,
            headers: undefined,
            mimeType: undefined
            */
        }, opts);
        var self = MochiKit.Async;
        var req = self.getXMLHttpRequest();
        if (opts.queryString) {
            var qs = m.queryString(opts.queryString);
            if (qs) {
                url += "?" + qs;
            }
        }
        // Safari will send undefined:undefined, so we have to check.
        // We can't use apply, since the function is native.
        if ('username' in opts) {
            req.open(opts.method, url, true, opts.username, opts.password);
        } else {
            req.open(opts.method, url, true);
        }
        if (req.overrideMimeType && opts.mimeType) {
            req.overrideMimeType(opts.mimeType);
        }
        if (opts.headers) {
            var headers = opts.headers;
            if (!m.isArrayLike(headers)) {
                headers = m.items(headers);
            }
            for (var i = 0; i < headers.length; i++) {
                var header = headers[i];
                var name = header[0];
                var value = header[1];
                req.setRequestHeader(name, value);
            }
        }
        return self.sendXMLHttpRequest(req, opts.sendContent);
    },

    _buildURL: function (url/*, ...*/) {
        if (arguments.length > 1) {
            var m = MochiKit.Base;
            var qs = m.queryString.apply(null, m.extend(null, arguments, 1));
            if (qs) {
                return url + "?" + qs;
            }
        }
        return url;
    },

    /** @id MochiKit.Async.doSimpleXMLHttpRequest */
    doSimpleXMLHttpRequest: function (url/*, ...*/) {
        var self = MochiKit.Async;
        url = self._buildURL.apply(self, arguments);
        return self.doXHR(url);
    },

    /** @id MochiKit.Async.loadJSONDoc */
    loadJSONDoc: function (url/*, ...*/) {
        var self = MochiKit.Async;
        url = self._buildURL.apply(self, arguments);
        var d = self.doXHR(url, {
            'mimeType': 'text/plain',
            'headers': [['Accept', 'application/json']]
        });
        d = d.addCallback(self.evalJSONRequest);
        return d;
    },

    /** @id MochiKit.Async.wait */
    wait: function (seconds, /* optional */value) {
        var d = new MochiKit.Async.Deferred();
        var m = MochiKit.Base;
        if (typeof(value) != 'undefined') {
            d.addCallback(function () { return value; });
        }
        var timeout = setTimeout(
            m.bind("callback", d),
            Math.floor(seconds * 1000));
        d.canceller = function () {
            try {
                clearTimeout(timeout);
            } catch (e) {
                // pass
            }
        };
        return d;
    },

    /** @id MochiKit.Async.callLater */
    callLater: function (seconds, func) {
        var m = MochiKit.Base;
        var pfunc = m.partial.apply(m, m.extend(null, arguments, 1));
        return MochiKit.Async.wait(seconds).addCallback(
            function (res) { return pfunc(); }
        );
    }
});

/** @id MochiKit.Async.DeferredLock */
MochiKit.Async.DeferredLock = function () {
    this.waiting = [];
    this.locked = false;
    this.id = this._nextId();
};

MochiKit.Async.DeferredLock.prototype = {
    __class__: MochiKit.Async.DeferredLock,
    /** @id MochiKit.Async.DeferredLock.prototype.acquire */
    acquire: function () {
        var d = new MochiKit.Async.Deferred();
        if (this.locked) {
            this.waiting.push(d);
        } else {
            this.locked = true;
            d.callback(this);
        }
        return d;
    },
    /** @id MochiKit.Async.DeferredLock.prototype.release */
    release: function () {
        if (!this.locked) {
            throw TypeError("Tried to release an unlocked DeferredLock");
        }
        this.locked = false;
        if (this.waiting.length > 0) {
            this.locked = true;
            this.waiting.shift().callback(this);
        }
    },
    _nextId: MochiKit.Base.counter(),
    repr: function () {
        var state;
        if (this.locked) {
            state = 'locked, ' + this.waiting.length + ' waiting';
        } else {
            state = 'unlocked';
        }
        return 'DeferredLock(' + this.id + ', ' + state + ')';
    },
    toString: MochiKit.Base.forwardCall("repr")

};

/** @id MochiKit.Async.DeferredList */
MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) {

    // call parent constructor
    MochiKit.Async.Deferred.apply(this, [canceller]);

    this.list = list;
    var resultList = [];
    this.resultList = resultList;

    this.finishedCount = 0;
    this.fireOnOneCallback = fireOnOneCallback;
    this.fireOnOneErrback = fireOnOneErrback;
    this.consumeErrors = consumeErrors;

    var cb = MochiKit.Base.bind(this._cbDeferred, this);
    for (var i = 0; i < list.length; i++) {
        var d = list[i];
        resultList.push(undefined);
        d.addCallback(cb, i, true);
        d.addErrback(cb, i, false);
    }

    if (list.length === 0 && !fireOnOneCallback) {
        this.callback(this.resultList);
    }

};

MochiKit.Async.DeferredList.prototype = new MochiKit.Async.Deferred();

MochiKit.Async.DeferredList.prototype._cbDeferred = function (index, succeeded, result) {
    this.resultList[index] = [succeeded, result];
    this.finishedCount += 1;
    if (this.fired == -1) {
        if (succeeded && this.fireOnOneCallback) {
            this.callback([index, result]);
        } else if (!succeeded && this.fireOnOneErrback) {
            this.errback(result);
        } else if (this.finishedCount == this.list.length) {
            this.callback(this.resultList);
        }
    }
    if (!succeeded && this.consumeErrors) {
        result = null;
    }
    return result;
};

/** @id MochiKit.Async.gatherResults */
MochiKit.Async.gatherResults = function (deferredList) {
    var d = new MochiKit.Async.DeferredList(deferredList, false, true, false);
    d.addCallback(function (results) {
        var ret = [];
        for (var i = 0; i < results.length; i++) {
            ret.push(results[i][1]);
        }
        return ret;
    });
    return d;
};

/** @id MochiKit.Async.maybeDeferred */
MochiKit.Async.maybeDeferred = function (func) {
    var self = MochiKit.Async;
    var result;
    try {
        var r = func.apply(null, MochiKit.Base.extend([], arguments, 1));
        if (r instanceof self.Deferred) {
            result = r;
        } else if (r instanceof Error) {
            result = self.fail(r);
        } else {
            result = self.succeed(r);
        }
    } catch (e) {
        result = self.fail(e);
    }
    return result;
};

MochiKit.Async.EXPORT = [
    "AlreadyCalledError",
    "CancelledError",
    "BrowserComplianceError",
    "GenericError",
    "XMLHttpRequestError",
    "Deferred",
    "succeed",
    "fail",
    "getXMLHttpRequest",
    "doSimpleXMLHttpRequest",
    "loadJSONDoc",
    "wait",
    "callLater",
    "sendXMLHttpRequest",
    "DeferredLock",
    "DeferredList",
    "gatherResults",
    "maybeDeferred",
    "doXHR"
];

MochiKit.Async.EXPORT_OK = [
    "evalJSONRequest"
];

MochiKit.Async.__new__ = function () {
    var m = MochiKit.Base;
    var ne = m.partial(m._newNamedError, this);

    ne("AlreadyCalledError",
        /** @id MochiKit.Async.AlreadyCalledError */
        function (deferred) {
            /***

            Raised by the Deferred if callback or errback happens
            after it was already fired.

            ***/
            this.deferred = deferred;
        }
    );

    ne("CancelledError",
        /** @id MochiKit.Async.CancelledError */
        function (deferred) {
            /***

            Raised by the Deferred cancellation mechanism.

            ***/
            this.deferred = deferred;
        }
    );

    ne("BrowserComplianceError",
        /** @id MochiKit.Async.BrowserComplianceError */
        function (msg) {
            /***

            Raised when the JavaScript runtime is not capable of performing
            the given function.  Technically, this should really never be
            raised because a non-conforming JavaScript runtime probably
            isn't going to support exceptions in the first place.

            ***/
            this.message = msg;
        }
    );

    ne("GenericError",
        /** @id MochiKit.Async.GenericError */
        function (msg) {
            this.message = msg;
        }
    );

    ne("XMLHttpRequestError",
        /** @id MochiKit.Async.XMLHttpRequestError */
        function (req, msg) {
            /***

            Raised when an XMLHttpRequest does not complete for any reason.

            ***/
            this.req = req;
            this.message = msg;
            try {
                // Strange but true that this can raise in some cases.
                this.number = req.status;
            } catch (e) {
                // pass
            }
        }
    );

    this.EXPORT_TAGS = {
        ":common": this.EXPORT,
        ":all": m.concat(this.EXPORT, this.EXPORT_OK)
    };

    m.nameFunctions(this);

};

MochiKit.Async.__new__();

MochiKit.Base._exportSymbols(this, MochiKit.Async);


text:
public class User {

  public static void test() { new Test(1, 2); }

}

redpajama_set_name: RedPajamaGithub


text:
package com.jetheis.android.grades.test;

import android.content.Context;
import android.test.AndroidTestCase;
import android.test.RenamingDelegatingContext;

import com.jetheis.android.grades.model.Course;
import com.jetheis.android.grades.model.Course.CourseType;
import com.jetheis.android.grades.model.PercentageGradeComponent;
import com.jetheis.android.grades.model.PointTotalGradeComponent;
import com.jetheis.android.grades.storage.CourseStorageAdapter;
import com.jetheis.android.grades.storage.DatabaseHelper;

public class CourseStorageTest extends AndroidTestCase {

    private Context mSandboxedContext;

    protected void setUp() throws Exception {
        super.setUp();

        if (mSandboxedContext == null) {
            mSandboxedContext = new RenamingDelegatingContext(getContext(), "course_storage_test-");
            DatabaseHelper.initializeDatabaseHelper(mSandboxedContext);
        }
    }

    public void testTotalDeletion() {
        Course course = new Course();
        course.setName("testTotalDeletion");
        course.setCourseType(CourseType.POINT_TOTAL);
        course.save();

        new CourseStorageAdapter().deleteAllCourses();

        assertEquals(0, Course.getAllCourses().size());
    }

    public void testSimpleSaveExistance() {
        Course course = new Course();
        course.setName("testSimpleSave");
        course.setCourseType(CourseType.POINT_TOTAL);
        course.save();

        assertEquals(1, Course.getAllCourses().size());
    }

    public void testSaveIdentifierPopulation() {
        Course course1 = new Course();
        course1.setName("testSaveIdentifierPopulation1");
        course1.setCourseType(CourseType.POINT_TOTAL);
        course1.save();

        assertTrue(course1.getId() > 0);

        Course course2 = new Course();
        course2.setName("testSaveIdentifierPopulation2");
        course2.setCourseType(CourseType.POINT_TOTAL);
        course2.save();

        assertEquals(course1.getId() + 1, course2.getId());
    }

    public void testSaveAndRetrieve() {
        Course course = new Course();
        course.setName("testSaveAndRetrieve");
        course.setCourseType(CourseType.POINT_TOTAL);
        course.save();

        assertEquals(course, new CourseStorageAdapter().getCourseById(course.getId()));
    }

    public void testUpdate() {
        Course course = new Course();
        course.setName("testUpdate");
        course.setCourseType(CourseType.POINT_TOTAL);
        course.save();

        long oldId = course.getId();

        course.setName("changed");
        course.save();

        assertEquals(oldId, course.getId());
        assertEquals(course, new CourseStorageAdapter().getCourseById(course.getId()));
    }

    public void testRetrievalFromGradeComponent() {
        Course rh131 = ObjectMother.rh131();
        PointTotalGradeComponent pointTotalExams = ObjectMother.pointTotalExams();

        rh131.save();
        pointTotalExams.setCourseId(rh131.getId());
        pointTotalExams.loadConnectedObjects();

        assertEquals(rh131, pointTotalExams.getCourse());

        Course csse230 = ObjectMother.csse230();
        PercentageGradeComponent percentageExams = ObjectMother.percentageExams();

        csse230.save();
        percentageExams.setCourseId(csse230.getId());
        percentageExams.loadConnectedObjects();

        assertEquals(csse230, percentageExams.getCourse());
    }

    public void testDestroy() {
        Course rh131 = ObjectMother.rh131();
        rh131.save();

        Course csse230 = ObjectMother.csse230();
        csse230.save();

        assertEquals(2, Course.getAllCourses().size());

        rh131.destroy();
        assertEquals(1, Course.getAllCourses().size());

        csse230.destroy();
        assertEquals(0, Course.getAllCourses().size());
    }

    public void testAlphabetizingAllCourseResults() {
        Course rh131 = ObjectMother.rh131();
        rh131.save();

        Course csse230 = ObjectMother.csse230();
        csse230.save();

        assertEquals(csse230, Course.getAllCourses().get(0));

        rh131.setName("AAAAA");
        rh131.save();

        assertEquals(rh131, Course.getAllCourses().get(0));
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();

        new CourseStorageAdapter().deleteAllCourses();
    }

}


text:
#pragma once
#include <aws/elasticbeanstalk/ElasticBeanstalk_EXPORTS.h>
#include <aws/elasticbeanstalk/ElasticBeanstalkRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace ElasticBeanstalk
{
namespace Model
{

  /**
   *
Result message containing all of the configuration settings for a specified
   * solution stack or configuration template.

See Also:
   AWS
   * API Reference

   */
  class AWS_ELASTICBEANSTALK_API DescribeConfigurationSettingsRequest : public ElasticBeanstalkRequest
  {
  public:
    DescribeConfigurationSettingsRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DescribeConfigurationSettings"; }

    Aws::String SerializePayload() const override;

  protected:
    void DumpBodyToUrl(Aws::Http::URI& uri ) const override;

  public:

    /**
     *
The application for the environment or configuration template.

     */
    inline const Aws::String& GetApplicationName() const{ return m_applicationName; }

    /**
     *
The application for the environment or configuration template.

     */
    inline void SetApplicationName(const Aws::String& value) { m_applicationNameHasBeenSet = true; m_applicationName = value; }

    /**
     *
The application for the environment or configuration template.

     */
    inline void SetApplicationName(Aws::String&& value) { m_applicationNameHasBeenSet = true; m_applicationName = std::move(value); }

    /**
     *
The application for the environment or configuration template.

     */
    inline void SetApplicationName(const char* value) { m_applicationNameHasBeenSet = true; m_applicationName.assign(value); }

    /**
     *
The application for the environment or configuration template.

     */
    inline DescribeConfigurationSettingsRequest& WithApplicationName(const Aws::String& value) { SetApplicationName(value); return *this;}

    /**
     *
The application for the environment or configuration template.

     */
    inline DescribeConfigurationSettingsRequest& WithApplicationName(Aws::String&& value) { SetApplicationName(std::move(value)); return *this;}

    /**
     *
The application for the environment or configuration template.

     */
    inline DescribeConfigurationSettingsRequest& WithApplicationName(const char* value) { SetApplicationName(value); return *this;}

    /**
     *
The name of the configuration template to describe.

 Conditional: You
     * must specify either this parameter or an EnvironmentName, but not both. If you
     * specify both, AWS Elastic Beanstalk returns an
     * InvalidParameterCombination error. If you do not specify either,
     * AWS Elastic Beanstalk returns a MissingRequiredParameter error.
     *

     */
    inline const Aws::String& GetTemplateName() const{ return m_templateName; }

    /**
     *
The name of the configuration template to describe.

 Conditional: You
     * must specify either this parameter or an EnvironmentName, but not both. If you
     * specify both, AWS Elastic Beanstalk returns an
     * InvalidParameterCombination error. If you do not specify either,
     * AWS Elastic Beanstalk returns a MissingRequiredParameter error.
     *

     */
    inline void SetTemplateName(const Aws::String& value) { m_templateNameHasBeenSet = true; m_templateName = value; }

    /**
     *
The name of the configuration template to describe.

 Conditional: You
     * must specify either this parameter or an EnvironmentName, but not both. If you
     * specify both, AWS Elastic Beanstalk returns an
     * InvalidParameterCombination error. If you do not specify either,
     * AWS Elastic Beanstalk returns a MissingRequiredParameter error.
     *

     */
    inline void SetTemplateName(Aws::String&& value) { m_templateNameHasBeenSet = true; m_templateName = std::move(value); }

    /**
     *
The name of the configuration template to describe.

 Conditional: You
     * must specify either this parameter or an EnvironmentName, but not both. If you
     * specify both, AWS Elastic Beanstalk returns an
     * InvalidParameterCombination error. If you do not specify either,
     * AWS Elastic Beanstalk returns a MissingRequiredParameter error.
     *

     */
    inline void SetTemplateName(const char* value) { m_templateNameHasBeenSet = true; m_templateName.assign(value); }

    /**
     *
The name of the configuration template to describe.

 Conditional: You
     * must specify either this parameter or an EnvironmentName, but not both. If you
     * specify both, AWS Elastic Beanstalk returns an
     * InvalidParameterCombination error. If you do not specify either,
     * AWS Elastic Beanstalk returns a MissingRequiredParameter error.
     *

     */
    inline DescribeConfigurationSettingsRequest& WithTemplateName(const Aws::String& value) { SetTemplateName(value); return *this;}

    /**
     *
The name of the configuration template to describe.

 Conditional: You
     * must specify either this parameter or an EnvironmentName, but not both. If you
     * specify both, AWS Elastic Beanstalk returns an
     * InvalidParameterCombination error. If you do not specify either,
     * AWS Elastic Beanstalk returns a MissingRequiredParameter error.
     *

     */
    inline DescribeConfigurationSettingsRequest& WithTemplateName(Aws::String&& value) { SetTemplateName(std::move(value)); return *this;}

    /**
     *
The name of the configuration template to describe.

 Conditional: You
     * must specify either this parameter or an EnvironmentName, but not both. If you
     * specify both, AWS Elastic Beanstalk returns an
     * InvalidParameterCombination error. If you do not specify either,
     * AWS Elastic Beanstalk returns a MissingRequiredParameter error.
     *

     */
    inline DescribeConfigurationSettingsRequest& WithTemplateName(const char* value) { SetTemplateName(value); return *this;}

    /**
     *
The name of the environment to describe.

 Condition: You must specify
     * either this or a TemplateName, but not both. If you specify both, AWS Elastic
     * Beanstalk returns an InvalidParameterCombination error. If you do
     * not specify either, AWS Elastic Beanstalk returns
     * MissingRequiredParameter error.

     */
    inline const Aws::String& GetEnvironmentName() const{ return m_environmentName; }

    /**
     *
The name of the environment to describe.

 Condition: You must specify
     * either this or a TemplateName, but not both. If you specify both, AWS Elastic
     * Beanstalk returns an InvalidParameterCombination error. If you do
     * not specify either, AWS Elastic Beanstalk returns
     * MissingRequiredParameter error.

     */
    inline void SetEnvironmentName(const Aws::String& value) { m_environmentNameHasBeenSet = true; m_environmentName = value; }

    /**
     *
The name of the environment to describe.

 Condition: You must specify
     * either this or a TemplateName, but not both. If you specify both, AWS Elastic
     * Beanstalk returns an InvalidParameterCombination error. If you do
     * not specify either, AWS Elastic Beanstalk returns
     * MissingRequiredParameter error.

     */
    inline void SetEnvironmentName(Aws::String&& value) { m_environmentNameHasBeenSet = true; m_environmentName = std::move(value); }

    /**
     *
The name of the environment to describe.

 Condition: You must specify
     * either this or a TemplateName, but not both. If you specify both, AWS Elastic
     * Beanstalk returns an InvalidParameterCombination error. If you do
     * not specify either, AWS Elastic Beanstalk returns
     * MissingRequiredParameter error.

     */
    inline void SetEnvironmentName(const char* value) { m_environmentNameHasBeenSet = true; m_environmentName.assign(value); }

    /**
     *
The name of the environment to describe.

 Condition: You must specify
     * either this or a TemplateName, but not both. If you specify both, AWS Elastic
     * Beanstalk returns an InvalidParameterCombination error. If you do
     * not specify either, AWS Elastic Beanstalk returns
     * MissingRequiredParameter error.

     */
    inline DescribeConfigurationSettingsRequest& WithEnvironmentName(const Aws::String& value) { SetEnvironmentName(value); return *this;}

    /**
     *
The name of the environment to describe.

 Condition: You must specify
     * either this or a TemplateName, but not both. If you specify both, AWS Elastic
     * Beanstalk returns an InvalidParameterCombination error. If you do
     * not specify either, AWS Elastic Beanstalk returns
     * MissingRequiredParameter error.

     */
    inline DescribeConfigurationSettingsRequest& WithEnvironmentName(Aws::String&& value) { SetEnvironmentName(std::move(value)); return *this;}

    /**
     *
The name of the environment to describe.

 Condition: You must specify
     * either this or a TemplateName, but not both. If you specify both, AWS Elastic
     * Beanstalk returns an InvalidParameterCombination error. If you do
     * not specify either, AWS Elastic Beanstalk returns
     * MissingRequiredParameter error.

     */
    inline DescribeConfigurationSettingsRequest& WithEnvironmentName(const char* value) { SetEnvironmentName(value); return *this;}

  private:

    Aws::String m_applicationName;
    bool m_applicationNameHasBeenSet;

    Aws::String m_templateName;
    bool m_templateNameHasBeenSet;

    Aws::String m_environmentName;
    bool m_environmentNameHasBeenSet;
  };

} // namespace Model
} // namespace ElasticBeanstalk
} // namespace Aws


text:
No More Referrer is a Chrome Extension that disable referrer.

## Download
[No More Referrer - Chrome Web Store](https://chrome.google.com/webstore/detail/no-more-referrer/pnieocdcmbkplilpaihcajgeglmggego)

## Change Log
See [CHANGELOG.md](https://github.com/noraworld/no-more-referrer/blob/master/CHANGELOG.md).

## Notice
Some sites check referrer, and you may not see these sites correctly, e.g. [github.com/new](https://github.com/new). Add these sites as excluded URLs at options page to bypass any trouble.

## Usage for developers

```bash
# if you have not installed gulp on global environment yet
$ npm install gulp -g
```

```bash
$ npm install
$ gulp
```

Then, load this extension from **chrome://extensions**.

## License
All codes of this repository except library file are available under the MIT license. See the [LICENSE](https://github.com/noraworld/no-more-referrer/blob/master/LICENSE) for more information.


text:
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ToolsUtilities;

namespace GameJsonCommunicationPlugin.Common
{
    internal class GameConnectionManager : IDisposable
    {
        #region private
        private Object _lock = new Object();
        private ConcurrentQueue<Packet> _sendItems = new ConcurrentQueue<Packet>();
        private ConcurrentDictionary<Guid, WaitingPacket> _waitingPackets = new ConcurrentDictionary<Guid, WaitingPacket>();
        private Action<string, string> _eventCaller;
        private IPAddress _addr;
        private Socket _listener = null;
        private Socket _client = null;
        private bool _isListening = false;

        private bool _isConnected = false;
        private bool IsConnected
        {
            get
            {
                return _isConnected;
            }

            set
            {
                _isConnected = value;

                if(_isConnected)
                    _eventCaller("GameCommunication_Connected", "");
                else
                    _eventCaller("GameCommunication_Disconnected", "");
            }
        }
        private CancellationTokenSource _periodicCheckTaskCancellationToken;

        #endregion

        #region properties
        private bool _doConnections = true;
        public bool DoConnections
        {
            get
            {
                return _doConnections;
            }
            set
            {
                _doConnections = value;
                if (!_doConnections)
                {
                    _listener?.Dispose();
                    _client?.Dispose();
                }
            }
        }

        private int _port;
        public int Port
        {
            get
            {
                return _port;
            }
            set
            {
                if(_port != value)
                {
                    _port = value;
                    _listener?.Dispose();
                    _client?.Dispose();
                }

            }
        }
        private IPEndPoint EndPoint
        {
            get
            {
                return new IPEndPoint(_addr, Port);
            }
        }

        public double TimeoutInSeconds { get; set; } = 10;
        #endregion

        public GameConnectionManager(Action<string, string> eventCaller)
        {
            _eventCaller = eventCaller;
            _addr = IPAddress.Loopback;
            StartListening();
            _periodicCheckTaskCancellationToken = new CancellationTokenSource();
            Task task = StatusCheckTask(_periodicCheckTaskCancellationToken.Token);
        }

        #region privateMethods

        private void StartListening()
        {
            if (!_isListening)
            {
                lock (_lock)
                {
                    Debug.WriteLine("Entering StartListening()");

                    if (_listener != null)
                        _listener.Dispose();

                    if (_client != null)
                    {
                        _client.Dispose();
                        _client = null;
                    }

                    if (_doConnections)
                    {
                        _isListening = true;

                        Task.Run(() =>
                        {
                            try
                            {
                                _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                                _listener.Bind(EndPoint);
                                _listener.Listen(1);

                                Debug.WriteLine($"Listening on port {Port}");

                                EstablishConnection(_listener.Accept());
                                _listener.Dispose();
                                _listener = null;
                            }
                            catch (Exception ex)
                            {
                                Debug.WriteLine($"Listening Error: {ex}");
                            }
                            finally
                            {
                                lock (_lock)
                                {
                                    _isListening = false;
                                }
                            }
                        });
                    }
                }
            }
        }

        private void EstablishConnection(Socket socket)
        {
            Debug.WriteLine("Connected");

            _client = socket;
            _sendItems.Clear();
            _waitingPackets.Clear();

            IsConnected = true;

            _eventCaller("GameCommunication_Connected", "");

            Task.Run(() =>
            {
                try
                {
                    while (IsConnected)
                    {
                        byte[] bufferSize = new byte[sizeof(long)];
                        _client.Receive(bufferSize);
                        var packetSize = BitConverter.ToInt64(bufferSize, 0);

                        using (MemoryStream stream = new MemoryStream())
                        {
                            var remainingBytes = packetSize;
                            while (remainingBytes > 0)
                            {
                                var pullSize = remainingBytes > 1024 ? 1024 : remainingBytes;
                                byte[] bufferData = new byte[pullSize];
                                _client.Receive(bufferData);
                                stream.Write(bufferData, 0, bufferData.Length);
                                remainingBytes -= pullSize;
                            }

                            var payload = Encoding.ASCII.GetString(stream.ToArray());

                            if (OnPacketReceived != null)
                            {
                                var packet = JsonConvert.DeserializeObject<Packet>(payload);

                                if (packet != null)
                                {
                                    if(packet.InResponseTo.HasValue && _waitingPackets.TryGetValue(packet.InResponseTo.Value, out var waitingPacket))
                                    {
                                        waitingPacket.ReceivedPacket = packet;
                                    }
                                    else
                                    {
                                        OnPacketReceived(new PacketReceivedArgs
                                        {
                                            Packet = packet
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine($"Client Connection Failed: {ex}");
                }
                finally { IsConnected = false; }
            });

            Task.Run(() =>
            {
                try
                {
                    while (IsConnected)
                    {
                        if (_sendItems.TryDequeue(out var item))
                        {
                            try
                            {
                                var packet = JsonConvert.SerializeObject(item);
                                var sendBytes = Encoding.ASCII.GetBytes(packet);
                                long size = sendBytes.LongLength;

                                //Send size
                                _client.Send(BitConverter.GetBytes(size));

                                //Send payload
                                _client.Send(sendBytes);
                            }
                            catch
                            {
                                Debug.WriteLine($"Removing Wait Id: {item.Id} due to error");
                                _waitingPackets.TryRemove(item.Id, out var tempValue);
                                throw;
                            }
                        }
                        else
                        {
                            Thread.Sleep(10);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.Write($"Client Connection Failed: {ex}");
                }
                finally { IsConnected = false; }
            });
        }

        private async Task StatusCheckTask(CancellationToken cancellation)
        {
            while (!cancellation.IsCancellationRequested)
            {
                StatusCheck();
                await Task.Delay(100, cancellation);
            }
        }

        private void StatusCheck()
        {
            lock (_lock)
            {
                if (!_isListening && !IsConnected && _doConnections)
                {
                    StartListening();
                }
            }
        }
        #endregion

        #region publicMethods

        public void SendItem(Packet item)
        {
            if (IsConnected)
                _sendItems.Enqueue(item);
        }

        public async Task<GeneralResponse<Packet>> SendItemWithResponse(Packet item)
        {
            var responseToReturn = new GeneralResponse<Packet>();

            if (IsConnected)
            {
                _sendItems.Enqueue(item);
                _waitingPackets.TryAdd(item.Id, new WaitingPacket
                {
                    StartedWaitingAt = DateTime.Now,
                    WaitingFor = item.Id
                });

                var packet = await Task.Run(async () =>
                {
                    do
                    {
                        await Task.Delay(10);

                        if (_waitingPackets.TryGetValue(item.Id, out var waitingPacket))
                        {
                            if (waitingPacket.ReceivedPacket != null)
                            {
                                _waitingPackets.TryRemove(item.Id, out var tempPacket);
                                return waitingPacket.ReceivedPacket;
                            }
                            else if ((DateTime.Now - waitingPacket.StartedWaitingAt).TotalSeconds > TimeoutInSeconds)
                            {
                                Debug.WriteLine($"Removing Wait Id: {item.Id} due to timeout");
                                _waitingPackets.TryRemove(item.Id, out var tempPacket);
                                return (Packet)null;
                            }
                        }
                        else
                        {
                            return (Packet)null;
                        }
                    }
                    while (true);
                });

                responseToReturn.Succeeded = packet != null;
                responseToReturn.Data = packet;
            }
            else
            {
                responseToReturn.Succeeded = false;
                responseToReturn.Message = "Not connected";
            }
            return responseToReturn;
        }

        public void Dispose()
        {
            try { _periodicCheckTaskCancellationToken.Cancel(); } catch { }
            try { _listener?.Dispose(); } catch { }
            try { _client?.Dispose(); } catch { }
        }

        #endregion

        #region classes
        public class Packet
        {
            public Guid Id { get; private set; } = Guid.NewGuid();
            public Guid? InResponseTo { get; set; }
            public string PacketType { get; set; }
            public string Payload { get; set; }
        }

        public class WaitingPacket
        {
            public Guid WaitingFor { get; set; }
            public DateTime StartedWaitingAt { get; set; }
            public Packet? ReceivedPacket { get; set; }
        }

        public class PacketReceivedArgs : EventArgs
        {
            public Packet Packet { get; set; }
        }
        #endregion

        #region events

        public delegate void PacketReceivedDelegate(PacketReceivedArgs packetReceivedArgs);
        public event PacketReceivedDelegate OnPacketReceived;

        #endregion
    }
}


text:
"""Miscellaneous training utility functions.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import inspect
import os
from collections import defaultdict
from pydoc import locate

import json

import tensorflow as tf
from tensorflow import gfile

from seq2seq.contrib import rnn_cell

class TrainOptions(object):
  """A collection of options that are passed to the training script
  and can be saved to perform inference later.

  Args:
    task: Name of the training task class.
    task_params: A dictionary of parameters passed to the training task.
  """

  def __init__(self, model_class, model_params):
    self._model_class = model_class
    self._model_params = model_params

  @property
  def model_class(self):
    """Returns the training task parameters"""
    return self._model_class

  @property
  def model_params(self):
    """Returns the training task class"""
    return self._model_params

  @staticmethod
  def path(model_dir):
    """Returns the path to the options file.

    Args:
      model_dir: The model directory
    """
    return os.path.join(model_dir, "train_options.json")

  def dump(self, model_dir):
    """Dumps the options to a file in the model directory.

    Args:
      model_dir: Path to the model directory. The options will be
      dumped into a file in this directory.
    """
    gfile.MakeDirs(model_dir)
    options_dict = {
        "model_class": self.model_class,
        "model_params": self.model_params,
    }

    with gfile.GFile(TrainOptions.path(model_dir), "wb") as file:
      file.write(json.dumps(options_dict).encode("utf-8"))

  @staticmethod
  def load(model_dir):
    """ Loads options from the given model directory.

    Args:
      model_dir: Path to the model directory.
    """
    with gfile.GFile(TrainOptions.path(model_dir), "rb") as file:
      options_dict = json.loads(file.read().decode("utf-8"))
    options_dict = defaultdict(None, options_dict)

    return TrainOptions(
        model_class=options_dict["model_class"],
        model_params=options_dict["model_params"])

def cell_from_spec(cell_classname, cell_params):
  """Create a RNN Cell instance from a JSON string.

  Args:
    cell_classname: Name of the cell class, e.g. "BasicLSTMCell".
    cell_params: A dictionary of parameters to pass to the cell constructor.

  Returns:
    A RNNCell instance.
  """

  cell_params = cell_params.copy()

  # Find the cell class
  cell_class = locate(cell_classname) or getattr(rnn_cell, cell_classname)

  # Make sure additional arguments are valid
  cell_args = set(inspect.getargspec(cell_class.__init__).args[1:])
  for key in cell_params.keys():
    if key not in cell_args:
      raise ValueError(
          """{} is not a valid argument for {} class. Available arguments
          are: {}""".format(key, cell_class.__name__, cell_args))

  # Create cell
  return cell_class(**cell_params)

def get_rnn_cell(cell_class,
                 cell_params,
                 num_layers=1,
                 dropout_input_keep_prob=1.0,
                 dropout_output_keep_prob=1.0,
                 residual_connections=False,
                 residual_combiner="add",
                 residual_dense=False):
  """Creates a new RNN Cell

  Args:
    cell_class: Name of the cell class, e.g. "BasicLSTMCell".
    cell_params: A dictionary of parameters to pass to the cell constructor.
    num_layers: Number of layers. The cell will be wrapped with
      `tf.contrib.rnn.MultiRNNCell`
    dropout_input_keep_prob: Dropout keep probability applied
      to the input of cell *at each layer*
    dropout_output_keep_prob: Dropout keep probability applied
      to the output of cell *at each layer*
    residual_connections: If true, add residual connections
      between all cells

  Returns:
    An instance of `tf.contrib.rnn.RNNCell`.
  """

  cells = []
  for _ in range(num_layers):
    cell = cell_from_spec(cell_class, cell_params)
    if dropout_input_keep_prob < 1.0 or dropout_output_keep_prob < 1.0:
      cell = tf.contrib.rnn.DropoutWrapper(
          cell=cell,
          input_keep_prob=dropout_input_keep_prob,
          output_keep_prob=dropout_output_keep_prob)
    cells.append(cell)

  if len(cells) > 1:
    final_cell = rnn_cell.ExtendedMultiRNNCell(
        cells=cells,
        residual_connections=residual_connections,
        residual_combiner=residual_combiner,
        residual_dense=residual_dense)
  else:
    final_cell = cells[0]

  return final_cell

def create_learning_rate_decay_fn(decay_type,
                                  decay_steps,
                                  decay_rate,
                                  start_decay_at=0,
                                  stop_decay_at=1e9,
                                  min_learning_rate=None,
                                  staircase=False):
  """Creates a function that decays the learning rate.

  Args:
    decay_steps: How often to apply decay.
    decay_rate: A Python number. The decay rate.
    start_decay_at: Don't decay before this step
    stop_decay_at: Don't decay after this step
    min_learning_rate: Don't decay below this number
    decay_type: A decay function name defined in `tf.train`
    staircase: Whether to apply decay in a discrete staircase,
      as opposed to continuous, fashion.

  Returns:
    A function that takes (learning_rate, global_step) as inputs
    and returns the learning rate for the given step.
    Returns `None` if decay_type is empty or None.
  """
  if decay_type is None or decay_type == "":
    return None

  start_decay_at = tf.to_int32(start_decay_at)
  stop_decay_at = tf.to_int32(stop_decay_at)

  def decay_fn(learning_rate, global_step):
    """The computed learning rate decay function.
    """
    global_step = tf.to_int32(global_step)

    decay_type_fn = getattr(tf.train, decay_type)
    decayed_learning_rate = decay_type_fn(
        learning_rate=learning_rate,
        global_step=tf.minimum(global_step, stop_decay_at) - start_decay_at,
        decay_steps=decay_steps,
        decay_rate=decay_rate,
        staircase=staircase,
        name="decayed_learning_rate")

    final_lr = tf.train.piecewise_constant(
        x=global_step,
        boundaries=[start_decay_at],
        values=[learning_rate, decayed_learning_rate])

    if min_learning_rate:
      final_lr = tf.maximum(final_lr, min_learning_rate)

    return final_lr

  return decay_fn

def create_input_fn(pipeline,
                    batch_size,
                    bucket_boundaries=None,
                    allow_smaller_final_batch=False,
                    scope=None):
  """Creates an input function that can be used with tf.learn estimators.
    Note that you must pass "factory funcitons" for both the data provider and
    featurizer to ensure that everything will be created in  the same graph.

  Args:
    pipeline: An instance of `seq2seq.data.InputPipeline`.
    batch_size: Create batches of this size. A queue to hold a
      reasonable number of batches in memory is created.
    bucket_boundaries: int list, increasing non-negative numbers.
      If None, no bucket is performed.

  Returns:
    An input function that returns `(feature_batch, labels_batch)`
    tuples when called.
  """

  def input_fn():
    """Creates features and labels.
    """

    with tf.variable_scope(scope or "input_fn"):
      data_provider = pipeline.make_data_provider()
      features_and_labels = pipeline.read_from_data_provider(data_provider)

      if bucket_boundaries:
        _, batch = tf.contrib.training.bucket_by_sequence_length(
            input_length=features_and_labels["source_len"],
            bucket_boundaries=bucket_boundaries,
            tensors=features_and_labels,
            batch_size=batch_size,
            keep_input=features_and_labels["source_len"] >= 1,
            dynamic_pad=True,
            capacity=5000 + 16 * batch_size,
            allow_smaller_final_batch=allow_smaller_final_batch,
            name="bucket_queue")
      else:
        batch = tf.train.batch(
            tensors=features_and_labels,
            enqueue_many=False,
            batch_size=batch_size,
            dynamic_pad=True,
            capacity=5000 + 16 * batch_size,
            allow_smaller_final_batch=allow_smaller_final_batch,
            name="batch_queue")

      # Separate features and labels
      features_batch = {k: batch[k] for k in pipeline.feature_keys}
      if set(batch.keys()).intersection(pipeline.label_keys):
        labels_batch = {k: batch[k] for k in pipeline.label_keys}
      else:
        labels_batch = None

      return features_batch, labels_batch

  return input_fn


text:
module.exports = {
    options: {
        forever: true,
        livereload: true,
        atBegin: true
    },
    less: {
        options: {
            livereload: false
        },
        files: ['<%= globalConfig.src %>/less/**/*.less'],
        tasks: ['less:style', 'less:others', 'autoprefixer']
    },
    css: {
        files: ['<%= globalConfig.basePath %><%= globalConfig.target %>/css/style.css', '<%= globalConfig.basePath %><%= globalConfig.target %>/css/critical.css'],
        tasks: []
    },
    assets: {
        files: ['<%= globalConfig.src %>/assets/**'],
        tasks: ['newer:copy:assets', 'newer:image']
    },
    external_sources: {
        files: ["resources/external_sources/**"],
        tasks: ['newer:copy:external_sources']
    },
    php: {
        files: ['<%= globalConfig.src %>/index.php', '<%= globalConfig.src %>/php/**'],
        tasks: ['newer:copy:php']
    },
    json: {
        files: ['<%= globalConfig.src %>/data/**/*.json'],
        tasks: ['newer:sync-json-handlebars'],
        options: {
            event: ['added']
        }
    },
    tmpl: {
        files: ['<%= globalConfig.src %>/tmpl/**/*.handlebars', '<%= globalConfig.src %>/data/**/*.json'],
        tasks: ['handlebars'],
        options: {
            interrupt: true
        }
    },
    html: {
        files: ['<%= globalConfig.basePath %><%= globalConfig.target %>/**/*.html'],
        tasks: ['html-register-controller:default'],
        options: {
            event: ['added', 'changed']
        }
    }
};


text:
from django.conf.urls import url

from .views import PlaceActivityFeed, PlaceActivityListView

urlpatterns = [

    url(r'^feeds/all/$',
        PlaceActivityFeed(),
        name='activitystream_feed',
    ),

    url(r'^',
        PlaceActivityListView.as_view(),
        name='activitystream_activity_list'
    ),

]


text:
import cookies from 'browser-cookies';

const modals = document.querySelectorAll('.js-modal');

function modalTracking (category, action) {
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    event: 'myClick',
    category,
    action
  });
}

Array.from(modals, (modal) => {
  const modalCampaign = modal.dataset.modalCampaign;
  const focusable = modal.querySelectorAll('a');

  const closeModal = () => {
    modal.setAttribute('tabindex', '-1');
    modal.setAttribute('aria-hidden', 'true');
    modalTracking(modalCampaign, 'pop-up dismissed');
    modal.dispatchEvent(new CustomEvent('jsModalClosed', { bubbles: true }));
    // remove focus focusHandler
    modal.classList.remove('b-modal--active');
  };

  const focusHandler = (e) => {
    if (e.keyCode === 9) {
      const first = focusable[0];
      const last = focusable[focusable.length - 1];
      const shift = e.shiftKey;
      if (focusable.length) {
        if (shift && document.activeElement === first) {
          last.focus();
          e.preventDefault();
        } else if (!shift && document.activeElement === last) {
          first.focus();
          e.preventDefault();
        }
      }
    }
    if (e.key === 'Escape') {
      modal.removeEventListener('keydown', focusHandler);
      closeModal();
    }
  };

  if (
    (!modal.dataset.modalOnceOnly || !cookies.get(modalCampaign)) &&
     !modal.dataset.notOnLoad
  ) {
    document.body.appendChild(modal);
    modal.setAttribute('tabindex', '0');
    modal.removeAttribute('aria-hidden');
    modal.classList.add('b-modal--active');
    modalTracking(modalCampaign, 'pop-up displayed');

    // focus the modal instead of the body
    modal.focus();
    focusable[1].focus();

    // add focus handler
    modal.addEventListener('keydown', focusHandler);
  }

  modal.addEventListener('click', (e) => {
    if (modal.dataset.modalOnceOnly) {
      cookies.set(modalCampaign, 'seen', { domain: modal.dataset.modalDomain, expires: 365 });
    }
    if (e.target !== modal) {
      if (!!(Array.from(e.target.classList).find(c => c === 'js-modal-action')) || e.target.closest('.js-modal-action')) {
        modalTracking(modalCampaign, `clicked: ${e.target.textContent}`);
      } else {
        modal.removeEventListener('keydown', focusHandler);
        closeModal();
      }
    }
  });
  return true;
});


text:
Ruby wrapper for managing deb repos with [Aptly](http://aptly.info).

This is currently a **work in progress**! `ruby-aptly` does not wrap 100% of the
aptly feature set yet, but most major things are working at this point.

### Compatibility

ruby-aptly is currently tested against Aptly 0.5. It is possible that it will
also work fine on older or newer versions, but this is untested.

ruby-aptly should work on any Ruby >= 1.8.7.

---

Aptly is a great tool for managing Apt repositories. It is reliable, actively
maintained, and ridiculously fast.

Setting up Aptly is a snap - creating repositories, seeding them, taking
snapshots, and most other operations are pretty simple.

Orchestrating repository updates are a bit different. Typically this can be done
with a few simple shell scripts or similar, but where it really shines is when
you start driving it with data. Having tooling that understands Aptly's state is
nice for quickly funneling your hiera data or similar into usable repositories
with just a few lines of code. This library aims to make that process simple.

API documentation available at
[rubydoc.info](http://rubydoc.info/gems/aptly/frames)

# Example

```ruby
require 'rubygems'
require 'aptly'

# Creates a new mirror
mirror = Aptly.create_mirror(
    'precise',
    'http://us.archive.ubuntu.com/ubuntu',
    'precise',
    :components => ['main', 'universe', 'multiverse']
)

# Performs a mirror update
mirror.update

# List packages in the mirror
mirror.list_packages

# Create a snapshot of a mirror
snap1 = mirror.snapshot 'snap1'

# Creates a new repo
repo = Aptly.create_repo 'test_repo'

# Import packages from a mirror into the repo
repo.import mirror.name, :packages => ['linux-image', 'bash']

# Create a snapshot from a repo
snap2 = repo.snap 'snap2'

# Merge two snapshots together, pulling in only latest packages
merged = Aptly.merge_snapshots snap1, snap2, :latest => true

# List packages in a merged snapshot
merged.list_packages

# Publish a snapshot
merged.publish
```