background preloader

Javascript

Facebook Twitter

Dejavu. Have you ever had the feeling that you're seeing something you've already seen before? That's the feeling you get when using dejavu. If you are a developer coming from a language like PHP, Java, ActionScript 3.0, and others, it's likely that you are already familiar with Object Oriented Programming. However, JavaScript uses prototypal inheritance which, although powerful and flexible, can be difficult to understand, and specially to maintain in large projects. dejavu is a library that delivers classical inheritance on top of JavaScript prototypal inheritance, making it a breeze to move into JavaScript. Users are encouraged to declare 'use strict' while using the dejavu in strict mode, otherwise some code might fail silently.

You will read more on it later in this document. Do not confuse 'use strict' with the dejavu strict mode. The quickest way to start using dejavu in your project, is by simply including dist/regular/strict/dejavu.js (note that this is in strict mode). Overview Mobile. TypeLink.js. TypeLink is a mini pure javascript library that allows users to find important page links by typing.. How many times did you search for "about" "team" or even "login" in a page?

The common drill was Ctrl+f , then type "about" and then navigate the cursor to the link... Forget about it .. . See? Simple... easy! Easy to use. include typelink.js Type Just add typelink class to your links <a href=" class=" " >About</a> About You can add custom hint text <a href=" class="typelink" >Request an invitation </a> Request an invitation Try to type Multiple hints also work for the same link <a href="www.mysite.com/login" class=" data-hint= >Login </a> Login , , point to Login.

Links don't have to be visible Try or You can also navigate in page Try and Can be done with js function or by placing empty links on key positions(not that good) It can also execute JS functions try Grands focus to elements Just type What's next... JavaScript Project Generator. Closure Compiler Service. How to Convert XML to a JSON-Like JavaScript Object. In my post How to Create an XML to JSON Proxy Server in PHP we created a system which translated XML messages into Ajax-ready JSON.

That’s great if you’re running PHP or another suitable server-side process. But what if you’re limited to JavaScript only? Randomly accessing data from an XML document isn’t fun. You can use DOM or XPath methods, but they’re not as easy as native (JSON-generated) JavaScript object properties such as myobj.list[0].property1. The XML2jsobj Function We’re going to write a function which recursively analyzes each node of an XML document’s DOM tree and returns a JavaScript object. Function XML2jsobj(node) { var data = {}; We’ll now define an Add() function within XML2jsobj. // append a value function Add(name, value) { if (data[name]) { if (data[name].constructor ! We now require a loop to examine the XML node’s attributes (e.g. // element attributes var c, cn; for (c = 0; cn = node.attributes; c++) { Add(cn.name, cn.value); } return data; } Converting XML <? Enchant.js - HTML5 + JavaScript Game Engine. Starting out There are several ways to create games and applications in enchant.js.

Please note that this list does not include the Maeda Block development environment derived from enchant.js. develop using code.9leapdevelop using jsdo.itdevelop with the file systemdevelop on a local serverdevelop on a remote server Develop using code.9leap code.9leap is both a development environment and a learning environment for creating simple games in enchant.js.

Develop using jsdo.it jsdo.it is a web development environment sponsored by KAYAC Inc., which can also be used for enchant.js. Develop with the (local) file system This method is easiest for those already familiar with JavaScript. For example, please open the file /examples/beginners/hellobear/index.html, included in the download package (live version) in your browser. Due to the specs of some browsers[1] such as Google Chrome and Firefox not supporting certain functions, some games may be prevented from starting. Developing with a web server.

Frameworks

Essential JavaScript Namespacing Patterns. In this post, I'll be discussing both intermediate and advanced patterns and approaches for namespacing in JavaScript. We're going to begin with the latter as I believe many of my readers have some prior experience in this area. If however you're new to namespacing with the language and would like to learn more about some of the fundamentals, please feel free to skip to the section titled 'namespacing fundamentals' to continue reading. What is namespacing? In many programming languages, namespacing is a technique employed to avoid collisions with other objects or variables in the global namespace. They're also extremely useful for helping organize blocks of functionality in your application into easily manageable groups that can be uniquely identified.

In JavaScript, namespacing at an enterprise level is critical as it's important to safeguard your code from breaking in the event of another script on the page using the same variable or method names as you are. Wow, that's ugly. 2. 3. 4. Addyosmani/todomvc - GitHub. Microjs: Fantastic Micro-Frameworks and Micro-Libraries for Fun and Profit!

HTML5 Image Effects App – Adding Noise and Invert. HTML5 Image Effects App – Adding Noise and Invert Today we continue HTML5 canvas examples, I hope you enjoy this series of articles. Even for me, working with graphics, images brings pleasure. Sure that and for you too. Today we will be adding two new filters – Noise and Invert. Here are our demo and downloadable package: Live Demo download in package Ok, download the example files and lets start coding !

Step 1. Here are all html of my demo index.html What I did since last our version. Step 2. Here are used CSS styles. css/main.css Step 3. Since today I don`t will publich whole script code again and again, but will publish our new functions which we using. Js/script.js We will generate colored noise. Invert function is pretty easy, we will subtract current color value from 255 (white). Conclusion Not bad, isn`t it? If you enjoy our articles, feel free to share our tutorials with your friends. Storing Data the Simple HTML5 Way (and a few tricks you might not have known) Yes indeed people, it’s your favourite HTML5 Doctor with JavaScript knowledge who lives in Brighton near a golf course! I’m also shooting for the longest title we’ve published so far – and I think I’m in the lead. This post is about the Web Storage API. Technically it’s been shifted out of the HTML5 specification and can now be found in it’s very own dedicated spec.

But if it counts at all – it used to be part of the Web Applications spec. Web Storage is a very, very simple way to store data in the client – i.e. the browser. What’s more, the support is fabulous: IE8 and upwards has support natively, and there’s lots of good polyfills in the wild already. This post however will just focus on the features of Web Storage and hopefully show you a trick or two you may not have known about. What Web Storage Does Using JavaScript, Web Storage makes it possible to easily store arbitrary values in the browser. There are two versions of Web Storage: local and session. Get Storing Hey everyone!

Ajax

Sliders. Maps. Node.js partie 1 - Tout ce que vous devez savoir sur Node.js. Parmi les nombreuses technologies qui me passionnent actuellement, Node.js tient une place importante. Et pour plusieurs raisons : développement Javascript côté serveur, gestion des entrées/sorties de manières non bloquantes, communauté très présente avec de nombreux modules comme Socket.IO et bien d’autres choses encore.

C’est pour toutes ces raisons, et aussi parce que la nouvelle version 0.4.0 vient de sortir, que Web Tambouille vous propose une série de 4 billets consacrée exclusivement à votre futur serveur préféré : Node ! Et cela commence dès aujourd’hui avec une petite introduction générale du serveur, ses concepts, les interviews et autres vidéos à ne pas manquer, les liens à connaître… bref un condensé de tout ce que vous devez absolument savoir sur Node !

Présentation Node s’appuie sur V8, le moteur Javascript de Google utilisé dans Chrome, qui fait partie des moteurs Javascript les plus puissants du marché actuellement. Prenons l’exemple du serveur Apache. Juste pour pinailler. Programmation fonctionnelle en Javascript. Parmi les sujets qui nous ont occupés en 2010, je retiendrai une fois de plus l’intérêt croissant des grands du Web pour la Programmation Fonctionnelle (Scala, F#…). Un paradigme qui, s’il est bien appliqué, permet d’avoir un code complètement réutilisable grâce aux objets immutables (pas de modification ni de partage d’état), aux fonctions en tant que type (String, Integer et maintenant Function)… mais aussi de construire des applications hautement disponibles. Pour une introduction de la programmation fonctionnelle, je vous renvoie vers l’excellent article sur haskell.org.

Mais ce ne sont pas que les grands du Web qui en auront besoin, en effet nos architectures orientée web ou WOA (Web Oriented Architecture) vont aussi avoir besoin de la programmation fonctionnelle et cette vidéo nous le prouve. Nous allons voir comment écrire un code de manière fonctionnelle en Javascript ou plutôt comment transformer un code Javascript de tous les jours en code Javascript fonctionnelle. Conclusion. ImagePreloader - Un plugin JQuery pour précharger vos images. JQuery Image Preloader est un plugin JQuery pour précharger des images en fond dans le but d'accélérer le chargement de vos pages.

Vous le savez certainement, la nouvelle mode dans le Web consiste à optimiser le temps de chargement de vos pages à l'aide de Sprites CSS par exemple, en minifiant vos codes JS et CSS, en réduisant le plus possible le nombres de requêtes vers des médias (Images, vidéos, scripts...) ou encore via des logiciels pour compresser au maximum vos images. Les moteurs de recherche tiennent désomais en compte la métrique d temps de chargement des pages web dans leurs algorithmes. Le concept: Lorsque tous les chargements d'une page ont été effectués, il ne se passe plus grand chose, et vous pourriez charger des images présentes sur d'autres pages du site en attendant. Les navigateurs les mettent en cache, ainsi lorsque vous vous rendez sur une autre page, ces images pré-chargées s'affichent directement.

On y gagne, une fois de plus, en temps de chargement. Utilisation: Spine. Déplacer des champ input à la volée : Javascript, AJAX. Function Efface_ligne(index, tab){ if (typeof tab == 'object' && tab instanceof Array && index >= 0 && index < tab.length) { tab.splice(index,1); } return tab;} // TEST var tab = Array(0,1,2,3,4,5,6,7); alert('Prend l\'index 6 du tableau ('+tab+') soit le septième élément contenant la valeur 6 et le place en 3 position soit l\'index 2 du tableau'); tab = Modif_ordre(6,2,tab); for (i=0; i < tab.length; i++) { alert('index = '+i+' contenu = '+tab[i]); } alert('efface maintenant la troisième ligne, soit l\'index 2 du tableau');tab = Efface_ligne(2,tab); alert('Insert maintenant la valeur 6 à l\'index 6 soit en septième position du tableau'); tab = Insert_ligne (6,6 ,tab);for (i=0; i < tab.length; i++) { alert('index = '+i+' contenu = '+tab[i]); } --></script>

Wink toolkit - Downloads. Symfony2 - Les nouveautés + résumé Symfony Live 2011. Nous revenons de deux jours de Symfony Live 2011 à Paris avec le plein de nouveautés pour Symfony2. Les nouveautés de Symfony2 Symfony2 est en cours de stabilisation. La version 1 officielle de Symfony2 sera disponible dans quelques semaines (Fin mars en théorie). Fabien Potencier a fait du teasing lors de la Keynote de clôture du Symfony Live 2011 ! Nouveau site pour Symfony2 Un nouveau logo, un nouveau site et un nouveau nom de domaine pour Symfony2: Différentes distributions du framework Symfony2 à télécharger Différentes distributions du framework seront téléchargeables suivant l'utilisation souhaitée.

Une édition standardUne édition CMS: Plus adapté à la gestion de contenusUne édition SandboxUne édition Hello World: La version de bench sur le fameux hello world (joke) Ce système de distributions, bien connu dans le monde linux, est intéressant pour disposer rapidement du framework prêt à emploi. Au début, seule la "Symfony2 Standart Edition" est disponible. Par PHPTv. Upload large files using Flash Uploader - SOLMETRA.