background preloader

Javascript

Facebook Twitter

Minify Javascript Online / Online JavaScript Packer. Underscore.js. Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects.

Underscore.js

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.

Collection Functions (Arrays or Objects) _.each(list, iterator, [context]) Alias: forEach Iterates over a list of elements, yielding each in turn to an iterator function. . _.every([true, 1, null, 'yes'], _.identity); => false. JavaScript Patterns. Validate.js. Lightweight JavaScript form validation library inspired by CodeIgniter.

validate.js

No dependencies, just over 2kb gzipped, and customizable! Validate.js (development - 16kb) validate.min.js (minified - 2.1kb) Example All of the fields were successfully validated! Features Validate form fields from over a dozen rules No dependencies Customizable messages Supply your own validation callbacks for custom rules Chainable customization methods for ease of declaration Conditionally validate certain form fields Works in all major browsers (even IE6!) Installation and Usage Include the JavaScript file in your source Create the validation object with your desired rules. JustGage.com. Handsontable - jQuery grid editor. Excel-like grid editing with HTML & JavaScript. Unify Client-Side and Server-Side Rendering by Embedding JSON. Not many applications I work on these days are solely using the traditional server-side rendering model.

Unify Client-Side and Server-Side Rendering by Embedding JSON

Neither do they employ 100% client-side rendering and templating. Usually it’s a mix in which the ‘old’ world meets the new world, giving rise to some interesting design decisions. In this article I want to explore a solution that combines both worlds while minimizing the duplication of rendering logic by embedding JSON in the view. Let’s introduce a simple example to illustrate the JSON embedding trick. It’s on GitHub, with several branches showing different approaches. After the initial request to the server, the first page of products is shown. What duplication? We have two main goals: Changing Times For Web Developers – 6 Tips You Should Read To Survive. The context of this post is about the changing times for a web developer, and I see a lot of web developers still lagging behind especially in the .NET world.

Changing Times For Web Developers – 6 Tips You Should Read To Survive

If you haven't yet started mastering your art and adapting to the changing trends, you should start today. Think about crafting your web applications properly. Use commonsense to mix and match based on scenarios. Here we go with 6 Tips to be a responsible web developer, and to stay on top of what you do. 1 – Learn to write better JavaScript and CSS If you don’t write proper JavaScript and CSS, you are dead. Familiarize yourself with a higher level abstraction language to write JavaScript once you are comfortable with plain Javascript – Like CoffeeScript or TypeScript. JQuery – Alright, you know this, don’t you? More Oh yes, start learning TypeScript especially if you have a Microsoft technology/C# background. 2 – Familiarize yourself with a Responsive Framework My personal choices include Twitter Bootstrap and Zurb’s Foundation. Better list example. Simplifying and cleaning up views in KnockoutJS - Knock Me Out. A common source of discontent that I hear about Knockout.js is how easy it is to find yourself with complex and verbose data-bind attributes that contain logic and code that belongs elsewhere.

Simplifying and cleaning up views in KnockoutJS - Knock Me Out

Partially because of this issue, there has been interest lately in ways to unobtrusively apply bindings. If a robust solution is developed to handle this, then it may be an interesting option with its own pros and cons. However, I wanted to present another angle on this topic. I believe that there are many techniques that can be used to reduce the complexity and general craziness of the data-bind attributes. Here are some common examples of bindings that could stand to be improved for various reasons: Utility functions in KnockoutJS - Knock Me Out. When working with KnockoutJS, there seem to be many common operations that you need to perform on your view model objects.

Utility functions in KnockoutJS - Knock Me Out

Internally, Knockout has a number of utility functions used by the library itself, but many of these functions might actually be handy for anyone using the library. I wanted to build a sample that highlights a few of my favorite utilities. Handling data from the server One of the first tasks that you typically encounter is converting data from the server to a suitable format for use in Knockout. Suppose, we are provided a JSON string from the server that was not automatically turned into a JavaScript object: Knockout.js 2.2 is out now! - Knock Me Out.