background preloader

Google JavaScript Style Guide

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

Introduction to RequireJS In this tutorial we are going to take a look at RequireJS, an AMD compatible asynchronous script loader that is incredibly powerful. In my experiments with RequireJS I've hugely enjoyed working with it and will be using it heavily in my future development. This is a fairly heavy post as far as complexity goes, but please do stick with it. I struggled to get my head around RequireJS and AMD for a long time but once it "clicks" it is really awesome. The basic use case for RequireJS is as a basic script loader, but in this tutorial I wont concentrate on that, but on its uses for modular development. jQuery datePicker home A flexible unobtrusive calendar component for jQuery Welcome to the homepage for version 2 of the jQuery datePicker plugin. This is an clean, unobtrusive plugin for jQuery which allows you to easily add date inputing functionality to your web forms and pages.

JavaScript Guide - JavaScript The JavaScript Guide shows you how to use JavaScript and gives an overview of the language. If you need exhaustive information about a language feature, have a look at the JavaScript reference. This Guide is divided into the following chapters. Introduction 11 Multi-touch and Touch events Javascript libraries Touch screen devices are ruling the mobile platform nowadays. Most of the smart phones have it, tablet and based on the trend, it's slowly come to our desktop as well. To develop a touch screen compatible web applications or website, you can use the existing touch events of the browsers or the platforms.

JavaScript Execution Context, Closure, Eval and “this” Keyword These are a few key concepts of JavaScript language that developers should know: execution context, activation object, variable instantiation, scoping, closure, eval and “this” keyword. Knowing these would help one tremendously in Ajax development. For example, when you write an inner function, you know that you can access the local variables defined in the outer function as if they were defined locally. You can also access the global variables. -Why? How does the host environment resolve such variables? The Top 10 Javascript MVC Frameworks Reviewed - CodeBrief UPDATE 1/14/2012: Added Batman.js and Angular.js due to popular demand and because they looked impressive. Over the last several months I have been in a constant search for the perfect javascript MVC framework. Driven by a dire need for the right level of abstraction and features, I have tried out - some more cursorily than others - every framework I could get my hands on. Here lies a brief synopsis of each framework. Lastly, I share the framework which I ultimately decided on.

Intro Javascript--what the heck is it? Is it a really difficult programming language that casual web designers should be afraid of? What is it used for? WebRTC status Current as of December 22nd, 2013 Spot an inaccuracy? Please email WebRTC and PeerJS are still works in (rapid) progress. Video, audio, and DataChannel are all available in stable mobile and web versions of Chrome and Firefox. Detecting the ‘Tap’ event on a Mobile touch device using javascript Currently we can use different types of events to control a touch gesture on a mobile device using javascript, but unfortunately they are not enough to detect all the huge amount of behaviours that an User could do with a touch gesture. Some of the events that you can catch having everything under control are touchstart, touchmove, touchend and touchcancel. In one of my projects I needed to detect the ‘Tap’ event that is a bit different from the ‘touchstart’ event *, so I found this solution that works pretty well, and here you can get the code.

jQuery Event Delegation Improves Performance In this post, I will share a simple tip of how you can improve jQuery performance by using Event Delegation to add event listeners to the parent element, and in turn, check for events on its children. First let’s take an example where there are a bunch of ‘li’ elements inside an unordered list. We have to use jQuery to provide a click event and perform an action, when the user clicks on a li element. For this example, we are converting the li into hyperlinks (not by appearance but by functionality)

YUI Theater: Douglas Crockford, The JavaScript Programming Language I’ve shared on YUIBlog and in the YUI Theater two presentations created by Yahoo! JavaScript Architect Douglas Crockford (“Advanced JavaScript” and“An Inconvenient API: The Theory of the Dom”). Today I’m happy to announce that Douglas’s more foundational talk “The JavaScript Programming Language,” is publicly available. In this presentation, which is meant to be the beginning of the three-course sequence (followed by “Theory of the DOM” and then “Advanced JavaScript”), Douglas explores not only the language as it is today but also how the language came to be the way it is. It’s always worth pointing out that ideas and perspectives are Douglas’s own and that the many eggregious flaws in videographic craftsmanship are mine.

Single page apps in depth (a.k.a. Mixu' single page app book) This free book is what I wanted when I started working with single page apps. It's not an API reference on a particular framework, rather, the focus is on discussing patterns, implementation choices and decent practices. I'm taking a "code and concepts" approach to the topic - the best way to learn how to use something is to understand how it is implemented. My ambition here is to decompose the problem of writing a web app, take a fresh look at it and hopefully make better decisions the next time you make one. Update: the book is now also on Github. Introduction

Coding Smackdown TV - Putting a headlock on the coding lifestyle! First off I want to thank Joel Hooks of the DFW Area AngularJS Meetup Group for suggesting this topic and providing the title. “Modules provide an excellent mechanism for cleanly dividing up our code into functional areas. Angular allows us to use modules in many ways. Let’s take a look at modules and some of the approaches we can leverage to produce cleaner more manageable code.” – Joel Hooks

10 jQuery Security Plugins How secure is your password? If you are confident enough that no hacker can break your pass codes then you might have to think again. Below are some tutorials that you might want to learn to secure you passwords. Be safe! Related posts: 1.