This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* For a current project I need to wait to execute a code until some images have been loaded. | |
* Beside, I also need to execute a callback (in my specific code I want to show the image | |
* with a fade-in effect) every time a single image has been loaded. | |
* | |
* So basically I used two deferred objects: the nested one which is resolved for a single | |
* image successfull load event (or when image has been discarded) and the outside one, | |
* which is resolved when all deferred objects on single images have been resolved or rejected. | |
* | |
* This snippet also takes care all frequent issues when trying to load an image (excessive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* with this snippet you can create a raw silhouette of an image, it works transforming | |
non-white pixels (with a small tolerance) into black pixels */ | |
<img id="canvassource" src="your-image-300x300.jpg" /> | |
<canvas id="area" width="300" height="300"></canvas> | |
<script> | |
window.onload = function() { | |
var canvas = document.getElementById("area"); | |
var context = canvas.getContext("2d"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# Typical Jamiroquai video explained by a context-free grammar (just for fun) | |
JV ::= <epsilon> | <Someone> <Does> <Something> in a <Place> | <Exceptions> ; | |
Someone ::= He | the invisible man ; | |
SomeoneElse ::= Him | another invisible man ; | |
Does ::= (runs away with | follows | drives) a ; | |
Something ::= (porsche | ferrari | moto | helicopter) followed by <SomeoneElse> <Consequence> ; | |
Consequence ::= wasting fuel | polluting environment | making roads insecure ; | |
Place ::= dull desertic land | desert | bright floor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Fabrizio Calderan, twitter @fcalderan, 2010.11.02 | |
* I had an idea: could Inception movie be explained by a few javascript closures | |
* and variable resolution scope (just for fun)? | |
* | |
* Activate javascript console =) | |
*/ | |
<script> | |
console.group("inception movie"); |
NewerOlder