background preloader


Facebook Twitter

10 Small Things You May Not Know About Javascript. It doesn’t matter how many years I’ve been dealing with Javascript – it contains many little things that surprises me almost every week.

10 Small Things You May Not Know About Javascript

For me, Javascript means a constant learning process. In this article, I’ll provide ten small Javascript tips, mainly aimed for beginner and intermediate Javascript developers. Hopefully there’s at least one useful tip for every reader :). 1. Variables conversions This sounds quite obvious, but as far I’ve seen, using object constructors, like Array() or Number() for converting variables is quite common practice. Var myVar = "3.14159", str = ""+ myVar, int = ~~myVar, float = 1*myVar, bool = !! Var myVar = "3.14159", str = ""+ myVar,// to string int = ~~myVar, // to integer float = 1*myVar, // to float bool = !! Converting to dates (new Date(myVar)) and regular expressions (new RegExp(myVar)) must be done with constructors. 2. Are you writing separate functions for hex (or octal) conversios?

DropKick - a jQuery plugin for beautiful dropdowns. Javascript PC Emulator. jQuery Shadow Plugin. Useful Coding Tools and JavaScript Libraries For Web Developers - Smashing Magazine. Advertisement Everyone who is a regular Smashing Magazine reader will know that we have a traditional habit of regularly researching the latest resources, tools and services out there on the Web, as productivity is a crucial asset of professional Web designers and developers.

Useful Coding Tools and JavaScript Libraries For Web Developers - Smashing Magazine

We could, and should, all integrate workflow optimization into our working practices. Perhaps we should warn you upfront for the long compilation, but what can we say — there are so many excellent tools out there which deserve attention of the community, yet unfortunately remain obscure way too often. We love all the designers and developers out there for releasing and producing useful, valuable resources for all of us to use! We, for one, surely sincerely appreciate it in the name of the Web design community. Useful Coding and Workflow Tools Stripe: Easy Credit-Card Processing For Online StoresA website owner has many options for accepting credit card payments. Last Click Stay Tuned! jQuery Sliding Clock v1.1. Flexigrid. Presentation tool based on the power of CSS3 transforms and transitions in modern browsers.

Logging with JavaScript. I am sure this has been done a thousand times, I'm posting because I found a really old posting I wrote on the subject.

Logging with JavaScript

So anyway, for posterity's sake, I'm copying here. It should be pretty clear what this does. Basically, we are appending the log message as a query string parameter and making the browser request it as an image. The images are stored in an array because objects in the function will lose scope when the function ends. This could prevent some requests from being made. You should probably have something to receive the request (one pixel gif maybe), just to prevent filling the log with 404 errors. Just for kicks, here is a version that doesn't use the global variable for the image array. This works due to the fact that functions are objects in javascript.

A word about caching, if there is an expectation that the same messages be logged for a user, consider adding a random number to the end on the query string. jQuery Slideshow & Content Slider Plugin For Wordpress. JavaScript log servlet. It is a Java servlet lets you log data right from your JavaScript code.

JavaScript log servlet

Actually you can use Ajax for asynchronous transferring data from your JavaScript code to this servlet. Servlet will record them into log file as well as display via own GUI. You can use it as debug or monitoring tool for your JavaScript code. How to use it: JavaScript $N Multistroke Recognizer. Download $N Recognizer: JavaScript, C# Pseudocode: $N, $N-Protractor Multistroke gesture logs: xml About The $N Multistroke Recognizer is a 2-D stroke recognizer designed for rapid prototyping of gesture-based user interfaces.

JavaScript $N Multistroke Recognizer

In machine learning terms, $N is an instance-based nearest-neighbor classifier with a Euclidean scoring function, i.e., a geometric template matcher. $N is built upon the $1 Unistroke Recognizer. Demo. JavaScript Style Attributes. Are you ready for this. Filed: Thu, Oct 11 2007 under Programming|| Tags: DOM onlaod onready ondomready ready functional For small pages, the preferred method of starting up your scripts is to use the window.onload event.

Are you ready for this

This is a perfectly great little event which will fire after the page has finished loading and call whatever function you've assigned to it. For instance the following code will run as soon as the page has finished loading. <script> function startup() { alert("The page has finished loading! I'm ready to do stuff! ") Here we create a startup function that simply issues an alert box, we then pass window.onload the pointer to the function. Scaling onload The problem with the above script is that it assumes that no other script or library will want to attach an onload event of its own. The solution here is to create a registration function that allows you to register events.