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
| /** **************************************** | |
| * Utility file | |
| * mixin.js | |
| * @returns [object] | |
| */ | |
| function mixinFactory() { | |
| var len = arguments.length, | |
| i = 0, | |
| finalObj = {}; | |
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
| /** **************************************** | |
| * Constructor for say hi feature. | |
| * @constructor SayHiConstructor | |
| * @returns {object} | |
| */ | |
| function SayHiConstructor() { | |
| this.greeting = "Basic module says, 'hallo'!" | |
| } | |
| SayHi.prototype.sayHi = function sayHi() { | |
| this.writeToConsole()); |
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
| /** **************************************** | |
| * Module for say hi feature | |
| * @module sayHiFactory | |
| * @returns {object} | |
| */ | |
| function sayHiFactory() { | |
| var greeting = "Basic module says, 'hallo'!" | |
| function prvtWriteToConsole() { | |
| console.log(greeting); |
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
| // Sample object | |
| var mySampleData = { | |
| foo: { | |
| bar: [ | |
| 1, | |
| 2, | |
| { | |
| baz: "hello", | |
| wut: 2, | |
| hi: [7, 8, 9] |
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
| /** **************************************** | |
| * Utility file | |
| * mixin.js | |
| * @returns [object] | |
| */ | |
| function mixinFactory() { | |
| var len = arguments.length, | |
| i = 0, | |
| finalObj = {}; | |
- Definition: The front-end consists of any code that is run on the client (browser): HTML, CSS and JavaScript.
- Agnostic and independent front-end code is priority. Front-end code should not represent server/back-end architecture.
- Modularity and encapsulation is vital to increase reusability and following the DRY philosophy.
- The MVC philosophy (when developing web-applications) should be closely followed, but exact replication may be unnecessary. The structure goes as follows:
- Model: Models do not technically exist in the client (unless using client-sided storage (localStorage, et cetera), but act more as temporary data stores between getting and setting data with the server. So, this temporary data store will be considered and called a Service. Data should always exist as native JSON either as objects or arrays.
- View: Views should be pure HTML containing virtually no logic. Element attributes (data-, classes, ids, ng-model,
There are examples of apps that use localStorage on the AngularJS blog. One that I downloaded and picked apart was FoodMe by Igor Minar. In FoodMe, Igor creates a localStorage service which basically just wraps window.localStorage so it can be loaded with dependency injection. The $scope is then watched, and a string version of a given record is dumped into localStorage using JSON.stringify:
foodMeApp.factory('customer', function($rootScope, localStorage) {
var LOCAL_STORAGE_ID = 'fmCustomer';
var customerString = localStorage[LOCAL_STORAGE_ID];
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
| alias gitA="git add -A && git status " | |
| alias gitS="git status " | |
| alias gitPl="git pull " | |
| alias gitCm="git commit -m " | |
| alias gitACm="gitA && gitCm " | |
| alias gitPPM="git pull && git push origin master " | |
| alias gitPB="git push origin " | |
| alias gitPg="git checkout gh-pages && git push origin gh-pages && git checkout master && git branch -d gh-pages" | |
| alias gitCkM="git checkout master " | |
| alias gitStPlPhi="git subtree pull --prefix=phi git@github.com:cerebralideas/phi.git " |
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
Show hidden characters
| { | |
| // -------------------------------------------------------------------- | |
| // JSHint Configuration, Strict Edition | |
| // -------------------------------------------------------------------- | |
| // | |
| // This is a options template for [JSHint][1], using [JSHint example][2] | |
| // and [Ory Band's example][3] as basis and setting config values to | |
| // be most strict: | |
| // | |
| // * set all enforcing options to true |
OlderNewer