text:
'use strict';

/* Controllers */

angular.module('myApp.controllers', ['firebase.utils', 'simpleLogin'])
  .controller('LinksCtrl', ['$scope', '$location', 'User', 'Link', 'Auth', '$routeParams',
    function ($scope, $location, User, Link, Auth, $routeParams) {
        if ($location.path() === '/')
        {
            $scope.links = Link.all;
            $scope.linksPagin = true;

        }
        else {
            $scope.linksPagin = false;
        }

        $scope.currentPage = 0;

        $scope.totalItems = $scope.links.length;
        $scope.pageSize = 10;
        $scope.numberOfPages = function() {
            return Math.ceil($scope.links.length / $scope.pageSize)
        };

        $scope.currentPageSub = function() {
          if($scope.currentPage >= 1) {
              $scope.currentPage = $scope.currentPage - 1;
          }
        };

        $scope.currentPageAdd = function() {
            if($scope.currentPage < $scope.links.length / $scope.pageSize - 1) {
                $scope.currentPage = $scope.currentPage + 1;
            }
        };

        $scope.link = {url: 'http://'};

        $scope.upVoteNum = function(link) {
            try {
                var votes = link.upVotes;
                var count = 0;
                angular.forEach(votes, function() {
                    count += 1;
                });
                return count;
            }
            catch (e) {
                return null;
            }

        };

        $scope.downVoteNum = function(link) {
            try {
                var votes = link.downVotes;
                var count = 0;
                angular.forEach(votes, function() {
                    count += 1;
                });
                return count;
            }
            catch (e) {
                return null;
            }
        };

        $scope.deleteLink = function (linkId) {
            /* link is a $firebase object and sent to Link.delete */
            Link.delete(linkId);
        };
  }])

  .controller('PostsCtrl', ['$scope', '$location', 'User', 'Post',
    function ($scope, $location, User, Post) {

        if ($location.path() === '/posts')
        {
            $scope.posts = Post.all;
            $scope.postsPagin = true;
        }
        else {
            $scope.postsPagin = false;
        }

        $scope.currentPage = 0;
        $scope.totalItems = $scope.posts.length;
        $scope.pageSize = 10;

        $scope.numberOfPages = function() {
            return Math.ceil($scope.posts.length / $scope.pageSize)
        };

        $scope.currentPageSub = function() {
            if($scope.currentPage >= 1) {
                $scope.currentPage = $scope.currentPage - 1;
            }
        };

        $scope.currentPageAdd = function() {
            if($scope.currentPage < $scope.posts.length / $scope.pageSize - 1) {
                $scope.currentPage = $scope.currentPage + 1;
            }
        };

        $scope.deletePost = function (postId) {
            Post.delete(postId);
        };

        $scope.upVoteNum = function(post) {
            try {
                var votes = post.upVotes;
                var count = 0;
                angular.forEach(votes, function() {
                    count += 1;
                });
                return count;
            }
            catch (e) {
                return null;
            }

        };

        $scope.downVoteNum = function(post) {
            try {
                var votes = post.downVotes;
                var count = 0;
                angular.forEach(votes, function() {
                    count += 1;
                });
                return count;
            }
            catch (e) {
                return null;
            }
        };
    }])

  .controller('FeedCtrl', ['$scope', 'User', 'Post', 'Link', '$timeout',
    function($scope, User, Post, Link, $timeout) {

        $scope.feedPosts = [];
        $scope.feedLinks = [];

        $scope.allLinks = Link.all;
        $scope.allPosts = Post.all;

        $scope.$on('$firebaseSimpleLogin:login', function() {
            $timeout(function() {
                if (User.getCurrent() !== undefined) {
                    $scope.thisUser = User.returnCurrent(User.getCurrent());
                }
            }, 750);

            $timeout(function() {
                $scope.$watchCollection('allLinks', function() {
                    $scope.feedLinks = [];
                    populateFeedLinks();
                });
            }, 1000);

            $timeout(function() {
                $scope.$watchCollection('allPosts', function() {
                    $scope.feedPosts = [];
                    populateFeedPosts();
                });
            }, 1000);
        });

        function populateFeedLinks() {
            for(var i = 0; i < $scope.allLinks.length; i++) {
                if ($scope.allLinks[i].owner === $scope.thisUser.username) {
                    $scope.feedLinks.push($scope.allLinks[i]);
                }
            }

        }

        function populateFeedPosts() {
            for(var i = 0; i < $scope.allPosts.length; i++) {
                if ($scope.allPosts[i].owner === $scope.thisUser.username) {
                    $scope.feedPosts.push($scope.allPosts[i]);
                }
            }
        }

        $scope.deletePost = function (post) {
            Post.delete(post);
            var idx = $scope.feedPosts.indexOf(post);
            $scope.feedPosts.splice(idx, 1);
        };

        $scope.deleteLink = function (link) {
            Link.delete(link);
            var idx = $scope.feedLinks.indexOf(link);
            $scope.feedLinks.splice(idx, 1);
        };
    }])

  .controller('MapCtrl', ['$scope', 'Map', 'User', '$timeout',
    function($scope, Map, User, $timeout) {

    $scope.maps = Map.all;

    var localMaps = [];
    $scope.theseMaps = [];

    $scope.mapOptions = {
        center: new google.maps.LatLng(30.270, -97.746),
        zoom: 4,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    $scope.maps.$loaded(function() {

        $timeout(function() {
            for(var i = 0; i < $scope.maps.length; i++) {
                placeMarker($scope.maps[i].k, $scope.maps[i].B,
                    $scope.maps[i].owner, $scope.maps[i]);
                if (localMaps.indexOf($scope.maps[i]) == $scope.maps[i]) {
                    break;
                }
                else {
                    localMaps.push($scope.maps[i]);
                }
            }
        }, 450)

    });

    function placeMarker(lat, long, owner, map) {
        if (owner === User.getCurrent().username) {
            var color = 'https://maps.google.com/mapfiles/ms/icons/red-dot.png'
        }
        else {
            var color = 'https://maps.google.com/mapfiles/ms/icons/green-dot.png'
        }
        $scope.theseMaps.push(new google.maps.Marker({
            position: new google.maps.LatLng(lat, long),
            map: $scope.myMap,
            owner: owner,
            id: map.$id,
            content: map.content,
            icon: color
        }));

    }

    $scope.setMarkerInfo = function(marker, content) {
        if(marker.content !== '') {
            marker.content = content;
            Map.setContent(marker.id, content);
        }
    };

    $scope.openMarkerInfo = function(marker) {
        $scope.currentMarker = marker;
        $scope.currentMarkerLat = marker.getPosition().lat();
        $scope.currentMarkerLng = marker.getPosition().lng();
        $scope.myInfoWindow.open($scope.myMap, marker);
    };

    $scope.addMarker = function($event, $params) {

        var marker = new google.maps.Marker({
            map: $scope.myMap,
            position: $params[0].latLng,
            owner: User.getCurrent().username
        });

        Map.createMarker(marker.position).then(function(ref){
            marker.id = ref;
            $scope.theseMaps.push(marker);
            $scope.currentMarker = marker;
            $scope.currentMarkerLat = marker.getPosition().lat();
            $scope.currentMarkerLng = marker.getPosition().lng();
            $scope.myInfoWindow.open($scope.myMap, marker);
        });
    };

    $scope.deleteMarker = function(marker) {
        var idx = $scope.theseMaps.indexOf(marker);
        if ($scope.theseMaps[idx] !== undefined) {
            $scope.theseMaps[idx].setMap(null);
            $scope.currentMarker = null;
            Map.delete(marker);
            $scope.theseMaps.splice(idx, 1);
        }
        }
    }])

  .controller('ChatCtrl', ['$scope', 'messageList', function($scope, messageList) {
    $scope.messages = messageList;
    $scope.addMessage = function(newMessage) {
      if( newMessage ) {
        $scope.messages.$add({text: newMessage});
      }
    };
  }])

  .controller('NavCtrl', ['$scope', '$location', 'User', 'Link', 'Post', 'Auth', '$timeout',
    function($scope, $location, User, Link, Post, Auth, $timeout){

        $scope.$on('$firebaseSimpleLogin:login', function() {
            /*$timeout(function() {
                $scope.$apply();
            }, 1000);*/

        });

        $scope.linkBool = true;
        $scope.postBool = false;
        $scope.link = {url: 'http://', title: ''};
        $scope.post = {title: '', content: ''};

        $scope.submitFlub = function() {
            if ($scope.linkBool) {
                if ($scope.link.url.match(
                    /([^w][A-z][^w]*[A-z])+(\.[a-z\.]{2,6})([\/\w \.-]*)/i) === null) {
                    $scope.error = 'Not a valid URL';
                }
                else {
                    Link.create($scope.link).then(function(linkId) {
                        /* ref is Firebase ref used to create instance */
                        $location.path('/links/' + linkId);
                        $scope.link = {url: 'http://', title: ''};
                    });
                }
            }

            else if(!$scope.linkBool) {
                Post.create($scope.post).then(function(postId) {
                   console.log(postId);
                   $scope.post = {title: '', content: ''};
                });
            }
        };

        $scope.changeToPost = function() {
            $scope.linkBool = false;
            $scope.postBool = true;
        };

        $scope.changeToLink = function() {
            $scope.linkBool = true;
            $scope.postBool = false;
        };

        $scope.changeToMap = function() {
            $scope.linkBool = false;
            $scope.postBool = false;
        };

        $scope.logout = function() {
            Auth.logout();
        };

  }])

  .controller('AuthCtrl', ['$scope', '$location', 'Auth', 'User',
    function($scope, $location, Auth, User) {
        if (Auth.signedIn()) {
            $location.path('/');
        }

        $scope.$on('$firebaseSimpleLogin:login', function () {
            $location.path('/');
        });

        $scope.login = function() {
            Auth.login($scope.user).then(function() {
                $location.path('/');
            }, function(error) {
                $scope.error = error.toString();
            });
        };

        $scope.register = function(){
            if ($scope.user.password !== $scope.user.confPass) {
                $scope.error = 'passwords do not match';
            }
            else {
                Auth.register($scope.user).then(function (authUser) {
                    User.create(authUser, $scope.user.username);
                    $location.path('/');
                    alert("Success! You may now login.");

                }, function (error) {
                    $scope.error = error.toString();
                });
            }
        };
    }])

  .controller('ProfileCtrl', ['$scope', '$routeParams', 'User', 'Link', 'Post', '$timeout',
    function($scope, $routeParams, User, Link, Post, $timeout) {

    $timeout(function() {
        $scope.user = User.findByUsername($routeParams.username);
    }, 450);

    $scope.links = {};
    $scope.posts = {};
    $scope.commentedLinks = {};
    $scope.commentedPosts = {};
    $scope.linkComments = {};
    $scope.postComments = {};

    $timeout(function() {

        $scope.user.$loaded(function() {
            populateLinks();
            populatePosts();
            populateLinkComments();
            populatePostComments();
        });

    }, 750);

    function populateLinks() {
        var links = User.links($scope.user.$id).$asArray();

        links.$loaded(function() {

            angular.forEach(links, function(link) {
                $scope.links[link.$id] = Link.find(link.$value);
            });
        });

    }

    function populatePosts() {
        var posts = User.posts($scope.user.$id).$asArray();

        posts.$loaded(function() {

            angular.forEach(posts, function(post) {
                $scope.posts[post.$id] = Post.find(post.$value);
            });
        });

    }

    function populateLinkComments() {
        var comments = User.comments($scope.user.$id).$asArray();

        comments.$loaded(function() {
            angular.forEach(comments, function(comment){

                var link = Link.find(comment.$value);

                link.$loaded(function() {
                    if (link.$value !== null) {
                        var linkComments = Link.comments(comment.$value).$asObject();

                        linkComments.$loaded(function() {
                            $scope.commentedLinks[comment.$id] = link;
                            $scope.linkComments[comment.$id] = linkComments[comment.$id];
                        });
                    }

                });

            });
        });

      }

    function populatePostComments() {

        var comments = User.comments($scope.user.$id).$asArray();

        comments.$loaded(function () {
            angular.forEach(comments, function (comment) {

                var post = Post.find(comment.$value);

                post.$loaded(function () {
                    if (post.$value !== null) {
                        var postComments = Post.comments(comment.$value).$asObject();

                        postComments.$loaded(function () {
                            $scope.commentedPosts[comment.$id] = post;
                            $scope.postComments[comment.$id] = postComments[comment.$id];

                        })
                    }
                });
            });
        });

    }

  }])

  .controller('LinkViewCtrl', ['$scope', '$routeParams', '$route', 'User', 'Link', '$location', '$timeout',
    function($scope, $routeParams, $route, User, Link, $location, $timeout) {
        /*linkId is an obj attr on $routeParams because it's defined in the app.js route ':linkId
         could be named anything*/
        $scope.link = Link.find($routeParams.linkId);

        $scope.comments = Link.comments($routeParams.linkId).$asArray();
        $scope.thisUpVote = false;
        $scope.thisDownVote = false;

        $scope.addComment = function() {
            Link.addComment($routeParams.linkId, $scope.comment);
            $scope.comment = '';
        };

        $scope.removeComment = function(comment) {
            Link.deleteComment($scope.link.$id, comment);
        };

        $scope.upVoted = function(link) {
            if (User.upVoted(link) === true) {
                return User.upVoted(link);
            }
        };

        $scope.downVoted = function(link) {
            if (User.downVoted(link) === true) {
                return User.downVoted(link);
            }
        };

        $scope.upVoteLink = function(link) {
            if(!$scope.thisUpVote){
                Link.upVote(link);
                $scope.thisUpVote = true;
            }

        };

        $scope.downVoteLink = function(link) {
            if (!$scope.thisDownVote) {
                Link.downVote(link);
                $scope.thisDownVote = true;
            }

        };

  }])

  .controller('PostViewCtrl', ['$scope', '$routeParams', 'User', 'Post',
    function($scope, $routeParams, User, Post) {
        $scope.post = Post.find($routeParams.postId);
        $scope.thisUpVote = false;
        $scope.thisDownVote = false;

        $scope.comments = Post.comments($routeParams.postId).$asArray();

        $scope.addComment = function() {
            Post.addComment($routeParams.postId, $scope.comment);
            $scope.comment = '';
        };

        $scope.removeComment = function(comment) {
            Post.deleteComment($scope.post.$id, comment);
        };

        $scope.upVoted = function(post) {
            if (User.upPostVoted(post) === true) {
                return User.upPostVoted(post);
            }
        };

        $scope.downVoted = function(post) {
            if (User.downPostVoted(post) === true) {
                return User.downPostVoted(post);
            }
        };

        $scope.upVotePost = function(post) {
            if(!$scope.thisUpVote){
                Post.upVote(post);
                $scope.thisUpVote = true;
            }

        };

        $scope.downVotePost = function(post) {
            if (!$scope.thisDownVote) {
                Post.downVote(post);
                $scope.thisDownVote = true;
            }

        };

    }])

  .controller('AccountCtrl', ['$scope', 'simpleLogin', 'fbutil', '$location',
    function($scope, simpleLogin, fbutil, $location) {
      // create a 3-way binding with the user profile object in Firebase
      var profile = fbutil.syncObject(['users', User.uid]);
      profile.$bindTo($scope, 'profile');

      // expose logout function to scope
      $scope.logout = function() {
        profile.$destroy();
        simpleLogin.logout();
        $location.path('/login');
      };

      $scope.changePassword = function(pass, confirm, newPass) {
        resetMessages();
        if( !pass || !confirm || !newPass ) {
          $scope.err = 'Please fill in all password fields';
        }
        else if( newPass !== confirm ) {
          $scope.err = 'New pass and confirm do not match';
        }
        else {
          simpleLogin.changePassword(profile.email, pass, newPass)
            .then(function() {
              $scope.msg = 'Password changed';
            }, function(err) {
              $scope.err = err;
            })
        }
      };

      $scope.clear = resetMessages;

      $scope.changeEmail = function(pass, newEmail) {
        resetMessages();
        profile.$destroy();
        simpleLogin.changeEmail(pass, newEmail)
          .then(function(user) {
            profile = fbutil.syncObject(['users', User.uid]);
            profile.$bindTo($scope, 'profile');
            $scope.emailmsg = 'Email changed';
          }, function(err) {
            $scope.emailerr = err;
          });
      };

      function resetMessages() {
        $scope.err = null;
        $scope.msg = null;
        $scope.emailerr = null;
        $scope.emailmsg = null;
      }
    }
  ]);


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.testingsoftware.selrunner Class Hierarchy (SelRunner 0.1.1-SNAPSHOT API)</title>
<meta name="date" content="2013-05-06">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package org.testingsoftware.selrunner

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

org.testingsoftware.selrunner.AbstractRunner

org.testingsoftware.selrunner.ChromeRunner

org.testingsoftware.selrunner.FirefoxRemoteRunner

org.testingsoftware.selrunner.FirefoxRunner

org.testingsoftware.selrunner.InternetExplorerRemoteRunner

org.testingsoftware.selrunner.InternetExplorerRunner

org.testingsoftware.selrunner.PhantomJsRunner

org.testingsoftware.selrunner.ByConverter (implements fitnesse.slim.Converter<T>)

org.testingsoftware.selrunner.KeysConverter (implements fitnesse.slim.Converter<T>)

org.testingsoftware.selrunner.LoggingAspect

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2013. All Rights Reserved.

redpajama_set_name: RedPajamaGithub


text:
package com.zhy.changeskin.attr;

import android.view.View;

/**
 * Created by zhy on 15/9/22.
 */
public class SkinAttr
{
    String resName;
    SkinAttrType attrType;

    public SkinAttr(SkinAttrType attrType, String resName)
    {
        this.resName = resName;
        this.attrType = attrType;
    }

    public void apply(View view)
    {
        attrType.apply(view, resName);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
org.apache.hadoop.metrics.spi Class Hierarchy (Hadoop 0.10.0 API)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
      Use
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Hierarchy For Package org.apache.hadoop.metrics.spi

Package Hierarchies:
All Packages

Class Hierarchy

java.lang.Object

org.apache.hadoop.metrics.spi.AbstractMetricsContext (implements org.apache.hadoop.metrics.MetricsContext)

org.apache.hadoop.metrics.spi.NullContext

org.apache.hadoop.metrics.spi.MetricsRecordImpl (implements org.apache.hadoop.metrics.MetricsRecord)

org.apache.hadoop.metrics.spi.MetricValue
org.apache.hadoop.metrics.spi.OutputRecord
org.apache.hadoop.metrics.spi.Util

      Overview
      Package
      Class
      Use
    Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2006 The Apache Software Foundation


text:
import { Assertions } from '@ephox/agar';
import { describe, it } from '@ephox/bedrock-client';
import { SugarElement } from '@ephox/sugar';
import { LegacyUnit, TinyAssertions, TinyHooks } from '@ephox/wrap-mcagar';
import { assert } from 'chai';

import Editor from 'tinymce/core/api/Editor';

describe('browser.tinymce.core.MiscCommandsTest', () => {
  const hook = TinyHooks.bddSetupLight<Editor>({
    add_unload_trigger: false,
    disable_nodechange: true,
    indent: false,
    entities: 'raw',
    convert_urls: false,
    valid_styles: {
      '*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,' +
        'float,margin,margin-top,margin-right,margin-bottom,margin-left,padding-left,text-align,display'
    },
    base_url: '/project/tinymce/js/tinymce'
  }, []);

  const isTextNode = (node: Node): node is Text =>
    node.nodeType === 3;

  const normalizeRng = (rng: Range) => {
    if (isTextNode(rng.startContainer)) {
      if (rng.startOffset === 0) {
        rng.setStartBefore(rng.startContainer);
      } else if (rng.startOffset >= rng.startContainer.data.length - 1) {
        rng.setStartAfter(rng.startContainer);
      }
    }

    if (isTextNode(rng.endContainer)) {
      if (rng.endOffset === 0) {
        rng.setEndBefore(rng.endContainer);
      } else if (rng.endOffset >= rng.endContainer.data.length - 1) {
        rng.setEndAfter(rng.endContainer);
      }
    }

    return rng;
  };

  it('InsertHorizontalRule', () => {
    const editor = hook.editor();
    let rng;

    editor.setContent('
123
');
    rng = editor.dom.createRng();
    rng.setStart(editor.dom.select('p')[0].firstChild as Text, 1);
    rng.setEnd(editor.dom.select('p')[0].firstChild as Text, 2);
    editor.selection.setRng(rng);
    editor.execCommand('InsertHorizontalRule');
    TinyAssertions.assertContent(editor, '
1

3
');
    rng = normalizeRng(editor.selection.getRng());
    assert.isTrue(rng.collapsed);
    Assertions.assertDomEq('Nodes are not equal', SugarElement.fromDom(editor.getBody().lastChild as HTMLParagraphElement), SugarElement.fromDom(rng.startContainer));
    assert.equal(rng.startContainer.nodeName, 'P');
    assert.equal(rng.startOffset, 0);
    assert.equal(rng.endContainer.nodeName, 'P');
    assert.equal(rng.endOffset, 0);
  });

  it('SelectAll', () => {
    const editor = hook.editor();
    editor.setContent('
a

b

c
');
    LegacyUnit.setSelection(editor, 'div div', 0);
    editor.execCommand('SelectAll');
    assert.equal(editor.selection.getStart().nodeName, 'DIV');
    assert.equal(editor.selection.getEnd().nodeName, 'DIV');
    assert.equal(editor.selection.isCollapsed(), false);
  });
});


text:
<title>The One With All The Haste</title>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<meta NAME="GENERATOR" CONTENT="Microsoft FrontPage 3.0">
<meta NAME="Template" CONTENT="C:\Program Files\Microsoft Office\Templates\FRIENDS1.dot">

The One With All The Haste

Written by: Wil Calhoun & Scott Silveri

Transcribed by: Eric Aasen

[Scene: Rachel’s bedroom; Rachel is awoken by a man singing in the next
apartment.]

The Singing Man: (singing, duh) Morning’s here! Sunshine is here! The sky
is clear, the morning’s here! The morning’s here!

Rachel: HEY!! Do you have to do that? It’s Saturday!

The Singing Man: Oh come on! Morning’s here! (Starts singing)
Morning’s here! The morning is here! Sunshine is here!

(Rachel slams shut her window and storms into the living room, where Joey and Monica
are eating breakfast.)

Rachel: I hate this apartment! I hate the color of these walls! I hate
the fact that this place still smells like bird! I hate that singing guy!

Joey: Are you kidding? I love that guy! (Starts singing) Morning’s here!
Morning is here—

Rachel: Stop it! I will kill you. I hate the fact that my room is so small.

Monica: Hey, I have all the space I need. Just do what I did.

Rachel: Monica, you don’t even have a bed, you sleep in a ball on the
floor!

Monica: Y’know what? I am really tired of your bellyaching! Okay,
I-I worked really hard at making this a nice place for us to live!

Rachel: I’m sorry. I’m so sorry.

Monica: Okay.

Joey: See, this is a great apartment.

Monica: Shut up! This place is a hole!

Opening Credits

[Scene: Ross’s bedroom; Ross and Emily are making out. Ross as a new feature.]

Emily: Oh, blimey, I still can’t believe you’ve got an earring!

(Yep, it’s a little gold loop.)

Ross: Huh? I know, I know. Who am I? David Bowe? (Shakes his head around,
pretending like he’s jamming.)

Emily: He does that?!

Ross: Uh, I don’t know, whatever.

Emily: I think it makes you look really dangerous.

Ross: Oh, I know. Y’know what, I never would’ve gotten this if it
weren’t for you. No really, when I’m with you I’m-I’m like this whole
other guy, I love that guy! I mean, I love you too, a lot, but that guy! I-I love
that guy!

Emily: I love both of you!

Ross: Yeah?

(They kiss.)

Emily: I wish I didn’t have to go.

Ross: Then don’t. Stay here. Just don’t go so soon to London, just one
more day.

Emily: Ohh, Ross, please!

Ross: One more day, seriously/

Emily: Don’t do this to me, again. You’d know I’d stay here in a
minute, but I’d really miss so much work, they’ll fire me.

Ross: So, then you can stay as long as you want.

Emily: I wish I could.

Ross: Oh no. Don’t, don’t, don’t start packing. Come on! (She
puts some clothes into her bag, and Ross throws them out.)

Emily: I don’t think you understand packing. Look, I just don’t want
to leave it to the last minute. Last time I left in such a rush, I left my knickers here.

Ross: Yeah, I know, I uh, I tried them on.

Emily: You didn’t!

Ross: No. No, I didn’t. I didn’t want to be that guy.

[Scene: Monica and Rachel's erm, Chandler and Joey's, Joey and Chandler are watching
one of those Kung Fu movies and imitating the moves.]

Phoebe: (entering, wearing Santa pants) Hello!

Chandler: Ho! Ho! Ho!

Phoebe: Excuse me.

Chandler: Your pants!

Phoebe: Oh, yeah! You like ‘em? I just, I went to a used clothes store and
got a bunch of maternity stuff. These are sooo comfortable!

Joey: Uhh, Pheebs, those are uh, those are Santa pants.

Phoebe: What?

Chandler: Santa pants. (Phoebe still doesn’t get it.) Santa Claus’s
pants.

Phoebe: Nuh-uh! They’re maternity pants. They even came with a list of baby
names. (Pulls out a sheet of paper which lists who’s been naughty and who’s been
nice.) See, these names are good, and these names are bad. (Finally, she figures it out.)
Ohh.

Rachel: (entering) Hey!

Monica: (entering) Hey!

Rachel: So—Hey, Pheebs! So, how are the elves?

Phoebe: I don’t know! How are the-the-the-the, y’know—You’re
clothes aren’t funny.

Monica: Hey, guys, what-what should I wear to a Knicks game?

Chandler: Uhh, a T-shirt that says, "I don’t belong here."

Joey: You have Knicks tickets?

Rachel: Yeah, my mom got my dad’s season tickets in the divorce, so she
just gave them to me.

Monica: Yeah, apparently, they’re pretty good seats.

Rachel: Yeah.

Joey: (examining the tickets) Oh my God! Those are almost right on the floor!

Rachel: Do you guys want these?

Joey: Yeah!

Chandler: Yeah we do!

Rachel: Ohh, well you got ‘em.

Both: All right!

Rachel: Just give us our apartment back!

Phoebe: Boy! I didn’t see that coming!

Chandler: Are you serious?

Rachel: Oh, come on! We know what these are worth.

Monica: Yeah, what, do you think we’re stupid?

Joey: You’re not stupid. You’re meaner than I thought.

Monica: What do you say?

Chandler: Forget it! Okay, I’m not giving up my bachelor pad for some
basketball seats!

Rachel: You’re bachelor pad?!

Monica: Have you even had a girl up here?

Chandler: No. But uh, Joey has, and I usually talk to them in the morning time.

Joey: Yeah, you do!

[Scene: Central Perk, Joey is whining to Chandler about the tickets.]

Joey: Come on!

Chandler: (ignoring him) Yes, Gunther, can I get two cups of chino, please?

Gunther: Good one.

Joey: Come on, season tickets! Season tickets, do you know what that means?

Chandler: Forget it! Okay, I’m not giving up the apartment.

Joey: Oh come—look, when I was a kid my dad’s company gave season
tickets to the number one salesman every year, all right? My dad never won! Of
course, he wasn’t in the sales division, but still, I never ever, ever forgot that!

Ross: (entering) Hey, guys! (They both notice his new little friend)

Joey: Hey!

Chandler: Oh my God!

Joey: We don’t make enough fun of you already?

Ross: Oh yeah, Emily convinced me to do it.

Chandler: You do know that Wham broke up?

Ross: I like it, and Emily likes it, and that’s what counts. So uh, how are
you guys doing?

Joey: Oh-no, don’t try and talk all normal with that thing in your ear.

Chandler: Where is Emily?

Ross: Ugh, she’s saying good-bye to her uncle.

Chandler: Man, didn’t she like just get here?

Ross: Yeah!! Yeah!

Chandler: Easy tiger.

Ross: I just, I hate this so much! I mean, every time I go pick her up at the
airport, it’s-it’s so great. But at the same time I’m thinking, "Well,
I’m gonna be right back there in a couple of days, dropping her off."

Chandler: So what are you going to do?

Ross: Nothing! There’s nothing to do! I mean, she lives there, I live here.
I mean, she-she’d have to uh, move here. She should move here!

Joey: What?

Ross: I could ask her to live with me!

Chandler: Are you serious?

Ross: I mean, why not! I mean, I mean why not?!

Chandler: Because you’ve only known her for six weeks! Okay, I’ve got
a carton of milk in my fridge I’ve had a longer relationship with!

Ross: Look guys, when I’m with her it’s-it’s-it’s like she
brings this-this-this great side out of me. I mean I-I-I love her, y’know?

Chandler: And I love the milk! But, I’m not gonna some British girl to move
in with me! (Realizes that made no sense.) Joey, you say things now.

Joey: All right look, Ross, he’s right. Emily’s great, she’s
great! But this way too soon, you’re only gonna scare her!

Ross: I don’t want to do that.

Joey: No! You don’t want to wreck it, you don’t want to go to fast!

Ross: Yeah, no, you’re right, I know, you’re right, I’m not,
I’m not gonna do it. All right, thanks guys. (Gets up to leave.)

Chandler: Okay, no problem, just remember to wake us up before you go-go.

[Scene: Monica and Rachel's erm, Chandler and Joey's, later that same day. Joey and
Chandler are eating pizza, and Phoebe is trying to knit something.]

Phoebe: That’s too hard. Too hard!

Monica: (entering with Rachel) All right boys, last chance for the tickets!

Rachel: Or I’ll give them to my new boyfriend, Joshua.

Chandler: No thank you.

Joey: Wait-wait-wait-wait! (To Chandler) Come on! Come on, let’s trade! The
timing’s perfect, I just clogged the toilet!

Chandler: Look, I want those basketball seats as much as you do! Okay, but we
can’t leave in the small apartment after we’ve lived here! Didn’t you ever
read Flowers for Algernon?

Joey: Yes! Didn’t you ever read Sports Illustrated?! No! I
didn’t read yours! But come on, we can go to the game tonight!

Chandler: Look, the only way I will even consider this is if they offer a lot
more than just season seats.

Joey: It’s the Knicks!

Chandler: Screw the Knicks!

Joey: Whoa!

Chandler: I didn’t mean that. I just meant that the apartment is worth so
much more.

Joey: Huh.

Chandler: And the Knicks rule all.

Joey: Yeah, the Knicks rule all!

Phoebe: Hey, so? Are you gonna do it?

Chandler: No. No. We’re not gonna do that, y’know why? Because its not
an even trade.

Rachel: All right, okay, look, what if you could keep the apartment and get the
tickets?

Joey: Done!

Rachel: Let me finish.

Joey: Oh.

Rachel: I’m talking about a bet, winner takes all.

Joey: Ooh, we could end up with nothing.

Phoebe: Or you could end up with everything.

Joey: Ooh, I like that.

Monica: All right, so what do you say?

Chandler: No!

Monica: Oh, just do it!!

Chandler: Op, op, I’m convinced!

Joey: Come on man, you know I’d do it for you! Because, you’re my best
friend.

Chandler: All right, but you can’t use that again for a whole year.
I’m in.

Joey: All right!

Phoebe: Ooh, this is so exciting! Ooh, God, what are you going to bet?

Rachel: Oh, okay, well, I think we should let Phoebe decide, because she’s
the only who’s impartial, and she’s so pretty.

Phoebe: Okay. Umm, ooh, ooh—oh, I have a game!

Joey: Okay!

Chandler: Okay!

Phoebe: This is great!

Joey: What’s the game?! What’s the game?!

Phoebe: Oh, well, it doesn’t have a name—oh, okay, Phoebeball! No, it
doesn’t have a name. Umm, okay, Monica, what is your favourite thing about trees?

Monica: They’re green?

Phoebe: Good! Good! Five points!

(They both rejoice; Chandler is totally confused.)

Phoebe: All right, Joey, same question.

(He looks to Chandler, who doesn’t have a clue.)

Joey: Uhh, they’re tall.

Phoebe: Ooh, three points. Both fine answers, but we were looking for leafy,
leafy.

(Joey turns and is angry that Chandler didn’t come up with the answer.)

Monica: That’s not even a game!

Rachel: What? Shut up! We’re winning!

Monica: You wanna finish this right now? All right, we get a deck of cards, high
card wins. What do you say?

Chandler: Fine, let’s do it.

Phoebe: Oh, I have cards!

Joey: Oh.

Monica: Oh, good.

Phoebe: Yeah! Here! (She grabs a deck out of her purse) Oh no, these are the
trick deck. Okay. Here yes. Okay.

Chandler: Okay, you guys uh, you guys pick first

Rachel: Okay.

Monica: Okay. (She picks a card.) Four.

Chandler: That’s a low one!

Joey: Yeah! Okay. (Joey picks a card.) Phoebe, you look, I can’t.

Phoebe: What make you think I can?! (Shields her eyes from it.)

Joey: Okay. Okay. (He looks at the card.) Ace!

(Both Joey and Chandler and Monica and Rachel jump up and down for joy.)

Chandler: Why are you screaming and hugging?

Monica: Because we won our apartment back!

Joey: What? Ace is high! Jack, queen, king, ace!

Monica: No! Ace is low! Ace, two, three, four!

(They all look to Phoebe to settle this.)

Phoebe: I don’t know. Ooh! Ooh! Look it! (She fans out the trick deck.)
Ah-ha!

Rachel: All right, cut, let’s pick again, pick again.

Joey: Okay.

Rachel: Come on apartment! Come on apartment! (Picks a card.) Oh! I know queen
is high!

Joey: Uh-huh, not as high as…(picks a card) It worked! King!

Chandler: Yeah baby!

Monica: But, we pick again! We pick again!

Joey: Why?!

Monica: I don’t know!

Chandler: Tickets please! (Rachel hands over the tickets) That’s courtside
baby!

Joey: Seriously, good game though. Good game. (He tries to congratulate them,
but they pull away.) (To Chandler) What are they so mad about? They get the apartment
back!

Chandler: No they didn’t!

[Scene: Ross’s apartment, Emily has packed as Ross returns.]

Ross: Hey!

Emily: I packed while you were gone. I left some knickers under your pillow.

Ross: (laughs) Move in with me.

Emily: What?!

Ross: Don’t be scared, I-I know it sounds crazy and-and people will say
it’s too soon, but just-just think, think how great it will be.

Emily: Ohh, no. Ugh. Oh, leaving London, my whole family lives there.

Ross: I know.

Emily: My job!

Ross: Well, so, you-you’ll get a job here! I mean, I’m always hearing
about uh, them foreigners coming in here and stealing American jobs; that could be you!

Emily: Yeah, but it-it-it’s my whole life—you come to England.

Ross: No, I can’t. I would, I really would, but my son is here; I
can’t leave him. Isn’t—you don’t think there’s any way?

Emily: Ohh, I don’t think so. I mean it would be different if it was way
into the future –and-and-and we were getting married or something.

Ross: What?

Emily: Oh no, no, right I shouldn’t have said married. Uh, please
don’t go freaky on me. I didn’t mean it. Well, I didn’t say it; I take it
back!

Ross: No, no, don’t. Why don’t we?

Emily: Why don’t we what?

Ross: Get married.

Emily: You are mad!

Ross: No! No! I’m not! It’s-it’s-it’s perfect! I mean
it’s better than you just-just moving here, ‘cause it’s us together
forever, and that’s-that’s what I want.

Emily: We’ve only known each other for six weeks!

Ross: Yeah, I know, so what? I mean, who’s-who’s to say? Does that me
we-we can’t do it? Look, huh, I was with Carol for four years before we got married
and I wound up divorced from a pregnant lesbian. I mean, this, this makes sense for us.
Come on! I mean, on our first date we ended up spending the whole weekend in Vermont! I
mean, last night I got my ear pierced! Me! This feels right. Doesn’t it?

Emily: My parents are going to be really mad.

Ross: Is that—are you saying yes? Is that yes?

Emily: Yes.

(They kiss and hug.)

Emily: Yes!

Ross: Yes! We’re getting married?!

Emily: Oh my God!

Ross: Yes!

Emily: We’re getting married!

Ross: Come here, come here. Uh, (He takes the earring out.) ow! Emily, will you
marry me?

Emily: Yes.

(He tries to put it on her finger.)

Emily: Ohh, it’s a bit small.

Ross: Damn! I thought that was going to be romantic as hell!

Emily: It was.

(They kiss.)

Commerical Break

[Scene: The hallway, Joey and Chandler are coming back from the game.]

Chandler: Those were like the best seats ever.

Joey: Oh yeah. Hey! Should we give these shirts to the girls? Y’know, kinda
like a peace offering.

Chandler: Oh yeah, that’s very nice. Plus, y’know they were free and
they’re too small.

(He knocks on the girls’ door and walks in. Surprise! The girls, obviously using Star
Trek technology, have completely moved everything in both apartments back to their
original positions, all in the time it took for the guys to go to a basketball game. Wow!
Anyhoo, Chandler is stunned, and Joey doesn’t even realise it.)

Chandler: Oh. Oh, God! (He starts running around like a chicken with his head
cut off.)

Joey: Hey, want a beer? (Hands him a beer and sits down in one of the chairs.)
(Jumping up.) WHOA!!!!

Chandler: I KNOW!!!

(They both sprint to what used to be their apartment.)

Chandler: Open up! Open up! Open up!

(A very angry Monica opens the door with the security chain still on.)

Monica: We’ll discuss it, in the morning! (Slams the door shut.)

Chandler: What the hell is going on?!

(It’s Rachel’s turn to open the door.)

Rachel: We took our apartment back!! (Slams the door shut.)

Phoebe: (opening the door) I had nothing to do with it. (Closes the door.)
(Opens the door.) Okay, it was my idea, but I don’t feel good about it.

(She goes to close the door, but Chandler puts his foot it in.)

Chandler: We are switching back, right now!

Monica: No, we’re not! We’re not leaving!

Chandler: Well, you’re gonna have to leave sometime, because you both have
jobs, and as soon as you do, we’re switching it back! There’s nothing you can do
to stop us! Right, Joe?

Joey: I don’t know.

Chandler: What?

Joey: I don’t want to move again!

Chandler: I don’t care, this is our apartment! And they stole—you
stole it—our apartment, and we won that apartment fair and square, twice! And I am
getting it back right now. I’m getting back right now!

(They open the door.)

Rachel: All right. We figured you might respond this way, so we have a backup
offer.

Chandler: Oh no-no-no, no more offers. You can’t offer anything to us!

Rachel: Let us keep the apartment and…

Monica: As a thank you, Rachel and I will kiss for one minute.

[Time lapse. The guys are entering their apartment.]

Chandler: Totally worth it!

Joey: That was one good minute!

Chandler: Good night.

Joey: Good night.

(They both go back into their old rooms and shut the doors. Of course, Chandler has to
close both sections of his door.)

[Cut to the girls apartment.]

Monica: Men are such idiots.

Rachel: Yeah! Can you believe that something that stupid actually got us our
apartment back?

Phoebe: That’s so funny to think if you’d just done that right after
the last contest, no one would have had to move at all.

Monica: Yeah, let-let-let’s pretend that’s not true.

Rachel: Yeah.

Phoebe: Okay, scarf’s done. (It’s not really a scarf, it’s just a
bunch of yarn that Phoebe has tied together. Just then, Ross and Emily enter dragging with
them Joey and Chandler.)

Ross: Come on! Come on. Come on.

Chandler: Okay!

Phoebe: Hey!

Ross: Hey!

Monica: What-what’s going on?

Joey: Ross has some big thing to tell everyone.

Ross: Uhh, okay, it’s uh, Emily and I, we decided to uh, to get married.

(The gang is stunned.)

Phoebe: What? Oh, are you pregnant too?!

Emily: Umm, no.

Monica: When, when did—how, how did you…

Ross: We, we just decided to uh, to go for it.

Emily: I mean, we know it’s a bit hasty but, uh, it just feels so right,
so…

(Rachel slowly walks in from her bedroom. She is stunned speechless.)

Ross: (turning around.) Umm, uh, I was just telling the guys…

Rachel: Yeah, I-I heard. (Pause, everyone looks at each other, waiting for
Rachel’s reaction.) I think it’s great! (Hugs Ross.) Ohh, I’m so happy for
you!

(Seeing Rachel’s apparently okay with this, the rest of the gang jumps up to
congratulate Ross and Emily on their pending nuptials.)

Chandler: Oh, well, that’s great!

Joey: Yeah! Yeah!

Monica: (to Ross) I can’t believe you’re getting married!

Ross: Yeah. (They hug again.)

Joey: Monica and Rachel made out. (Giggles like a schoolboy and Monica glares at
him.)

Closing Credits

[Scene: Joey’s bedroom, he is awoken by the singing guy.]

The Singing Man: (singing) Morning’s here! The morning’s here!

(Joey joins him.)

Both: Sunshine is here! The sky is clear, the morning’s here!

The Singing Man: Hey! You’re back!

Joey: Hey! (Singing) Get into gear!

The Singing Man: (singing) Breakfast is near!

Both: The dark of night has disappeared!!

The Singing Man: I’ll see you tomorrow morning!

Joey: (happily) Okay!

End


text:
'use strict';

describe('Controller: QueriesCtrl', function () {

  // load the controller's module
  beforeEach(module('zenQueryUiApp'));

  var queriesCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    queriesCtrl = $controller('QueriesCtrl', {
      $scope: scope
    });
  }));

  it('should set default values', function () {
    expect(scope.configuration).not.toBe(null);
    expect(scope.filteredQueries.length).toBe(0);
    expect(scope.currentPage).toBe(1);
    expect(scope.itemsPerPage).toBe(5);
    expect(scope.maxSize).toBe(5);
  });
});


text:
use strict;
use IO::Socket;

############################
# Package-global variables #
############################
# global settings:
my $maryInfoSocket; # handle to socket server
my $maryDataSocket; # handle to socket server
my $host; # string containing host address
my $port;   # socket port on which we listen
my ($in, $out, $audiotype); # requested input / output format
my $voice; # default voice
my $id; # request ID

######################################################################
################################ main ################################
######################################################################

STDOUT->autoflush(1);

$host = "cling.dfki.uni-sb.de";
$port = 59125;
$in  = "TEXT";
$out = "ALLOPHONES";
$audiotype = "MP3";
#$audiotype = "WAVE";
#$voice = "male";
$voice = "de3";

# create a tcp connection to the specified host and port
$maryInfoSocket = IO::Socket::INET->new(Proto     => "tcp",
                                        PeerAddr  => $host,
                                        PeerPort  => $port)
  or die "can't connect to port $port on $host: $!";

# avoid buffering when writing to server:
$maryInfoSocket->autoflush(1);              # so output gets there right away

########## Write input to server: ##########
# formulate the request:
print $maryInfoSocket "MARY IN=$in OUT=$out AUDIO=$audiotype";
if ($voice) { print $maryInfoSocket " VOICE=$voice"; }
print $maryInfoSocket "\015\012";

# receive a request ID:
$id = <$maryInfoSocket>;
chomp $id; chomp $id;

# open second socket for the data:
$maryDataSocket = IO::Socket::INET->new(Proto     => "tcp",
				PeerAddr  => $host,
				PeerPort  => $port)
    or die "can't connect to port $port on $host: $!";
# identify with request number:
print $maryDataSocket $id, "\015\012";

# copy standard input and/or files given on the command line to the socket
while (defined (my $line = <>)) {
    print $maryDataSocket $line;
}
# mark end-of-request:
print $maryDataSocket "\015\012"; # that is a \n, actually
shutdown($maryDataSocket, 1); # we have stopped writing data

########## Read output from server: ##########
# copy the data socket to standard output
if ($out ne "AUDIO") { # text output
    my $line;
    while (defined ($line = <$maryDataSocket>)) {
        print STDOUT $line;
    }
} else { # audio data output
    my $nr; # number of bytes read
    my $buf; # buffer to read into
    my $outnr; # number of bytes written
    while($nr = read($maryDataSocket, $buf, 100000)) {
	# (read returns no. of bytes read, 0 at eof)
        print STDOUT $buf
            or die "Write error on stdout";
    } # while read something from socket
} # audio output

### Read complaints from server:
my $line;
while (defined ($line = <$maryInfoSocket>)) {
    print STDERR $line;
}


text:
package main

import (
	"encoding/json"
	"expvar"
	"flag"
	"log"
	"net"
	"net/http"
	nurl "net/url"
	"os"
	"reflect"
	"strconv"
	"strings"

	"github.com/donovanhide/eventsource"
	"github.com/fiorix/freegeoip"
	"github.com/monnand/goredis"
)

const (
	// ssePath is the PATH for the eventsource handler is going to be mounted on
	ssePath = "/push/"
)

var (
	numRegisterUsers   = expvar.NewInt("num_register_users")
	numUnregisterUsers = expvar.NewInt("num_unregister_users")
	numMessages        = expvar.NewInt("num_messages")
)

// Message is the bit of information that is transfered via eventsource
type Message struct {
	Idx           string
	Channel, HTML string
}

// Id is required to implement the eventsource.Event interface
func (c *Message) Id() string { return c.Idx }

// Event is required to implement the eventsource.Event interface
func (c *Message) Event() string { return c.Channel }

// Data is required to implement the eventsource.Event interface
func (c *Message) Data() string {
	return c.HTML
}

// Connection is use to relate a user token to a channel
type Connection struct {
	token   string
	channel string
}

type Location struct {
	Latitude  float64
	Longitude float64
	timezone  string
}

// Hub maintains the states
type Hub struct {
	Data       map[string][]string // Key is the channel, value is a slice of token
	Users      map[string]string   // Key is the token, value is a channel
	register   chan Connection
	unregister chan string
	messages   chan goredis.Message
	srv        *eventsource.Server
	client     goredis.Client
	ipdb       *freegeoip.DB
}

func (h *Hub) userExists(token string) bool {
	_, ok := h.Users[token]
	return ok
}

func (h *Hub) run() {
	log.Println("[Info] Start the Hub")
	var payload [4]string
	psub := make(chan string, 0)
	go h.client.Subscribe(nil, nil, psub, nil, h.messages)

	// Listening to all channel updates
	psub <- "channel_update:*"

	for {
		select {
		case conn := <-h.register:
			log.Println("[Info] register user: ", conn.token)
			h.Users[conn.token] = conn.channel
			h.Data[conn.channel] = append(h.Data[conn.channel], conn.token)
			numRegisterUsers.Add(1)

		case token := <-h.unregister:
			log.Println("[Info] Unregister user: ", token)
			ch, ok := h.Users[token]
			if ok {
				delete(h.Users, token)
				delete(h.Data, ch)
			}
			numUnregisterUsers.Add(1)

		case msg := <-h.messages:
			err := json.Unmarshal(msg.Message, &payload)
			if err != nil {
				log.Println("[Error] An error occured while Unmarshalling the msg: ", msg)
			}
			message := &Message{
				Idx:     payload[2],
				Channel: payload[0],
				HTML:    payload[1],
			}

			val, ok := h.Data[msg.Channel]
			if ok && len(val) >= 1 {
				//log.Println("[Debug] Publishing message", message)
				h.srv.Publish(val, message)
			}

			if h.ipdb != nil {
				// lookup the host
				ips, err := net.LookupIP(payload[3])
				if err == nil && len(ips) > 0 {
					var result map[string]interface{}
					err = h.ipdb.Lookup(ips[0], &result)
					if err != nil {
						log.Println(err)
					} else {
						location := reflect.ValueOf(result["location"])
						lat := location.Interface().(map[string]interface{})["latitude"]
						lon := location.Interface().(map[string]interface{})["longitude"]

						val, _ := json.Marshal([]float64{reflect.ValueOf(lat).Interface().(float64),
							reflect.ValueOf(lon).Interface().(float64)})
						message2 := &Message{
							Idx:     payload[2],
							Channel: "loc",
							HTML:    string(val),
						}

						log.Println("[Debug] Sending ip to glob ", message2)
						h.srv.Publish([]string{"glob"}, message2)
					}
				} else {
					log.Println("[Error] Cannot resolve host :'", payload[3], "'. ", err)
				}
			}

			numMessages.Add(1)
		}
	}
}

// EventSourceHandler implements the Handler interface
func (h *Hub) EventSourceHandler(w http.ResponseWriter, req *http.Request) {
	token := req.URL.Path[len(ssePath):]

	// The reserved name "glob" is accepted as a global channel that just sends stats
	if token == "glob" {
		log.Println("[Info] Connecting to the global channel")
		h.register <- Connection{"_", "glob"} // TODO: Need to come up with random, unique user ids
		defer func(u string) {
			h.unregister <- u
		}("_")
		h.srv.Handler(token)(w, req)

	} else {
		if h.userExists(token) {
			log.Println("[Info] Forbiden, user already connected")
			http.Error(w, "Forbiden", http.StatusForbidden)
		} else {
			log.Println("[Info] Exchange token against the channel list", token)
			val, err := h.client.Getset(token, []byte{})
			if err != nil {
				log.Println("[Error] occured while exchanging the your security token.", token, ":", err)
				http.Error(w, "Error occured while exchanging the your security token", http.StatusUnauthorized)

			} else if chanName := string(val); chanName != "" {
				log.Println("[Info] Connecting", token, "to the channel", chanName)
				h.register <- Connection{token, chanName}
				defer func(u string) {
					h.unregister <- u
				}(token)
				h.srv.Handler(token)(w, req)
			}
			_, err = h.client.Del(token)
			if err != nil {
				log.Println("[Error] An error occured while trying to delete the token from redis", err)
			}
		}
	}
}

// NewHub returns a pointer to a initialized and running Hub
func NewHub() *Hub {
	// Handle the flags. TODO: add flags for redis
	var dbPath string
	flag.StringVar(&dbPath, "ipdb-path", os.Getenv("IPDB_PATH"),
		"The path to the ip->location DB")
	flag.Parse()

	// Initialze the hub
	log.Println("[Info] Starting the eventsource Hub")

	var db *freegeoip.DB
	var err error
	if dbPath != "" {
		log.Println("[Info] Using ip->location DB ", dbPath)
		db, err = freegeoip.Open(dbPath)
		if err != nil {
			log.Fatal(err)
		}
	} else {
		log.Println("[Info] No ip->location DB provided")
	}

	redisURLString := os.Getenv("REDIS_SSEQUEUE_URL")
	if redisURLString == "" {
		// Use db 2 by default for  pub/sub
		redisURLString = "redis://localhost:6379/2"
	}
	log.Println("[Info] Redis configuration used for pub/sub", redisURLString)
	redisURL, err := nurl.Parse(redisURLString)
	if err != nil {
		log.Fatal("Could not read Redis string", err)
	}

	redisDb, err := strconv.Atoi(strings.TrimLeft(redisURL.Path, "/"))
	if err != nil {
		log.Fatal("[Error] Could not read Redis path", err)
	}

	server := eventsource.NewServer()
	server.AllowCORS = true

	h := Hub{
		Data:       make(map[string][]string),
		Users:      make(map[string]string),
		register:   make(chan Connection, 0),
		unregister: make(chan string, 0),
		messages:   make(chan goredis.Message, 0),
		srv:        server,
		client:     goredis.Client{Addr: redisURL.Host, Db: redisDb},
		ipdb:       db,
	}

	go h.run()
	return &h
}

func main() {
	sseString := os.Getenv("SSE_HOST")

	if sseString == "" {
		log.Fatal("SSE_HOST is not set, example: SSE_HOST=localhost:3000")
	}
	h := NewHub()

	// eventsource endpoints
	log.Println("[Info] botbot-eventsource is listening on " + sseString)
	http.HandleFunc(ssePath, h.EventSourceHandler)

	log.Fatalln(http.ListenAndServe(sseString, nil))
}


text:
package mnemosynerpc

import (
	"net/url"
	"time"

	"github.com/golang/protobuf/ptypes"
	"golang.org/x/oauth2"
)

// Token implements oauth2.TokenSource interface.
func (s *Session) Token() (*oauth2.Token, error) {
	var (
		err      error
		expireAt time.Time
	)
	if s.ExpireAt != nil {
		expireAt, err = ptypes.Timestamp(s.ExpireAt)
		if err != nil {
			return nil, err
		}
	}
	token := &oauth2.Token{
		AccessToken: string(s.AccessToken),
		Expiry:      expireAt,
	}
	if s.Bag != nil && len(s.Bag) > 0 {
		token = token.WithExtra(bagToURLValues(s.Bag))
	}

	return token, nil
}

func bagToURLValues(b map[string]string) url.Values {
	r := make(map[string][]string, len(b))
	for k, v := range b {
		r[k] = []string{v}
	}
	return url.Values(r)
}


text:
package org.subzero.core.plugin;

import org.apache.log4j.Logger;
import org.subzero.core.helper.FileHelper;
import org.subzero.core.helper.PropertiesHelper;
import org.subzero.core.postprocess.PostProcessBase;

/**
 * Post-Process plug-in that move subtitle & video files to output folder
 * @author Julien
 *
 */
public class PostProcessMoveOnly extends PostProcessBase {

	/**
	 * Logger
	 */
	private static Logger log = Logger.getLogger(PostProcessMoveOnly.class);

	/**
	 * Launch the post-process after subtitle retrieval with video file of the TV show
	 * @return Success (true) or failure (false)
	 */
	@Override
	public boolean launchPostProcess() {
		try {
			log.debug("Post-Process Move Only - Start");

			// Ensure that the output folder exists
			FileHelper.ensureFolder(outputFolderPath);

			log.debug(String.format("Try to move files to '%s'", outputFolderPath));

			// Move subtile & video files to output path
			String inputVideoFileName = tvShowInfo.getInputVideoFileName();
			String subFileName = subTitleInfo.getSubFileName();
			FileHelper.moveWorkingFileToFolder(this.workingFolderPath, inputVideoFileName, outputFolderPath);
			FileHelper.moveWorkingFileToFolder(this.workingFolderPath, subFileName, outputFolderPath);

			// Process extra files
			if (subTitleInfo.getExtraFileNames() != null && subTitleInfo.getExtraFileNames().size() > 0) {
				// Move extra input files to Ori folder or delete
				if (PropertiesHelper.getMkvMergeMoveOriFilesKeep()) {
	            	// Keep extra files
	            	String oriFolderPath = PropertiesHelper.getMkvMergeMoveOriFilesFolderPath();
	            	log.debug(String.format("Moving extra files to Ori Folder '%s'", oriFolderPath));
	            	for (String extraFileName : subTitleInfo.getExtraFileNames()) {
						FileHelper.moveWorkingFileToFolder(this.workingFolderPath, extraFileName, oriFolderPath);
					}
	            }
	            else {
	            	// Delete extra files
	            	log.debug("Deleting extra files");
	    			if (subTitleInfo.getExtraFileNames() != null && subTitleInfo.getExtraFileNames().size() > 0) {
	    				for (String extraFileName : subTitleInfo.getExtraFileNames()) {
	    					FileHelper.deleteWorkingFile(this.workingFolderPath, extraFileName);
	    				}
	    			}
	            }
			}

			log.info(String.format("Post-Process Move Only succeeded for files '%s' and '%s' to folder '%s'", inputVideoFileName, subFileName, outputFolderPath));

            return true;
        }
		catch (Exception e) {
			log.error("Error while trying to post-process files with Move Only", e);
            return false;
        }
		finally
		{
			log.debug("Post-Process Move Only - End");
		}
	}

}


text:
namespace {

// AudioJitterBuffer maintains a list of AudioPackets whose total playback
// duration <= |kMaxQueueLatency|.
// Once the buffer has run out of AudioPackets (latency reaches 0), it waits
// until the total latency reaches |kUnderrunRecoveryLatency| before it starts
// feeding the get-data requests. This helps reduce the frequency of stopping
// when the buffer underruns.
// If the total latency has reached |kMaxQueueLatency|, the oldest packets
// will get dropped until the latency is reduced to no more than
// |kOverrunRecoveryLatency|. This helps reduce the number of glitches when
// the buffer overruns.
// Otherwise the total latency can freely fluctuate between 0 and
// |kMaxQueueLatency|.

constexpr base::TimeDelta kMaxQueueLatency =
    base::TimeDelta::FromMilliseconds(150);
constexpr base::TimeDelta kUnderrunRecoveryLatency =
    base::TimeDelta::FromMilliseconds(60);
constexpr base::TimeDelta kOverrunRecoveryLatency =
    base::TimeDelta::FromMilliseconds(90);

}  // namespace

namespace remoting {

AudioJitterBuffer::AudioJitterBuffer(
    OnFormatChangedCallback on_format_changed) {
  DETACH_FROM_THREAD(thread_checker_);
  on_format_changed_ = std::move(on_format_changed);
}

AudioJitterBuffer::~AudioJitterBuffer() = default;

void AudioJitterBuffer::AddAudioPacket(std::unique_ptr<AudioPacket> packet) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  CHECK_EQ(1, packet->data_size());
  DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
  DCHECK_NE(AudioPacket::SAMPLING_RATE_INVALID, packet->sampling_rate());

  AudioStreamFormat stream_format;
  stream_format.bytes_per_sample = packet->bytes_per_sample();
  stream_format.channels = packet->channels();
  stream_format.sample_rate = packet->sampling_rate();

  DCHECK_GT(stream_format.bytes_per_sample, 0);
  DCHECK_GT(stream_format.channels, 0);
  DCHECK_GT(stream_format.sample_rate, 0);
  DCHECK_EQ(packet->data(0).size() %
                (stream_format.channels * stream_format.bytes_per_sample),
            0u);

  if (!stream_format_ || *stream_format_ != stream_format) {
    ResetBuffer(stream_format);
  }

  // Push the new data to the back of the queue.
  queued_bytes_ += packet->data(0).size();
  queued_packets_.push_back(std::move(packet));

  if (underrun_protection_mode_ &&
      queued_bytes_ > GetBufferSizeFromTime(kUnderrunRecoveryLatency)) {
    // The buffer has enough data to start feeding the requests.
    underrun_protection_mode_ = false;
  }

  DropOverrunPackets();
  ProcessGetDataRequests();
}

void AudioJitterBuffer::AsyncGetData(std::unique_ptr<GetDataRequest> request) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  DCHECK(stream_format_);
  DCHECK_EQ(request->bytes_needed % stream_format_->bytes_per_sample, 0u);
  queued_requests_.push_back(std::move(request));
  ProcessGetDataRequests();
}

void AudioJitterBuffer::ClearGetDataRequests() {
  queued_requests_.clear();
}

void AudioJitterBuffer::ResetBuffer(const AudioStreamFormat& new_format) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  queued_packets_.clear();
  queued_bytes_ = 0;
  first_packet_offset_ = 0;
  ClearGetDataRequests();
  stream_format_ = std::make_unique<AudioStreamFormat>(new_format);
  underrun_protection_mode_ = true;
  if (on_format_changed_) {
    on_format_changed_.Run(*stream_format_);
  }
}

void AudioJitterBuffer::ProcessGetDataRequests() {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);

  if (underrun_protection_mode_) {
    return;
  }

  // Get the active request if there is one.
  while (!queued_requests_.empty() && !queued_packets_.empty()) {
    auto& active_request = queued_requests_.front();

    // Copy any available data into the active request up to as much requested.
    while (active_request->bytes_extracted < active_request->bytes_needed &&
           !queued_packets_.empty()) {
      uint8_t* next_data = static_cast<uint8_t*>(active_request->data) +
                           active_request->bytes_extracted;

      const std::string& packet_data = queued_packets_.front()->data(0);
      size_t bytes_to_copy = std::min(
          packet_data.size() - first_packet_offset_,
          active_request->bytes_needed - active_request->bytes_extracted);

      memcpy(next_data, packet_data.data() + first_packet_offset_,
             bytes_to_copy);

      first_packet_offset_ += bytes_to_copy;
      active_request->bytes_extracted += bytes_to_copy;
      queued_bytes_ -= bytes_to_copy;
      DCHECK_GE(queued_bytes_, 0u);
      // Pop off the packet if we've already consumed all its bytes.
      if (queued_packets_.front()->data(0).size() == first_packet_offset_) {
        queued_packets_.pop_front();
        first_packet_offset_ = 0;
      }
    }

    // If this request is fulfilled, call the callback and pop it off the queue.
    if (active_request->bytes_extracted == active_request->bytes_needed) {
      active_request->OnDataFilled();
      queued_requests_.pop_front();
    }
  }

  if (queued_packets_.empty()) {
    // Buffer overrun.
    underrun_protection_mode_ = true;
  }
}

size_t AudioJitterBuffer::GetBufferSizeFromTime(
    base::TimeDelta duration) const {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  DCHECK(stream_format_);
  return duration.InMilliseconds() * stream_format_->sample_rate *
         stream_format_->bytes_per_sample * stream_format_->channels /
         base::Time::kMillisecondsPerSecond;
}

void AudioJitterBuffer::DropOverrunPackets() {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);

  if (queued_bytes_ <= GetBufferSizeFromTime(kMaxQueueLatency)) {
    return;
  }

  size_t new_size = GetBufferSizeFromTime(kOverrunRecoveryLatency);
  while (queued_bytes_ > new_size) {
    queued_bytes_ -=
        queued_packets_.front()->data(0).size() - first_packet_offset_;
    DCHECK_GE(queued_bytes_, 0u);
    queued_packets_.pop_front();
    first_packet_offset_ = 0;
  }
}

}  // namespace remoting


text:
@ParametersAreNonnullByDefault
package nafi.jnafi;

import javax.annotation.ParametersAreNonnullByDefault;


text:
This is really awesome webiste

Updates made on master on Github before rebase

## Repository Purpose

This file is just a readme file.

## Purpose

the purpose of this file is to provide examples
of how to use Git and Github together


text:
nv.models.pieChart = function() {
    "use strict";

    //============================================================
    // Public Variables with Default Settings
    //------------------------------------------------------------

    var pie = nv.models.pie();
    var legend = nv.models.legend();
    var tooltip = nv.models.tooltip();

    var margin = {top: 30, right: 20, bottom: 20, left: 20}
        , marginTop = null
        , width = null
        , height = null
        , showTooltipPercent = false
        , showLegend = true
        , legendPosition = "top"
        , color = nv.utils.defaultColor()
        , state = nv.utils.state()
        , defaultState = null
        , noData = null
        , duration = 250
        , dispatch = d3.dispatch('stateChange', 'changeState','renderEnd')
        ;

    tooltip
        .duration(0)
        .headerEnabled(false)
        .valueFormatter(function(d, i) {
            return pie.valueFormat()(d, i);
        });

    //============================================================
    // Private Variables
    //------------------------------------------------------------

    var renderWatch = nv.utils.renderWatch(dispatch);

    var stateGetter = function(data) {
        return function(){
            return {
                active: data.map(function(d) { return !d.disabled })
            };
        }
    };

    var stateSetter = function(data) {
        return function(state) {
            if (state.active !== undefined) {
                data.forEach(function (series, i) {
                    series.disabled = !state.active[i];
                });
            }
        }
    };

    //============================================================
    // Chart function
    //------------------------------------------------------------

    function chart(selection) {
        renderWatch.reset();
        renderWatch.models(pie);

        selection.each(function(data) {
            var container = d3.select(this);
            nv.utils.initSVG(container);

            var that = this;
            var availableWidth = nv.utils.availableWidth(width, container, margin),
                availableHeight = nv.utils.availableHeight(height, container, margin);

            chart.update = function() { container.transition().call(chart); };
            chart.container = this;

            state.setter(stateSetter(data), chart.update)
                .getter(stateGetter(data))
                .update();

            //set state.disabled
            state.disabled = data.map(function(d) { return !!d.disabled });

            if (!defaultState) {
                var key;
                defaultState = {};
                for (key in state) {
                    if (state[key] instanceof Array)
                        defaultState[key] = state[key].slice(0);
                    else
                        defaultState[key] = state[key];
                }
            }

            // Display No Data message if there's nothing to show.
            if (!data || !data.length) {
                nv.utils.noData(chart, container);
                return chart;
            } else {
                container.selectAll('.nv-noData').remove();
            }

            // Setup containers and skeleton of chart
            var wrap = container.selectAll('g.nv-wrap.nv-pieChart').data([data]);
            var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-pieChart').append('g');
            var g = wrap.select('g');

            gEnter.append('g').attr('class', 'nv-pieWrap');
            gEnter.append('g').attr('class', 'nv-legendWrap');

            // Legend
            if (!showLegend) {
                g.select('.nv-legendWrap').selectAll('*').remove();
            } else {
                if (legendPosition === "top") {
                    legend.width( availableWidth ).key(pie.x());

                    wrap.select('.nv-legendWrap')
                        .datum(data)
                        .call(legend);

                    if (!marginTop && legend.height() !== margin.top) {
                        margin.top = legend.height();
                        availableHeight = nv.utils.availableHeight(height, container, margin);
                    }

                    wrap.select('.nv-legendWrap')
                        .attr('transform', 'translate(0,' + (-margin.top) +')');
                } else if (legendPosition === "right") {
                    var legendWidth = nv.models.legend().width();
                    if (availableWidth / 2 < legendWidth) {
                        legendWidth = (availableWidth / 2)
                    }
                    legend.height(availableHeight).key(pie.x());
                    legend.width(legendWidth);
                    availableWidth -= legend.width();

                    wrap.select('.nv-legendWrap')
                        .datum(data)
                        .call(legend)
                        .attr('transform', 'translate(' + (availableWidth) +',0)');
                }
            }
            wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');

            // Main Chart Component(s)
            pie.width(availableWidth).height(availableHeight);
            var pieWrap = g.select('.nv-pieWrap').datum([data]);
            d3.transition(pieWrap).call(pie);

            //============================================================
            // Event Handling/Dispatching (in chart's scope)
            //------------------------------------------------------------

            legend.dispatch.on('stateChange', function(newState) {
                for (var key in newState) {
                    state[key] = newState[key];
                }
                dispatch.stateChange(state);
                chart.update();
            });

            // Update chart from a state object passed to event handler
            dispatch.on('changeState', function(e) {
                if (typeof e.disabled !== 'undefined') {
                    data.forEach(function(series,i) {
                        series.disabled = e.disabled[i];
                    });
                    state.disabled = e.disabled;
                }
                chart.update();
            });
        });

        renderWatch.renderEnd('pieChart immediate');
        return chart;
    }

    //============================================================
    // Event Handling/Dispatching (out of chart's scope)
    //------------------------------------------------------------

    pie.dispatch.on('elementMouseover.tooltip', function(evt) {
        evt['series'] = {
            key: chart.x()(evt.data),
            value: chart.y()(evt.data),
            color: evt.color,
            percent: evt.percent
        };
        if (!showTooltipPercent) {
            delete evt.percent;
            delete evt.series.percent;
        }
        tooltip.data(evt).hidden(false);
    });

    pie.dispatch.on('elementMouseout.tooltip', function(evt) {
        tooltip.hidden(true);
    });

    pie.dispatch.on('elementMousemove.tooltip', function(evt) {
        tooltip();
    });

    //============================================================
    // Expose Public Variables
    //------------------------------------------------------------

    // expose chart's sub-components
    chart.legend = legend;
    chart.dispatch = dispatch;
    chart.pie = pie;
    chart.tooltip = tooltip;
    chart.options = nv.utils.optionsFunc.bind(chart);

    // use Object get/set functionality to map between vars and chart functions
    chart._options = Object.create({}, {
        // simple options, just get/set the necessary values
        width:              {get: function(){return width;},                set: function(_){width=_;}},
        height:             {get: function(){return height;},               set: function(_){height=_;}},
        noData:             {get: function(){return noData;},               set: function(_){noData=_;}},
        showTooltipPercent: {get: function(){return showTooltipPercent;},   set: function(_){showTooltipPercent=_;}},
        showLegend:         {get: function(){return showLegend;},           set: function(_){showLegend=_;}},
        legendPosition:     {get: function(){return legendPosition;},       set: function(_){legendPosition=_;}},
        defaultState:       {get: function(){return defaultState;},         set: function(_){defaultState=_;}},

        // options that require extra logic in the setter
        color: {get: function(){return color;}, set: function(_){
            color = _;
            legend.color(color);
            pie.color(color);
        }},
        duration: {get: function(){return duration;}, set: function(_){
            duration = _;
            renderWatch.reset(duration);
            pie.duration(duration);
        }},
        margin: {get: function(){return margin;}, set: function(_){
            if (_.top !== undefined) {
                margin.top = _.top;
                marginTop = _.top;
            }
            margin.right  = _.right  !== undefined ? _.right  : margin.right;
            margin.bottom = _.bottom !== undefined ? _.bottom : margin.bottom;
            margin.left   = _.left   !== undefined ? _.left   : margin.left;
        }}
    });
    nv.utils.inheritOptions(chart, pie);
    nv.utils.initOptions(chart);
    return chart;
};


text:
title: ScholarMe
excerpt: Monthly financial aid drops for college students
type: mobile app
color: "#212121"
logo: ../images/scholarmedrops.png
order: 2
collection: projects
tags: []
published: true
---

        Website


text:
package com.jme3.input.eventprocessing;

import java.util.List;

import com.jme3.input.event.InputEvent;

public interface IEventProcessor {

	/**
	 * Will emit the inputEvents to all registered EventProcessors
	 * @param inputQueue
	 */
	void emit(List<InputEvent> inputQueue);

	/**
	 * Add evenProcessor to the list over EVP which will receive
	 * events.
	 * @param evp
	 */
	void add(EventProcessor evp);

	/**
	 * Removes eventProcessor from the list of Evp wich will receive events.
	 * @param evp
	 */
	void remove(EventProcessor evp);

}


text:
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)

## Scripts

### `yarn start`

Runs the application in production mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

### `yarn run build`

Builds the application for production using [Next.js](https://zeit.co/blog/next).
Generates `./next` directory with build artifacts.

### `yarn run commit`

Commit code while enforcing the [Commitizen](http://commitizen.github.io/cz-cli/) conventional changelog standard.
Before running this script, add files using `git add`.

### `yarn run dev`

Runs the application in development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

### `yarn run lint`

Lint code using [JavaScript Standard Style](http://standardjs.com/).
Tries to fix code style errors automatically.

## Updates

### Generate event timestamp

```js
(new Date("2019-04-06 1:00 PM")).getTime()
```


text:
package com.exmertec.dummie;

import static com.exmertec.dummie.Dummie.create;
import static com.exmertec.dummie.Dummie.withStrategy;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

import com.exmertec.dummie.configuration.GenerationStrategy;
import org.junit.Test;

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

public class SetTest {

    @Test
    public void should_create_object_with_set_field() {
        SetData data = create(SetData.class);

        assertThat(data, not(nullValue()));
        assertThat(data.getNotParameterized().size(), is(0));
        assertThat(data.getParameterized().size(), is(1));
    }

    @Test
    public void should_create_object_with_hashset_field() {
        HashSetData data = create(HashSetData.class);

        assertThat(data, not(nullValue()));
        assertThat(data.getNotParameterized().size(), is(0));
        assertThat(data.getParameterized().size(), is(1));
    }

    @Test
    public void should_create_diff_cache_for_set_and_hashset() throws Exception {
        MixSetData data = create(MixSetData.class);

        validateMixSetData(data);
    }

    @Test
    public void should_create_object_with_set_field_and_random_strategy() {
        MixSetData data = withStrategy(GenerationStrategy.RANDOM)
            .create(MixSetData.class);

        validateMixSetData(data);
    }

    private void validateMixSetData(MixSetData data) {
        assertThat(data, not(nullValue()));
        assertThat(data.getNotParameterized().size(), is(0));
        assertThat(data.getParameterized().size(), is(1));
        assertThat(data.getParameterized(), not(equalTo((Set)data.getNotParameterizedHashSet())));
    }

    public static class SetData {
        private Set notParameterized;

        private Set<String> parameterized;

        public Set getNotParameterized() {
            return notParameterized;
        }

        public void setNotParameterized(Set notParameterized) {
            this.notParameterized = notParameterized;
        }

        public Set<String> getParameterized() {
            return parameterized;
        }

        public void setParameterized(Set<String> parameterized) {
            this.parameterized = parameterized;
        }
    }

    public static class MixSetData {
        private HashSet notParameterizedHashSet;

        private HashSet<String> parameterizedHashSet;

        private Set notParameterized;

        private Set<String> parameterized;

        public Set getNotParameterized() {
            return notParameterized;
        }

        public void setNotParameterized(Set notParameterized) {
            this.notParameterized = notParameterized;
        }

        public Set<String> getParameterized() {
            return parameterized;
        }

        public void setParameterized(Set<String> parameterized) {
            this.parameterized = parameterized;
        }

        public HashSet getNotParameterizedHashSet() {
            return notParameterizedHashSet;
        }

        public void setNotParameterizedHashSet(HashSet notParameterizedHashSet) {
            this.notParameterizedHashSet = notParameterizedHashSet;
        }

        public HashSet<String> getParameterizedHashSet() {
            return parameterizedHashSet;
        }

        public void setParameterizedHashSet(HashSet<String> parameterizedHashSet) {
            this.parameterizedHashSet = parameterizedHashSet;
        }
    }

    public static class HashSetData {
        private HashSet notParameterized;

        private HashSet<String> parameterized;

        public HashSet getNotParameterized() {
            return notParameterized;
        }

        public void setNotParameterized(HashSet notParameterized) {
            this.notParameterized = notParameterized;
        }

        public HashSet<String> getParameterized() {
            return parameterized;
        }

        public void setParameterized(HashSet<String> parameterized) {
            this.parameterized = parameterized;
        }
    }
}


text:
package com.turn.camino.render.functions;

import com.turn.camino.Context;
import com.turn.camino.render.Function;
import com.turn.camino.render.FunctionCallException;
import com.turn.camino.render.FunctionCallExceptionFactory;
import com.turn.camino.util.Validation;

import static com.turn.camino.util.Message.*;

import java.util.List;

/**
 * Math functions
 *
 * @author llo
 */
public class MathFunctions {

	private final static Validation<FunctionCallException> VALIDATION =
			new Validation<>(new FunctionCallExceptionFactory());

	public static abstract class ArithmeticFunction implements Function {
		@Override
		public Object invoke(List<?> params, Context context) throws FunctionCallException {
			VALIDATION.requireListSize(params, 2, 2, prefix("parameters"));
			Number arg0 = VALIDATION.requireType(params.get(0), Number.class, prefix("arg0"));
			Number arg1 = VALIDATION.requireType(params.get(1), Number.class, prefix("arg1"));
			return invoke(arg0, arg1);
		}
		protected abstract Object invoke(Number arg0, Number arg1) throws FunctionCallException;
	}

	public static class Add extends ArithmeticFunction {
		@Override
		public Object invoke(Number arg0, Number arg1) throws FunctionCallException {
			if (arg0 instanceof Long && arg1 instanceof Long) {
				return arg0.longValue() + arg1.longValue();
			} else {
				return arg0.doubleValue() + arg1.doubleValue();
			}
		}
	}

	public static class Subtract extends ArithmeticFunction {
		@Override
		public Object invoke(Number arg0, Number arg1) throws FunctionCallException {
			if (arg0 instanceof Long && arg1 instanceof Long) {
				return arg0.longValue() - arg1.longValue();
			} else {
				return arg0.doubleValue() - arg1.doubleValue();
			}
		}
	}

	public static class Multiply extends ArithmeticFunction {
		@Override
		public Object invoke(Number arg0, Number arg1) throws FunctionCallException {
			if (arg0 instanceof Long && arg1 instanceof Long) {
				return arg0.longValue() * arg1.longValue();
			} else {
				return arg0.doubleValue() * arg1.doubleValue();
			}
		}
	}

	public static class Divide extends ArithmeticFunction {
		@Override
		public Object invoke(Number arg0, Number arg1) throws FunctionCallException {
			if (arg0 instanceof Long && arg1 instanceof Long) {
				if (arg1.longValue() == 0) {
					throw new FunctionCallException("Divide by zero");
				}
				return arg0.longValue() / arg1.longValue();
			} else {
				if (arg1.doubleValue() == 0) {
					throw new FunctionCallException("Divide by zero");
				}
				return arg0.doubleValue() / arg1.doubleValue();
			}
		}
	}

}


text:
define(["dojo/_base/lang", "dojo/on", "dijit/registry", "dojo/date/stamp"],
function(lang, on, registry, stamp){
	var _onResults = []; // events on array

	var opener, datePicker2;

	return {
		init: function(){
			opener = this.opener;
			var onResult = on(this.selDate1, "click", lang.hitch(this, function(){
				this.datePicker2.set("value", date);
				this.opener.show(this.selDate1, ['below-centered','above-centered','after','before']);
			}));
			_onResults.push(onResult);

			onResult = on(this.save, "click", lang.hitch(this, function(){
				this.opener.hide(true);
				date = this.selDate1.value = this.datePicker2.get("value");
			}));
			_onResults.push(onResult);

			onResult = on(this.cancel, "click", lang.hitch(this, function(){
				this.opener.hide(false);
			}));
			_onResults.push(onResult);

			datePicker2 = registry.byId("datePicker2");
			// initialize the global Date variable as today
			date = stamp.toISOString(new Date(), {selector: "date"});
		},

		beforeActivate: function(){
			//console.log("date view beforeActivate()");
	/*		var backButtomDom = dom.byId('headerBackButton');
			onResult = on(backButtomDom, "click", lang.hitch(this, function(e){

				var transOpts = {
					title:'header+navigation+centerNavigation',
					target:'header+navigation+centerNavigation',
					url:'#header+navigation+centerNavigation'
				};
				new TransitionEvent(e.target, transOpts, e).dispatch();
			}));
			_onResults.push(onResult);
	*/
		},

		// view destroy
		destroy: function(){
			var onResult = _onResults.pop();
			while(onResult){
				onResult.remove();
				onResult = _onResults.pop();
			}
		}
	};
});


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>org.apache.poi.poifs.crypt.agile (POI API Documentation)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

org.apache.poi.poifs.crypt.agile

Classes

AgileDecryptor

AgileEncryptionHeader

AgileEncryptionInfoBuilder

AgileEncryptionVerifier

AgileEncryptionVerifier.AgileCertificateEntry

AgileEncryptor


text:
package biz.paluch.logging.gelf.jul;

import static biz.paluch.logging.gelf.LogMessageField.NamedLogField.*;

import java.util.Collections;
import java.util.logging.*;

import biz.paluch.logging.RuntimeContainer;
import biz.paluch.logging.gelf.GelfMessageAssembler;
import biz.paluch.logging.gelf.LogMessageField;
import biz.paluch.logging.gelf.PropertyProvider;
import biz.paluch.logging.gelf.intern.*;

/**
 * Logging-Handler for GELF (Graylog Extended Logging Format). This Java-Util-Logging Handler creates GELF Messages and posts
 * them using UDP (default) or TCP. Following parameters are supported/needed:
 *

 *
host (Mandatory): Hostname/IP-Address of the Logstash Host
 *

 *
(the host) for UDP, e.g. 127.0.0.1 or some.host.com

 *
See docs for more details

 *

 *

 *
port (Optional): Port, default 12201

 *
version (Optional): GELF Version 1.0 or 1.1, default 1.0

 *
originHost (Optional): Originating Hostname, default FQDN Hostname

 *
extractStackTrace (Optional): Post Stack-Trace to StackTrace field (true/false/throwable reference [0 = throwable, 1 =
 * throwable.cause, -1 = root cause]), default false

 *
filterStackTrace (Optional): Perform Stack-Trace filtering (true/false), default false

 *
includeLogMessageParameters (Optional): Include message parameters from the log event (see
 * {@link LogRecord#getParameters()}, default true

 *
includeLocation (Optional): Include source code location, default true

 *
mdcProfiling (Optional): Perform Profiling (Call-Duration) based on MDC Data. See MDC
 * Profiling, default false

 *
facility (Optional): Name of the Facility, default gelf-java

 *
level (Optional): Log-Level, default INFO

 *
filter (Optional): Class-Name of a Log-Filter, default none

 *
additionalField.(number) (Optional): Post additional fields. Eg. .GelfLogHandler.additionalField.0=fieldName=Value

 *

 *
 * The {@link #publish(LogRecord)} method is thread-safe and may be called by different threads at any time.
 *
 * @author Mark Paluch
 */
public class GelfLogHandler extends Handler implements ErrorReporter {

    protected volatile GelfSender gelfSender;
    protected GelfMessageAssembler gelfMessageAssembler;
    private final ErrorReporter errorReporter = new MessagePostprocessingErrorReporter(this);

    public GelfLogHandler() {
        super();

        RuntimeContainer.initialize(errorReporter);
        gelfMessageAssembler = createGelfMessageAssembler();

        initializeDefaultFields();

        JulPropertyProvider propertyProvider = new JulPropertyProvider(GelfLogHandler.class);
        gelfMessageAssembler.initialize(propertyProvider);

        String level = propertyProvider.getProperty(PropertyProvider.PROPERTY_LEVEL);
        if (null != level) {
            setLevel(Level.parse(level.trim()));
        } else {
            setLevel(Level.INFO);
        }

        String additionalFields = propertyProvider.getProperty(PropertyProvider.PROPERTY_ADDITIONAL_FIELDS);
        if (null != additionalFields) {
            setAdditionalFields(additionalFields);
        }

        String additionalFieldTypes = propertyProvider.getProperty(PropertyProvider.PROPERTY_ADDITIONAL_FIELD_TYPES);
        if (null != additionalFieldTypes) {
            setAdditionalFieldTypes(additionalFieldTypes);
        }

        String includeLocation = propertyProvider.getProperty(PropertyProvider.PROPERTY_INCLUDE_LOCATION);
        if (null != includeLocation) {
            setIncludeLocation(Boolean.valueOf(includeLocation));
        }

        String filter = propertyProvider.getProperty(PropertyProvider.PROPERTY_FILTER);
        try {
            if (null != filter) {
                final Class clazz = ClassLoader.getSystemClassLoader().loadClass(filter);
                setFilter((Filter) clazz.getDeclaredConstructor().newInstance());
            }
        } catch (final Exception e) {
            // ignore
        }
    }

    protected void initializeDefaultFields() {
        gelfMessageAssembler.addFields(LogMessageField.getDefaultMapping(Time, Severity, ThreadName, SourceClassName,
                SourceMethodName, SourceSimpleClassName, LoggerName));
    }

    protected GelfMessageAssembler createGelfMessageAssembler() {
        return new GelfMessageAssembler();
    }

    @Override
    public void flush() {
        // nothing to do
    }

    @Override
    public void publish(final LogRecord record) {
        if (!isLoggable(record)) {
            return;
        }

        try {
            if (null == gelfSender) {
                synchronized (this) {
                    if (null == gelfSender) {
                        gelfSender = createGelfSender();
                    }
                }
            }
        } catch (Exception e) {
            reportError("Could not send GELF message: " + e.getMessage(), e, ErrorManager.OPEN_FAILURE);
            return;
        }

        try {
            GelfMessage message = createGelfMessage(record);
            if (!message.isValid()) {
                reportError("GELF Message is invalid: " + message.toJson(), null, ErrorManager.WRITE_FAILURE);
                return;
            }

            if (null == gelfSender || !gelfSender.sendMessage(message)) {
                reportError("Could not send GELF message", null, ErrorManager.WRITE_FAILURE);
            }
        } catch (Exception e) {
            reportError("Could not send GELF message: " + e.getMessage(), e, ErrorManager.FORMAT_FAILURE);
        }
    }

    protected GelfSender createGelfSender() {
        return GelfSenderFactory.createSender(gelfMessageAssembler, errorReporter, Collections.<String, Object>emptyMap());
    }

    @Override
    public void reportError(String message, Exception e) {
        reportError(message, e, ErrorManager.GENERIC_FAILURE);
    }

    @Override
    public void close() {
        if (null != gelfSender) {
            Closer.close(gelfSender);
            gelfSender = null;
        }
    }

    protected GelfMessage createGelfMessage(final LogRecord record) {
        return gelfMessageAssembler.createGelfMessage(new JulLogEvent(record));
    }

    public void setAdditionalFields(String spec) {
        ConfigurationSupport.setAdditionalFields(spec, gelfMessageAssembler);
    }

    public void setAdditionalFieldTypes(String spec) {
        ConfigurationSupport.setAdditionalFieldTypes(spec, gelfMessageAssembler);
    }

    public void setMdcFields(String spec) {
        ConfigurationSupport.setMdcFields(spec, gelfMessageAssembler);
    }

    public void setDynamicMdcFields(String spec) {
        ConfigurationSupport.setDynamicMdcFields(spec, gelfMessageAssembler);
    }

    public void setDynamicMdcFieldTypes(String spec) {
        ConfigurationSupport.setDynamicMdcFieldTypes(spec, gelfMessageAssembler);
    }

    public String getGraylogHost() {
        return gelfMessageAssembler.getHost();
    }

    public void setGraylogHost(String graylogHost) {
        gelfMessageAssembler.setHost(graylogHost);
    }

    public String getOriginHost() {
        return gelfMessageAssembler.getOriginHost();
    }

    public void setOriginHost(String originHost) {
        gelfMessageAssembler.setOriginHost(originHost);
    }

    public String getHost() {
        return gelfMessageAssembler.getHost();
    }

    public void setHost(String host) {
        gelfMessageAssembler.setHost(host);
    }

    public int getPort() {
        return gelfMessageAssembler.getPort();
    }

    public void setPort(int port) {
        gelfMessageAssembler.setPort(port);
    }

    public int getGraylogPort() {
        return gelfMessageAssembler.getPort();
    }

    public void setGraylogPort(int graylogPort) {
        gelfMessageAssembler.setPort(graylogPort);
    }

    public String getFacility() {
        return gelfMessageAssembler.getFacility();
    }

    public void setFacility(String facility) {
        gelfMessageAssembler.setFacility(facility);
    }

    public String getExtractStackTrace() {
        return gelfMessageAssembler.getExtractStackTrace();
    }

    public void setExtractStackTrace(String extractStacktrace) {
        gelfMessageAssembler.setExtractStackTrace(extractStacktrace);
    }

    public boolean isFilterStackTrace() {
        return gelfMessageAssembler.isFilterStackTrace();
    }

    public void setFilterStackTrace(boolean filterStackTrace) {
        gelfMessageAssembler.setFilterStackTrace(filterStackTrace);
    }

    public boolean isIncludeLogMessageParameters() {
        return gelfMessageAssembler.isIncludeLogMessageParameters();
    }

    public void setIncludeLogMessageParameters(boolean includeLogMessageParameters) {
        gelfMessageAssembler.setIncludeLogMessageParameters(includeLogMessageParameters);
    }

    public boolean isIncludeLocation() {
        return gelfMessageAssembler.isIncludeLocation();
    }

    public void setIncludeLocation(boolean includeLocation) {
        gelfMessageAssembler.setIncludeLocation(includeLocation);
    }

    public String getTimestampPattern() {
        return gelfMessageAssembler.getTimestampPattern();
    }

    public void setTimestampPattern(String timestampPattern) {
        gelfMessageAssembler.setTimestampPattern(timestampPattern);
    }

    public int getMaximumMessageSize() {
        return gelfMessageAssembler.getMaximumMessageSize();
    }

    public void setMaximumMessageSize(int maximumMessageSize) {
        gelfMessageAssembler.setMaximumMessageSize(maximumMessageSize);
    }

    public String getVersion() {
        return gelfMessageAssembler.getVersion();
    }

    public void setVersion(String version) {
        gelfMessageAssembler.setVersion(version);
    }
}


text:
const Sequelize = require('sequelize');

module.exports = function(app) {
  const sequelizeClient = app.get('sequelizeClient');
  const projectMemberships = sequelizeClient.define(
    'projectMemberships',
    {
      type: {
        type: Sequelize.ENUM,
        values: ['editor', 'viewer'],
        allowNull: false,
      },
    },
    {
      underscoredAll: true,
      classMethods: {
        associate(models) {
          // eslint-disable-line no-unused-vars
          // Define associations here
          // See http://docs.sequelizejs.com/en/latest/docs/associations/
        },
      },
    }
  );

  return projectMemberships;
};


text:
import {
  CONFIGURATION_REQUEST,
  CONFIGURATION_SUCCESS,
  CONFIGURATION_FAILURE,
  SCREEN_DIMENSIONS_CHANGED
} from './constants';

export const getConfiguration = () => {
  return { type: CONFIGURATION_REQUEST };
};

export const configurationLoaded = configuration => {
  return { type: CONFIGURATION_SUCCESS, payload: configuration };
};

export const configurationFailed = error => {
  return { type: CONFIGURATION_FAILURE, payload: error };
};

export const setScreenDimensions = dimensions => {
  return { type: SCREEN_DIMENSIONS_CHANGED, payload: dimensions }
}