text:
(function() {

  describe("Nine Ball League Match", function() {
    var leagueMatch;
    leagueMatch = void 0;
    beforeEach(function() {
      var options, setUpMatchDefaults;
      leagueMatch = new $CS.Models.NineBall.LeagueMatch(options = {
        homeTeamNumber: "123",
        awayTeamNumber: "345",
        homeTeamName: "HomeTeam",
        awayTeamName: "AwayTeam",
        startTime: "10:00 pm",
        tableType: "Coin-Operated"
      });
      leagueMatch.setMatch(new $CS.Models.NineBall.Match(options = {
        playerOneName: "Player1",
        playerTwoName: "Player2",
        playerOneRank: 2,
        playerTwoRank: 2,
        playerOneNumber: "1",
        playerTwoNumber: "2",
        playerOneTeamNumber: "123",
        playerTwoTeamNumber: "345"
      }), 1);
      leagueMatch.match.one.player.one.currentlyUp = true;
      leagueMatch.setMatch(new $CS.Models.NineBall.Match(options = {
        playerOneName: "Player1",
        playerTwoName: "Player2",
        playerOneRank: 2,
        playerTwoRank: 2,
        playerOneNumber: "1",
        playerTwoNumber: "2",
        playerOneTeamNumber: "345",
        playerTwoTeamNumber: "123"
      }), 2);
      leagueMatch.match.two.player.one.currentlyUp = true;
      leagueMatch.setMatch(new $CS.Models.NineBall.Match(options = {
        playerOneName: "Player1",
        playerTwoName: "Player2",
        playerOneRank: 2,
        playerTwoRank: 2,
        playerOneNumber: "1",
        playerTwoNumber: "2",
        playerOneTeamNumber: "123",
        playerTwoTeamNumber: "345"
      }), 3);
      leagueMatch.match.three.player.one.currentlyUp = true;
      leagueMatch.setMatch(new $CS.Models.NineBall.Match(options = {
        playerOneName: "Player1",
        playerTwoName: "Player2",
        playerOneRank: 2,
        playerTwoRank: 2,
        playerOneNumber: "1",
        playerTwoNumber: "2",
        playerOneTeamNumber: "345",
        playerTwoTeamNumber: "123"
      }), 4);
      leagueMatch.match.four.player.one.currentlyUp = true;
      leagueMatch.setMatch(new $CS.Models.NineBall.Match(options = {
        playerOneName: "Player1",
        playerTwoName: "Player2",
        playerOneRank: 2,
        playerTwoRank: 2,
        playerOneNumber: "1",
        playerTwoNumber: "2",
        playerOneTeamNumber: "123",
        playerTwoTeamNumber: "345"
      }), 5);
      leagueMatch.match.five.player.one.currentlyUp = true;
      setUpMatchDefaults = function(matchNum) {
        leagueMatch.match[matchNum].player.one.currentlyUp = true;
        leagueMatch.match[matchNum].completedGames = [];
        leagueMatch.match[matchNum].ended = false;
        leagueMatch.match[matchNum].originalId = 0;
        leagueMatch.match[matchNum].leagueMatchId = 0;
        leagueMatch.match[matchNum].playerNumberWinning = 0;
        leagueMatch.match[matchNum].suddenDeath = false;
        leagueMatch.match[matchNum].forfeit = false;
        leagueMatch.match[matchNum].currentGame.player.one.score = 0;
        leagueMatch.match[matchNum].currentGame.player.one.nineOnSnap = false;
        leagueMatch.match[matchNum].currentGame.player.one.breakAndRun = false;
        leagueMatch.match[matchNum].currentGame.player.one.ballsHitIn = [];
        leagueMatch.match[matchNum].currentGame.player.one.deadBalls = [];
        leagueMatch.match[matchNum].currentGame.player.one.lastBall = null;
        leagueMatch.match[matchNum].currentGame.player.one.timeoutsTaken = 0;
        leagueMatch.match[matchNum].currentGame.player.two.score = 0;
        leagueMatch.match[matchNum].currentGame.player.two.nineOnSnap = false;
        leagueMatch.match[matchNum].currentGame.player.two.breakAndRun = false;
        leagueMatch.match[matchNum].currentGame.player.two.ballsHitIn = [];
        leagueMatch.match[matchNum].currentGame.player.two.deadBalls = [];
        leagueMatch.match[matchNum].currentGame.player.two.lastBall = null;
        leagueMatch.match[matchNum].currentGame.player.two.timeoutsTaken = 0;
        leagueMatch.match[matchNum].currentGame.numberOfInnings = 0;
        leagueMatch.match[matchNum].currentGame.ended = false;
        leagueMatch.match[matchNum].currentGame.onBreak = true;
        return leagueMatch.match[matchNum].currentGame.breakingPlayerStillShooting = true;
      };
      setUpMatchDefaults('one');
      setUpMatchDefaults('two');
      setUpMatchDefaults('three');
      setUpMatchDefaults('four');
      return setUpMatchDefaults('five');
    });
    it("should have homeTeamNumber, awayTeamNumber, startTime, and tableType initialized from constructor", function() {
      expect(leagueMatch.homeTeamNumber).toEqual("123");
      expect(leagueMatch.awayTeamNumber).toEqual("345");
      expect(leagueMatch.startTime).toEqual("10:00 pm");
      return expect(leagueMatch.tableType).toEqual("Coin-Operated");
    });
    it("should hold 5 different games", function() {
      expect(leagueMatch.match.one).toNotEqual(null);
      expect(leagueMatch.match.two).toNotEqual(null);
      expect(leagueMatch.match.three).toNotEqual(null);
      expect(leagueMatch.match.four).toNotEqual(null);
      return expect(leagueMatch.match.five).toNotEqual(null);
    });
    it("should hold a home and away team numbers", function() {
      expect(leagueMatch.homeTeamNumber).toEqual("123");
      return expect(leagueMatch.awayTeamNumber).toEqual("345");
    });
    it("should keep scorecard team owners number", function() {
      return expect(leagueMatch.teamNumber).toEqual("");
    });
    it("should have the Start Time and End Time", function() {
      return expect(leagueMatch.endTime).toEqual("");
    });
    it("should be able to calculate home and away teams scores", function() {
      leagueMatch.match.one.scoreNumberedBall(1);
      leagueMatch.match.one.scoreNumberedBall(2);
      leagueMatch.match.one.scoreNumberedBall(3);
      leagueMatch.match.one.scoreNumberedBall(4);
      expect(leagueMatch.getMatchPointsByTeam('home')).toEqual(20);
      expect(leagueMatch.getMatchPointsByTeam('away')).toEqual(0);
      leagueMatch.match.two.scoreNumberedBall(1);
      leagueMatch.match.two.scoreNumberedBall(2);
      leagueMatch.match.two.scoreNumberedBall(3);
      leagueMatch.match.two.shotMissed();
      leagueMatch.match.two.scoreNumberedBall(4);
      leagueMatch.match.two.scoreNumberedBall(5);
      leagueMatch.match.two.scoreNumberedBall(6);
      leagueMatch.match.two.scoreNumberedBall(7);
      leagueMatch.match.three.scoreNumberedBall(1);
      leagueMatch.match.three.scoreNumberedBall(2);
      leagueMatch.match.three.scoreNumberedBall(3);
      leagueMatch.match.three.shotMissed();
      leagueMatch.match.three.scoreNumberedBall(4);
      leagueMatch.match.three.scoreNumberedBall(5);
      leagueMatch.match.three.scoreNumberedBall(6);
      leagueMatch.match.three.scoreNumberedBall(7);
      leagueMatch.match.four.scoreNumberedBall(1);
      leagueMatch.match.four.scoreNumberedBall(2);
      leagueMatch.match.four.scoreNumberedBall(3);
      leagueMatch.match.four.scoreNumberedBall(4);
      leagueMatch.match.four.shotMissed();
      leagueMatch.match.four.scoreNumberedBall(4);
      leagueMatch.match.four.scoreNumberedBall(5);
      leagueMatch.match.four.scoreNumberedBall(6);
      leagueMatch.match.four.scoreNumberedBall(9);
      leagueMatch.match.five.scoreNumberedBall(1);
      leagueMatch.match.five.scoreNumberedBall(2);
      leagueMatch.match.five.scoreNumberedBall(3);
      leagueMatch.match.five.scoreNumberedBall(4);
      leagueMatch.match.five.shotMissed();
      leagueMatch.match.five.scoreNumberedBall(4);
      leagueMatch.match.five.scoreNumberedBall(5);
      leagueMatch.match.five.scoreNumberedBall(6);
      leagueMatch.match.five.scoreNumberedBall(9);
      expect(leagueMatch.getMatchPointsByTeam('home')).toEqual(60);
      return expect(leagueMatch.getMatchPointsByTeam('away')).toEqual(40);
    });
    it("should know which team is winning the match", function() {
      leagueMatch.match.one.scoreNumberedBall(1);
      leagueMatch.match.one.scoreNumberedBall(2);
      leagueMatch.match.one.scoreNumberedBall(3);
      leagueMatch.match.one.scoreNumberedBall(4);
      expect(leagueMatch.isHomeTeamWinning()).toEqual(true);
      expect(leagueMatch.isAwayTeamWinning()).toEqual(false);
      leagueMatch.match.two.scoreNumberedBall(1);
      leagueMatch.match.two.scoreNumberedBall(2);
      leagueMatch.match.two.scoreNumberedBall(3);
      leagueMatch.match.two.currentGame.breakIsOver();
      leagueMatch.match.two.shotMissed();
      leagueMatch.match.two.scoreNumberedBall(4);
      leagueMatch.match.two.scoreNumberedBall(5);
      leagueMatch.match.two.scoreNumberedBall(6);
      leagueMatch.match.two.scoreNumberedBall(7);
      leagueMatch.match.three.currentGame.breakIsOver();
      leagueMatch.match.three.shotMissed();
      leagueMatch.match.three.scoreNumberedBall(1);
      leagueMatch.match.three.scoreNumberedBall(2);
      leagueMatch.match.three.scoreNumberedBall(3);
      leagueMatch.match.three.scoreNumberedBall(4);
      leagueMatch.match.three.scoreNumberedBall(5);
      leagueMatch.match.three.scoreNumberedBall(6);
      leagueMatch.match.three.scoreNumberedBall(7);
      leagueMatch.match.four.currentGame.breakIsOver();
      leagueMatch.match.four.shotMissed();
      leagueMatch.match.four.scoreNumberedBall(1);
      leagueMatch.match.four.scoreNumberedBall(2);
      leagueMatch.match.four.scoreNumberedBall(3);
      leagueMatch.match.four.scoreNumberedBall(4);
      leagueMatch.match.four.scoreNumberedBall(4);
      leagueMatch.match.four.scoreNumberedBall(5);
      leagueMatch.match.four.scoreNumberedBall(6);
      leagueMatch.match.four.scoreNumberedBall(9);
      leagueMatch.match.five.shotMissed();
      leagueMatch.match.five.scoreNumberedBall(1);
      leagueMatch.match.five.scoreNumberedBall(2);
      leagueMatch.match.five.scoreNumberedBall(3);
      leagueMatch.match.five.scoreNumberedBall(4);
      leagueMatch.match.five.scoreNumberedBall(4);
      leagueMatch.match.five.scoreNumberedBall(5);
      leagueMatch.match.five.scoreNumberedBall(6);
      leagueMatch.match.five.scoreNumberedBall(9);
      expect(leagueMatch.isHomeTeamWinning()).toEqual(false);
      return expect(leagueMatch.isAwayTeamWinning()).toEqual(true);
    });
    it("should be able to get the winning teams number", function() {
      leagueMatch.match.one.scoreNumberedBall(1);
      leagueMatch.match.one.scoreNumberedBall(2);
      leagueMatch.match.one.scoreNumberedBall(3);
      leagueMatch.match.one.scoreNumberedBall(4);
      expect(leagueMatch.getWinningTeamNumber()).toEqual("123");
      leagueMatch.match.two.currentGame.breakIsOver();
      leagueMatch.match.two.scoreNumberedBall(1);
      leagueMatch.match.two.scoreNumberedBall(2);
      leagueMatch.match.two.scoreNumberedBall(3);
      leagueMatch.match.two.shotMissed();
      leagueMatch.match.two.scoreNumberedBall(4);
      leagueMatch.match.two.scoreNumberedBall(5);
      leagueMatch.match.two.scoreNumberedBall(6);
      leagueMatch.match.two.scoreNumberedBall(7);
      leagueMatch.match.three.currentGame.breakIsOver();
      leagueMatch.match.three.shotMissed();
      leagueMatch.match.three.scoreNumberedBall(1);
      leagueMatch.match.three.scoreNumberedBall(2);
      leagueMatch.match.three.scoreNumberedBall(3);
      leagueMatch.match.three.scoreNumberedBall(4);
      leagueMatch.match.three.scoreNumberedBall(5);
      leagueMatch.match.three.scoreNumberedBall(6);
      leagueMatch.match.three.scoreNumberedBall(7);
      leagueMatch.match.four.currentGame.breakIsOver();
      leagueMatch.match.four.shotMissed();
      leagueMatch.match.four.scoreNumberedBall(1);
      leagueMatch.match.four.scoreNumberedBall(2);
      leagueMatch.match.four.scoreNumberedBall(3);
      leagueMatch.match.four.scoreNumberedBall(4);
      leagueMatch.match.four.scoreNumberedBall(4);
      leagueMatch.match.four.scoreNumberedBall(5);
      leagueMatch.match.four.scoreNumberedBall(6);
      leagueMatch.match.four.scoreNumberedBall(9);
      leagueMatch.match.five.shotMissed();
      leagueMatch.match.five.scoreNumberedBall(1);
      leagueMatch.match.five.scoreNumberedBall(2);
      leagueMatch.match.five.scoreNumberedBall(3);
      leagueMatch.match.five.scoreNumberedBall(4);
      leagueMatch.match.five.scoreNumberedBall(4);
      leagueMatch.match.five.scoreNumberedBall(5);
      leagueMatch.match.five.scoreNumberedBall(6);
      leagueMatch.match.five.scoreNumberedBall(9);
      return expect(leagueMatch.getWinningTeamNumber()).toEqual("345");
    });
    it("should be able to set each match and set the leagueMatchId for each", function() {
      expect(leagueMatch.match.one.leagueMatchId).toEqual(1);
      expect(leagueMatch.match.two.leagueMatchId).toEqual(2);
      expect(leagueMatch.match.three.leagueMatchId).toEqual(3);
      expect(leagueMatch.match.four.leagueMatchId).toEqual(4);
      return expect(leagueMatch.match.five.leagueMatchId).toEqual(5);
    });
    it("should be able to keep team names", function() {
      expect(leagueMatch.homeTeamName).toEqual("HomeTeam");
      return expect(leagueMatch.awayTeamName).toEqual("AwayTeam");
    });
    it("should be able to tell which team has signed the match", function() {
      expect(leagueMatch.homeTeamSigned).toEqual(false);
      expect(leagueMatch.awayTeamSigned).toEqual(false);
      leagueMatch.homeTeamSigned = true;
      leagueMatch.awayTeamSigned = true;
      expect(leagueMatch.homeTeamSigned).toEqual(true);
      return expect(leagueMatch.awayTeamSigned).toEqual(true);
    });
    it("should know when all of the matches have ended and the league match is complete", function() {
      leagueMatch.match.one.ended = true;
      leagueMatch.match.two.ended = true;
      leagueMatch.match.three.ended = true;
      leagueMatch.match.four.ended = true;
      leagueMatch.match.five.ended = true;
      return expect(leagueMatch.ended()).toEqual(true);
    });
    return describe("toJSON/fromJSON", function() {
      it("should be able to take a new League Match and turn it into a JSON object", function() {
        return expect(leagueMatch.toJSON()).toEqual({
          match: {
            one: {
              player: {
                one: {
                  name: "Player1",
                  rank: 2,
                  ballCount: "19",
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 2,
                  ballCount: "19",
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: false
                }
              },
              playerOneMatchPointsEarned: 0,
              playerTwoMatchPointsEarned: 0,
              currentGame: {
                playerOneScore: 0,
                playerOneTimeoutsTaken: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerOneBallsHitIn: [],
                playerOneDeadBalls: [],
                playerOneLastBall: null,
                playerTwoScore: 0,
                playerTwoTimeoutsTaken: 0,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                playerTwoBallsHitIn: [],
                playerTwoDeadBalls: [],
                playerTwoLastBall: null,
                ended: false,
                numberOfInnings: 0,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              suddenDeath: false,
              forfeit: false,
              ended: false,
              originalId: 0,
              leagueMatchId: 0
            },
            two: {
              player: {
                one: {
                  name: "Player1",
                  rank: 2,
                  ballCount: "19",
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 2,
                  ballCount: "19",
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: false
                }
              },
              playerOneMatchPointsEarned: 0,
              playerTwoMatchPointsEarned: 0,
              currentGame: {
                playerOneScore: 0,
                playerOneTimeoutsTaken: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerOneBallsHitIn: [],
                playerOneDeadBalls: [],
                playerOneLastBall: null,
                playerTwoScore: 0,
                playerTwoTimeoutsTaken: 0,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                playerTwoBallsHitIn: [],
                playerTwoDeadBalls: [],
                playerTwoLastBall: null,
                ended: false,
                numberOfInnings: 0,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              suddenDeath: false,
              forfeit: false,
              ended: false,
              originalId: 0,
              leagueMatchId: 0
            },
            three: {
              player: {
                one: {
                  name: "Player1",
                  rank: 2,
                  ballCount: "19",
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 2,
                  ballCount: "19",
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: false
                }
              },
              playerOneMatchPointsEarned: 0,
              playerTwoMatchPointsEarned: 0,
              currentGame: {
                playerOneScore: 0,
                playerOneTimeoutsTaken: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerOneBallsHitIn: [],
                playerOneDeadBalls: [],
                playerOneLastBall: null,
                playerTwoScore: 0,
                playerTwoTimeoutsTaken: 0,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                playerTwoBallsHitIn: [],
                playerTwoDeadBalls: [],
                playerTwoLastBall: null,
                ended: false,
                numberOfInnings: 0,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              suddenDeath: false,
              forfeit: false,
              ended: false,
              originalId: 0,
              leagueMatchId: 0
            },
            four: {
              player: {
                one: {
                  name: "Player1",
                  rank: 2,
                  ballCount: "19",
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 2,
                  ballCount: "19",
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: false
                }
              },
              playerOneMatchPointsEarned: 0,
              playerTwoMatchPointsEarned: 0,
              currentGame: {
                playerOneScore: 0,
                playerOneTimeoutsTaken: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerOneBallsHitIn: [],
                playerOneDeadBalls: [],
                playerOneLastBall: null,
                playerTwoScore: 0,
                playerTwoTimeoutsTaken: 0,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                playerTwoBallsHitIn: [],
                playerTwoDeadBalls: [],
                playerTwoLastBall: null,
                ended: false,
                numberOfInnings: 0,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              suddenDeath: false,
              forfeit: false,
              ended: false,
              originalId: 0,
              leagueMatchId: 0
            },
            five: {
              player: {
                one: {
                  name: "Player1",
                  rank: 2,
                  ballCount: "19",
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 2,
                  ballCount: "19",
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  currentlyUp: false
                }
              },
              playerOneMatchPointsEarned: 0,
              playerTwoMatchPointsEarned: 0,
              currentGame: {
                playerOneScore: 0,
                playerOneTimeoutsTaken: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerOneBallsHitIn: [],
                playerOneDeadBalls: [],
                playerOneLastBall: null,
                playerTwoScore: 0,
                playerTwoTimeoutsTaken: 0,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                playerTwoBallsHitIn: [],
                playerTwoDeadBalls: [],
                playerTwoLastBall: null,
                ended: false,
                numberOfInnings: 0,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              suddenDeath: false,
              forfeit: false,
              ended: false,
              originalId: 0,
              leagueMatchId: 0
            }
          },
          teamNumber: "",
          homeTeamNumber: "123",
          awayTeamNumber: "345",
          startTime: "10:00 pm",
          endTime: "",
          tableType: "Coin-Operated",
          leagueMatchId: 1
        });
      });
      it("should be able to take a new League Match and turn it into a small JSON object", function() {
        return expect(leagueMatch.toSmallJSON()).toEqual({
          teamNumber: "",
          homeTeamNumber: "123",
          awayTeamNumber: "345",
          startTime: "10:00 pm",
          endTime: "",
          tableType: "Coin-Operated",
          leagueMatchId: 1
        });
      });
      it("should be able to set SmallJSON = true to return only the small JSON object when toJSON is called.", function() {
        leagueMatch.smallJSON = true;
        return expect(leagueMatch.toJSON()).toEqual({
          teamNumber: "",
          homeTeamNumber: "123",
          awayTeamNumber: "345",
          startTime: "10:00 pm",
          endTime: "",
          tableType: "Coin-Operated",
          leagueMatchId: 1
        });
      });
      it("should be able to take a json object and fill its own values", function() {
        var options;
        leagueMatch = new $CS.Models.NineBall.LeagueMatch(options = {
          homeTeamNumber: "123",
          awayTeamNumber: "345",
          homeTeamName: "HomeTeam",
          awayTeamName: "AwayTeam",
          startTime: "10:00 pm",
          tableType: "Coin-Operated"
        });
        leagueMatch.fromJSON({
          match: {
            one: {
              player: {
                one: {
                  name: "PlayerOne",
                  rank: 1,
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 1,
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: false
                }
              },
              currentGame: {
                playerOneScore: 0,
                playerTwoScore: 0,
                numberOfInnings: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                ended: false,
                playerOneBallsHitIn: [],
                playerTwoBallsHitIn: [],
                playerOneDeadBalls: [],
                playerTwoDeadBalls: [],
                playerOneLastBall: null,
                playerTwoLastBall: null,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              ended: false,
              originalId: 0,
              leagueMatchId: 1
            },
            two: {
              player: {
                one: {
                  name: "PlayerOne",
                  rank: 1,
                  number: "1",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: false
                },
                two: {
                  name: "Player2",
                  rank: 1,
                  number: "2",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: true
                }
              },
              currentGame: {
                playerOneScore: 0,
                playerTwoScore: 0,
                numberOfInnings: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                ended: false,
                playerOneBallsHitIn: [],
                playerTwoBallsHitIn: [],
                playerOneDeadBalls: [],
                playerTwoDeadBalls: [],
                playerOneLastBall: null,
                playerTwoLastBall: null,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              ended: false,
              originalId: 0,
              leagueMatchId: 1
            },
            three: {
              player: {
                one: {
                  name: "PlayerOne",
                  rank: 1,
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 1,
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: false
                }
              },
              currentGame: {
                playerOneScore: 0,
                playerTwoScore: 0,
                numberOfInnings: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                ended: false,
                playerOneBallsHitIn: [],
                playerTwoBallsHitIn: [],
                playerOneDeadBalls: [],
                playerTwoDeadBalls: [],
                playerOneLastBall: null,
                playerTwoLastBall: null,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              ended: false,
              originalId: 0,
              leagueMatchId: 1
            },
            four: {
              player: {
                one: {
                  name: "PlayerOne",
                  rank: 1,
                  number: "1",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 1,
                  number: "2",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: false
                }
              },
              currentGame: {
                playerOneScore: 0,
                playerTwoScore: 0,
                numberOfInnings: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                ended: false,
                playerOneBallsHitIn: [],
                playerTwoBallsHitIn: [],
                playerOneDeadBalls: [],
                playerTwoDeadBalls: [],
                playerOneLastBall: null,
                playerTwoLastBall: null,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              ended: false,
              originalId: 0,
              leagueMatchId: 1
            },
            five: {
              player: {
                one: {
                  name: "TestPlayer",
                  rank: 1,
                  number: "1",
                  teamNumber: "345",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: true
                },
                two: {
                  name: "Player2",
                  rank: 1,
                  number: "2",
                  teamNumber: "123",
                  score: 0,
                  safeties: 0,
                  nineOnSnaps: 0,
                  breakAndRuns: 0,
                  timeoutsTaken: 0,
                  currentlyUp: false
                }
              },
              currentGame: {
                playerOneScore: 0,
                playerTwoScore: 0,
                numberOfInnings: 0,
                playerOneNineOnSnap: false,
                playerOneBreakAndRun: false,
                playerTwoNineOnSnap: false,
                playerTwoBreakAndRun: false,
                ended: false,
                playerOneBallsHitIn: [],
                playerTwoBallsHitIn: [],
                playerOneDeadBalls: [],
                playerTwoDeadBalls: [],
                playerOneLastBall: null,
                playerTwoLastBall: null,
                onBreak: true,
                breakingPlayerStillShooting: true
              },
              completedGames: [],
              ended: false,
              originalId: 0,
              leagueMatchId: 1
            }
          },
          teamNumber: "",
          homeTeamNumber: "123",
          awayTeamNumber: "345",
          startTime: "10:00 pm",
          endTime: "",
          tableType: "Coin-Operated",
          leagueMatchId: null
        });
        expect(leagueMatch.teamNumber).toEqual("");
        expect(leagueMatch.homeTeamNumber).toEqual("123");
        expect(leagueMatch.awayTeamNumber).toEqual("345");
        expect(leagueMatch.startTime).toEqual("10:00 pm");
        expect(leagueMatch.endTime).toEqual("");
        expect(leagueMatch.tableType).toEqual("Coin-Operated");
        expect(leagueMatch.leagueMatchId).toEqual(null);
        expect(leagueMatch.match.five.player.one.name).toEqual("TestPlayer");
        leagueMatch.match.five.scoreNumberedBall(9);
        expect(leagueMatch.match.five.currentGame.getBallsScored()).toEqual([9]);
        leagueMatch.match.five.startNewGame();
        expect(leagueMatch.match.five.currentGame.getBallsScored()).toEqual([]);
        return expect(leagueMatch.match.five.completedGames.length).toEqual(1);
      });
      return it("should be able to take a small json object and fill its own values", function() {
        var options;
        leagueMatch = new $CS.Models.NineBall.LeagueMatch(options = {
          homeTeamNumber: "123",
          awayTeamNumber: "345",
          homeTeamName: "HomeTeam",
          awayTeamName: "AwayTeam",
          startTime: "10:00 pm",
          tableType: "Coin-Operated"
        });
        leagueMatch.fromSmallJSON({
          teamNumber: "",
          homeTeamNumber: "123",
          awayTeamNumber: "345",
          startTime: "10:00 pm",
          endTime: "",
          tableType: "Coin-Operated",
          leagueMatchId: null
        });
        expect(leagueMatch.teamNumber).toEqual("");
        expect(leagueMatch.homeTeamNumber).toEqual("123");
        expect(leagueMatch.awayTeamNumber).toEqual("345");
        expect(leagueMatch.startTime).toEqual("10:00 pm");
        expect(leagueMatch.endTime).toEqual("");
        expect(leagueMatch.tableType).toEqual("Coin-Operated");
        return expect(leagueMatch.leagueMatchId).toEqual(null);
      });
    });
  });

}).call(this);


text:
(function() {
  define(["clazzy/Clazzy"], function(Class) {
    'use strict';
    return Class("mizuhiki.MizuhikiMeta", null, null, {
      constructor: function() {
        this._attachPoints = {};
        this._attachEvents = {};
        this._attachIds = {};
        this._dataBindings = {};
        this._setterBindings = {};
        return this;
      }
    });
  });

}).call(this);

//# sourceMappingURL=MizuhikiMeta.js.map

redpajama_set_name: RedPajamaGithub


text:
let double = (x) => { return 2 * x; };
let triple = (x) => 3 * x;

// Assignment is allowed
let value = {};
let setName = (x) => x.name = "Matt";
setName(value);
console.log(value.name);  // "Matt"

// Invalid syntax:
let multiply = (a, b) => return a * b;


text:
nfc_read
========

nfc_read is an awesome utility that reads the serial no from a nfc reader device.

Disclaimer
==========

This stuff is not done yet, we're still experimenting a lot.

Requirements
============

* C++14
* CMake 3.0
* libnfc


text:
MAINTENANCE

VENDOR

					SEARCH BY :

						<select name="forecast_param" class="form-control filter1">
							<option value="aw.warehouse_name">WAREHOUSE</option>
							<option value="ae.employee_name">CREATED BY</option>
							<option value="3">DATE</option>
						</select>
						<input type="text" class="form-control value1" id="ddd" name="forecast_param1_value" placeholder="value">
						<button type="submit" name="submit_param" class="btn btn-default" onclick="excecuteSearch()"></button>

                <a href="<?=base_url('asset/MaintenanceSchedule/insert')?>"><button class="btn btn-primary">NEW</button>

								No
								Asset Code
								Contract Category
                                Asset Name
                                Maintenance scheduled
                                Maintenance executed
                                See Detail


text:
#include "exception.h"
#include "hdfs.h"
#include "jni_helper.h"

#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define EXCEPTION_INFO_LEN (sizeof(gExceptionInfo)/sizeof(gExceptionInfo[0]))

struct ExceptionInfo {
    const char * const name;
    int noPrintFlag;
    int excErrno;
};

static const struct ExceptionInfo gExceptionInfo[] = {
    {
        .name = "java/io/FileNotFoundException",
        .noPrintFlag = NOPRINT_EXC_FILE_NOT_FOUND,
        .excErrno = ENOENT,
    },
    {
        .name = "org/apache/hadoop/security/AccessControlException",
        .noPrintFlag = NOPRINT_EXC_ACCESS_CONTROL,
        .excErrno = EACCES,
    },
    {
        .name = "org/apache/hadoop/fs/UnresolvedLinkException",
        .noPrintFlag = NOPRINT_EXC_UNRESOLVED_LINK,
        .excErrno = ENOLINK,
    },
    {
        .name = "org/apache/hadoop/fs/ParentNotDirectoryException",
        .noPrintFlag = NOPRINT_EXC_PARENT_NOT_DIRECTORY,
        .excErrno = ENOTDIR,
    },
    {
        .name = "java/lang/IllegalArgumentException",
        .noPrintFlag = NOPRINT_EXC_ILLEGAL_ARGUMENT,
        .excErrno = EINVAL,
    },
    {
        .name = "java/lang/OutOfMemoryError",
        .noPrintFlag = 0,
        .excErrno = ENOMEM,
    },

};

int printExceptionAndFreeV(JNIEnv *env, jthrowable exc, int noPrintFlags,
        const char *fmt, va_list ap)
{
    int i, noPrint, excErrno;
    char *className = NULL;
    jstring jStr = NULL;
    jvalue jVal;
    jthrowable jthr;

    jthr = classNameOfObject(exc, env, &className);
    if (jthr) {
        fprintf(stderr, "PrintExceptionAndFree: error determining class name "
            "of exception.\n");
        className = strdup("(unknown)");
        destroyLocalReference(env, jthr);
    }
    for (i = 0; i < EXCEPTION_INFO_LEN; i++) {
        if (!strcmp(gExceptionInfo[i].name, className)) {
            break;
        }
    }
    if (i < EXCEPTION_INFO_LEN) {
        noPrint = (gExceptionInfo[i].noPrintFlag & noPrintFlags);
        excErrno = gExceptionInfo[i].excErrno;
    } else {
        noPrint = 0;
        excErrno = EINTERNAL;
    }
    if (!noPrint) {
        vfprintf(stderr, fmt, ap);
        fprintf(stderr, " error:\n");

        // We don't want to  use ExceptionDescribe here, because that requires a
        // pending exception.  Instead, use ExceptionUtils.
        jthr = invokeMethod(env, &jVal, STATIC, NULL,
            "org/apache/commons/lang/exception/ExceptionUtils",
            "getStackTrace", "(Ljava/lang/Throwable;)Ljava/lang/String;", exc);
        if (jthr) {
            fprintf(stderr, "(unable to get stack trace for %s exception: "
                    "ExceptionUtils::getStackTrace error.)\n", className);
            destroyLocalReference(env, jthr);
        } else {
            jStr = jVal.l;
            const char *stackTrace = (*env)->GetStringUTFChars(env, jStr, NULL);
            if (!stackTrace) {
                fprintf(stderr, "(unable to get stack trace for %s exception: "
                        "GetStringUTFChars error.)\n", className);
            } else {
                fprintf(stderr, "%s", stackTrace);
                (*env)->ReleaseStringUTFChars(env, jStr, stackTrace);
            }
        }
    }
    destroyLocalReference(env, jStr);
    destroyLocalReference(env, exc);
    free(className);
    return excErrno;
}

int printExceptionAndFree(JNIEnv *env, jthrowable exc, int noPrintFlags,
        const char *fmt, ...)
{
    va_list ap;
    int ret;

    va_start(ap, fmt);
    ret = printExceptionAndFreeV(env, exc, noPrintFlags, fmt, ap);
    va_end(ap);
    return ret;
}

int printPendingExceptionAndFree(JNIEnv *env, int noPrintFlags,
        const char *fmt, ...)
{
    va_list ap;
    int ret;
    jthrowable exc;

    exc = (*env)->ExceptionOccurred(env);
    if (!exc) {
        va_start(ap, fmt);
        vfprintf(stderr, fmt, ap);
        va_end(ap);
        fprintf(stderr, " error: (no exception)");
        ret = 0;
    } else {
        (*env)->ExceptionClear(env);
        va_start(ap, fmt);
        ret = printExceptionAndFreeV(env, exc, noPrintFlags, fmt, ap);
        va_end(ap);
    }
    return ret;
}

jthrowable getPendingExceptionAndClear(JNIEnv *env)
{
    jthrowable jthr = (*env)->ExceptionOccurred(env);
    if (!jthr)
        return NULL;
    (*env)->ExceptionClear(env);
    return jthr;
}

jthrowable newRuntimeError(JNIEnv *env, const char *fmt, ...)
{
    char buf[512];
    jobject out, exc;
    jstring jstr;
    va_list ap;

    va_start(ap, fmt);
    vsnprintf(buf, sizeof(buf), fmt, ap);
    va_end(ap);
    jstr = (*env)->NewStringUTF(env, buf);
    if (!jstr) {
        // We got an out of memory exception rather than a RuntimeException.
        // Too bad...
        return getPendingExceptionAndClear(env);
    }
    exc = constructNewObjectOfClass(env, &out, "RuntimeException",
        "(java/lang/String;)V", jstr);
    (*env)->DeleteLocalRef(env, jstr);
    // Again, we'll either get an out of memory exception or the
    // RuntimeException we wanted.
    return (exc) ? exc : out;
}


text:
using System.Text.Json;
using Azure.Core;

namespace Azure.Analytics.Synapse.Artifacts.Models
{
    public partial class RedshiftUnloadSettings : IUtf8JsonSerializable
    {
        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("s3LinkedServiceName");
            writer.WriteObjectValue(S3LinkedServiceName);
            writer.WritePropertyName("bucketName");
            writer.WriteObjectValue(BucketName);
            writer.WriteEndObject();
        }

        internal static RedshiftUnloadSettings DeserializeRedshiftUnloadSettings(JsonElement element)
        {
            LinkedServiceReference s3LinkedServiceName = default;
            object bucketName = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("s3LinkedServiceName"))
                {
                    s3LinkedServiceName = LinkedServiceReference.DeserializeLinkedServiceReference(property.Value);
                    continue;
                }
                if (property.NameEquals("bucketName"))
                {
                    bucketName = property.Value.GetObject();
                    continue;
                }
            }
            return new RedshiftUnloadSettings(s3LinkedServiceName, bucketName);
        }
    }
}


text:
DROP ROLE IF EXISTS read_access;
CREATE ROLE read_access NOLOGIN;
GRANT USAGE ON SCHEMA api TO read_access;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA api TO read_access;
GRANT SELECT ON ALL TABLES IN SCHEMA api TO read_access;

-- Create the anonymous role that all users that do not authorize use.
DROP ROLE IF EXISTS web_anon;
CREATE ROLE web_anon NOLOGIN;
GRANT web_anon TO lemmingpants;
GRANT read_access TO web_anon;

-- authorized_attendee can add and remove itself from speaker_queues.
DROP ROLE IF EXISTS authorized_attendee;
CREATE ROLE authorized_attendee NOLOGIN;
GRANT authorized_attendee TO lemmingpants;
GRANT read_access TO authorized_attendee;

-- The admin user can do a lot of fun things.
DROP ROLE IF EXISTS admin_user;
CREATE ROLE admin_user NOLOGIN;
GRANT admin_user TO lemmingpants;
GRANT read_access TO admin_user;
GRANT USAGE ON ALL SEQUENCES IN SCHEMA api TO admin_user;

-- Infrastructure for user roles ----------------------------------------------

SET SCHEMA 'model';

-- Saves usernames and passwords and maps users to roles.
CREATE TABLE users (
    username text PRIMARY KEY,
    password text NOT NULL,
    role     name NOT NULL
);

CREATE UNIQUE INDEX ON users (LOWER(username));

CREATE FUNCTION check_role_exists() RETURNS TRIGGER
    LANGUAGE plpgsql
    AS $$
    BEGIN
        IF NOT EXISTS (SELECT 1 FROM pg_roles AS r WHERE r.rolname = NEW.role) THEN
            RAISE FOREIGN_KEY_VIOLATION USING message = 'Unknown database role: ' || new.role;
            RETURN NULL;
        END IF;
        RETURN NEW;
    END
    $$;

CREATE CONSTRAINT TRIGGER ensure_user_role_exists
    AFTER INSERT OR UPDATE ON users
    FOR EACH ROW
        EXECUTE PROCEDURE check_role_exists();

CREATE FUNCTION encrypt_password() RETURNS TRIGGER
    LANGUAGE plpgsql
    AS $$
    BEGIN
        IF tg_op = 'INSERT' OR NEW.password <> OLD.password THEN
            NEW.password = crypt(NEW.password, gen_salt('bf', 8));
        END IF;
        RETURN NEW;
    end
    $$;

CREATE TRIGGER encrypt_password
    BEFORE INSERT OR UPDATE ON users
    FOR EACH ROW
        EXECUTE PROCEDURE encrypt_password();

-- Useful functions ---------------------------------------------------------
CREATE FUNCTION model.send_websocket_notification(event TEXT, message json) RETURNS void
    LANGUAGE sql SECURITY DEFINER SET search_path = model, public, pg_temp
    AS $$
        SELECT pg_notify(
          'postgres-websockets-listener',
          json_build_object('channel', 'state_updates', 'event', event, 'payload', message)::text
        );
    $$;

REVOKE ALL ON FUNCTION model.send_websocket_notification(event TEXT, message json) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION model.send_websocket_notification(event TEXT, message json) TO read_access;

CREATE FUNCTION model.websocket_news() RETURNS TRIGGER
    LANGUAGE plpgsql SECURITY DEFINER SET search_path = model, public, pg_temp
    AS $$
    BEGIN
        PERFORM model.send_websocket_notification(LOWER(TG_TABLE_NAME) || '_' || LOWER(TG_OP), row_to_json(NEW));
        RETURN NEW;
    END
    $$;

REVOKE ALL ON FUNCTION model.websocket_news() FROM PUBLIC;
GRANT EXECUTE ON FUNCTION model.websocket_news() TO read_access;


text:
@implementation ZWCommonConfig
+ (instancetype)sharedConfig{
    static ZWCommonConfig *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[ZWCommonConfig alloc] init];
    });
    return instance;
}
-(instancetype)init{
    self = [super init];
    if (self) {
        self.commonCellHeight       = 50.f;
        self.titleFontSize          = 15.f;
        self.detailTitleFontSize    = 15.f;
        self.textContainerInset = UIEdgeInsetsMake(8, 20, 8, 20);
    }
    return self;
}
@end


text:
package com.github.dylon.liblevenshtein.levenshtein;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;

import com.github.dylon.liblevenshtein.levenshtein.factory.ElementFactory;
import com.github.dylon.liblevenshtein.levenshtein.factory.PositionFactory;
import com.github.dylon.liblevenshtein.levenshtein.factory.StateFactory;

public abstract class AbstractXPositionTransitionFunctionTest {
  protected static final int N = 3; // max number of errors
  protected static final int W = 4; // length of characteristic vector

  protected final AbstractPositionTransitionFunction transition = buildTransition();

  protected final ElementFactory<int[]> elementFactory = new ElementFactory<>();
  protected final StateFactory stateFactory = new StateFactory();
  protected final PositionFactory positionFactory = new PositionFactory.ForXPositions();

  protected int i = 0;
  protected int e = 0;
  protected int x = 0;

  protected AbstractXPositionTransitionFunctionTest() {
    stateFactory.elementFactory(elementFactory);
    transition.stateFactory(stateFactory);
    transition.positionFactory(positionFactory);
  }

  protected abstract AbstractPositionTransitionFunction buildTransition();

  protected void check(boolean... characteristicVector) {
    final IState actualState = transition.of(N, new int[] {i,e,x}, characteristicVector, 0);
    assertNull(actualState);
  }

  protected void check(
      final int i1, final int e1, final int t1,
      final boolean... characteristicVector) {
    final IState actualState = transition.of(N, new int[] {i,e,x}, characteristicVector, 0);
    final int[] position = positionFactory.build(i1,e1,t1);
    final IState expectedState = stateFactory.build(position);
    assertEquals(actualState, expectedState);
  }

  protected void check(
      final int i1, final int e1, final int t1,
      final int i2, final int e2, final int t2,
      final boolean... characteristicVector) {
    final IState actualState = transition.of(N, new int[] {i,e,x}, characteristicVector, 0);
    final int[] p1 = positionFactory.build(i1,e1,t1);
    final int[] p2 = positionFactory.build(i2,e2,t2);
    final IState expectedState = stateFactory.build(p1,p2);
    assertEquals(actualState, expectedState);
  }

  protected void check(
      final int i1, final int e1, final int t1,
      final int i2, final int e2, final int t2,
      final int i3, final int e3, final int t3,
      final boolean... characteristicVector) {
    final IState actualState = transition.of(N, new int[] {i,e,x}, characteristicVector, 0);
    final int[] p1 = positionFactory.build(i1,e1,t1);
    final int[] p2 = positionFactory.build(i2,e2,t2);
    final int[] p3 = positionFactory.build(i3,e3,t3);
    final IState expectedState = stateFactory.build(p1,p2,p3);
    assertEquals(actualState, expectedState);
  }

  protected void check(
      final int i1, final int e1, final int t1,
      final int i2, final int e2, final int t2,
      final int i3, final int e3, final int t3,
      final int i4, final int e4, final int t4,
      final boolean... characteristicVector) {
    final IState actualState = transition.of(N, new int[] {i,e,x}, characteristicVector, 0);
    final int[] p1 = positionFactory.build(i1,e1,t1);
    final int[] p2 = positionFactory.build(i2,e2,t2);
    final int[] p3 = positionFactory.build(i3,e3,t3);
    final int[] p4 = positionFactory.build(i4,e4,t4);
    final IState expectedState = stateFactory.build(p1,p2,p3,p4);
    assertEquals(actualState, expectedState);
  }
}


text:
<?php

namespace NetSuite\Classes;

class ItemAccountMappingSearchAdvanced extends SearchRecord {
    public $criteria;
    public $columns;
    public $savedSearchId;
    public $savedSearchScriptId;
    static $paramtypesmap = array(
        "criteria" => "ItemAccountMappingSearch",
        "columns" => "ItemAccountMappingSearchRow",
        "savedSearchId" => "string",
        "savedSearchScriptId" => "string",
    );
}


text:
//  Copyright (c) 2015 Pactera. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "PPLNotificationCenter.h"
#import "PPLUtils.h"

@implementation PPLNotificationCenter

/**
 *  Returns the signletone instance of this class
 *
 *  @return creates and returns the instance or returns the already created
 * instance
 */
+ (PPLNotificationCenter *)sharedClient
{
    static PPLNotificationCenter *_sharedClient = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
      _sharedClient = [[PPLNotificationCenter alloc] init];
    });
    return _sharedClient;
}

- (id)init
{
    if (self = [super init])
    {
        // nothing here at the moment
    }
    return self;
}

/**
 *  Regist for notification permission
 *  Called in app delegate
 */
- (void)registerNotificationPermission
{
    if ([UIApplication
            instancesRespondToSelector:@selector(
                                           registerUserNotificationSettings:)])
    {
        [[UIApplication sharedApplication]
            registerUserNotificationSettings:
                [UIUserNotificationSettings
                    settingsForTypes:UIUserNotificationTypeAlert |
                                     UIUserNotificationTypeBadge |
                                     UIUserNotificationTypeSound
                          categories:nil]];
        [self recordVoteSubmissionTimeForNotificationSetup];
    }
}

- (BOOL)checkIfRegistionSuccessful
{
    NSUserDefaults *prefs = [[PPLUtils sharedInstance] getStandardUserDefaults];
    NSDate *voteDate = [prefs objectForKey:NOTIFICATION_KEY_IN_USERDEFAULTS];
    return (voteDate != nil);
}

- (void)clearAllNotifications
{
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
}

/**
 *  Clear existed notifications and add a new one after vote
 *  Called in PPLVoteViewController
 */
- (void)addNewNotificationAfterVote
{
    // Currently we have only one notification, so clear all
    [self clearAllNotifications];
    // At this stage, we don't need to record, reserve for future usage
    //[self recordVoteSubmissionTimeForNotificationSetup];
    [self addNewNotificationForTomorrow];
}

#pragma Notification
/**
 *  Add one notification on the next day, time:NOTIFICATION_TIME_ON_HOUR
 *  Will make this configurale on web server later
 */
- (void)addNewNotificationForTomorrow
{
    NSCalendar *calendar = [self getCalendarWithGMT];
    NSDateComponents *deltaComps = [[NSDateComponents alloc] init];
    [deltaComps setDay:0];
    NSDate *tomorrowDate = [calendar dateByAddingComponents:deltaComps
                                                     toDate:[NSDate date]
                                                    options:0];
    NSDateComponents *componentsForFireDate =
        [calendar components:(NSCalendarUnitYear | NSCalendarUnitWeekOfYear |
                              NSCalendarUnitHour | NSCalendarUnitMinute |
                              NSCalendarUnitSecond | NSCalendarUnitWeekday)
                    fromDate:tomorrowDate];
    [componentsForFireDate
        setHour:NOTIFICATION_TIME_ON_HOUR]; // for fixing 5PM hour:use 17
    [componentsForFireDate setMinute:0];
    [componentsForFireDate setSecond:0];

    UILocalNotification *notifyAlarm = [[UILocalNotification alloc] init];
    notifyAlarm.repeatInterval = 0; // don't repeat
    notifyAlarm.fireDate = [calendar dateFromComponents:componentsForFireDate];
    notifyAlarm.alertBody = NOTIFICATION_MESSAGE;
    notifyAlarm.timeZone = [NSTimeZone timeZoneWithName:@"GMT"];
    [[UIApplication sharedApplication] scheduleLocalNotification:notifyAlarm];
}

- (NSCalendar *)getCalendarWithGMT
{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    [calendar setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
    return calendar;
}

// The following function reserved for future usage
- (void)recordVoteSubmissionTimeForNotificationSetup
{
    NSUserDefaults *prefs = [[PPLUtils sharedInstance] getStandardUserDefaults];
    [prefs setObject:[self getCurrentDate]
              forKey:NOTIFICATION_KEY_IN_USERDEFAULTS];
    [prefs synchronize];
}

- (NSDate *)getCurrentDate
{
    NSCalendar *calendar = [self getCalendarWithGMT];
    NSDateComponents *components = [calendar
        components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear
          fromDate:[NSDate date]];
    return [calendar dateFromComponents:components];
}

- (BOOL)checkIfRegisterVoteNotification
{
    NSUserDefaults *prefs = [[PPLUtils sharedInstance] getStandardUserDefaults];
    NSDate *voteDate = [prefs objectForKey:NOTIFICATION_KEY_IN_USERDEFAULTS];
    return [self ifDateIsNextDay:voteDate];
}

/**
 *  Check if today is the next day of inputted date
 */
- (BOOL)ifDateIsNextDay:(NSDate *)date
{
    if (date == nil)
    {
        return NO;
    }

    NSCalendar *calendar = [self getCalendarWithGMT];
    NSDateComponents *deltaComps = [[NSDateComponents alloc] init];
    [deltaComps setDay:1];
    NSDate *recordedTomorrowDate =
        [calendar dateByAddingComponents:deltaComps toDate:date options:0];

    NSDateComponents *componentsToday = [calendar
        components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear
          fromDate:[NSDate date]];
    NSDate *todayDate = [calendar dateFromComponents:componentsToday];

    return [recordedTomorrowDate isEqualToDate:todayDate];
}
@end


text:
<?xml version="1.0" encoding="UTF-8"?>

    <title>Wicket Examples - template</title>
    <link rel="stylesheet" type="text/css" href="style.css" />

Template example

	This example shows two different ways of building your page up from shared parts.
	The first example uses what we commonly call 'markup inheritence',
	and the second example shows how to achieve roughly the same
	using borders.

	  Compare the examples and decides what works best for you. You will find that markup
	inheritance is usually easier to work with, and you'll rarely have the need to work with
	borders. But in some cases borders make sense, and can be a little bit more flexible.

	  Also note the use of panels and component replacement to switch the banner.
	Component replacement can be a powerful alternative to navigating between pages.

		<wicket:link>

templating using markup inheritance

templating using a border

		</wicket:link>


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

namespace LateNightStupidities.XorPersist.Exceptions
{
    /// <summary>
    /// This exception is thrown if two XorObject classes
    /// define the same name in the XorClass attribute.
    /// </summary>
    public class DuplicateXorClassNameException : XorPersistException
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DuplicateXorClassNameException" /> class.
        /// </summary>
        /// <param name="xorClassName">Name of the XorClass attribute.</param>
        /// <param name="existingType">The type that declared the XorClass name first.</param>
        /// <param name="newType">Another type that uses the same XorClass name.</param>
        public DuplicateXorClassNameException(string xorClassName, Type existingType, Type newType)
            : base(
                string.Format(Properties.Exceptions.DuplicateXorClassNameException, xorClassName, existingType, newType,
                    existingType.Assembly, newType.Assembly))
        {

        }
    }
}


text:
BtcPublicKey::BtcPublicKey(const ByteArray &pubKey) : ByteArray()
{
    if ((pubKey.size() == EC_COMPRESSED_PUBLIC_KEY_LENGTH) || (pubKey.size() == EC_PUBLIC_KEY_LENGTH))
    {
        this->insert(this->begin(), pubKey.begin(), pubKey.end());
    }
    else
    {
        throw std::runtime_error("PubKey hasn't the right size");
    }
}

bool BtcPublicKey::isCompressed() const
{
    return (this->size() == EC_COMPRESSED_PUBLIC_KEY_LENGTH);
}

std::string BtcPublicKey::getAddress() const
{
    return Conversions::toBase58Check(Crypto::ripemd160(Crypto::sha256(*this)), 0);
}

bool BtcPublicKey::checkSig(ByteArray hash, ByteArray sig)
{
    try
    {
        return Crypto::checkSig(*this, hash, sig);
    }
    catch(std::runtime_error e)
    {
        std::cerr << e.what() << std::endl;
        return false;
    }
}


text:
namespace pw::this_thread {

inline void yield() noexcept {
  // Ensure this is being called by a thread.
  PW_DASSERT(get_id() != thread::Id());
  taskYIELD();
}

}  // namespace pw::this_thread


text:
using Orleans.Runtime;
using System.Collections.Generic;

namespace Orleans.ServiceBus.Providers.Testing
{
    /// <summary>
    /// Data generator for test purpose
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IDataGenerator<T>
    {
        /// <summary>
        /// Data generator mimic event reading
        /// </summary>
        /// <param name="maxCount"></param>
        /// <param name="events"></param>
        /// <returns></returns>
        bool TryReadEvents(int maxCount, out IEnumerable<T> events);
    }

    /// <summary>
    /// StreamDataGeneratingController control stream data generating start and stop
    /// </summary>
    public interface IStreamDataGeneratingController
    {
        /// <summary>
        /// configure data generator for a stream
        /// </summary>
        /// <param name="streamId"></param>
        void AddDataGeneratorForStream(StreamId streamId);
        /// <summary>
        /// Ask one stream to stop producing
        /// </summary>
        /// <param name="streamId"></param>
        void StopProducingOnStream(StreamId streamId);
    }

    /// <summary>
    /// data generator for a specific stream
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IStreamDataGenerator<T>: IDataGenerator<T>
    {
        /// <summary>
        /// counter for sequence number
        /// </summary>
        IIntCounter SequenceNumberCounter { set; }
        /// <summary>
        /// Stream identity for this data generator
        /// </summary>
        StreamId StreamId { get; }
        /// <summary>
        ///
        /// </summary>
        bool ShouldProduce { set; }
    }

    /// <summary>
    /// counter for integer
    /// </summary>
    public interface IIntCounter
    {
        /// <summary>
        /// counter value
        /// </summary>
        int Value { get; }
        /// <summary>
        /// increment the counter
        /// </summary>
        void Increment();
    }

    internal class IntCounter : IIntCounter
    {
        private int counter = 0;
        public int Value { get { return this.counter; } }
        public void Increment()
        {
            counter++;
        }
    }
}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**StartedAt** | [**time.Time**](time.Time.md) | Time when task started execution. Always in UTC. | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
class SharedResource():
    """An abstract class that represents some resource shared by more than one
    test. A SharedResource provides a decorator that should be used to designate
    functions that share the same resource. This designation allow the TestRunner
    to deduce which tests can be run simultaneously and which cannot. The decorator
    appends the class name to the 'resources' attribute of the function."""

    @classmethod
    def decorator(cls, func_or_class):
        """A decorator method that adds this class to a 'resources' list on the
        decorated object."""
        resources = getattr(func_or_class, 'resources', [])
        resources.append(cls)
        func_or_class.resources = resources
        return func_or_class


text:
copyright:
 years: 2015, 2017

---

{:new_window: target="_blank"}
{:shortdesc: .shortdesc}
{:screen:.screen}
{:codeblock:.codeblock}

# Fasi successive
{: #next_steps_tags}
Ultimo aggiornamento: 11 gennaio 2017
{: .last-updated}

Dopo che hai correttamente configurato le notifiche di base, puoi configurare le notifiche basate sulle tag e le opzioni avanzate.

Aggiungi queste funzioni del servizio {{site.data.keyword.mobilepushshort}} alla tua applicazione.
Per utilizzare le notifiche basate sulle tag, vedi [Notifiche basate sulle tag](c_tag_basednotifications.html).
Per utilizzare le opzioni di notifica avanzate, vedi [Notifiche di push avanzate](t_advance_badge_sound_payload.html).


text:
j1Input::j1Input() : j1Module()
{
	name.create("input");

	keyboard = new j1KeyState[MAX_KEYS];
	memset(keyboard, KEY_IDLE, sizeof(j1KeyState) * MAX_KEYS);
	memset(mouse_buttons, KEY_IDLE, sizeof(j1KeyState) * NUM_MOUSE_BUTTONS);
}

// Destructor
j1Input::~j1Input()
{
	delete[] keyboard;
}

// Called before render is available
bool j1Input::Awake(pugi::xml_node& config)
{
	LOG("Init SDL input event system");
	bool ret = true;
	SDL_Init(0);

	if(SDL_InitSubSystem(SDL_INIT_EVENTS) < 0)
	{
		LOG("SDL_EVENTS could not initialize! SDL_Error: %s\n", SDL_GetError());
		ret = false;
	}

	return ret;
}

// Called before the first frame
bool j1Input::Start()
{
	SDL_StopTextInput();
	return true;
}

// Called each loop iteration
bool j1Input::PreUpdate()
{
	BROFILER_CATEGORY("PreUpdate Input", Profiler::Color::Yellow)

	static SDL_Event event;

	const Uint8* keys = SDL_GetKeyboardState(NULL);

	for(int i = 0; i < MAX_KEYS; ++i)
	{
		if(keys[i] == 1)
		{
			if(keyboard[i] == KEY_IDLE)
				keyboard[i] = KEY_DOWN;
			else
				keyboard[i] = KEY_REPEAT;
		}
		else
		{
			if(keyboard[i] == KEY_REPEAT || keyboard[i] == KEY_DOWN)
				keyboard[i] = KEY_UP;
			else
				keyboard[i] = KEY_IDLE;
		}
	}

	for(int i = 0; i < NUM_MOUSE_BUTTONS; ++i)
	{
		if(mouse_buttons[i] == KEY_DOWN)
			mouse_buttons[i] = KEY_REPEAT;

		if(mouse_buttons[i] == KEY_UP)
			mouse_buttons[i] = KEY_IDLE;
	}

	while(SDL_PollEvent(&event) != 0)
	{
		switch(event.type)
		{
			case SDL_QUIT:
				windowEvents[WE_QUIT] = true;
			break;

			case SDL_WINDOWEVENT:
				switch(event.window.event)
				{
					//case SDL_WINDOWEVENT_LEAVE:
					case SDL_WINDOWEVENT_HIDDEN:
					case SDL_WINDOWEVENT_MINIMIZED:
					case SDL_WINDOWEVENT_FOCUS_LOST:
					windowEvents[WE_HIDE] = true;
					break;

					//case SDL_WINDOWEVENT_ENTER:
					case SDL_WINDOWEVENT_SHOWN:
					case SDL_WINDOWEVENT_FOCUS_GAINED:
					case SDL_WINDOWEVENT_MAXIMIZED:
					case SDL_WINDOWEVENT_RESTORED:
					windowEvents[WE_SHOW] = true;
					break;
				}
			break;

			case SDL_MOUSEBUTTONDOWN:
				mouse_buttons[event.button.button - 1] = KEY_DOWN;
				//LOG("Mouse button %d down", event.button.button-1);
			break;

			case SDL_MOUSEBUTTONUP:
				mouse_buttons[event.button.button - 1] = KEY_UP;
				//LOG("Mouse button %d up", event.button.button-1);
			break;

			case SDL_MOUSEMOTION:
				int scale = App->win->GetScale();
				mouse_motion_x = event.motion.xrel / scale;
				mouse_motion_y = event.motion.yrel / scale;
				mouse_x = event.motion.x / scale;
				mouse_y = event.motion.y / scale;
				//LOG("Mouse motion x %d y %d", mouse_motion_x, mouse_motion_y);
			break;
		}
	}

	return true;
}

// Called before quitting
bool j1Input::CleanUp()
{
	LOG("Quitting SDL event subsystem");
	SDL_QuitSubSystem(SDL_INIT_EVENTS);
	return true;
}

// ---------
bool j1Input::GetWindowEvent(j1EventWindow ev)
{
	return windowEvents[ev];
}

void j1Input::GetMousePosition(int& x, int& y)
{
	x = mouse_x;
	y = mouse_y;
}

void j1Input::GetMouseMotion(int& x, int& y)
{
	x = mouse_motion_x;
	y = mouse_motion_y;
}


text:
<?php

namespace App\AppBundle\Helper;

class TorrentList {

    private $list;

    public function getListAsArray() {
        $return = array();
        $row = array();
        /**
         * @var $torrent App\AppBundle\Entity\Torrents
         */
        foreach($this->list as $torrent) {
            $row = array(
                'name' => $torrent->getName(),
                'link' => $torrent->getLink(),
                'linkSha1' => $torrent->getLinkSha1(),
                'provider' => $torrent->getProvider(),
                'seeds' => (int)$torrent->getSeeds(),
                'peers' => (int)$torrent->getPeers(),
                'size' => (int)$torrent->getSize(),
                'sizeOriginal' => $torrent->getSizeOriginal(),
                'createDate' => $this->parseDate($torrent->getCreateDate()),
                'updateDate' => $this->parseDate($torrent->getUpdateDate()),
            );
            $return[] = $row;
        }
        return $return;
    }

    private function parseDate($date) {
        if(!is_object($date)) {
            return $date;
        }
        return $date->format("Y-m-d H:i:s");
    }

    public function getList() {
        return $this->list;
    }

    public function setList($list) {
        $this->list = $list;
    }

}


text:
<?php
require_once 'vendor/autoload.php';

$runner = new \Basster\EulerRunner(3);
$runner->run();


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/footer_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <ProgressBar
        android:id="@+id/ptrf_progress_bar"
        android:layout_width="25dp"
        android:layout_height="25dp"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/ptrf_tv"
        android:layout_marginRight="15dp"
        android:visibility="invisible"
        />

    <TextView
        android:id="@+id/ptrf_tv"
        android:layout_width="wrap_content"
        android:layout_height="35dp"
        android:layout_centerInParent="true"
        android:textSize="13sp"
        android:gravity="center"
        android:text="上拉加载更多"/>
</RelativeLayout>


text:
#pragma config(Motor,  port2,           rightMotor,    tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port3,           leftMotor,     tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           pickup,        tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           track,         tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           shooter1,      tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor,  port7,           shooter2,      tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor,  port8,           shooter3,      tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor,  port9,           shooter4,      tmotorVex393HighSpeed_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)

#include "Vex_Competition_Includes.c"   //Main competition background code...do not modify!

// Written by: Omar Rahman
// East River Robotics Team 2015 - 2016

// PORT NOTES:
// Port 2: 2 Right motor
// Port 3: 2 Left motor
// Port 4: Pickup
// Port 5: Track
// Port 6: Shooter 1
// Port 7: Shooter 2
// Port 8: Shooter 3
// Port 9: Shooter 4

/////////////////////////////////////////////////////////////////////////////////////////
//
//                          Pre-Autonomous Functions
//
// You may want to perform some actions before the competition starts. Do them in the
// following function.
//
/////////////////////////////////////////////////////////////////////////////////////////

void pre_auton()
{
	// Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
	// Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
	bStopTasksBetweenModes = true;

	// All activities that occur before the competition starts
	// Example: clearing encoders, setting servo positions, ...
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task autonomous()
{
	// Start shooter
	motor[shooter1] = 127;
	motor[shooter2] = 127;
	motor[shooter3] = 127;
	motor[shooter4] = 127;

	// Wait 5 seconds
	wait1Msec(5000);

	// Bring ball(s) to shooter
	motor[pickup] = 127;
	motor[track] = 127;

	// Wait 10 seconds
	wait1Msec(10000);

	// Reset
	motor[shooter1] = 0;
	motor[shooter2] = 0;
	motor[shooter3] = 0;
	motor[shooter4] = 0;
	motor[pickup] = 0;
	motor[track] = 0;

}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 User Control Task
//
// This task is used to control your robot during the user control phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task usercontrol()
{
	while (true)
	{
		// Tank driving
		// Channel 3 = Left motor
		// Channel 2 = Right Motor

		motor[leftMotor] = vexRT[Ch3];
		motor[rightMotor] = vexRT[Ch2];

		// Ball pickup
		// If Button 6U is pressed turn on motor[pickup]
		// Brings the ball(s) inside the robot to the tracks
		if (vexRT[Btn6U] == 1) {
			motor[pickup] = -127;
		}
		// If Button 6U isn't pressed but Button 6D turn on motor[pickup]
		// Pushes the ball(s) out of the robot (In case they get stuck)
		else if (vexRT[Btn6D] == 1) {
			motor[pickup] = 127;
		}
		// If everything else is false, turn off motor[pickup]
		else {
			motor[pickup] = 0;
		}

		// Track
		// If Button 5U is pressed turn on motor[track] to 127
		// Brings the ball(s) up to the shooter
		if (vexRT[Btn5U] == 1) {
			motor[track] = 127;
		}
		// If Button 5U isn't pressed but Button 5D is pressed turn on motor[track] to -127
		// In case a ball(s) gets stuck it will reverse the tracks
		else if (vexRT[Btn5D] == 1) {
			motor[track] = -127;
		}
		// If everything else is false, turn off motor[track]
		else {
			motor[track] = 0;
		}

		// Shooter
		// If Button 8D is pressed turn on motor[shooter]
		// Shoots the ball(s) to the net
		if (vexRT[Btn8D] == 1) {
			motor[shooter1] = 127;
			motor[shooter2] = 127;
			motor[shooter3] = 127;
			motor[shooter4] = 127;
		}
		// If Button 8D isn't pressed turn off motor[shooter]
		else {
			motor[shooter1] = 0;
			motor[shooter2] = 0;
			motor[shooter3] = 0;
			motor[shooter4] = 0;
		}
	}
}


text:
{% set badge = award.badge %}

    {% include "badger/includes/badge_full.html" %}
    Award details


text:
<?php

/* base/stylesheets.twig */
class __TwigTemplate_4413a09ce095ffa2c40b15bba9904936 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
            'stylesheets' => array($this, 'block_stylesheets'),
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        $this->displayBlock('stylesheets', $context, $blocks);
    }

    public function block_stylesheets($context, array $blocks = array())
    {
        // line 2
        echo "
    <link rel=\"stylesheet\" href=\"";
        // line 3
        echo twig_escape_filter($this->env, (isset($context["assetUri"]) ? $context["assetUri"] : null), "html", null, true);
        echo "/css/bootstrap.min.css\">
    <link rel=\"stylesheet\" href=\"";
        // line 4
        echo twig_escape_filter($this->env, (isset($context["assetUri"]) ? $context["assetUri"] : null), "html", null, true);
        echo "/css/bootstrap-responsive.min.css\">
    <link rel=\"stylesheet\" href=\"";
        // line 5
        echo twig_escape_filter($this->env, (isset($context["assetUri"]) ? $context["assetUri"] : null), "html", null, true);
        echo "/css/bootstrap-formhelpers.css\">
    <link rel=\"stylesheet\" href=\"";
        // line 6
        echo twig_escape_filter($this->env, (isset($context["assetUri"]) ? $context["assetUri"] : null), "html", null, true);
        echo "/css/custom.css\">

";
    }

    public function getTemplateName()
    {
        return "base/stylesheets.twig";
    }

    public function getDebugInfo()
    {
        return array (  41 => 6,  37 => 5,  33 => 4,  29 => 3,  26 => 2,  20 => 1,  36 => 7,  31 => 4,  28 => 3,);
    }
}


text:
<?php

/* Paramètres :
 -- page : nom wiki de la page a inclure (obligatoire)
 -- class : nom de la classe de style à inclure (facultatif)
 -- auth : option d'affichage dans le cas d'un utilisateur non autorisé (facultatif)
    -- par défaut : ne fait rien
    -- valeur "noError" : n'affiche aucun message d'erreur
 -- edit : option d'accès en édition à la page incluse (facultatif)
    -- par défaut : ne fait rien
    -- valeur "show" :  ajoute un lien "[Édition]" en haut à droite de la boite
*/

// récuperation du nom de la page à inclure
$incPageName = trim($this->GetParameter('page'));

/**
* @todo améliorer le traitement des classes css
*/
if ($this->GetParameter('class'))
{
	$array_classes = explode(' ', $this->GetParameter('class'));
	$classes = '';
	foreach ($array_classes as $c)
	{
		if ($c && preg_match('`^[A-Za-z0-9-_]+$`', $c))
		{
			$classes .= ($classes ? ' ':'') . "include_$c";
		}
	}
}

// Affichage de la page ou d'un message d'erreur
//
if (empty($incPageName))
{
	echo '
'._t('ERROR').' '._t('ACTION').' Include : '._t('MISSING_PAGE_PARAMETER').'.
'."\n";
}
elseif ($this->IsIncludedBy($incPageName))
{
	$inclusions = $this->GetAllInclusions();
	$pg = strtolower($incPageName); // on l'effectue avant le for sinon il sera recalculé à chaque pas
	$err = '[[' . $pg . ']]';
	for($i = 0; $inclusions[$i] != $pg; $i++)
	{
		$err = '[[' . $inclusions[$i] . ']] > ' . $err;
	}
	echo '
'._t('ERROR').' '._t('ACTION').' Include : '._t('IMPOSSIBLE_FOR_THIS_PAGE').' '.$incPageName.' '._t('TO_INCLUDE_ITSELF')
		 . ($i ? ':
'._t('INCLUSIONS_CHAIN').' : '.$pg.' > '.$err : '').'
'."\n"; // si $i = 0, alors c'est une page qui s'inclut elle-même directement...
}
elseif (!$this->HasAccess('read', $incPageName) && $this->GetParameter('auth')!='noError')
{
	echo '
'._t('ERROR').' '._t('ACTION').' Include : '.' '._t('READING_OF_INCLUDED_PAGE').' '.$incPageName.' '._t('NOT_ALLOWED').'.
'."\n";
}
elseif (!$incPage = $this->LoadPage($incPageName))
{
	echo '
'._t('ERROR').' '._t('ACTION').' Include : '._t('INCLUDED_PAGE').' '.$incPageName.' '._t('DOESNT_EXIST').'...
'."\n";
}
// Affichage de la page quand il n'y a pas d'erreur
elseif ($this->HasAccess('read', $incPageName))
{
	$this->RegisterInclusion($incPageName);
	$output = $this->Format($incPage['body']);
	if (isset($classes))
	{
		if($this->GetParameter('edit')=='show')
			$editLink = "
Href("edit", $incPageName) . "\">["._t('EDITION')."]
\n";
		else $editLink = "";
		// Affichage
		echo "
\n" . $editLink . $output . "
\n";
	}
	else echo $output;
	$this->UnregisterLastInclusion();
}

?>


text:
import re
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User, Group
from django.utils import simplejson
from views import *
from TeaScrum.product.models import Product

class PokerViewTest(TestCase):
    def setUp(self):
        N = 5
        self.users = []
        self.team = Group.objects.create(name='Team_1')
        for i in xrange(N):
            u = User.objects.create_user('user_%d'%i, 'user%d@example.com', 'pass_%d'%i)
            u.groups.add(self.team)
            self.users.append(u)
#            print 'user[%d].pk=%d'%(i,u.pk)
        self.product = Product.objects.create(name='Product_1',owner=self.users[0],master=self.users[0],team=self.team)
#        print 'self.product.pk=',self.product.pk

    def tearDown(self):
        Product.objects.all().delete()
        User.objects.all().delete()
        Group.objects.all().delete()

    def testStart(self):
        self.client.login(username='user_0',password='pass_0')
        r = self.client.get('/poker/start/?pid=%s'%self.product.pk)
        self.assertEqual(r.status_code, 200)
        self.assertTrue(r.content.find('{"sid":')>=0)
        vs = Vote.objects.all()
        self.assertEqual(vs.count(), 1)
        self.assertTrue(vs[0].session, 1)
        self.assertTrue(vs[0].status, "STARTED")
        # non scrum master login should fail
        client2 = Client()
        client2.login(username='user_2',password='pass_2')
        r2 = client2.get('/poker/start/?pid=%s'%self.product.pk)
        self.assertTrue(r2.content.find("Scrum Master required")>0)

    def testStop(self):
        self.client.login(username='user_0', password='pass_0')
        r = self.client.get('/poker/stop/')
        self.assertTrue(r.content.find('Not enough parameters')>=0)
        r = self.client.get('/poker/start/?pid=%s'%self.product.pk)
        sid = re.findall(r'"sid":\s*"(\w+)"', r.content)[0]
        self.user_vote(3, self.product.pk, sid, 2)
        self.user_vote(4, self.product.pk, sid, 6)
        r = self.client.get('/poker/stop/?pid=%s&sid=%s'%(self.product.pk,sid))
        self.assertTrue(re.match(r'{"status":\s*"OK"}', r.content))
        vs = Vote.objects.all()
        self.assertEqual(vs.count(), 3)
        self.assertEqual(vs[0].status, "CLOSED")
        self.assertEqual(vs[1].status, "CLOSED")
        self.assertEqual(vs[2].status, "CLOSED")

        # test start to clear the precious session
        sid2 = self.create_session()
        self.assertNotEqual(sid2, sid)
        self.assertEqual(Vote.objects.count(), 1)

    def create_session(self, ux=0, product=None, client=None):
        if not client: client = self.client
        client.login(username='user_%d'%ux,password='pass_%d'%ux)
        if not product: product = self.product.pk
        r = client.get('/poker/start/?pid=%s'%product)
        if not r.content:
            print 'create_session(',ux,product,client
        return re.findall(r'"sid":\s*"(\w+)"', r.content)[0] #sid

    def user_vote(self, user, pid, sid, vote):
        client = Client()
        client.login(username='user_%d'%user, password='pass_%d'%user)
        return client.get('/poker/vote/?pid=%s&sid=%s&vote=%s'%(pid,sid,vote))

    def testCollect(self):
        sid = self.create_session()
        self.user_vote(2, self.product.pk, sid, 5)
        r = self.client.get('/poker/collect/?pid=%s&sid=%s' % (self.product.pk,sid))
#        self.assertTrue(re.match(r'\{"status": "STARTED", "votes": \{"1": "\*", "3": "5"\}\}', r.content))
        ds = simplejson.loads(r.content)
        self.assertEqual(ds['status'], 'STARTED')
        self.assertEqual(ds['votes'], {'%d'%self.users[0].pk:'*','%d'%self.users[2].pk:'*'})
        self.user_vote(3, self.product.pk, sid, 4)
        r = self.client.get('/poker/collect/?pid=%s&sid=%s' % (self.product.pk,sid))
        ds = simplejson.loads(r.content)
        self.assertEqual(ds['votes'], {'%d'%self.users[0].pk:'*','%d'%self.users[2].pk:'*','%d'%self.users[3].pk:'*'})
        self.user_vote(4, self.product.pk, sid, 2)
        client4 = Client()
        client4.login(username='user_4',password='pass_4')
        # stop the session
        self.client.get('/poker/stop/?pid=%s&sid=%s' % (self.product.pk,sid))
        r = client4.get('/poker/collect/?pid=%s&sid=%s' % (self.product.pk,sid))
        ds = simplejson.loads(r.content)
        self.assertEqual(sorted(ds['votes'].values()), ['*','2','4','5'])

    def testStatus(self):
        client3 = Client()
        client3.login(username='user_3',password='pass_3')
        r = client3.get('/poker/status/?pid=%s'%self.product.pk)
        self.assertTrue(re.match('{"status":\s*"IDLE"}', r.content))
        sid = self.create_session()
        r = self.client.get('/poker/status/?pid=%s'%self.product.pk)
        self.assertTrue(re.match('{"status":\s*"STARTED"', r.content))
        r = client3.get('/poker/status/?pid=%s'%self.product.pk)
        self.assertTrue(re.match('{"status":\s*"STARTED"', r.content))
        self.client.get('/poker/stop/?pid=%s&sid=%s'%(self.product.pk,sid))
        r = client3.get('/poker/status/?pid=%s'%self.product.pk)
        self.assertTrue(re.match('{"status":\s*"CLOSED"', r.content))

    def testVote(self):
        sid = self.create_session()
        self.client.get('/poker/vote/?pid=%s&sid=%s&vote=5'%(self.product.pk,sid))
        v = Vote.objects.get(session=sid)
        self.assertEqual(v.vote, '5')
#        r = client2.get('/poker/vote/?pid=1&sid=%s&vote=3')
        r = self.user_vote(2, self.product.pk, sid, 3)
        self.assertTrue(re.match(r'{"status":\s*"OK"}', r.content))
        vs = Vote.objects.all()
        self.assertEqual(vs.count(), 2)
        self.assertEqual(vs[1].vote, '3')

class PokerModelTest(TestCase):
    def setUp(self):
        N = 5
        self.users = []
        self.team = Group.objects.create(name='Team_1')
        for i in xrange(N):
            u = User.objects.create_user('user_%d'%i, 'user%d@example.com', 'pass_%d'%i)
            u.groups.add(self.team)
            self.users.append(u)
#            print 'user[%d].pk=%d'%(i,u.pk)
        self.product = Product.objects.create(name='Product_1',owner=self.users[0],master=self.users[0],team=self.team)
#        print 'self.product.pk=',self.product.pk

    def tearDown(self):
        Product.objects.all().delete()
        User.objects.all().delete()
        Group.objects.all().delete()

    def testGeneral(self):
        """ Test multi-product concurrency. """
        sid1 = Vote.objects.start(self.users[0], self.product.pk)['sid']
        product2 = Product.objects.create(name='Product_2',owner=self.users[2],master=self.users[2],team=self.team)
        sid2 = Vote.objects.start(self.users[2], product2.pk)['sid']
        Vote.objects.get_or_create(session=sid1, product=self.product.pk, voter=self.users[1], vote='1')
        Vote.objects.get_or_create(session=sid1, product=self.product.pk, voter=self.users[3], vote='3')
        Vote.objects.get_or_create(session=sid2, product=product2.pk, voter=self.users[2], vote='2')
        Vote.objects.get_or_create(session=sid2, product=product2.pk, voter=self.users[4], vote='4')
        vs = Vote.objects.all()
        self.assertEqual(vs.count(), 6)
        d = Vote.objects.status(self.product.pk)
        self.assertEqual(d,{"status":"STARTED","sid":sid1})
        qs = Vote.objects.collect(self.product.pk, sid1)
        self.assertEqual(qs.count(),3)
        sid3 = Vote.objects.start(self.users[0], self.product.pk)['sid']
        self.assertEqual(Vote.objects.count(), 4)
        self.assertEqual(Vote.objects.collect(self.product.pk,sid1).count(), 0)


text:
My portfolio website in Bootstrap, Javascript, jQuery.

Copyright 2013-2016 Blackrock Digital LLC. Code released under the [MIT](https://github.com/BlackrockDigital/startbootstrap-freelancer/blob/gh-pages/LICENSE) license.


text:
{{ define "error" }}
    {{ template "header" . }}

          {{$.platform_name}}

Uh, oh!

Something has failed. Below are some details for debugging.

HTTP Status: {{.status_code}} {{.status}}

                    {{- .error -}}

    {{ template "footer" . }}
    {{ end }}


text:
import os
import subprocess
import sys
import phoenix_utils
import atexit
import urlparse

# import argparse
try:
    import argparse
except ImportError:
    current_dir = os.path.dirname(os.path.abspath(__file__))
    sys.path.append(os.path.join(current_dir, 'argparse-1.4.0'))
    import argparse

global childProc
childProc = None
def kill_child():
    if childProc is not None:
        childProc.terminate()
        childProc.kill()
        if os.name != 'nt':
            os.system("reset")
atexit.register(kill_child)

parser = argparse.ArgumentParser(description='Launches the Apache Phoenix Thin Client.')
# Positional argument "url" is optional
parser.add_argument('url', nargs='?', help='The URL to the Phoenix Query Server.', default='http://localhost:8765')
# Positional argument "sqlfile" is optional
parser.add_argument('sqlfile', nargs='?', help='A file of SQL commands to execute.', default='')
# Avatica wire authentication
parser.add_argument('-a', '--authentication', help='Mechanism for HTTP authentication.', choices=('SPNEGO', 'BASIC', 'DIGEST', 'NONE'), default='')
# Avatica wire serialization
parser.add_argument('-s', '--serialization', help='Serialization type for HTTP API.', choices=('PROTOBUF', 'JSON'), default=None)
# Avatica authentication
parser.add_argument('-au', '--auth-user', help='Username for HTTP authentication.')
parser.add_argument('-ap', '--auth-password', help='Password for HTTP authentication.')
# Common arguments across sqlline.py and sqlline-thin.py
phoenix_utils.common_sqlline_args(parser)
# Parse the args
args=parser.parse_args()

phoenix_utils.setPath()

url = args.url
sqlfile = args.sqlfile
serialization_key = 'phoenix.queryserver.serialization'

def cleanup_url(url):
    parsed = urlparse.urlparse(url)
    if parsed.scheme == "":
        url = "http://" + url
        parsed = urlparse.urlparse(url)
    if ":" not in parsed.netloc:
        url = url + ":8765"
    return url

def get_serialization():
    default_serialization='PROTOBUF'
    env=os.environ.copy()
    if os.name == 'posix':
      hbase_exec_name = 'hbase'
    elif os.name == 'nt':
      hbase_exec_name = 'hbase.cmd'
    else:
      print 'Unknown platform "%s", defaulting to HBase executable of "hbase"' % os.name
      hbase_exec_name = 'hbase'

    hbase_cmd = phoenix_utils.which(hbase_exec_name)
    if hbase_cmd is None:
        print 'Failed to find hbase executable on PATH, defaulting serialization to %s.' % default_serialization
        return default_serialization

    env['HBASE_CONF_DIR'] = phoenix_utils.hbase_conf_dir
    proc = subprocess.Popen([hbase_cmd, 'org.apache.hadoop.hbase.util.HBaseConfTool', serialization_key],
            env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    (stdout, stderr) = proc.communicate()
    if proc.returncode != 0:
        print 'Failed to extract serialization from hbase-site.xml, defaulting to %s.' % default_serialization
        return default_serialization
    # Don't expect this to happen, but give a default value just in case
    if stdout is None:
        return default_serialization

    stdout = stdout.strip()
    if stdout == 'null':
        return default_serialization
    return stdout

url = cleanup_url(url)

if sqlfile != "":
    sqlfile = "--run=" + sqlfile

colorSetting = args.color
# disable color setting for windows OS
if os.name == 'nt':
    colorSetting = "false"

# HBase configuration folder path (where hbase-site.xml reside) for
# HBase/Phoenix client side property override
hbase_config_path = os.getenv('HBASE_CONF_DIR', phoenix_utils.current_dir)

serialization = args.serialization if args.serialization else get_serialization()

java_home = os.getenv('JAVA_HOME')

# load hbase-env.??? to extract JAVA_HOME, HBASE_PID_DIR, HBASE_LOG_DIR
hbase_env_path = None
hbase_env_cmd  = None
if os.name == 'posix':
    hbase_env_path = os.path.join(hbase_config_path, 'hbase-env.sh')
    hbase_env_cmd = ['bash', '-c', 'source %s && env' % hbase_env_path]
elif os.name == 'nt':
    hbase_env_path = os.path.join(hbase_config_path, 'hbase-env.cmd')
    hbase_env_cmd = ['cmd.exe', '/c', 'call %s & set' % hbase_env_path]
if not hbase_env_path or not hbase_env_cmd:
    print >> sys.stderr, "hbase-env file unknown on platform %s" % os.name
    sys.exit(-1)

hbase_env = {}
if os.path.isfile(hbase_env_path):
    p = subprocess.Popen(hbase_env_cmd, stdout = subprocess.PIPE)
    for x in p.stdout:
        (k, _, v) = x.partition('=')
        hbase_env[k.strip()] = v.strip()

if hbase_env.has_key('JAVA_HOME'):
    java_home = hbase_env['JAVA_HOME']

if java_home:
    java = os.path.join(java_home, 'bin', 'java')
else:
    java = 'java'

jdbc_url = 'jdbc:phoenix:thin:url=' + url + ';serialization=' + serialization
if args.authentication:
    jdbc_url += ';authentication=' + args.authentication
if args.auth_user:
    jdbc_url += ';avatica_user=' + args.auth_user
if args.auth_password:
    jdbc_url += ';avatica_password=' + args.auth_password

java_cmd = java + ' $PHOENIX_OPTS ' + \
    ' -cp "' + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_thin_client_jar + \
    os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \
    os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
    " org.apache.phoenix.queryserver.client.SqllineWrapper -d org.apache.phoenix.queryserver.client.Driver " + \
    ' -u "' + jdbc_url + '"' + " -n none -p none " + \
    " --color=" + colorSetting + " --fastConnect=" + args.fastconnect + " --verbose=" + args.verbose + \
    " --incremental=false --isolation=TRANSACTION_READ_COMMITTED " + sqlfile

exitcode = subprocess.call(java_cmd, shell=True)
sys.exit(exitcode)


text:
function BlogPreview(container) {
  this.container_ = container;
}

BlogPreview.prototype.show = function (url, entries_num, title, title_link) {
  var feed = new google.feeds.Feed(url);
  var preview = this;
  feed.setNumEntries(entries_num);
  feed.load(function (result) {
    preview.render_(result, title, title_link);
  });
};

BlogPreview.prototype.render_ = function (result, title, title_link) {
  if (!result.feed || !result.feed.entries) {
    return;
  }
  while (this.container_.firstChild) {
    this.container_.removeChild(this.container_.firstChild);
  }

  var blog = this.createDiv_(this.container_, "blog");
  var header = this.createElement_("h2", blog, "");
  if (!title) {
    title = result.feed.title;
  }
  if (!title_link) {
    title_link = result.feed.link;
  }
  this.createLink_(header, title_link, title);

  for (var i = 0; i < result.feed.entries.length; i++) {
    var entry = result.feed.entries[i];
    var div = this.createDiv_(blog, "entry");
    var linkDiv = this.createDiv_(div, "title");
    this.createLink_(linkDiv, entry.link, entry.title);
    if (entry.author) {
      this.createDiv_(div, "author", "Posted by " + entry.author);
    }
    this.createDiv_(div, "snippet", entry.contentSnippet);
  }
};

BlogPreview.prototype.createDiv_ = function (parent, className, opt_text) {
  return this.createElement_("div", parent, className, opt_text);
};

BlogPreview.prototype.createLink_ = function (parent, href, text) {
  var link = this.createElement_("a", parent, "", text);
  link.href = href;
  return link;
};

BlogPreview.prototype.createElement_ = function (tagName, parent, className,
                                                 opt_text) {
  var div = document.createElement(tagName);
  div.className = className;
  parent.appendChild(div);
  if (opt_text) {
    div.appendChild(document.createTextNode(opt_text));
  }
  return div;
};