Activate your free membership today | Log-in

JavaScript


Wednesday, August 13th, 2008

Prefer Ruby syntax? See Red, and your Ruby will convert to JS

Category: JavaScript, Ruby

I am a fan of Ruby, and when I saw Red the framework that allows you to write Ruby and get JavaScript out the other end I was excited. It allows you to write this: PLAIN TEXT RUBY: class MyClass    @@my_var = 500        def initialize(arg)      @arg = arg   Read the rest...

Posted by Dion Almaer at 6:28 am
10 Comments

++---
2.9 rating from 34 votes

Tuesday, August 12th, 2008

Squirreling out the Fish on the iPhone

Category: iPhone, JavaScript, Mobile, Performance

PLAIN TEXT HTML:   <script type="text/javascript"> function recurse(n) {     if (n> 0) {         return recurse(n - 1);     }     return 0; }   try {     // recurse(43687);  // Highest that works for me in WebKit                   Read the rest...

Posted by Dion Almaer at 6:11 am
1 Comment

++++-
4.4 rating from 19 votes

Monday, August 11th, 2008

MockMe: A new JavaScript mocking framework

Category: JavaScript, Testing

Johannes Link is an Agile fellow who wasn't 100% happy with the existing JavaScript unit test frameworks, and he explained why. He gives an example: PLAIN TEXT JAVASCRIPT:     testDoubleSpeaker: function() { with(this) {     var actualMsg = null;     var mockSay = function(msg) {       actualMsg = msg;   Read the rest...

Posted by Dion Almaer at 8:22 am
7 Comments

+++--
3.5 rating from 15 votes

Thursday, August 7th, 2008

Enjoying the Observer pattern with custom events

Category: JavaScript

I created an introductory example discussing custom events as an implementation of the Observer pattern. I posted this on my personal blog first and quickly got a port from my Prototype version to Malte's jQuery port (and now we have a DOMAssistant and Appcelerator versions). I hope others keep them coming so we can aggregate Read the rest...

Posted by Dion Almaer at 7:59 am
10 Comments

++++-
4.1 rating from 17 votes

Wednesday, August 6th, 2008

Code on Demand: How JavaScript is RESTful

Category: JavaScript

In the code-on-demand style, a client component has access to a set of resources, but not the know-how on how to process them. It sends a request to a remote server for the code representing that know-how, receives that code, and executes it locally. The above quote comes from the infamous thesis by Roy Fielding Read the rest...

Posted by Dion Almaer at 11:11 am
2 Comments

+++--
3.8 rating from 11 votes

Introducing HTML into an iframe and getting it back

Category: HTML, JavaScript, Tip

Michael Mahemof is working a lot with TiddlyWiki and posted on how the project injects HTML into an iframe, and then get them out later. This enables you to use the browser parser to do its thing: PLAIN TEXT JAVASCRIPT:   // put it in var doc = iframe.document; if (iframe.contentDocument)   doc = iframe.contentDocument; Read the rest...

Posted by Dion Almaer at 11:07 am
7 Comments

++---
2.9 rating from 38 votes

Monday, August 4th, 2008

NoGray Visual Time Picker

Category: Component, JavaScript

The NoGray Time Picker is a component that lets you add a time picker that is visual. The clock shows up, and you move the hands to wherever you need to be. All via a simple: PLAIN TEXT JAVASCRIPT:   var tp = new TimePicker('time2_picker', 'time2', 'time2_toggler', {format24:true});   Or a more complex version that Read the rest...

Posted by Dion Almaer at 7:54 am
15 Comments

+++--
3.3 rating from 31 votes

Wednesday, July 30th, 2008

Light-weight JSON Binding Framework

Category: JavaScript

In my other life as a desktop application developer (which due to a mix of Fluid, AIR, Prism, canvas, SVG, and Flash is threatening to converge on my Ajax life) I've long been a fan of data-binding frameworks that make it easy to have a form automatically synchronize with backing data structures, saving you from Read the rest...

Posted by Ben Galbraith at 9:59 am
13 Comments

+++--
3.8 rating from 16 votes

onJSReady Prototype Plug-in

Category: JavaScript, Prototype

In a follow-up to our post a few days ago on parallelizing JavaScript loading and firing an event when loading is done, Stefan Hayden wrote a Prototype extension (based on onDOMReady) that makes it easy for you to execute your code when all JavaScript is loaded: PLAIN TEXT JAVASCRIPT:   Event.onJSReady(function () { dependent_on_external_js(); }); Read the rest...

Posted by Ben Galbraith at 9:30 am
3 Comments

++++-
4.2 rating from 26 votes

Tuesday, July 29th, 2008

Book review: “JavaScript: The Good Parts” by Crockford

Category: Book Reviews, Books, JavaScript

I heart David Flanagan. I'm making my way through "The Ruby Programming Language" this summer. Its exhaustiveness really satisfies. But a decade ago, my programming Bible was Flanagan's "JavaScript: The Definitive Guide". As I transitioned from a career in content to a career in code, "the Rhino book" taught me everything I needed to know Read the rest...

Posted by Dietrich Kappe at 3:51 pm
7 Comments

++++-
4 rating from 26 votes

Monday, July 28th, 2008

What’s the Fastest Way to Code a Loop in JavaScript?

Category: Browsers, JavaScript, Performance

Gregory Reimer, frontend engineer for sun.com, has written a barrage of tests to answer the question What's the Fastest Way to Code a Loop in JavaScript? specifically for large data sets: I built a loop benchmarking test suite for different ways of coding loops in JavaScript. There are a few of these out there already, Read the rest...

Posted by Dion Almaer at 10:15 am
17 Comments

++++-
4.2 rating from 30 votes

Thursday, July 24th, 2008

Getting around the blocking of script

Category: JavaScript, Performance, Yahoo!

Stoyan Stefanov has a post that discusses the issues with browsers blocking on script tags. He discusses the general problem and how YUI has a helper for it by using onreadystatechange and onload: PLAIN TEXT JAVASCRIPT:   var myHandler = {     onSuccess: function(){         alert(':))');     },     Read the rest...

Posted by Dion Almaer at 7:15 am
6 Comments

+++--
3.9 rating from 14 votes

Wednesday, July 23rd, 2008

window.name meet dojox.io.windowName

Category: Ajax, Dojo, JavaScript

We have written about using window.name as a transport and Kris Zyp has just posted about how Dojo has created a new dojox.io.windowName module. The window.name transport is a new technique for secure cross-domain browser based data transfer, and can be utilized for creating secure mashups with untrusted sources. window.name is implemented in Dojo in Read the rest...

Posted by Dion Almaer at 7:08 am
7 Comments

+++--
3.8 rating from 54 votes

Getting to know GWT JSNI; Including talking to GWT code from JavaScript

Category: GWT, JavaScript

Bruce Johnson has written an expansive post on understanding the GWT JavaScript Native Interface (JSNI). It starts out with the piece that some people know about, namely inlining native JavaScript such as this: PLAIN TEXT JAVA:   // Java method declaration... native String flipName(String name) /*-{   // ...implemented with JavaScript   var re = Read the rest...

Posted by Dion Almaer at 6:43 am
Comment here

++++-
4.1 rating from 15 votes

Monday, July 21st, 2008

Increase DOM Node Insertion Performance

Category: JavaScript, Performance

John Resig continues his streak of compelling blog entries with "DOM DocumentFragments" where he shows that: A method that is largely ignored in modern web development can provide some serious (2-3x) performance improvements to your DOM manipulation. The technique shown is compatible across a large swath of modern browsers, including our friend IE6. Here's an Read the rest...

Posted by Ben Galbraith at 9:00 am
6 Comments

++++-
4.3 rating from 29 votes

Monday, July 14th, 2008

Interview with the Gears on Rails team

Category: Gears, JavaScript, Podcasts, Rails, Ruby

With my Google hat on, I got to interview Michael Marcus and Rui Ma, two recent graduates from a masters program at NYU. They joined me to discuss Gears on Rails, their open source framework that makes it easier than ever to take a Rails code-base offline. They take the approach of giving you a Read the rest...

Posted by Dion Almaer at 4:29 pm
1 Comment

++---
2.9 rating from 16 votes