Skip to content

Instantly share code, notes, and snippets.

View prtksxna's full-sized avatar
🐢
Slow and steady

Prateek Saxena prtksxna

🐢
Slow and steady
View GitHub Profile
@prtksxna
prtksxna / js.md
Created November 18, 2013 06:55 — forked from ritvvijparrikh/js.md

General

  • Indentation - 4 spaces
  • Line Length - 80 characters
  • Required License in File Header

Naming

  • variables and functions - lowerCamelCase
  • constructor like functions - UpperCamelCase
  • constants - ALL_UPPER_CASE_WITH_UNDERSCORES
Element.addMethods({
setPngBackground: (function() {
var IEBelow7 = (function(agent) {
var version = new RegExp('MSIE ([\\d.]+)').exec(agent);
return version ? parseFloat(version[1]) < 7 : false;
})(navigator.userAgent);
return function(element, url) {
element = $(element);
var options = Object.extend({