Skip to content

Instantly share code, notes, and snippets.

@seangibat
Last active August 29, 2015 14:21
Show Gist options
  • Save seangibat/f05010d9bec2f9f57cb9 to your computer and use it in GitHub Desktop.
Save seangibat/f05010d9bec2f9f57cb9 to your computer and use it in GitHub Desktop.
//Style Guide:
//https://github.com/makersquare/student-wiki/wiki/Style-Guide
//Keep things consistent. Makes reading your code a lot easier.
//1. Quotes. Decide on single or double.
//2. Functions. Space after parens.
//Choose one.
function() {...}
function(){...}
function () {...}
function (){...}
//3. stick to function expressions.
var print = function() {...}; //Yes. Make sure you use a semi-colon when writing FEs.
function print() {...} //No.
//3. Spaces after variable declarations.
var x = 5; // Yes.
var x=5; // No.
var x= 5; // No.
//4. Variable names.
// good:
var animals = ['cat', 'dog', 'fish'];
// bad:
var animalList = ['cat', 'dog', 'fish'];
// bad:
var animal = ['cat', 'dog', 'fish'];
//5. Spaces for loops and conditionals.
//Pick one.
for (var i = 0; i < something; i++) {...}
for(var i = 0; i < something; i++) {...}
//This is the MKS way.
if (thisThing === "thatThing") {
//...
} else {
//...
}
//6. Don't forget your semicolons.
//No semicolons after conditionals
//Remember to use semicolons after function expressions.
//7. Indentation. Pick one Tab or Spaces. MakerSquare uses spaces.
//And make sure you indent properly. We see a lot of sloppy indentation from students.
//It's understandable; you're trying to move quickly and make progress.
//But you're saving yourself time in the future by keeping your indentation correct as you go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment