background preloader

Underscore.js

Underscore.js
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It’s the answer to the question: “If I sit down in front of a blank HTML page, and want to start being productive immediately, what do I need?” … and the tie to go along with jQuery's tux and Backbone's suspenders. Underscore provides 80-odd functions that support both the usual functional suspects: map, select, invoke — as well as more specialized helpers: function binding, javascript templating, deep equality testing, and so on. It delegates to built-in functions, if present, so modern browsers will use the native implementations of forEach, map, reduce, filter, every, some and indexOf. The project is hosted on GitHub.

http://underscorejs.org/

Related:  Javascript

Everything you wanted to know about JavaScript scope The JavaScript language has a few concepts of “scope”, none of which are straightforward or easy to understand as a new JavaScript developer (and even some experienced JavaScript developers). This post is aimed at those wanting to learn about the many depths of JavaScript after hearing words such as scope, closure, this, namespace, function scope, global scope, lexical scope and public/private scope. Hopefully by reading this post you’ll know the answers to: What is Scope? Mongo Model Domain Model for MongoDB and Node.JS CoffeeScript and Fibers are optional. You can use Model with plain old JavaScript and Callbacks. class global.Post extends Model @collection 'posts' @embedded 'comments' class global.Comment extends Model Dynamic schema, flexible queries. post = new Post text: 'Zerg on Tarsonis!'

Sample App with Backbone.js and Twitter Bootstrap Backbone.js is a lightweight JavaScript framework that provides the basic infrastructure (Model, Collection, View, and Router classes) to bring structure to your Web applications. Twitter Bootstrap is a UI toolkit that provides simple and flexible HTML, CSS, and Javascript to implement popular user interface components and interactions. In other words, Backbone.js and Twitter Bootstrap focus on different areas of your application: core architecture and user interface respectively. Because of their well-defined and non-overlapping scope, Backbone.js and Twitter Bootstrap work well together. In general, I find a lightweight architectural framework and a UI toolkit to be a powerful combination, and an interesting alternative to full-stack frameworks: it gives you the flexibility to choose the library you like (if any) in the respective areas of your application.

iScroll 4 Project info Last code update: 2012.07.14 – v4.2Device compatibility: iPhone/Ipod touch >=3.1.1, iPad >=3.2, Android >=1.6, Desktop Webkit, Firefox, Opera desktop/mobile.Discussion groupQR Code opens demo page. Support development If this script saved your day and you wish to support future developments you may consider sending some funds via PayPal or Flattr. Overview iScroll 4 is a complete rewrite of the original iScroll code. Performant JavaScript Best Practices - Level Up Coding Like any program, JavaScript programs can get slow fast if we aren’t careful with writing our code. In this article, we’ll look at some best practices for writing fast JavaScript programs. DOM manipulation is slow. The more we do, the slower it’ll be.

Asynchronous Control Flow with Promises Static Version A Promise is an object that represents the result of an asynchronous function call. Promises are also called futures and deferreds in some communities. Goal of this Article Organizing Your Backbonejs Application With Modules If you have spent any time looking at Backbone.js, like many others, you are probably amazed by how lightweight, flexible and elegant it is. Backbone.js is incredibly powerful, but not prescriptive in how it should be used. With great power comes great responsibility, and if you’ve tried to use Backbone.js for a large project you might be asking yourself: how do I organize my code? When thinking about “code organization” the questions you might be asking are: How do I declare and invoke Backbone types?

The 10 Most Common Mistakes JavaScript Developers Make Today, JavaScript is at the core of virtually all modern web applications. The past several years in particular have witnessed the proliferation of a wide array of powerful JavaScript-based libraries and frameworks for single page application (SPA) development, graphics and animation, and even server-side JavaScript platforms. JavaScript has truly become ubiquitous in the world of web app development and is therefore an increasingly important skill to master. At first blush, JavaScript may seem quite simple. And indeed, to build basic JavaScript functionality into a web page is a fairly straightforward task for any experienced software developer, even if they’re new to JavaScript.

Managing module dependencies Static Version Following this discussion on the node.js mailing list about managing module dependencies, I thought it's worth sharing some pointers on that here. Using NPM to bundle your module dependencies If you're building an application that is dependent on a number of NPM modules, you can specify them in your package.json file this way: By doing so, every time you checkout your project fresh, all you need to do to get your dependencies sorted out is: $ npm install D3.js Is Way More Than Just Another Visualization Framework If you're an experienced web developer, you probably (a) are intimately familiar with the DOM, and (b) still find data-driven JavaScript apps a little unusual. You may know about how Backbone.js has brought MVC architecture to the web -- and if you like data-driven programming, but aren't already using Backbone, you really need to check it out. (And if you're thinking about Backbone but can't quite dive fully into its particular brand of JavaScript MVC: DZone is hoping to publish a Backbone Refcard some time soon, so stay tuned!)

Understanding the Difference Between Reference and Value in JavaScript Now, what about data types that are not primitives in JavaScript? For example, objects are not primitives, and neither are arrays (which are really just objects, secretly). Objects are passed by reference. To understand what that means, let’s look at a simple example: const someNumbers = [1, 2, 3];const addNumberToArray = arr => { arr.push(100); return arr;}const otherNumbers = addNumberToArray(someNumbers);console.log(someNumbers);console.log(otherNumbers); In this example we have a variable someNumbers which is an array that contains three elements.

How To Module Static Version This article was written for Node v0.4.1 and is no longer applicable. As of node.js 0.6.3 NPM comes pre-installed. These are some basic steps for writing a NodeJS module. Most of the suggestions in this document are optional. db4o: Simple POJO Persistence We Recommend These Resources Ranging from mobile to web applications, and from plain old Java to Scala or Groovy dialects, a modern Java developer always needs an ace in the hole when it comes to dealing with data persistence. Ideally, you're looking for a solution that gives you enough power to handle your domain complexity while being simple enough to boost your productivity by avoiding painful configurations or steep learning curves. On one side of this scenario you have relational databases with ORM tools which force you to go through several steps like the creation of an object mapping file, a database configuration file, a helper class to initialize a session factory and class association mappings (i.e. precious time spent on downloading, installing, configuring, and then writing a lot of XML). On the other side there's just plain old serialization (mostly ending up in XML files).

Related:  sabdoulweb dev.FrameworksFrameworksbackbone