text:
Function.RegisterNamespace("Test.Aura.Util");

[Fixture]
Test.Aura.Util.UtilTest = function() {
    var Aura = {Utils:{
        Json:function() {},
        Style:function() {},
        SizeEstimator: function() {},
        Bitset:{},
        NumberFormat:{},
        SecureFilters:{},
        Mutex: function() {}
    }};
    var auraMock = function(delegate) {
        Mocks.GetMocks(Object.Global(), {
            exp:function() {},
            window:Object.Global(),
            document:{createDocumentFragment:function() {}},
            Json:function() {},
            Style:function() {},
            SizeEstimator: function() {},
            Bitset:{},
            NumberFormat:{},
            Aura: Aura,
            $A:{
                ns:{},
                assert:Stubs.GetMethod(function(condition,message){if(!condition)throw message;}),
                util:{
                    isString: function(arg) { return (typeof arg === 'string' || arg instanceof String); }
                }
           },
            navigator:{userAgent:''}
         })(function(){
            [Import("aura-impl/src/main/resources/aura/util/Util.js")]
            delegate();
        });
    };

    var targetUtil;
    auraMock(function(){
        targetUtil = new Aura.Utils.Util();
    });

    [Fixture]
    function isIOSWebView(){
        [Fact]
        function ReturnsTrueForIOS7WebView(){
            var actual;
            var mockUserAgentIOS7WebView = Mocks.GetMock(Object.Global(), "window", {
                navigator: {
                    userAgent: "iPhone OS/7.1 (iPhone) Salesforce1/3001899 XBranding/1.0 SalesforceTouchContainer/2.0 Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D167 (241664608)"
                }
            });
            // Create fresh instance of Util.js since we store isIOSWebView return value on object
            var targetUtil;
            auraMock(function(){
                targetUtil = new Aura.Utils.Util();
            });

            mockUserAgentIOS7WebView(function(){
                actual = targetUtil.isIOSWebView();
            });

            Assert.True(actual);
        }

        [Fact]
        function ReturnsFalseForIOS7_1Safari(){
            var actual;
            var mockUserAgentIOS7Safari = Mocks.GetMock(Object.Global(), "window", {
                navigator: {
                    userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D5145e Safari/9537.53"
                }
            });
            // Create fresh instance of Util.js since we store isIOSWebView return value on object
            var targetUtil;
            auraMock(function(){
                targetUtil = new Aura.Utils.Util();
            });

            mockUserAgentIOS7Safari(function(){
                actual = targetUtil.isIOSWebView();
            });

            Assert.False(actual);
        }
    }

    [Fixture]
    function stripTags(){

        var tags = ['script', 'style'];

        var mockElement = {
            name: '',
            parentNode: ''
        };

        var mockDiv = {
            innerHTML:'',
            getElementsByTagName:function(name){
                mockElement.name = name;
                mockElement.parentNode = this;

                var str;
                if(name == 'script'){
                    str = '<script>';
                }
                else{
                    str = '<style>';
                }
                var count = 0;
                var index = this.innerHTML.indexOf(str);
                while(index != -1){
                    count++;
                    index = this.innerHTML.indexOf(str, index+1);
                }

                var arr = new Array();
                for (var j = 0; j < count; j++){
                    arr[j] = mockElement;
                }
                return arr;
            },
            removeChild:function(element) {
                if(element.name == 'script') {
                    this.innerHTML = this.innerHTML.replace('<script>', '');
                    this.innerHTML = this.innerHTML.replace('</script>', '');
                }
                if(element.name == 'style') {
                    this.innerHTML = this.innerHTML.replace('<style>', '');
                    this.innerHTML = this.innerHTML.replace('</style>', '');
                }
            }
        };

        var mockDocument = Mocks.GetMock(Object.Global(), "document", {
            createElement:function(value){
                if(value == 'div') return mockDiv;
            }
        });

        var mockRemoveElement = Mocks.GetMock(targetUtil, "removeElement", function(element){
            if(element != mockDiv) throw new Error("Wrong Element, expected div");
        });

        [Fact]
        function undefinedValue(){
            var expected = "";
            var actual = targetUtil.stripTags(undefined, tags);

            // Assert
            Assert.Equal(expected, actual);

        }

        [Fact]
        function invalidValue(){
            var expected = '';
            var actual = targetUtil.stripTags('', tags);

            // Assert
            Assert.Equal(expected, actual);
        }

        [Fact]
        function invalidTags(){
            var expected = 'value';
            var actual;

            mockDocument(function(){
                mockRemoveElement(function(){
                    actual = targetUtil.stripTags('value', '');
                });
            });
            // Assert
            Assert.Equal(expected, actual);
        }

        [Fact]
        function noTags(){
            var expected = 'value';
            var actual;

            mockDocument(function(){
                mockRemoveElement(function(){
                    actual = targetUtil.stripTags('value', tags);
                });
            });
            // Assert
            Assert.Equal(expected, actual);
        }

        [Fact]
        function withTags(){
            var expected = 'value';
            var actual;

            mockDocument(function(){
                mockRemoveElement(function(){
                    actual = targetUtil.stripTags('<script>value</script>', tags);
                });
            });
            // Assert
            Assert.Equal(expected, actual);
        }

        [Fact]
        function withMultipleTags(){
            var expected = 'value';
            var actual;

            mockDocument(function(){
                mockRemoveElement(function(){
                    actual = targetUtil.stripTags('<script></script>value<script></script>', tags);
                });
            });
            // Assert
            Assert.Equal(expected, actual);
        }

        [Fact]
        function withNestedTags(){
            var expected = 'value';
            var actual;

            mockDocument(function(){
                mockRemoveElement(function(){
                    actual = targetUtil.stripTags('<script><script><style>value</style></script></script>', tags);
                });
            });
            // Assert
            Assert.Equal(expected, actual);
        }

        [Fact]
        function withMultipleValues(){
            var expected = 'value1 value2 value3';
            var actual;

            mockDocument(function(){
                mockRemoveElement(function(){
                    actual = targetUtil.stripTags('value1 <script><script><style>value2</style></script></script> value3', tags);
                });
            });
            // Assert
            Assert.Equal(expected, actual);
        }
    }

    [Fixture]
    function isIE(){
        var auraMockCustomUserAgent = function(delegate, userAgentOverride) {
            Mocks.GetMocks(Object.Global(),{
                exp:function() {},
                window:Object.Global(),
                document:{createDocumentFragment:function() {}},
                Json:function() {},
                Style:function() {},
                Bitset:{},
                NumberFormat:{},
                $A:{ns:{}},
                Aura: Aura,
                navigator:{userAgent : userAgentOverride }
            })(function(){
                [Import("aura-impl/src/main/resources/aura/util/Util.js")]
                delegate();
            });
        }

            [Fact]
        function IE11UserAgentReturnsTrue(){
            //Arrange
            var actual;
            var userAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko";

            //Act
            auraMockCustomUserAgent(function(){
                var targetUtil = new Aura.Utils.Util();
                actual = targetUtil.isIE;
            }, userAgent);

            // Assert
            Assert.True(actual);
        }

        [Fact]
        function ChromeUserAgentReturnsFalse(){
            //Arrange
            var actual;
            var userAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36";

            //Act
            auraMockCustomUserAgent(function(){
                var targetUtil = new Aura.Utils.Util();
                actual = targetUtil.isIE;
            }, userAgent);

            // Assert
            Assert.False(actual);
        }
    }

    [Fixture]
    function equals(){
        var falseyValues=[null,undefined,0,''];
        var testPrimitives=falseyValues.concat([7357,"expected",true,false]);

        [Fact, Data(testPrimitives)]
        function ReturnsTrueIfPrimitivesMatch(data){
            var actual=targetUtil.equals(data,data);

            Assert.True(actual,"Failed on data='"+data+"'");
        }

        [Fact, Data(testPrimitives)]
        function ReturnsFalseIfPrimitivesDoNotMatch(data){
            var actual=targetUtil.equals(data,"unexpected");

            Assert.False(actual,"Failed on data='"+data+"'");
        }

        [Fact, Data(falseyValues)]
        function ReturnsFalseIfExpectedIsFalseyWithoutMatch(data){
            var actual=targetUtil.equals(data,"unexpected");

            Assert.False(actual,"Failed on data='"+data+"'");
        }

        [Fact, Data(falseyValues)]
        function ReturnsFalseIfActualIsFalseyWithoutMatch(data){
            var actual=targetUtil.equals("unexpected",data);

            Assert.False(actual,"Failed on data='"+data+"'");
        }

        //Objects
        [Fact]
        function ReturnsFalseIfExpectedIsAnObjectAndActualIsNot(){
            var actual=targetUtil.equals({},"unexpected");

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseIfActualIsAnObjectAndExpectedIsNot(){
            var actual=targetUtil.equals("unexpected",{});

            Assert.False(actual);
        }

        [Fact]
        function ReturnsTrueIfThereAreNoObjectMembers(){
            var actual=targetUtil.equals({},{});

            Assert.True(actual);
        }

        [Fact]
        function ReturnsFalseIfObjectMemberNotFound(){
            var actual=targetUtil.equals({one:"one"},{});

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseIfObjectMembersDoNotMatch(){
            var actual=targetUtil.equals({one:"one"},{one:"two"});

            Assert.False(actual);
        }

        [Fact]
        function ReturnsTrueIfObjectMembersMatch(){
            var actual=targetUtil.equals({one:"one",two:"two"},{one:"one",two:"two"});

            Assert.True(actual);
        }

        [Fact]
        function ReturnsTrueIgnoringAdditionalObjectMembers(){
            var actual=targetUtil.equals({one:"one"},{one:"one",two:"two"});

            Assert.True(actual);
        }

        [Fact]
        function ReturnsTrueIfObjectMembersMatchRecursively(){
            var actual=targetUtil.equals({one:{two:"two"},three:"three"},{one:{two:"two",four:"four"},three:"three",five:"five"});

            Assert.True(actual);
        }

        // Arrays
        [Fact]
        function ReturnsFalseIfExpectedIsAnArrayAndActualIsNot(){
            var actual=targetUtil.equals([],"unexpected");

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseIfActualIsAnArrayAndExpectedIsNot(){
            var actual=targetUtil.equals("unexpected",[]);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseIfArrayLengthsDoNotMatch(){
            var actual=targetUtil.equals([1,1],[1,1,1]);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseIfArrayEntriesDoNotMatch(){
            var actual=targetUtil.equals([1,2],[2,1]);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsTrueifArrayEntriesMatch(){
            var actual=targetUtil.equals([1,2],[1,2]);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsTrueifArrayEntriesMatchRecursively(){
            var actual=targetUtil.equals([1,[1,{one:"one"}]],[1,[1,{one:"one"}]]);

            Assert.True(actual);
        }
    }

    [Fixture]
    function merge() {
        [Fact]
        function testMerge() {
            var expected = [0, 1, 2, 3, 4, 5, 6, 7, 8];
            var actual;
            auraMock(function() {
                var util = new Aura.Utils.Util(),
                    array1 = [0, 1],
                    array2 = [2, 3, 4],
                    array3 = [5, 6, 7, 8],
                    i = 0;

                // Merge arrays into array1 and test:
                util.merge(array1, array2, array3);
                actual = array1;
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function testMergeSingleArrayIsUnchanged() {
            var expected = [0, 1, 2, 3, 4, 5, 6, 7, 8];
            var actual;
            auraMock(function() {
                var util = new Aura.Utils.Util(),
                    array1 = [0, 1],
                    array2 = [2, 3, 4],
                    array3 = [5, 6, 7, 8],
                    i = 0;

                // Merge arrays into array1 and test:
                util.merge(expected);
                actual = expected.slice();
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function testMergeErrorOnNonArrayAtStart() {
            var expected = "Merge takes only arrays as arguments.";
            var actual;

            auraMock(function() {
                actual = Record.Exception(function(){
                    new Aura.Utils.Util().merge({}, [0], [1, 2]);
                })
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function testMergeErrorOnNonArrayAtMiddle() {
            var expected = "Merge takes only arrays as arguments.";
            var actual;

            auraMock(function() {
                actual = Record.Exception(function(){
                    new Aura.Utils.Util().merge([0], {}, [1, 2]);
                })
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function testMergeErrorOnNonArrayAtEnd() {
            var expected = "Merge takes only arrays as arguments.";
            var actual;

            auraMock(function() {
                actual = Record.Exception(function(){
                    new Aura.Utils.Util().merge([0], [1, 2], {});
                })
            });

            Assert.Equal(expected, actual);
        }
    }

    [Fixture]
    function format(){
        [Fact]
        function ThrowsIfFormatStringIsNotConvertibleToString(){
            var expected="$A.util.format(): 'formatString' must be a String.";

            var actual=Record.Exception(function(){
                auraMock(function(){
                    targetUtil.format(null);
                });
            });

            Assert.Equal(expected,actual);
        }

        [Fact]
        function FormatsPrimitivesIntoString(){
            var target="Boolean: {0}, Number:{1}, String:{2}";
            var expected="Boolean: true, Number:7357, String:test";
            var actual=null;

            auraMock(function(){
                actual=targetUtil.format(target,true,7357,"test");
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function FormatsObjectIntoString(){
            var expected="Object: [object Object]";
            var actual=null;
            var target="Object: {0}";

            auraMock(function(){
               actual=targetUtil.format(target,{});
            });

            Assert.Equal(expected,actual);
        }

        [Fact]
        function FormatsArrayIntoString(){
            var expected="Array: this,is,an,array,test";
            var actual=null;
            var target="Array: {0}";

            auraMock(function(){
                actual=targetUtil.format(target,["this","is","an","array","test"]);
            });

            Assert.Equal(expected,actual);
        }

        [Fact]
        function FormatsObjectUsingCustomToString(){
            var expected="Object: Custom toString. Value is: TEST";
            var actual=null;
            var targetString="Object: {0}";
            var targetObject={value:"TEST"};
            targetObject.toString=function(){
                return "Custom toString. Value is: "+this.value;
            };

            auraMock(function(){
                actual=targetUtil.format(targetString,targetObject);
            });

            Assert.Equal(expected,actual);
        }

        [Fact]
        function IgnoresTokensWithNullOrUndefinedParameters(){
            var expected="Format String: {0} test {2} {3}";
            var target="Format String: {0} {1} {2} {3}";
            var actual=null;

            auraMock(function(){
                actual=targetUtil.apply(expected,undefined,"test",null);
            });

            Assert.Equal(expected,actual);
        }

        [Fact]
        function FormatStringIsEmptyString() {
            var expected = "";

            var actual = null;
            auraMock(function() {
                actual = targetUtil.format(expected);
            });

            Assert.Equal(expected,actual);
        }
    }

    [Fixture]
    function apply() {
        [Fact]
        function CopiesTopLevelMembersWithoutOverridingExistingValues() {
            auraMock(function() {

                // Arrange
                var util = new Aura.Utils.Util(),
                    base     =  { "a": { "b": { "c": 1,  "d": { "e": 2, "f": 3 }         }}, "h": 5,  "i": { "j": 6 } },
                    members  =  { "a": { "b": { "c": 10, "d": { "e": 20        }, "g": 4 }}, "h": 50, "i": 7 },
                    expected =  { "a": { "b": { "c": 1,  "d": { "e": 2, "f": 3 }         }}, "h": 5,  "i": { "j": 6 } };

                // Act
                util.apply(base, members, false, false);

                // Assert
                Assert.Equal(base, expected);
            });
        }

        [Fact]
        function CopiesTopLevelMembersAndOverridesExistingValues() {
            auraMock(function() {

                // Arrange
                var util = new Aura.Utils.Util(),
                    base     =  { "a": { "b": { "c": 1,  "d": { "e": 2, "f": 3 }         }}, "h": 5,  "i": { "j": 6 } },
                    members  =  { "a": { "b": { "c": 10, "d": { "e": 20        }, "g": 4 }}, "h": 50, "i": 7 },
                    expected =  { "a": { "b": { "c": 10, "d": { "e": 20        }, "g": 4 }}, "h": 50, "i": 7 };

                // Act
                util.apply(base, members, true, false);

                // Assert
                Assert.Equal(base, expected);
            });
        }

        [Fact]
        function DeepCopiesMembersWithoutOverridingExistingValues() {
            auraMock(function() {
                // Arrange
                var util = new Aura.Utils.Util(),
                    base     =  { "a": { "b": { "c": 1,  "d": { "e": 2, "f": 3 }         }}, "h": 5,  "i": { j: 7 } },
                    members  =  { "a": { "b": { "c": 10, "d": { "e": 20        }, "g": 4 }}, "h": 50, "i": 6 },
                    expected =  { "a": { "b": { "c": 1,  "d": { "e": 2, "f": 3 }, "g": 4 }}, "h": 5,  "i": { j: 7 } };

                // Act
                util.apply(base, members, false, true);

                // Assert
                Assert.Equal(base, expected);
            });
        }

        [Fact]
        function DeepCopiesMembersAndOverridesExistingValues() {
            auraMock(function() {
                // Arrange
                var util = new Aura.Utils.Util(),
                    base     =  { "a": { "b": { "c": 1,  "d": { "e": 2,  "f": 3 }         }}, "h": 5,  "i": { j: 7 } },
                    members  =  { "a": { "b": { "c": 10, "d": { "e": 20         }, "g": 4 }}, "h": 50, "i": 6 },
                    expected =  { "a": { "b": { "c": 10, "d": { "e": 20, "f": 3 }, "g": 4 }}, "h": 50, "i": 6 };

                // Act
                util.apply(base, members, true, true);

                // Assert
                Assert.Equal(base, expected);
            });
        }
    }

    [Fixture]
    function supportsTouchEvents() {
        var mockIsUndefinedReturnsFalse = Mocks.GetMock(Object.Global(), "$A", {
            util: {
                isUndefined: function() {
                    return false;
                }
            }
        });

        [Fact]
        function ReturnsCachedResultIfExistsAndTruthy() {
            var actual;
            var expected = true;
            targetUtil.supportsTouchEvents.cache = expected;

            mockIsUndefinedReturnsFalse(function() {
                actual = targetUtil.supportsTouchEvents();
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function ReturnsCachedResultIfExistsAndFalsy() {
            var actual;
            var expected = false;
            targetUtil.supportsTouchEvents.cache = expected;

            mockIsUndefinedReturnsFalse(function() {
                actual = targetUtil.supportsTouchEvents();
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function ReturnsTrueWhenOnTouchStartInWindow() {
            var actual;
            var expected = true;
            var mockItAll = Mocks.GetMocks(Object.Global(), {
                $A: {
                    util: {
                        isUndefined: function() {
                            return true;
                        }
                    },
                    getContext: function() {
                        return {
                            getMode: function() {
                                return "NonBlacklistedMode";
                            }
                        }
                    },
                    get: function() {
                        return true;
                    }
                },
                window: {
                    ontouchstart: true
                }
            });

            mockItAll(function() {
                actual = targetUtil.supportsTouchEvents();
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function ReturnsTrueForWindowsPhone() {
            var actual;
            var expected = true;
            var mockItAll = Mocks.GetMocks(Object.Global(), {
                $A: {
                    util: {
                        isUndefined: function() {
                            return true;
                        }
                    },
                    getContext: function() {
                        return {
                            getMode: function() {
                                return "NonBlacklistedMode";
                            }
                        }
                    },
                    get: function() {
                        return true;
                    }
                },
                window: {
                    navigator: {
                        msPointerEnabled: true
                    }
                }
            });

            mockItAll(function() {
                actual = targetUtil.supportsTouchEvents();
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function ReturnsTrueForMaxTouchPoints() {
            var actual;
            var expected = true;
            var mockItAll = Mocks.GetMocks(Object.Global(), {
                $A: {
                    util: {
                        isUndefined: function() {
                            return true;
                        }
                    },
                    getContext: function() {
                        return {
                            getMode: function() {
                                return "NonBlacklistedMode";
                            }
                        }
                    },
                    get: function() {
                        return false;
                    }
                },
                window: {
                    navigator: {
                        msPointerEnabled: false,
                        msMaxTouchPoints: 10
                    }
                }
            });

            mockItAll(function() {
                actual = targetUtil.supportsTouchEvents();
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        function ReturnsFalseForBlacklistedMode() {
            var actual;
            var expected = false;
            var mockItAll = Mocks.GetMocks(Object.Global(), {
                $A: {
                    util: {
                        isUndefined: function() {
                            return true;
                        }
                    },
                    getContext: function() {
                        return {
                            getMode: function() {
                                return "PTEST";
                            }
                        }
                    },
                    get: function (query) {
                        return false;
                    }
                },
                window: {
                    ontouchstart: false
                }
            });

            mockItAll(function() {
                actual = targetUtil.supportsTouchEvents();
            });

            Assert.Equal(expected, actual);
        }

        [Fact]
        // This case covers non-touch IE11 where msPointerEnabled is true
        function ReturnsFalseForPointerEnabledNotWindowsPhone() {
            var actual;
            var expected = false;
            var mockItAll = Mocks.GetMocks(Object.Global(), {
                $A: {
                    util: {
                        isUndefined: function() {
                            return true;
                        }
                    },
                    getContext: function() {
                        return {
                            getMode: function() {
                                return "NonBlacklistedMode";
                            }
                        }
                    },
                    get: function() {
                        return false;
                    }
                },
                window: {
                    navigator: {
                        msPointerEnabled: true,
                        pointerEnabled: true,
                        msMaxTouchPoints: 0,
                        maxTouchPoints: 0
                    }
                }
            });

            mockItAll(function() {
                actual = targetUtil.supportsTouchEvents();
            });

            Assert.Equal(expected, actual);
        }
    }

    [Fixture]
    function lookup() {
        [Fact]
        function looksUpNestedObjectProperties() {
            var structure = {
                wrong: {},
                first: {
                    wrong: {},
                    second: {
                        wrong: {},
                        third: "VALUE"
                    }
                }
            };

            auraMock(function() {
                Assert.Equal("VALUE", new Aura.Utils.Util().lookup(structure, "first", "second", "third"));
            });
        }

        [Fact]
        function looksUpNestedArrayProperties() {
            var structure = ["WRONG", ["WRONG", ["VALUE", "WRONG"]]];

            auraMock(function() {
                Assert.Equal("VALUE", new Aura.Utils.Util().lookup(structure, 1, 1, 0));
            });
        }

        [Fact]
        function looksUpNestedMixedProperties() {
            var structure = {
                wrong: {},
                first: ["WRONG", ["WRONG", [{result: "VALUE"}, "WRONG"]]]
            };

            auraMock(function() {
                Assert.Equal("VALUE", new Aura.Utils.Util().lookup(structure, "first", 1, 1, 0, "result"));
            });
        }

        [Fact]
        function handlesUnfoundProperties() {
            var structure = {
                wrong: {},
                first: ["WRONG", ["WRONG", [{result: "VALUE"}, "WRONG"]]]
            };

            auraMock(function() {
                var util = new Aura.Utils.Util();

                var found = 0;
                found += util.lookup(structure, "second", 1, 4, 3, "result") === undefined ? 0 : 1;
                found += util.lookup(structure, "first", 2, 4, 3, "result") === undefined ? 0 : 1;
                found += util.lookup(structure, "first", 1, 1, 1, "result") === undefined ? 0 : 1;
                found += util.lookup(structure, "first", 1, 1, 0, "resultMispelled") === undefined ? 0 : 1;

                Assert.Equal(0, found);
            });
        }
    }

    [Fixture]
    function isArray() {
        [Fact]
        function ReturnsTrueForEmptyArray() {
            var array = [];

            var actual = targetUtil.isArray(array);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsTrueForArrayConstructed() {
            var array = new Array();

            var actual = targetUtil.isArray(array);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsFalseForUndefined() {
            var array = undefined;

            var actual = targetUtil.isArray(array);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForNull() {
            var array = null;

            var actual = targetUtil.isArray(array);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForObject() {
            var array = {};

            var actual = targetUtil.isArray(array);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForArrayLikeObject() {
            var array = arguments;

            var actual = targetUtil.isArray(array);

            Assert.False(actual);
        }

        [Fact]
        function RetrunsFalseForFunction() {
            var array = function(){};

            var actual = targetUtil.isArray(array);

            Assert.False(actual);
        }
    }

    [Fixture]
    function isObject() {
        [Fact]
        function ReturnsTrueForEmptyObject() {
            var object = {};

            var actual = targetUtil.isObject(object);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsTrueForConstructedObject() {
            var object = new Object();

            var actual = targetUtil.isObject(object);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsFalseForArray() {
            var object = [];

            var actual = targetUtil.isObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForUndefined() {
            var object = undefined;

            var actual = targetUtil.isObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForNull() {
            var object = null;

            var actual = targetUtil.isObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsTrueForArrayLikeObject() {
            var object = arguments;

            var actual = targetUtil.isObject(object);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsFalseForFunction() {
            var object = function(){};

            var actual = targetUtil.isObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsTrueForCustomObject() {
            var object = targetUtil;

            var actual = targetUtil.isObject(object);

            Assert.True(actual);
        }
    }

    [Fixture]
    function isPlainObject() {
        [Fact]
        function ReturnsTrueForEmptyObject() {
            var object = {};

            var actual = targetUtil.isPlainObject(object);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsTrueForConstructedObject() {
            var object = new Object();

            var actual = targetUtil.isPlainObject(object);

            Assert.True(actual);
        }

        [Fact]
        function ReturnsFalseForArray() {
            var object = [];

            var actual = targetUtil.isPlainObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForUndefined() {
            var object = undefined;

            var actual = targetUtil.isPlainObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForNull() {
            var object = null;

            var actual = targetUtil.isPlainObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForArrayLikeObject() {
            var object = arguments;

            var actual = targetUtil.isPlainObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForFunction() {
            var object = function(){};

            var actual = targetUtil.isPlainObject(object);

            Assert.False(actual);
        }

        [Fact]
        function ReturnsFalseForCustomObject() {
            var object = targetUtil;

            var actual = targetUtil.isPlainObject(object);

            Assert.False(actual);
        }
    }

    [Fixture]
    function getComponentHierarchy() {
        var mockComponent = function(type) {
            return {
                setOwner: function(owner) {this.owner = owner;},
                getOwner: function() {return this.owner;},
                getType: function() {return type;}
            };
        };

        [Fact]
        function ReturnsEmptyStringWhenNull() {
            var expected = '';

            var actual = targetUtil.getComponentHierarchy(null);

            Assert.Equal(expected, actual);
        }

        [Fact]
        function ReturnsComponentHierarchyWhenComponentHasOwner() {
            var a = mockComponent("a");
            var b = mockComponent("b");
            var c = mockComponent("c");
            a.setOwner(b);
            b.setOwner(c);
            c.setOwner(c);

            var expected = "[c]>[b]>[a]";

            var actual = targetUtil.getComponentHierarchy(a);

            Assert.Equal(expected, actual);
        }

        [Fact]
        function ReturnsComponentHierarchyWhenComponentHasNoOwner() {
            var a = mockComponent("a");
            var b = mockComponent("b");
            var c = mockComponent("c");
            var d = null;
            a.setOwner(b);
            b.setOwner(d);
            c.setOwner(c);

            var expected = "[b]>[a]";

            var actual = targetUtil.getComponentHierarchy(a);

            Assert.Equal(expected, actual);
        }
    }

    [Fixture]
    function getHashCode() {

        [Fact]
        function returnsExpectedStringOne() {
            var str = "Hello";

            //based on Java's String.hashCode() result
            var expected = 69609650;

            var actual = targetUtil.getHashCode(str);

            Assert.Equal(expected, actual);
        }

        [Fact]
        function returnsExpectedStringTwo() {
            var str = "";

            //based on Java's String.hashCode() result
            var expected = 0;

            var actual = targetUtil.getHashCode(str);

            Assert.Equal(expected, actual);
        }

        [Fact]
        function returnsExpectedStringThree() {
            var str = "`~!@#$%^&*()_-+={}[];',./<>?:|\"";

            //based on Java's String.hashCode() result
            var expected = -1703803484;

            var actual = targetUtil.getHashCode(str);

            Assert.Equal(expected, actual);
        }

        [Fact]
        function returnsExpectedStringFour() {
            var str = "qwertyuiopasdfghjklzxcvbnm1234567890";

            //based on Java's String.hashCode() result
            var expected = 1306960482;

            var actual = targetUtil.getHashCode(str);

            Assert.Equal(expected, actual);
        }

        [Fact]
        function returnsExpectedStringFive() {
            var str = "2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z2019-01-18T22%3A09%3A34Z";

            //based on Java's String.hashCode() result
            var expected = -461051314;

            var actual = targetUtil.getHashCode(str);

            Assert.Equal(expected, actual);
        }
    }
};


text:
/*  @preserve
 *  Project: jQuery plugin Photo4Me
 *  Description:
 *  Author: Simon Philp : https://www.siphilp.co.uk
 *  Version: 0.1
 *  License: MIT
 */
(function ($) {
    $.fn.getMyPhotos = function (options) {
        var settings = $.extend({ apiUrl: "http://api.photo4me.com/result/"}, options);
        var apiUrl = settings.apiUrl + settings.userId;
        var elem = $(this);
        $('#p4meloader').show();
        $.getJSON(apiUrl, function() {
        }).done(function (data) {
            var listHtml = "";
              $.each(data.Photos, function (i, item) {
                  listHtml += "

";
                  if (i+1 === settings.numberPhotos) {return false;}});
              listHtml += "
View All
";
            elem.html(listHtml);
        }).error(function(error) {
            console.log(error);
        }).always(function() {
            $('#p4meloader').hide();
        });
    };
}(jQuery));

redpajama_set_name: RedPajamaGithub


text:
class ofxBgScene : public ofxFadeScene
{
public:
    ofxBgScene(bool animate = true, bool orange = true, bool black = false, string prefix = "scene")
    : bAnimate(animate),bBlack(black), ofxFadeScene(prefix + ": " + "BgScene"){
        setSingleSetup(false); // setup each time the scene is loaded
        setFade(0,0);
		bBlue = !orange;

    }

    void setup();
    void update();
    void draw();

    void keyPressed(int key);
    void mouseMoved(int x, int y );

    void clear();

private:

    bool bAnimate;
		bool bBlack;
    //this holds all of our points
    vector<ofVec3f> points;
    //this keeps track of the center of all the points
    ofVec3f center;

    float maxZ;

    bool endLine;

    float sWidth;
    float sHeight;

    bool bBlue;
    bool bBackground;

};


text:
namespace GestureSample.Views
{
	public partial class FlexLayoutXaml
	{
		public FlexLayoutXaml ()
		{
			InitializeComponent ();
		}
	}
}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Office2016.Drawing;
using DocumentFormat.OpenXml.Office2019.Drawing.SVG;
using DocumentFormat.OpenXml.Packaging;
using System;
using System.IO;
using System.Linq;

using Drawing = DocumentFormat.OpenXml.Drawing;
using Presentation = DocumentFormat.OpenXml.Presentation;

namespace SvgExample
{
    public static class StronglyTypedTools
    {
        public static void AddSvg(Stream stream, string svgPath, double percentageOfCy)
        {
            using PresentationDocument presentationDocument = PresentationDocument.Open(stream, true);
            PresentationPart presentationPart = presentationDocument.PresentationPart ??
                                                throw new InvalidOperationException(@"PresentationDocument is invalid.");

            // Get relationship ID of first slide.
            string sldRelId = presentationPart
                .Presentation
                .SlideIdList?
                .Elements<Presentation.SlideId>()
                .Select(slideId => (string)slideId.RelationshipId!)
                .FirstOrDefault() ?? throw new InvalidOperationException(@"Presentation has no slides.");

            // Get first slide's part.
            var slidePart = (SlidePart)presentationPart.GetPartById(sldRelId);

            // Determine unique relationship IDs for new image parts.
            int partsCount = slidePart.Parts.Count();
            string pngRelId = $"rId{++partsCount}";
            string svgRelId = $"rId{++partsCount}";

            // Add new image part with PNG image to slide part.
            using Stream pngStream = GeneralTools.ReadSvgAsPng(svgPath);
            GeneralTools.AddImagePart(slidePart, ImagePartType.Png, pngRelId, pngStream);

            // Add new image part with SVG image to slide part.
            using Stream svgStream = File.Open(svgPath, FileMode.Open, FileAccess.Read);
            GeneralTools.AddImagePart(slidePart, ImagePartType.Svg, svgRelId, svgStream);

            // Create markup.
            var picture =
                new Presentation.Picture(
                    new Presentation.NonVisualPictureProperties(
                        new Presentation.NonVisualDrawingProperties(
                            new Drawing.NonVisualDrawingPropertiesExtensionList(
                                new Drawing.Extension(
                                    new CreationId
                                    {
                                        Id = GeneralTools.GetNewGuidString(),
                                    }.WithNamespaceDeclaration("a16", "http://schemas.microsoft.com/office/drawing/2014/main"))
                                {
                                    Uri = "{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}",
                                }))
                        {
                            Id = (uint)++partsCount,
                            Name = "Picture 1",
                        },
                        new Presentation.NonVisualPictureDrawingProperties(
                            new Drawing.PictureLocks
                            {
                                NoChangeAspect = true,
                            }),
                        new Presentation.ApplicationNonVisualDrawingProperties()),
                    new Presentation.BlipFill(
                        new Drawing.Blip(
                            new Drawing.BlipExtensionList(
                                new Drawing.Extension(
                                    new SVGBlip
                                    {
                                        Embed = svgRelId,
                                    })
                                {
                                    Uri = "{96DAC541-7B7A-43D3-8B79-37D633B846F1}",
                                }))
                        {
                            Embed = pngRelId,
                        },
                        new Drawing.Stretch(
                            new Drawing.FillRectangle())),
                    GetShapeProperties(presentationPart, percentageOfCy));

            Presentation.ShapeTree shapeTree = slidePart
                .Slide
                .CommonSlideData?
                .ShapeTree ?? throw new InvalidOperationException();

            shapeTree.AppendChild(picture);
        }

        public static TOpenXmlElement WithNamespaceDeclaration<TOpenXmlElement>(
            this TOpenXmlElement element,
            string prefix,
            string uri)
            where TOpenXmlElement : OpenXmlElement
        {
            element.AddNamespaceDeclaration(prefix, uri);
            return element;
        }

        private static Presentation.ShapeProperties GetShapeProperties(PresentationPart part, double percentageOfCy)
        {
            Presentation.SlideSize slideSize = part.Presentation.SlideSize!;
            var slideCx = (int)slideSize.Cx!;
            var slideCy = (int)slideSize.Cy!;

            var extentSize = (long)(slideCy * percentageOfCy);
            long offsetX = (slideCx / 2) - (extentSize / 2);
            long offsetY = (slideCy / 2) - (extentSize / 2);

            return new Presentation.ShapeProperties(
                new Drawing.Transform2D(
                    new Drawing.Offset
                    {
                        X = offsetX,
                        Y = offsetY,
                    },
                    new Drawing.Extents
                    {
                        Cx = extentSize,
                        Cy = extentSize,
                    }),
                new Drawing.PresetGeometry(
                    new Drawing.AdjustValueList())
                {
                    Preset = Drawing.ShapeTypeValues.Rectangle,
                });
        }
    }
}


text:
namespace Microsoft.Azure.Management.Compute
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// GalleryApplicationsOperations operations.
    /// </summary>
    public partial interface IGalleryApplicationsOperations
    {
        /// <summary>
        /// Create or update a gallery Application Definition.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery in which the Application
        /// Definition is to be created.
        /// </param>
        /// <param name='galleryApplicationName'>
        /// The name of the gallery Application Definition to be created or
        /// updated. The allowed characters are alphabets and numbers with
        /// dots, dashes, and periods allowed in the middle. The maximum length
        /// is 80 characters.
        /// </param>
        /// <param name='galleryApplication'>
        /// Parameters supplied to the create or update gallery Application
        /// operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<GalleryApplication>> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Update a gallery Application Definition.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery in which the Application
        /// Definition is to be updated.
        /// </param>
        /// <param name='galleryApplicationName'>
        /// The name of the gallery Application Definition to be updated. The
        /// allowed characters are alphabets and numbers with dots, dashes, and
        /// periods allowed in the middle. The maximum length is 80 characters.
        /// </param>
        /// <param name='galleryApplication'>
        /// Parameters supplied to the update gallery Application operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<GalleryApplication>> UpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Retrieves information about a gallery Application Definition.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery from which the
        /// Application Definitions are to be retrieved.
        /// </param>
        /// <param name='galleryApplicationName'>
        /// The name of the gallery Application Definition to be retrieved.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<GalleryApplication>> GetWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Delete a gallery Application.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery in which the Application
        /// Definition is to be deleted.
        /// </param>
        /// <param name='galleryApplicationName'>
        /// The name of the gallery Application Definition to be deleted.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List gallery Application Definitions in a gallery.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery from which Application
        /// Definitions are to be listed.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<GalleryApplication>>> ListByGalleryWithHttpMessagesAsync(string resourceGroupName, string galleryName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Create or update a gallery Application Definition.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery in which the Application
        /// Definition is to be created.
        /// </param>
        /// <param name='galleryApplicationName'>
        /// The name of the gallery Application Definition to be created or
        /// updated. The allowed characters are alphabets and numbers with
        /// dots, dashes, and periods allowed in the middle. The maximum length
        /// is 80 characters.
        /// </param>
        /// <param name='galleryApplication'>
        /// Parameters supplied to the create or update gallery Application
        /// operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<GalleryApplication>> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplication galleryApplication, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Update a gallery Application Definition.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery in which the Application
        /// Definition is to be updated.
        /// </param>
        /// <param name='galleryApplicationName'>
        /// The name of the gallery Application Definition to be updated. The
        /// allowed characters are alphabets and numbers with dots, dashes, and
        /// periods allowed in the middle. The maximum length is 80 characters.
        /// </param>
        /// <param name='galleryApplication'>
        /// Parameters supplied to the update gallery Application operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<GalleryApplication>> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, GalleryApplicationUpdate galleryApplication, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Delete a gallery Application.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group.
        /// </param>
        /// <param name='galleryName'>
        /// The name of the Shared Application Gallery in which the Application
        /// Definition is to be deleted.
        /// </param>
        /// <param name='galleryApplicationName'>
        /// The name of the gallery Application Definition to be deleted.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string galleryName, string galleryApplicationName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List gallery Application Definitions in a gallery.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="Microsoft.Rest.Azure.CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<GalleryApplication>>> ListByGalleryNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
    }
}


text:
class SessionsController < ApplicationController

  def new
    @bg = "bg-8"
  end

# creates a session for a dog Owner
# here is where we can create a session for a user, but then we can define
#whether or not that user is an owner or a walker
  def create
    @user = User.find_by_email(params[:session][:email])
      if @user && @user.authenticate(params[:session][:password])
        session[:user_id] = @user.id
        owner = Owner.where(:user_id == @user.id)
        redirect_to user_owner_path(@user, owner)
      else
        flash[:alert] = "Your username/password combination was invalid."
        redirect_to 'login'
      end
  end

# creates a session for a dog Walker
  # def create_walker
  #   @user = User.find_by_email(params[:session][:email])
  #     if @user && @user.authenticate(params[:session][:password])
  #       session[:user_id] = @user.id
  #       walker = Walker.where(:user_id == @user.id)
  #       redirect_to user_walker_path(@user, walker)
  #     else
  #       flash[:alert] = "Your username/password combination was invalid."
  #       redirect_to 'login'
  #     end

  # end

  def destroy
    session[:user_id] = nil
    redirect_to "/"
  end

end


text:
game.storyboard = {
    genericLocked = {
        "It's locked.",
        "Cannot open it without a key.",
    },
    genericStuck = {
        "It's stuck.",
        "Cannot open with bare hands.",
    },
    mirror = {
        "The mirror is dirty.",
        "A mirror."
    },
    deadScientist = {
        "It's a dead scientist",
        "What happened here?"
    },
    nothingThere = {
        "Nothing to do there.",
        "I think i'm done with that"
    },
    steam = {
        "I'm not getting through that, it's too hot",
        "Nope."
    },
    boxes = "Boxes filled with dangerous materials.",
    code = "The code reads 5362. I wonder where that goes?",
    paint = "Fresh paint. I wonder why that's here."
}


text:
import * as assert from 'assert';

import Middleware from '../../src/core/middleware';

describe('Middleware', () => {
  it('should be a class', () => {
    assert.ok(typeof Middleware === 'function');
  });

  describe('#constructor', () => {
    it('should have empty stack', () => {
      const middleware = new Middleware();
      assert.equal(0, middleware.stack.length);
    });
  });

  describe('#validate', () => {
    it('it should throw error when exec method is missing', () => {
      const middleware = new Middleware();
      class MyExector {
        // eslint-disable-next-line class-methods-use-this
        isMatched() {
          return true;
        }
      }
      assert.throws(() => {
        middleware.validate(new MyExector());
      }, /exector must implement Exectorable interface/);
    });

    it('should throw error when isMatched method is missing', () => {
      const middleware = new Middleware();
      class MyExector {
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return undefined;
        }
      }
      assert.throws(() => {
        middleware.validate(new MyExector());
      }, /exector must implement Exectorable interface/);
    });
  });

  describe('#use', () => {
    it('should have 1 used executor in stack', () => {
      const middleware = new Middleware();

      class MyExector {
        // eslint-disable-next-line class-methods-use-this
        isMatched() {
          return true;
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return undefined;
        }
      }

      const myExector = new MyExector();
      middleware.use(myExector);

      assert.equal(1, middleware.stack.length);
      assert.equal(myExector, middleware.stack[0]);
    });

    it('should throw with used executor', () => {
      const middleware = new Middleware();

      class MyExector {
        // eslint-disable-next-line class-methods-use-this
        isMatched() {
          return true;
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return undefined;
        }
      }

      const myExector = new MyExector();
      middleware.use(myExector);
      assert.throws(() => {
        middleware.use(myExector);
      }, /MyExector is already in use/);

      assert.equal(1, middleware.stack.length);
      assert.equal(myExector, middleware.stack[0]);
    });
  });

  describe('#findMatchedExector', () => {
    it('should return a matched executor', () => {
      class MyExecutor1 {
        // eslint-disable-next-line class-methods-use-this
        isMatched(...args) {
          return args[0] === 'my1';
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return undefined;
        }
      }

      class MyExecutor2 {
        // eslint-disable-next-line class-methods-use-this
        isMatched(name) {
          return name === 'my2';
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return undefined;
        }
      }

      const middeware = new Middleware();
      middeware.use(new MyExecutor1()).use(new MyExecutor2());

      const foundMy1 = middeware.findMatchedExector('my1', 'hello');
      const foundMy2 = middeware.findMatchedExector('my2', 'hi');

      assert.equal(foundMy1.constructor.name, 'MyExecutor1');
      assert.equal(foundMy2.constructor.name, 'MyExecutor2');
    });

    it('should not return a matched executor', () => {
      class MyExecutor1 {
        // eslint-disable-next-line class-methods-use-this
        isMatched(...args) {
          return args[0] === 'my1';
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return undefined;
        }
      }

      class MyExecutor2 {
        // eslint-disable-next-line class-methods-use-this
        isMatched(name) {
          return name === 'my2';
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return undefined;
        }
      }

      const middeware = new Middleware();
      middeware.use(new MyExecutor1()).use(new MyExecutor2());

      const foundMy1 = middeware.findMatchedExector('my3', 'hello');
      const foundMy2 = middeware.findMatchedExector('my4', 'hi');

      assert.equal(foundMy1, undefined);
      assert.equal(foundMy2, undefined);
    });
  });

  describe('#exec', () => {
    it('should throw no matched executor found error on empty stack', () => {
      const middleware = new Middleware();

      assert.throws(() => {
        middleware.exec();
      }, /no matched exector found/);
    });

    it('should get result from matched executor', () => {
      const middleware = new Middleware();

      class MyExector {
        // eslint-disable-next-line class-methods-use-this
        isMatched(...args) {
          return args[0] === 'hi';
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return 'hello';
        }
      }

      middleware.use(new MyExector());

      const result = middleware.exec('hi', 'hello', 'there');

      assert.equal('hello', result);
    });

    it('should throw no matched executor found error on the registered stack', () => {
      const middleware = new Middleware();

      class MyExector {
        // eslint-disable-next-line class-methods-use-this
        isMatched() {
          return false;
        }
        // eslint-disable-next-line class-methods-use-this
        exec() {
          return 'hello';
        }
      }

      middleware.use(new MyExector());

      assert.throws(() => {
        middleware.exec('hi', 'there');
      }, /no matched exector found/);
    });
  });
});


text:
import math

from naoth.math2d import Vector2 as Vec
from naoth.math2d import LineSegment

from actions import Actions, Actions_2, Actions_3
from state import State

from copy import deepcopy
import numpy as np

class Field():
    """
    the field class represents the soccer field

    this class is going to be the subclass on which world and referee operate

    thus we include functions to check weather the ball in in the field, in one goal,
    outside the field etc.

    """

    width = 9000
    height = 6000
    center_point = Vec(0, 0)
    opp_goal_line = LineSegment(Vec(4500, 750), Vec(4500, -750))
    own_goal_line = LineSegment(Vec(-4500, 750), Vec(-4500, -750))

    objects = []

    def in_own_goal(self, object1, object2=None):
        """
        detects weather the is / went trough in the own goal
        :param object: m2d Vector2
        :return: boolean
        """

        ball_trajectory = self.get_ball_trajectory(object1, object2)

        if object2 is None or ball_trajectory is None:
            # ball trajectory is none, if the two points are less than 1 cm apart
            return (object1.x < -4500 and (-750 < object1.y < 750))
        in_goal = self.own_goal_line.intersect(ball_trajectory) and \
                  ball_trajectory.intersect(self.own_goal_line)
        if in_goal == float('inf'):
            in_goal = 0
        return in_goal

        # return ((object1.x < -4500) and (-750 < object1.y < 750))

    def in_opp_goal(self, object1, object2=None):
        """
        detects weather the ball is / went trough in the opponents goal
        :param object: m2d Vector2
        :return: boolean
        """

        ball_trajectory = self.get_ball_trajectory(object1, object2)

        if object2 is None or ball_trajectory is None:
            # ball trajectory is none, if the two points are less than 1 cm apart
            return (object1.x > 4500 and (-750 < object1.y < 750))

        in_goal = self.opp_goal_line.intersect(ball_trajectory) and \
                  ball_trajectory.intersect(self.opp_goal_line)
        if in_goal == float('inf'):
            in_goal = 0
        return in_goal

    def add_object(self, object):
        self.objects.append(object)

    def object_collision(self, state):
        """
        ball_trajectory = LineSegment(state.position, state.ball_position)

        collision = object.intersect(ball_trajectory) and \
                  ball_trajectory.intersect(object)

        if collision == float('inf'):
            collision = 0
        return collision
        """
        ball_trajectory = self.get_ball_trajectory(state.position, state.ball_position)

        for object in self.objects:
            if object.collision(ball_trajectory):
                return True
        return False

    def in_field(self, object):
        """
        detects weather the object is in the field
        :param object: m2d Vector2
        :return: boolean
        """
        return ((-4500 <= object.x <= 4500) and (-3000 <= object.y <= 3000))

    def get_ball_trajectory(self, player, ball):
        """

        :param ball: math2d Vector2 object
        :param player: math2d Vector2 object
        :return: return line segment
        """
        return LineSegment(player, ball)

class Rules(Field):
    """
    the rules class checks ball positions and manipulates the ball according to the
    RoboCup Standard Platform League - rules

    this implementation is going to be rather naive and not complete
    """

    def ball_in_goal(self, state):
        ball = state.ball_position
        player = state.position

        if self.in_own_goal(ball, player) or self.in_opp_goal(ball, player):
            ball = self.center_point

    def ball_out(self, state):
        ball = state.ball_position
        player = state.position

        if not (self.in_field(ball, player) or self.ball_in_goal(ball, player)):
            self.throw_in(state)

    def throw_in(self, state):
        """
        Throw-in rules:
            Throw-in line:  400mm into the field from side lines
                            7000mm long (from (-3500,-2600) to (3500,-2600) &
                                            (-3500, 2600) to (3500, 2600) )

                - ball placed on throw-in line on the same side
                - paces farthest back of one of these options:
                    * 1000mm back form the robot
                    * 1000mm back from the point where it went out
                    * always placed on the throw-in line

            End-line:
                - if last touched by defensive team
                    -> placed at closed endpoint of throw-in line
                - if last touched by offensive team
                    -> placed on the throw-in line on the farthes back of these positions:
                        * 1000mm back from last touched robot
                        * at the intersection of halfway and throw-in line (0, -2600) or (0, 2600)

        :param ball: ball position (x,y) coordinates
        :param player: player position (x,y) coordinates
        :return: new ball position (x,y) coordinates
        """

        ball = state.ball_position
        player = state.position

        new_ball = Vec()
        if (not self.in_field(ball)) and (not self.in_own_goal(ball, player)) and (
        not self.in_opp_goal(ball, player)):
            if player is not None:
                ## here we always asume that there is only one player thus we know who touched the ball at last
                ### the opponent goal is on the right, the own goal on the left side
                # first case: ball went out crossing a sideline
                if -4500 < ball.x < 4500:
                    if ball.x <= player.x:
                        # take option which places the ball the furthest back
                        new_ball.x = (ball.x - 1000)
                    else:
                        new_ball.x = (player.x - 1000)
                    if new_ball.x > 3500:
                        new_ball.x = 3500
                    if new_ball.x < -3500:
                        new_ball.x = -3500
                # second case: ball went out crossing the end-line
                if ball.x > 4500:
                    if player.x - 1000 < 0:
                        new_ball.x = 0
                    else:
                        new_ball.x = player.x - 1000
                if ball.x < -4500:
                    new_ball.x = -3500  # adding random noise

                if ball.y > 0:  # set on upper or lower throw-in line
                    new_ball.y = 2600
                else:
                    new_ball.y = -2600

            ball = new_ball  # set new_ball as ball otherwise just return the ball position
        state.ball_position = ball

class World(Rules, Actions_3):
    """
    This class models the World in which the Robot interacts

    With this class all actual actions get calculated and then passed on, in simpler form ( given trough features ),
    to the environment on which the agent learns it behaviour.

    For further information see the documentation.

    TODO: Write Documentation!

    """

    reset_x_range = [-4490, 4490]
    reset_y_range = [-2990, 2990]
    reset_rad_range = [0, 2 * np.pi]

    history = []  # add max size??

    state = None

    def __init__(self, reward_function, feature_function):
        Actions_3.__init__(self, add_noise=True)
        if feature_function is None:
            self.feature = lambda state=None, return_output_state=None: None
        else:
            self.feature = feature_function  # feature function which gives a feature vector

        if reward_function is None:
            self.reward = lambda state=None, old_state=None: None
        else:
            self.reward = lambda state, old_state: reward_function(self, state,
                                                                   old_state)  # reward function which derives reward from state ( inout must be State object )

        self.state = self.reset_state()  # initialize state

    def current_state(self):
        return self.feature(self.state)

    def perform_action(self, state, chosen_action):
        """
        simulates a chosen action (with noise)

        :param state: current state of the robot
        :param chosen_action: integer between 0,...,(nr of actions - 1)
        :return: None
        """

        action_list, _ = self.get_actions_from_state(state)

        action_list[chosen_action](state)  # take action
        self.throw_in(state)  # check throw in rules

    def move_robot_to_ball(self, state):
        """
        move the robot to ball position

        function manipulates input object -> no return
        """

        # just set if position are not equal
        # (otherwise rotation action could get lost)
        if state.position.x != state.ball_position.x or \
                state.position.y != state.ball_position.y:
            # robot orientation (direction) is the direction of the shortest path to the ball
            state.direction = (state.ball_position - state.position).normalize()
            # new position is equal to ball position
            state.position = state.ball_position

    def step_old(self, state, action):
        self.perform_action(state, action)
        self.move_robot_to_ball(state)

    def reset_state(self, range_x=reset_x_range, range_y=reset_y_range, range_rad=reset_rad_range):
        new_state = State()

        new_state.position.x = np.random.randint(range_x[0],
                                                 range_x[1])  # get random position in field
        new_state.position.y = np.random.randint(range_y[0], range_y[1])
        new_state.ball_position = deepcopy(new_state.position)

        rad = range_rad[1] * np.random.rand() - range_rad[0] * np.random.rand()
        new_state.direction = Vec(1, 0).rotate(rad)
        self.state = new_state

    def terminated(self, state):
        # position and ball position should not be equal for this check to be usefull!!
        if self.in_opp_goal(state.position, state.ball_position):
            return True  # reward = 100
        elif self.in_own_goal(state.position, state.ball_position):
            return True  # reward = -100

        for obstacle in self.obstacles:
            pass  # check collision

        return False

    def reset_history(self):
        self.history = []

    def remember(self, state, action, reward, next_state, done):
        self.history.append((state, action, reward, next_state, done))

    def step(self, action):
        # watch out for correct evaluation process:
        #   state -> predict action -> do action -> receive reward -> get termination state-> move to new position
        #       -> add to history

        old_state = deepcopy(self.state)

        self.perform_action(self.state, action)  # do action

        reward, done = self.reward(self.state, old_state)  # get reward for action

        # done = self.terminated(self.state)  # get termination state (bool)

        self.move_robot_to_ball(self.state)  # move robot to ball

        new_state = deepcopy(self.state)

        self.remember(old_state, action, reward, new_state, done)  # add to history

        observation = self.feature(
            self.state)  # output the observation for environment (simplified position)

        info = {}

        return observation, reward, done, info

    def reset(self):
        self.reset_state()
        self.reset_history()
        return self.feature(self.state)

    def close(self):
        self.reset()

    def render(self):
        from matplotlib import pyplot as plt
        from naoth import math2d as m2d
        from tools.tools import draw_field

        state_history = [None] * len(self.history)
        action_history = [None] * len(self.history)
        for i, entry in enumerate(self.history):
            state_history[i] = entry[0]
            action_history[i] = entry[1]
            if i == len(self.history) - 1:
                state_history.append(entry[3])

        print(action_history)
        print(str(len(self.history)))

        plt.clf()
        axes = plt.gca()
        draw_field(axes)

        # h1 = np.array([[h.state.pose.translation.x, h.state.pose.translation.y] for h in run])
        positions = np.array([[state.position.x, state.position.y] for state in state_history])
        # plt.plot(positions[:,0], positions[:,1], '-or')

        _, action_names = self.get_actions_degree(0)

        for i, state in enumerate(state_history):
            # plt.scatter(positions[:i+1, 0], positions[:i+1, 1], '-or')

            plt.plot(positions[:i + 1, 0], positions[:i + 1, 1], '-or')

            arrow_head = m2d.Vector2(500, 0).rotate(state.direction.angle())
            axes.arrow(state.position.x, state.position.y, arrow_head.x, arrow_head.y,
                       head_width=100,
                       head_length=100, fc='k', ec='k')
            if i < len(state_history) - 1:
                axes.text(x=positions[i, 0], y=positions[i, 1] + 30,
                          s=action_names[action_history[i]])
            plt.pause(0.2)
        plt.show()

        print("#" * 20)

if __name__ == "__main__":
    import features
    import reward
    from naoth import math2d

    simWorld = World(reward.simple_reward, features.no_features_normalized)
    simWorld.state = State(position=math2d.Vector2(4000, 2800), direction=math2d.Vector2(0, 1))
    # print simWorld.feature(simWorld.state).shape
    simWorld.step(0)
    simWorld.step(0)
    simWorld.render()


text:
<!DOCTYPE html>

  <meta charset="UTF-8">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

  <link rel="stylesheet" href="https://js.arcgis.com/4.7/esri/css/main.css">


text:
#ifndef _ASM_X86_KVM_PARA_H
#define _ASM_X86_KVM_PARA_H

#include <linux/types.h>

/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx.  It
 * should be used to determine that a VM is running under KVM.
 */
#define KVM_CPUID_SIGNATURE	0x40000000

/* This CPUID returns a feature bitmap in eax.  Before enabling a particular
 * paravirtualization, the appropriate feature bit should be checked.
 */
#define KVM_CPUID_FEATURES	0x40000001
#define KVM_FEATURE_CLOCKSOURCE		0
#define KVM_FEATURE_NOP_IO_DELAY	1
#define KVM_FEATURE_MMU_OP		2

#define MSR_KVM_WALL_CLOCK  0x11
#define MSR_KVM_SYSTEM_TIME 0x12

#define KVM_MAX_MMU_OP_BATCH           32

/* Operations for KVM_HC_MMU_OP */
#define KVM_MMU_OP_WRITE_PTE            1
#define KVM_MMU_OP_FLUSH_TLB	        2
#define KVM_MMU_OP_RELEASE_PT	        3

/* Payload for KVM_HC_MMU_OP */
struct kvm_mmu_op_header {
	__u32 op;
	__u32 pad;
};

struct kvm_mmu_op_write_pte {
	struct kvm_mmu_op_header header;
	__u64 pte_phys;
	__u64 pte_val;
};

struct kvm_mmu_op_flush_tlb {
	struct kvm_mmu_op_header header;
};

struct kvm_mmu_op_release_pt {
	struct kvm_mmu_op_header header;
	__u64 pt_phys;
};

#endif /* _ASM_X86_KVM_PARA_H */


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ComboBoxEnabledItems
{
	public class TreeNode
	{
		public string Symbol { get; set; }
		public List<TreeNode> Children { get; set; }
	}
}


text:
require 'attribute_predicates/extensions/module'
require 'attribute_predicates/extensions/active_record'


text:
import { syncHistory } from 'redux-simple-router';
import { hashHistory } from 'react-router';
import { alerts } from '../actions';
import { unauthorized } from '../actions/auth';

// should catch any API errors and act accordingly
export const apiErrorMiddleware = store => next => action => {
  const result = next(action);

  if (result.payload && result.payload.error) {
    const { error } = result.payload;

    switch (error.status) {

      case 400:

        store.dispatch(alerts.warning('There was an error in your submission: ' + error.data));
        break;

      case 401:

        store.dispatch(unauthorized());
        break;

      case 404:

        store.dispatch(alerts.warning(
          'Sorry, an error has occurred: this action is not available'));
        break;

      default:

        store.dispatch(alerts.warning('Sorry, an error has occurred'));
        break;
    }
  }
  return result;
};

export const reduxRouterMiddleware = syncHistory(hashHistory);


text:
package de.vproductions.pdi.plugin.step.googleanalyticsmanagementapi;

import org.pentaho.di.core.Const;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.row.RowDataUtil;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.*;
import org.pentaho.di.i18n.BaseMessages;

import com.google.api.services.analytics.Analytics;
//import com.google.api.services.analytics.model.Accounts;
//import com.google.api.services.analytics.model.Profile;
import com.google.api.services.analytics.model.Profiles;
//import com.google.api.services.analytics.model.Webproperties;

public class GoogleAnalyticsManagement extends BaseStep implements StepInterface {

	private static Class<?> PKG = GoogleAnalyticsManagementMeta.class; // for i18n purposes

	private GoogleAnalyticsManagementData data;
	private GoogleAnalyticsManagementMeta meta;

	private Analytics analytics;

	public GoogleAnalyticsManagement(StepMeta s, StepDataInterface stepDataInterface, int c, TransMeta t, Trans dis) {
		super(s, stepDataInterface, c, t, dis);
	}

	public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
		meta = (GoogleAnalyticsManagementMeta) smi;
		data = (GoogleAnalyticsManagementData) sdi;

		Object[] r = getRow(); // get row, blocks when needed!
		if (r == null) // no more input to be expected...
		{
			setOutputDone();
			return false;
		}

		if (first) {
			first = false;

			data.outputRowMeta = (RowMetaInterface) getInputRowMeta().clone();
			meta.getFields(data.outputRowMeta, getStepname(), null, null, this);

		}

		Object[] outputRow = callGoogleAnalyticsManagement(r);

		putRow(data.outputRowMeta, outputRow); // copy row to possible alternate rowset(s)

		if (checkFeedback(getLinesRead())) {
			logBasic("Linenr " + getLinesRead()); // Some basic logging
		}

		return true;
	}

	private Object[] callGoogleAnalyticsManagement( Object[] rowData ) throws KettleException {

		Object[] newRow = null;
	    if ( rowData != null ) {
	      newRow = rowData.clone();
	    }

	    newRow = RowDataUtil.addValueData( newRow, data.outputRowMeta.size() - 1, data.profiles );

		return newRow;
	}

	public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
		meta = (GoogleAnalyticsManagementMeta) smi;
		data = (GoogleAnalyticsManagementData) sdi;

		if ( !super.init( smi, sdi ) ) {
		      return false;
		}

	    String appName = environmentSubstitute( meta.getApplicationName() );
	    String serviceAccount = environmentSubstitute( meta.getServiceAccountMail() );
	    String OAuthKeyFile = environmentSubstitute( meta.getP12File() );

	    if ( log.isDetailed() ) {
	      logDetailed( BaseMessages.getString( PKG, "GoogleAnalyticsManagementDialog.GeneralTab.SettingsGroup.ApplicationName.Label" ) + ": " + appName );
	      logDetailed( BaseMessages.getString( PKG, "GoogleAnalyticsManagementDialog.AuthTab.APIAuthGroup.ServiceAccountMail.Label" ) + ": " + serviceAccount );
	      logDetailed( BaseMessages.getString( PKG, "GoogleAnalyticsManagementDialog.AuthTab.APIAuthGroup.P12File.Label" ) + ": " + OAuthKeyFile );
	    }

		try {
		      // Create an Analytics object, and fetch what we can for later (account name, e.g.)
		      analytics = GoogleAnalyticsManagementApiFramework.createFor(
		        environmentSubstitute( meta.getApplicationName() ),
		        environmentSubstitute( meta.getServiceAccountMail() ),
		        environmentSubstitute( meta.getP12File() )
		      ).getAnalytics();
		      // There is necessarily an account name associated with this, so any NPEs or other exceptions mean bail out
		      //accountName = analytics.management().accounts().list().execute().getItems().iterator().next().getName();
//		      Accounts accounts = analytics.management().accounts().list().execute();
//		      Webproperties properties = analytics.management().webproperties().list("~all").execute();

//    		  if (properties.getItems().isEmpty()) {
//		        System.err.println("No Webproperties found");
//		      } else {
//		        String firstWebpropertyId = properties.getItems().get(0).getId();

		      //logError("all profiles: " + analytics.management().profiles().list("~all", "~all").execute());
		      // 1: accountId
		      // 2: webPropertyId

		      Profiles profiles = analytics.management().profiles().list(environmentSubstitute( meta.getAccountId() ), environmentSubstitute( meta.getWebPropertyId() )).execute();
		      data.profiles = profiles;

//		      for (Profile profile : profiles.getItems()) {
//		    	  logError("View (Profile) ID: " + profile.getId());
//		    	  logError("View (Profile) Name: " + profile.getName());
//		      }

		} catch ( Exception e ) {
			logError( e.toString() );
			return false;
		}
		return true;

	}

	public void dispose(StepMetaInterface smi, StepDataInterface sdi) {
		meta = (GoogleAnalyticsManagementMeta) smi;
		data = (GoogleAnalyticsManagementData) sdi;

		super.dispose(smi, sdi);
	}

	//
	// Run is were the action happens!
	public void run() {
		logBasic("Starting to run...");
		try {
			while (processRow(meta, data) && !isStopped())
				;
		} catch (Exception e) {
			logError("Unexpected error : " + e.toString());
			logError(Const.getStackTracker(e));
			setErrors(1);
			stopAll();
		} finally {
			dispose(meta, data);
			logBasic("Finished, processing " + getLinesRead() + " rows");
			markStop();
		}
	}

}


text:
<?php

/**
 * Page cache observer model
 *
 * @category    Mage
 * @package     Mage_PageCache
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_PageCache_Model_Observer
{
    const XML_NODE_ALLOWED_CACHE = 'frontend/cache/allowed_requests';

    /**
     * Check if full page cache is enabled
     *
     * @return bool
     */
    public function isCacheEnabled()
    {
        return Mage::helper('pagecache')->isEnabled();
    }

    /**
     * Check when cache should be disabled
     *
     * @param Varien_Event_Observer $observer
     * @return Mage_PageCache_Model_Observer
     */
    public function processPreDispatch(Varien_Event_Observer $observer)
    {
        if (!$this->isCacheEnabled()) {
            return $this;
        }
        $action = $observer->getEvent()->getControllerAction();
        $request = $action->getRequest();
        $needCaching = true;

        if ($request->isPost()) {
            $needCaching = false;
        }

        $configuration = Mage::getConfig()->getNode(self::XML_NODE_ALLOWED_CACHE);

        if (!$configuration) {
            $needCaching = false;
        }

        $configuration = $configuration->asArray();
        $module = $request->getModuleName();
        $controller = $request->getControllerName();
        $action = $request->getActionName();

        if (!isset($configuration[$module])) {
            $needCaching = false;
        }

        if (isset($configuration[$module]['controller']) && $configuration[$module]['controller'] != $controller) {
            $needCaching = false;
        }

        if (isset($configuration[$module]['action']) && $configuration[$module]['action'] != $action) {
            $needCaching = false;
        }

        if (!$needCaching) {
            Mage::helper('pagecache')->setNoCacheCookie();
        }

        return $this;
    }
}


text:
e(fx)clipse samples for Wuff
======================
[![Build Status](https://travis-ci.org/mcmil/wuff-efxclipse-samples.svg)](https://travis-ci.org/mcmil/wuff-efxclipse-samples)
[![Wuff Compatibility](https://img.shields.io/badge/wuff-0.0.14-47b31f.svg)](https://github.com/mcmil/wuff/tree/efxclipse)

The samples presented in this repository are built against the latest build of [Wuff](https://github.com/akhikhl/wuff). Currently version `0.0.14` is supported. Initially [Contacts-Griffon](https://github.com/tschulte/contacts-griffon) sample application was used as base for their creation.

The samples are created to work with [Wuff IntelliJ plugin](https://github.com/mcmil/wuff-intellij-plugin).

##Samples
This sample is used to illustrate the idea of multi-module efxclipse projects with wuff. It contains two elements:

* [pl.cmil.wuff.sample.main](pl.cmil.wuff.sample.main) A startup module which renders a simple JavaFX part.
* [pl.cmil.wuff.sample.services](pl.cmil.wuff.sample.services) A simple POJO service.

Wuff configuration is available in the [build.gradle](build.gradle) file in the root project.

If you are looking for a barebone, simple application see the [wuff-skeleton](https://github.com/mcmil/wuff-skeleton) sample.

### Starting the samples

To run the application simply download the repository to a desired directory, and run `gradlew run` in it.

##Requirements
JDK 1.8.0_u20 or later is required to run the samples.