21 May 2012

The Tech Reflector

 
Star Following

  Source Favicon
On DailyJS 8 months ago.
Email

…the same data types that jQuery supports: text, HTML , JSON , JSONP , Script, and XML .

Mocking a request looks a lot like the ajax API :

$ . mockjax ({ url : '/restful/fortune' , responseTime : 750 , responseText : { status : 'success' } });

Mockjax modifies jQuery using $.extend({ ajax: function() { // ... } }); — by passing one argument to $.extend the jQuery object itself is modified. The original ajax module is kept around internally …

dailyjs.com Read
  Source Favicon
On DailyJS 8 months ago.
Email

…able to parse a JSON string, but if your browser already had built in support for JSON parsing, it didn't require you to load anything extra!

HTML5

JavaScript-powered asynchronous loading isn't the end of the story. In HTML5, the script element has been updated to support async and defer attributes. This is already available in recent WebKit-based browsers and Firefox 3.6.

These attributes effectively let us do what LABjs offers:

If async is present, …

dailyjs.com Read
  Source Favicon
By Chris Heilmann of Mozilla Hacks - the Web developer blog 9 months ago.
Email

…by Wayne Pan and this demo by Joe Lambert explains but this also seems quite verbose.

I'd love to have a CSSAnimations collection for example where you could store different animations in JSON or as a string and have their name as the key. Right now, creating a new rule dynamically and adding it either to the document or append it to the ruleset seems to be the only cross-browser way. Thoughts?

hacks.mozilla.org Read
  Source Favicon
By James of James Padolsey 9 months ago.
Email

You know what the DOM is, and if you don't it's easy enough to find out . What isn't so easily discovered is the answer to this: how should your code communicate with the DOM API? Should it be treated as just another API? Is it no more deserving than, for example, a JSON web service or the web storage API?

What I've been seeing a lot of is the DOM becoming incredibly intertwined with the logic, i.e. the program becomes indifferentiable to the DOM. It all ends up being the same:

james.padolsey.com Read
  Source Favicon
Email

Libraries and Frameworks

Sprite3D.js

Responsive-Menu is a jQuery plugin to display menus as a select dropdown on mobile devices

jQuery Boilerplate is a boilerplate for creating jQuery plugins.

vintageJS

wru is a unit test framework for node.js and Rhino

box2dweb is a port of Box2DFlash 2.1a to JavaScript.

MediaElement.js

klass.js

JSONDB is a tiny script to pack and unpack (flatten and unflatten) JSON for transmission over the fire

jsmag.com Read
  Source Favicon
Email
  Source Favicon
By azakai of Mozilla Hacks - the Web developer blog 9 months ago.
Email

…This allows the normal eSpeak datafiles to be used (either through an xhr, or by converting them to JSON and bundling them with the script file). The result of running the compiled eSpeak code is that it ‘writes' a . wav file with the generated audio to the emulated filesystem. speak.js then takes that data, encodes it using base64, and creates a data URL. That URL is then loaded in an HTML5 audio element, letting the browser handle playback. (Note that while that is a very simple way …

hacks.mozilla.org Read
  Source Favicon
By Andrea Giammarchi of Web Reflection 9 months ago.
Email

I have already described JSONH and now I also have the proof that it's as safe as native JSON is but on average 2X faster than native JSON operations with both small (10 objects), medium (100 objects), and massive (5000 objects and not a real world case, just a stress test to see how much JSONH scales) homogenous collections.

Wherever it's not faster it's just " as fast " but the best part is that it seems to be always faster on slower machines ( mobile ).

webreflection.blogspot.com Read
  Source Favicon
By Andrea Giammarchi of Web Reflection 9 months ago.
Email

…expecting is that actually different projects and developers adopted this technique to shrink down JSON size.

Basic Advantage Of JSON.hpack Gzip and deflate work really good with repeated chunks of strings and this is why homogeneous collections have really good compression ratio there.

However, gzip and deflate compression does not come for free!

If we compress everything on server side we can easily test the CPU overload compared with uncompressed data.

Via JSON.hpack we …

webreflection.blogspot.com Read
  Source Favicon
By kangax of Perfection kills 10 months ago.
Email

…Function.prototype.bind , String.prototype.trim , JSON.* , etc. These are the things that are shimmed most often. And the question is — is it OK to extend native, built-in objects with these standardized methods?

Well, let's quickly go over problems with host objects extension:

Host vs. Native

"Lack of specification" doesn't apply here, as long as methods that are being shimmed are part of ES5 (or ES3) . ES5 is a standard. There's …

perfectionkills.com Read