Revisions
-
odino revised this gist
Feb 23, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Coding challenge: cartified! **Hey JavaScript talents, here at [namshi.com](https://en-ae.namshi.com), we are [looking for you](https://www.angularjobs.com/posts/658-senior-frontend-developer-team-lead-at-namshi-in-dubai-remote-or-on-site)! Submit this coding challenge to [email protected] and we'll get back to you as soon as possible!** Your task is to implement a basic shopping cart for a website, following these basic rules: -
odino revised this gist
Feb 23, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Coding challenge: cartified! **Hey JavaScript talents, here at [namshi.com](https://en-ae.namshi.com), we are [looking for you](https://www.angularjobs.com/posts/658-senior-frontend-developer-team-lead-at-namshi-in-dubai-remote-or-on-site)! Submit this coding challenge at [email protected] and we'll get back to you as soon as possible!** Your task is to implement a basic shopping cart for a website, following these basic rules: -
odino revised this gist
Feb 23, 2014 . 1 changed file with 18 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,20 @@ angular.module('services.cart', []) .service('Cart', ['$rootScope', 'Reviewer', function ($rootScope, Reviewer) { var getCart = function(){}; var addItem = function(){}; var addItems = function() {}; var save = function() {}; var remove = function () {}; var clear = function() {}; var persist = function() {}; var changeQuantity = function (){}; var refresh = function() {}; }]); -
odino revised this gist
Feb 23, 2014 . 2 changed files with 4 additions and 19 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # Coding challenge: cartified! **Hey JavaScript talents, here at [namshi.com](https://en-ae.namshi.com), we are looking for you! Submit this coding challenge at [email protected] and we'll get back to you as soon as possible!** Your task is to implement a basic shopping cart for a website, following these basic rules: * the cart needs to be implemented as an AngularJS service @@ -48,4 +50,4 @@ You are not allowed to inject any dependency on the Cart service other than the Another thing to consider: the cart should be working even when the user has multiple browser tabs open and is adding products from each of them. We are **not** going to check the submitted script for syntax errors: concentrate on the design of the `Cart` service, we don't need to check for the small things 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 charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,3 @@ angular.module('services.cart', []) .service('Cart', ['$rootScope', 'Reviewer', function ($rootScope, Reviewer) { var getCart -
odino revised this gist
Feb 23, 2014 . 2 changed files with 2 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ For some of the methods mentioned in the empty Cart service, we thought of givin ### Save Checks if the cart can be persisted through the `Reviewer` service: if so, it `persist`s it. ### Clear 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,5 @@ angular.module('services.cart', []) .service('Cart', ['$rootScope', 'Reviewer', function ($rootScope, Reviewer) { var getCart = function(){}; var addItem = function(){}; -
odino revised this gist
Feb 23, 2014 . 2 changed files with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,7 @@ Notifies the application that the cart has been persisted, so that other parts o You are not allowed to inject any dependency on the Cart service other than the ones provided: * `$rootScope`: you might want to use it for whatever reason (for example, triggering events) * `Reviewer`: it's an angular service that will review the contents of the cart (`Reviewer.review(cart)`, returns a promise) ## What are we going to look for? 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ angular.module('services.cart', []) .service('Cart', ['$rootScope', 'Reviewer', function ($rootScope, Reviewer) { var cartService = this; var getCart = function(){}; -
odino revised this gist
Feb 23, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -45,4 +45,6 @@ You are not allowed to inject any dependency on the Cart service other than the * clear, coincise, DRY implementation * appropriate naming conventions Another thing to consider: the cart should be working even when the user has multiple browser tabs open and is adding products from each of them. We are **not** going to check the submitted script for syntax errors: concentrate on the design of the `Cart` service, we don't need to check for the small things now :) -
odino created this gist
Feb 23, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ # Coding challenge: cartified! Your task is to implement a basic shopping cart for a website, following these basic rules: * the cart needs to be implemented as an AngularJS service * the cart should be retrieved from the localStorage, where it's stored under the key `cart` * every time an action is performed on the cart, it should be persisted on the localStorage * the cart should only know about item IDs and their quantity * you will write the cart by implementing the methods of the provided cart service in the `template.js` file contained in this gist: please fork it and submit your implementation * it should take you less than 1 hour to come up with an implementation, but we won't put any time limit for this challenge ## Methods explanation For some of the methods mentioned in the empty Cart service, we thought of giving you some explanation to better understand what they're there for. ### Save Checks if the cart can be persisted: if so, it `persist`s it. ### Clear Empties the cart ### Persist Persist the cart on the localStorage ### changeQuantity Changes the quantity of one of the items in the cart. ### Refresh Notifies the application that the cart has been persisted, so that other parts of the app can modify themselves based on the latest cart update. ## Dependencies You are not allowed to inject any dependency on the Cart service other than the ones provided: * `$rootScope`: you might want to use it for whatever reason (for example, triggering events) ## What are we going to look for? * the fewer lines of code, the better * clear, coincise, DRY implementation * appropriate naming conventions We are **not** going to check the submitted script for syntax errors: concentrate on the design of the `Cart` service, we don't need to check for the small things now :) 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ angular.module('services.cart', []) .service('Cart', ['$rootScope', function ($rootScope) { var cartService = this; var getCart = function(){}; var addItem = function(){}; var addItems = function() {}; var save = function() {}; var remove = function () {}; var clear = function() {}; var persist = function() {}; var changeQuantity = function (){}; var refresh = function() {}; }]);