8/02/2010

How to know if $ is jQuery ?

Sometime (mostly in highly conflicted environement) you may want to know if $ is really a jQuery alias. Because $ can be an alias for Mootools too (and of course other libs).

Here is a way to detect jQuery:

How to get the call-stack of a javascript function

And to be more precise: How to get the call-stack of a Javascript function everytime she's called without blocking the execution.

From time to time you may want to see every call-stack of a specific function for profiling concerns.

Here is a naive approach:


When executed in firebug, only 1 Error is shown. We miss the alert() and the second call from doAnotherThing.

Solution? Prefer console.log instead of throw:


Now our 2 error (with call-stack) appear in Firebug while the alert('ok') pop-out as expected.
7/30/2010

[Fun] The Inception Code ! (spoiler)

While watching Inception I couldn't stop thinking about recursion (a dream in a dream).
And here we are...

« »
 
 
Made with ❤ on a hot august night from an airplane the 19th of March 2017.