trochette/Angular-Design-Patterns-Best-Practices · GitHub github - What is the proper git workflow for basing a project off a 'seed' repo? Best Practices for Building Angular.js Apps Update 2016–04–17: I wrote this article almost 2 years ago for Angular 1.x. This article is still tremendously popular somehow, but I want to warn that it may not be the best for Angular 2.x or other methods of building JS front-ends. I have spent almost all my time writing CLI code since I wrote this, so I have really no context to say if this is still the best practice I considered it to be in 2014. Still, I offer a simple solution that many have said they prefer to more complicated setups. Burke Holland had a fantastic post explaining how Angular loads an application and comparing the merits of browserify vs require.js in an Angular app. I’ve worked with Angular on quite a few apps at this point, and have seen many different ways to structure them. I must note that if I was on a project with his structure, I would be content. Before we start though, the concept of modules in the world of Angular can be a bit confusing, so let me lay out the current state of affairs. .noConflict()
Basic Branching and Merging Let’s go through a simple example of branching and merging with a workflow that you might use in the real world. You’ll follow these steps: Do work on a web site.Create a branch for a new story you’re working on.Do some work in that branch. At this stage, you’ll receive a call that another issue is critical and you need a hotfix. You’ll do the following: Switch to your production branch.Create a branch to add the hotfix.After it’s tested, merge the hotfix branch, and push to production.Switch back to your original story and continue working. Basic Branching First, let’s say you’re working on your project and have a couple of commits already. You’ve decided that you’re going to work on issue #53 in whatever issue-tracking system your company uses. $ git checkout -b iss53 Switched to a new branch "iss53" This is shorthand for: $ git branch iss53 $ git checkout iss53 You work on your web site and do some commits. $ vim index.html $ git commit -a -m 'added a new footer [issue 53]' Basic Merging Note
Google's AngularJS Style Guide This is the external version of a document that was primarily written for Google engineers. It describes a recommended style for AngularJS apps that use Closure, as used internally at Google. Members of the broader AngularJS community should feel free to apply (or not apply) these recommendations, as relevant to their own use cases. This document describes style for AngularJS apps in google3. Style Note: Examples on the AngularJS external webpage, and many external apps, are written in a style that freely uses closures, favors functional inheritance, and does not often use JavaScript types. 1 Angular Language Rules 2 Angular Style Rules 3 Angular Tips, Tricks, and Best Practices 4 Best practices links and docs 1 Angular Language Rules Manage dependencies with Closure's goog.require and goog.provide Choose a namespace for your project, and use goog.provide and goog.require. goog.provide('hello.about.AboutCtrl'); goog.provide('hello.versions.Versions'); Why? Modules Why? For example: Why? Why? No:
Git Reference git reset is probably the most confusing command written by humans, but it can be very useful once you get the hang of it. There are three specific invocations of it that are generally helpful. git reset HEAD unstage files from index and reset pointer to HEAD First, you can use it to unstage something that has been accidentally staged. Let's see what it looks like to unstage something. $ git status -s M README M hello.rb $ git add .$ git status -sM README M hello.rb $ git reset HEAD -- hello.rb Unstaged changes after reset: M hello.rb $ git status -sM README M hello.rb Now you can run a git commit which will just record the changes to the README file, not the now unstaged hello.rb. In case you're curious, what it's actually doing here is it is resetting the checksum of the entry for that file in the "index" to be what it was in the last commit. If you want to be able to just run git unstage, you can easily setup an alias in Git. The third option is to go --hard.
Google JavaScript Style Guide We follow the C++ formatting rules in spirit, with the following additional clarifications. Curly Braces Because of implicit semicolon insertion, always start your curly braces on the same line as whatever they're opening. For example: if (something) { // ... } else { // ... } Array and Object Initializers Single-line array and object initializers are allowed when they fit on a line: Multiline array initializers and object initializers are indented 2 spaces, with the braces on their own line, just like blocks. Long identifiers or values present problems for aligned initialization lists, so always prefer non-aligned initialization. Not like this: Function Arguments When possible, all function arguments should be listed on the same line. // Four-space, wrap at 80. When the function call is itself indented, you're free to start the 4-space indent relative to the beginning of the original statement or relative to the beginning of the current function call. Passing Anonymous Functions Blank lines
git - Where does .gitignore file belong? Angular Best Practice for App Structure (Public) github - Delete a Git branch both locally and remotely Best Practices · angular/angular.js Wiki · GitHub Related: Anti-Patterns Namespace distributed code You shouldn't worry about prefixing internal code, but anything you plan to OpenSource should be namespaced The ng- is reserved for core directives.Purpose-namespacing (i18n- or geo-) is better than owner-namespacing (djs- or igor-)Checkout ui-alias to remove 3rd party prefixesOnly use .$broadcast(), .$emit() and .