background preloader

Minify JavaScript - Free JavaScript Compressor

Minify JavaScript - Free JavaScript Compressor

Control Flow in Node Part II Static Version I had so much fun writing the last article on control flow, that I decided to play around with the feedback I received. One thing in particular I want to talk about is the good work inimino is doing. Node has two constructs that are used currently to handle async return values, namely callbacks and event emitters. UPDATE Promises were removed from node a while back, this article has been updated to show callbacks instead of promises. Why the distinction between Callback and EventEmitter? In node there are two event handling techniques. callback.js var fs = require('fs'); fs.readFile('mydata.txt', function (err, buffer) { if (err) { // Handle error console.error(err.stack); return; } // Do something console.log(buffer);}); fs.readFile() takes a filename and "returns" the contents of the file. Sometimes you want to listen for events that can happen several times. http-body.js var http = require('http'); console.log("Server started on continuable.js do.js

10 strike plan to grease your site for speed. - Webdistortion I’ve recently spoke of the importance of speed with your website or blog. It can have a significant impact on site goals, and in many cases improve bounce rates and increase page views. Paying attention to detail and improving page load speed can really get your pages performing at their optimum. 1) All Sites – on page speed Javascript Google host a variety of popular javascript libraries for web developers, and this standardised hosting platform provides a central repository for developers. This has a couple of benefits. 2) Images There are a number of way to optimise images for speed. I’ve found in the past the compression engine within Fireworks to be superior to Photoshop when analysing quality verses size. 3) Lowering web requests Web requests are individual web page calls to a web server for a file. You should do everything in your power to lower the number of requests that you make – the lower that number the better. 4) Client Side Compression 5) Server Side Compression Cache Plugins

jquery parse json multidimensional array JsMini.com - Minify Your Javascript/jQuery Code Online Control Flow in Node Static Version One of the unique aspects of programming in an async framework like node is the ability to decide between which function will run in serial and which will run in parallel. While there are no built-in methods for managing this in node, I'll discuss some of the tricks I came up with while writing the node-blog engine that generates this site. Parallel vs Serial Usually in an application you have steps that can't run until the result from a previous step is known. This is the case in Node too, except for functions that would otherwise perform blocking IO. For my blog engine I have a tree structure of files that need to be processed. Get a list of articles.Read in and parse the articles.Get a list of authors.Read in and parse the authors.Get a list of HAML templates.Read in all the HAML templates.Get a list of static resource files.Read in the static files.Write article html pages.Write author pages.Write index page.Write feed page.Write static resources. simple-scanner.js

How do I force SSL on my ASP/.NET site on Cloud Sites? Below are three examples of how to force SSL on your ASP or ASP.NET site. web.config If your website has the IIS Rewrite Module available*, you can use rewrite rules in your web.config to force SSL on all pages: Please contact support if you are unsure if the IIS Rewrite Module is available for your site. The above example could be modified to force SSL on one page or specific pages. ASP.NET (Non MVC 3) Using ASP.NET you can use this code snippet to force SSL on a page on your site: When using the "RequireHttps" attribute to decorate actions within your MVC application: Classic ASP Using classic ASP you can use this code snippet to force SSL on a page on your site: © 2011-2013 Rackspace US, Inc. Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License See license specifics and DISCLAIMER

jQuery: The Write Less, Do More, JavaScript Library JSMIN, The JavaScript Minifier The JavaScript Minifier Douglas Crockfordwww.crockford.com JSMin is a filter which removes comments and unnecessary whitespace from JavaScript files. What JSMin Does JSMin is a filter that omits or modifies some characters. JSMin first replaces carriage returns ('\r') with linefeeds ('\n'). It omits spaces except when a space is preceded and followed by a non-ASCII character or by an ASCII letter or digit, or by one of these characters: It is more conservative in omitting linefeeds, because linefeeds are sometimes treated as semicolons. and if it follows a non-ASCII character or an ASCII letter or digit or one of these characters: No other characters are omitted or modified. JSMin knows to not modify quoted strings and regular expression literals. JSMin does not obfuscate, but it does uglify. Before: After: Character Set JSMin requires, but does not verify, that the character set encoding of the input program is either ASCII or UTF-8. Caution Be sure to retain your original source file. a + ++b

Prototypal Inheritance Static Version In almost all modern programming languages we use the concept of Object Oriented Programming (OOP) to help manage the complexity of today's software. The biggest challenge in modern software is in fact managing the complexity of it. Most languages do this with a variant OOP called Classical OOP. This is the one you see in Java, C#, C++, PHP, Ruby, and Python. While this is a great abstraction, I would like to experiment with other ideas. So what does JavaScript have? From what I hear (I wasn't there at the time), JavaScript was initially a prototypal inheritance system. Classical OOP classical.js var frank = new Person("Frank Dijon");frank.greet(); Output => 'Hello world, my name is Frank Dijon' Here we have a class like object Person. Prototypal OOP I don't like the new keyword, it overloads the meaning of functions and is dangerous. Instead try this on for size: prototypal.js#intro-to-style There is more you can set, but value and enumerable are the interesting ones.

ASP.NET - Browser speed on localhost Don't let jQuery's $(document).ready() slow you down jQuery’s $(document).ready() event is something that you probably learned about in your earliest exposure to jQuery and then rarely thought about again. The way it abstracts away DOM timing issues is like a warm security blanket for code running in a variety of cold, harsh browser windows. Between that comforting insurance and the fact that deferring everything until $(document).ready() will never break your code, it’s understandable not to give much thought to its necessity. However, what if $(document).ready() is slowing you down? Example: live() One of the most popular uses for jQuery’s live() is to maintain event handlers on elements that are dynamically created and destroyed over time. Imagine that we have an application with several slideToggling sidebar blocks which may be dynamically added and removed while the user interacts with the page. <html><head><script type="text/javascript" src="jquery.js"></script><script type="text/javascript"><! Benefit: A more responsive UI Conclusion

Related: