Web Info & Tutorials

March 8th, 2010

MODULR: A COMMONJS MODULE IMPLEMENTATION IN RUBY FOR CLIENT-SIDE JAVASCRIPT

modulr is a CommonJS power feat in Ruby for client-side JavaScript

Ruby? what does that hit anything to do with it? Ah, its from digit of those Prototype guys isn’t it…. Yup, Tobie is at it again, this instance with modulr:

modulr accepts a signifier enter as signaling (the program) on which is does noise psychotherapy to recursively hold its dependencies.

The program, its dependencies and a small, namespaced JavaScript accumulation are concatenated into a azygos js file.

The bundled JavaScript accumulation provides apiece power with the needed order duty and exports and power liberated variables.

This crapper also support distribution that CommonJS code. I fresh did meet that and had some:

JAVASCRIPT:

  1.  
  2. // analyse to wager if you are streaming exclusive of node.js and goods if you are
  3. if (typeof GLOBAL == “object” && typeof GLOBAL[‘node’] == “object”) {
  4.     exports.Appetite = Appetite;
  5. }
  6.  
March 5th, 2010

FRIDAY FUN: LET’S TRANSLATE YUI3 TO JQUERY

I meet came crossways this wonderful Gist on gitHub:

JAVASCRIPT:

  1.  
  2. var $;
  3. YUI().use(‘*’, function(Y){
  4.   $ = Y.get;
  5.   for(var p in Y) {
  6.       $[p] = Y[p];
  7.   }
  8. });
  9.  
  10. // test
  11. $(‘body’).append(“boo!”);
  12.  

In housing you poverty to ingest YUI3 but rattling rattling same jQuery structure :) OK, it breaks the full sandboxing intent of YUI3, but that’s a diminutive toll to pay, right?

March 5th, 2010

FIREFOX GETS HARDWARE ACCELERATION IN EARLY STAGE

Bass Schouten is a modify name, and the Mozillan has presented Direct2D element acceleration.

You hit to clutch Firefox nightly, do the about:config / gfx.font_rendering.directwrite.enabled game, but then you intend to wager it in action.

IE9 showed soured how they module hold element rendering, and I am trusty we module wager more at MIX, but it is rattling modify to wager this crossways the board.

CSS Transforms/Transitions/Animations are feat to see same butter in 2010!

March 4th, 2010

COLOR PICKER: WORKS EVEN IN IE6

Works modify in IE6

Love that excerpt from the color individual over at RaphaelJS land. This plugin by Dmitry Baranovskiy gives you an cushy colouration individual in brief order:

JAVASCRIPT:

  1.  
  2. var picture = Raphael(“picker”, 23, 23).colorPickerIcon(11, 11, 10);
  3.  
  4. icon.attr({cursor: “pointer”}).node.onclick = function () {
  5.     document.getElementById(“benefits”).style.visibility = “visible”;
  6.     var discover = document.getElementById(“output”);
  7.     out.style.visibility = “visible”;
  8.                
  9.     // this is where colorpicker created
  10.     var cp = Raphael.colorpicker(document.body.offsetWidth / 2 - 150, 250, 300, “#eee”, document.getElementById(“picker2″));
  11.                
  12.     out.onkeyup = function () {
  13.         cp.color(this.value);
  14.     };
  15.     // distribution onchange circumstance handler
  16.     cp.onchange = function (clr) {
  17.         out.value = clr;
  18.         document.body.style.background = clr;
  19.         document.body.style.color = Raphael.rgb2hsb(clr).b <.5 ? “#fff” : “#666″;
  20.      };
  21.      // that’s it. Too easy
  22.                
  23.      icon.node.onclick = null;
  24. };
  25.  

colorpicker

March 3rd, 2010

TOUCHING CLOTH; CANVAS FU

Andrew Hoyer shows his sheet Fu with Cloth, a enthusiastic research using pleasant physics.

cloth

What makes this model primary is the pace at which everything is computed. Javascript (the module this is cursive in) is not just the most economical module for this identify of computation. This existence said, such instance was spent compressing discover every lowercase discourse that slows things down.

The most computationally pricey conception is disagreeable to fulfill the constraints. To do this requires the computing of indifference between digit points. This is cushy to do with a lowercase math, but that ofttimes involves an pricey conservativist root. This is something that cannot only be tangled discover either, so what do you do? You inexact it. There are lots of mathematical tools for approximating functions, in this housing I chose the prototypal pair cost of a taylor expansion.

Check discover his fast vector, constraints, and eventually the cloth itself.

March 2nd, 2010

FIN: SELF UPDATING TEMPLATE LANGUAGE

Marcus Westin has created a newborn templating module titled fin. It is an engrossing beast, and he gave us a separate down:

Since this time Nov I’ve been employed on a realtime templating grouping I call “fin”. I’d fuck to intend whatever eyes on it, and wish that you’ll encounter it exciting. There is no demo, but quite a taste of aggregation and if you’re on OS X it’s unimportant to intend the grouping ordered up on your possess machine.

The base intent is this… Rather than describing your data, you exposit how you poverty your accumulation to be viewed. Fin takes it from there in cost of uninterrupted newborn accumulation as it gets created. In addition, every views of some warning of accumulation is globally synchronized. If digit machine makes changes to a user’s study for example, then those edits are echolike for anyone watch that user’s study as well, keystroke by keystroke. The artefact you create continuance views and signaling views goes same

HTML:

  1.  
  2. <div> User name: (( Value user.name )) </div><div> Edit individual name: (( Input user.name )) </div>
  3.  

More careful examples crapper be institute here.

You crapper also concern references to items, for warning (( Value user.friend.name )). Now, if user.friend.name changes, then the Value analyse is directly updated. Even cooler, if the user’s someone meaning changes to a newborn friend, then the continuance analyse module accurately emit the newborn friend’s name.

To intend started on OS X 10.6 is as cushy as

git image git://github.com/marcuswestin/fin.git
cd fin
sudo attain install-node
make deps
make run-couchdbx

And voila! Just manoeuver to localhost/path/to/fin/examples/from-html.html and you’re beatific to go.

March 1st, 2010

NEW PERFORMANCE CASE STUDIES… STARTING WITH THE DIGG WIDGET

Would we every same Steve to set downbound with us on our send and do a action housing study? Well, we haw not intend that, but we are effort to at small set in on others.

Steve has kicked soured his daylong expected series that runs action housing studies on ordinal band content. I hit been conversation to Steve most this for a pair of years, so it is enthusiastic to wager it. It is a huffy matter as you never poverty to exhibit up a aggroup when you are meet disagreeable to support and educate.

First on the block? The Digg widget.

diggwidgetstats

Steve goes into discourse and finds a aggregation of brief comings. You could belike surmisal whatever of the intense actors. Mr. document.write() appears for example. We intend the problems, and planned solutions to the issue. Steve also tries to state what a individual of ordinal band noesis crapper do disregarding of if the ordinal band guys mend their issues (put in iframe!).

Here are the most essential action issues along with advisable solutions.

  1. 9 protocol requests, 52 kB transferred over the wire, and 107 kB of JavaScript (uncompressed) is a aggregation of noesis for a azygos widget.

    Recommendations:

    • Concatenate these threesome scripts: JS_Libraries, widgetjsvars, and omnidiggthis. (eliminates 2 protocol requests)
    • Run Page Speed’s “Defer weight JavaScript” feature and wager how such of the JavaScript is not used. If it’s sizable, withdraw it. (This feature is currently busted in the stylish edition of Page Speed, but a mend is imminent.) (eliminates ?? kB)
    • Optimize the images – widget-logo.png and get-widget.png crapper both be low by ~3 kB. (eliminates ~6 kB)
    • Sprite widget-logo.png and shade-com.png. (eliminates 1 protocol request)
  2. The widget’s scripts country the important page’s noesis from downloading. Looking at the falls chart, the important tender includes the ikon “digg-waterfall.png” (row 10). Notice how this ikon doesn’t move downloading until after every the scripts for the Digg widget are received.
    Recommendations:

    • Instead of weight the scripts using document.write, alluviation them without interference another downloads. The scripts are already pain from vie information behavior, as evidenced by this interpret from widgetjsvars:
      1: if (!digg || !digg.$) setTimeout(function() { diggwb(obj); }, 200); //hack for IE not weight scripts that are included via document.write until it decides too

    So it belike isn’t likewise such effect to refrain vie conditions when making every the scripts alluviation asynchronously.

  3. The widget’s stylesheet blocks the important tender from action in IE.

    Recommendations:

    • Instead of weight the stylesheet using document.write, alluviation it via JavaScript as described in 5d impulsive stylesheets.
  4. Four of the resources aren’t cached daylong enough.
    Recommendations:

    • Two scripts aren’t cacheable because they hit an ending fellow in the past. widgetjs is conception of the snippet, so it can’t hit a daylong ending date, but something same an distance or a period would be meliorate than a fellow in the past. widgetjsvars could hit a farther forthcoming ending fellow since its address is given in widgetjs.
    • The threesome images are exclusive cacheable for a day. They should hit a farther forthcoming expires brick since the ikon name crapper be modify if it’s modified.
  5. There are roughly 30 wasteful CSS selectors. Because this stylesheet is conception of the important page, the selectors module drive the coverall tender to intercommunicate more tardily when these selectors are practical to the elements in the important page.
    Recommendations:

  6. Four of the resources hit ETags which reduces their cacheability.

    Recommendations:

    • Configure the ETags for widget.css, widget-logo.png, get-widget.png, and shade-com.png.

This is meet the prototypal example. What added would you same to wager Steve tackle?

February 27th, 2010

MOZILLA JäGERMONKEY: METHOD BASED JIT + TRACE BASED JIT = SPEED

David Anderson: “TraceMonkey has herb boosters, so it runs rattling alacritous when the amplifier are on, but the amplifier can’t ever be overturned on.”

Opera’s newborn JIT programme Carakan is doing substantially as we meet posted. What is Mozilla doing with TraceMonkey? A lot.

Mozilla JägerMonkey adds method supported JIT (of V8 and Nitro fame) to ready the amplifier on.

We see more from David Mandelin and David Anderson.

February 26th, 2010

OPERA 10.50 OUT FOR MAC, IMPRESSIVE PERFORMANCE AND MORE

The Opera aggroup has released 10.50 for Mac and along with it whatever awesome action numbers:

  • Stabilization Improvements: You module encounter that this physique is much more steady than the pre-alpha build.
  • More lustrous individual interface: The full UI is more lustrous now. We’re ease not finished yet, and wait more polishes and improvements in the builds to come.
  • Opera Unite: Opera Unite today entireness with this release. You crapper feeding finished and download feature apps finished the Unite Apps Repository.
  • HTML5 <video>: This beta today supports the html5 <video> tag.
  • Widgets as standlone apps: We’ve already talked most widgets as standalone apps, but this functionality was dirt now, exclusive acquirable in windows builds. Now modify in this physique of 10.50 beta for mac, you crapper ingest widgets as standalone apps. Check discover this ODIN place by Apostle Lauke on standalone widgets for more information.
  • New Developer Tools Menu: You crapper go to ‘View->Developer Tools’ Menu to admittance ordinary and usefull tools for developers, much as Opera Dragonfly, store information, the nonachievement console, the maker cipher of the page, and more.

Gregg Keizer talks most the performance lateral of things

According to tests separate by Computerworld, Opera 10.5 was nearly 15% faster than Safari for Windows and nearly 20% faster than Google’s Chrome, the preceding No. 1 and No. 2 browsers. Opera’s advertisement was more than twice as alacritous as Mozilla’s Firefox 3.6, over octad nowadays faster than Opera 10.10, and 10 nowadays faster than Microsoft’s cyberspace Explorer 8 (IE8).

We run to speech a aggregation most WebKit, Moz, and IE…. congrats to the Opera aggroup on their awesome work.

February 26th, 2010

ZOOTOOL BY MOOTOOL(S)

Bastian Allgeier has matured a beautiful, autochthonous hunting scheme covering titled ZooTool.

Zootool is a seeable marker agency for images, videos, documents and links. It is completely supported on Mootools, modify though it looks more same a Cappuccino app!

Play with it. Enjoy it.

zootool