background preloader


Facebook Twitter

jTypes. Classes Classes help organize applications and libraries by promoting the reuse of code and facilitating the ease of maintainence.


They are created by providing the jTypes compiler with a definitions object in the following format: How do I compile a jTypes class? jTypes([String modifiers,] [Class base,] [Function constructor,] Object definitions) This definitions object is a template for creating instance objects. If an instance of the Color class is instantiated, the fields will have their default primitive values. The modifiers argument of the jTypes compiler accepts a space-separated string of keywords. Constraints Type constraints restrict values to simplify the implementation and maintainence of classes.

7 Things You Need To Know About Web Workers. Introduction Web Workers allow you to run JavaScript code in the background without blocking the web page user interface.

7 Things You Need To Know About Web Workers

You Might Not Need jQuery. Airbnb/javascript. Manuelbieh/Geolib. Writing Fast, Memory-Efficient JavaScript. Advertisement JavaScript engines such as Google’s V81 (Chrome, Node) are specifically designed for the fast execution2 of large JavaScript applications.

Writing Fast, Memory-Efficient JavaScript

As you develop, if you care about memory usage and performance, you should be aware of some of what’s going on in your user’s browser’s JavaScript engine behind the scenes. You should, however, ask yourself questions such as: Is there anything I could be doing more efficiently in my code? What (common) optimizations do popular JavaScript engines make? Fast-loading Web sites — like fast cars — require the use specialized tools. There are many common pitfalls when it comes to writing memory-efficient and fast code, and in this article we’re going to explore some test-proven approaches for writing code that performs better.

So, How Does JavaScript Work In V8? While it’s possible to develop large-scale applications without a thorough understanding of JavaScript engines, any car owner will tell you they’ve looked under the hood at least once. Learning JavaScript Design Patterns. Don't Initialize All the Things in jQuery.ready() One of the first impressions a user gets is loading your web application for the first time.

Don't Initialize All the Things in jQuery.ready()

Users don't have a high tolerance when it comes to page speed. They want to see something almost immediately and then be able to start interacting with your web site shortly after. If your website utilizes JavaScript and jQuery, which many web sites do, it is very tempting to pre-initialize all of your logic (plugins, widgets, modules, event handlers, etc) in order for them to respond as fast as possible. Unfortunately, initializing ALL THE THINGS during page load works against the user's goal of loading quickly.

Instead of initializing everything when the page is ready you can instead wait to initialize portions of your application until they are needed. Best Free JavaScript Chat Clients for Your Website. Upvote your favorite resources to improve the accuracy of the ranking :) Clipping JPEG Images Into Non-Rectangular Polygons Using polyClip.js. The trip of a lifetime. Byte-saving Techniques - GitHub. Byte-saving Techniques This is a collection of JavaScript wizardry that can shave bytes off of your code.

Byte-saving Techniques - GitHub

It's mainly intended as a reference for those creating entries for Feel free to add your own or send any feedback to @140bytes. Disclaimer Outside of the 140bytes challenge or other code golf challenges, please be considerate and don’t pre-minify code you wish to share with others. Arguments Use one-letter positional arguments, in alphabetical order Since arguments will need to be as short as possible, and will likely be reused within their lifetime, it's best to treat them as positionals instead of trying to give them meaning through their name. Function(t,d,v,i,f){...} // beforefunction(a,b,c,d,e){...} // after Test argument presence instead of length Use in to check whether a given argument was passed arguments.length>1||(cb=alert) // before1 in arguments||(cb=alert) // after If only truthy arguments are of interest, you can even boil that down to Variables Exploit coercion Loops.

Learning Advanced JavaScript. Learning Advanced JavaScript Double-click the code to edit the tutorial and try your own code.This tutorial contains code and discussion from the upcoming book Secrets of the JavaScript Ninja by John Resig.

Learning Advanced JavaScript

Our Goal Goal: To be able to understand this function: // The .bind method from Prototype.js Function.prototype.bind = function(){ var fn = this, args =, object = args.shift(); return function(){ return fn.apply(object, args.concat(; }; }; Some helper methods that we have: assert( true, "I'll pass. " ); assert( "truey", "So will I. " ); assert( false, "I'll fail. " ); assert( null, "So will I. " ); log( "Just a simple log", "of", "values Defining Functions What ways can we define functions?

Function isNimble(){ return true; } var canFly = function(){ return true; }; window.isDeadly = function(){ return true; }; log(isNimble, canFly, isDeadly); Does the order of function definition matter? Named Functions Context Closures. 5 Lesser Known JavaScript Libraries that Make Web Design Easier. In this round-up we'll be looking at 5 JavaScript libraries that can really ease the development of modern, attractive web sites.

5 Lesser Known JavaScript Libraries that Make Web Design Easier

The libraries that we'll be looking at aren't libraries in the same sense as something like jQuery or the YUI; they're much smaller and much more specialized. Lines go all over the place. Edge.js (javascript image mask effect) <form name="lst" id="lst" method="post" action=".. edge.js 1.5 allows you to add individual masks (inc. inbuilt mask) to images on your webpages.

edge.js (javascript image mask effect)

It uses unobtrusive javascript to keep your code clean. It works in all the major browsers - Mozilla Firefox 1.5+, Opera 9+, Safari and IE6+. On older browsers, it'll degrade and your visitors won't notice a thing.CVI-lab: Get a fast impression of the effects and their illustration qualities.