This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| client = boto3.client('route53') | |
| def add_cname_record(source, target): | |
| try: | |
| response = client.change_resource_record_sets( | |
| HostedZoneId='<hosted zone id>', | |
| ChangeBatch= { | |
| 'Comment': 'add %s -> %s' % (source, target), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('kahootCloneApp') | |
| .service('Player', function (fbutil, _, $cookieStore) { | |
| // AngularJS will instantiate a singleton by calling "new" on this function | |
| var self = this, _so; | |
| self.getUniqId = function() { | |
| // generate a unique idenftifier for the player and save it in a cookie to allow refreshes | |
| if($cookieStore.get('playerId')) { | |
| return self._id = $cookieStore.get('playerId'); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('kahootCloneApp') | |
| .service('Host', function (fbutil, Trivia) { | |
| var self = this, _so; | |
| self.init = function(PIN) { | |
| self.syncObject = fbutil.syncObject('games/' + PIN); | |
| _so = self.syncObject; | |
| return self.syncObject.$loaded(); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $scope.$watch('game.data.state', function(newValue, oldValue) { | |
| switch(newValue) { | |
| case 'preQuestion': | |
| $scope.countdown = 5; | |
| $interval(function() { | |
| $scope.countdown--; | |
| },1000, $scope.countdown) | |
| .then(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="row" ng-if="game.data.state == 'waitingForPlayers'"> | |
| ... | |
| </div> | |
| <div class="row" ng-if="game.data.state == 'preQuestion'"> | |
| ... | |
| </div> | |
| <div class="row" ng-if="game.data.state == 'question'"> | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('kahootCloneApp') | |
| .service('Player', function (fbutil, _, $cookieStore) { | |
| // AngularJS will instantiate a singleton by calling "new" on this function | |
| var self = this, _so; | |
| self.getUniqId = function() { | |
| // generate a unique idenftifier for the player and save it in a cookie to allow refreshes | |
| if($cookieStore.get('playerId')) { | |
| return self._id = $cookieStore.get('playerId'); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('kahootCloneApp') | |
| .controller('PlayerCtrl', function ($scope, Player, $location,$routeParams) { | |
| if(! $routeParams.hasOwnProperty('PIN')) { | |
| $scope.game = { | |
| data : { | |
| state: 'joinGame' | |
| } | |
| } | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="row" ng-if="game.data.state=='joinGame'"> | |
| <div class="col-md-6 col-md-offset-3"> | |
| <form> | |
| <div class="form-group"> | |
| <label for="PIN">Game PIN #</label> | |
| <input ng-model="$parent.PIN" type="text" class="form-control" id="PIN" placeholder="Enter 6 digit number availible on main screen"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="screenName">Your name</label> | |
| <input ng-model="$parent.screenName" type="text" class="form-control" id="screenName" placeholder="Choose a screen name"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('kahootCloneApp') | |
| .service('Host', function (fbutil) { | |
| var self = this; | |
| self.init = function(PIN) { | |
| self.syncObject = fbutil.syncObject('games/' + PIN); | |
| return self.syncObject.$loaded(); | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| yo angularfire:route Player | |
| yo angularfire:service Player |