Object-Oriented javascript book
I’ve just finished the book “Object-Oriented javascript” written by Stoyan Stefanov.
It covers the topics about OOP (Inheritance, Polymorphism, Encapsulation), some Javascript specific Design Patterns(Self-executing functions, Lazy Definition,Configuration Object, etc), and some general Design Patterns(Decorator, Singleton, Factory and Observer).
Its really a good ideia to read this book, so you can understand how the language works, it is different from others languages like c-sharp, java etc, because javascript doesn’t have classes, just objects, and after reading this book, you will know how to work properly with objects, and how powerful they are.
jQuery Lettering Animate Plugin
jQuery Lettering Animate is a plugin based on the Lettering.js. I made it to use in a project that I am working on, it iterates through each letter separated by the Lettering plugin, and animates it.
It’s requirements are the jQuery library and the Lettering plugin.
Tested in Safari, Firefox, IE9, Chrome.
Its very simple to use the plugin, here is the code:
1 | $("#element").lettering().animateLetters({randomOrder:true,time:1000},{left:200,opacity:0},{left:0,opacity:1},onCompleteHandler); |
First, you separate the letters using the Lettering plugin, then you animate each of them calling the function “animateLetters”. The first parameter is the config properties of the plugin, “randomOrder” means if the letters will be animated either in sequential order (sarting in the first letter until the last letter) or in random order, the “time” propertie is the delay between each letters starting animate.
The following 2 parameters are the properties that will be animated in each letter. First, you set the initial properties of each letter, after this, you set the final properties of each letters. The last parameter is the complete callback.
Pure Javascript Game
In the past weeks, I was diving into front-end development (html(5)/css(3)/javascript/jquery). However, before I got into jquery, I decided to learn pure javascript, I had some knowledge in javascript before (moreover, it is very similar to AS2), but nothing very deep. So, I read about javascript, did an video-course, and finally, I made a game to put in practice what I’ve learned. Of course, at the moment, I know just the basic about the language, but I am getting into it more and more. Feel free to comment, give me some advices, what I shouldn’t do etc.
To insert the sound, I used the html5 “audio” tag.
Renaming multiple files into sequential numbers
Have you ever need to rename multiple images name to sequential numbers? Have you done this manually? Here is a great solution using the bash command:
1 | i=1;for f in *.jpg; do mv "$f" "newname$i.jpg"; let i++; done |
This script will iterate for each jpg file, and rename them to “newname” + variable “i” + “jpg”, then, after each iteration, we increment the variable “i”.
This will be very useful for me, as I always have to do this type of renaming when dealing with dynamic images and so on.
Hope this will help somebody!.
Book Reference – Clean Code
“You are an author, you write stories to other developers read”
A few weeks ago, I bought the book called “Clean Code” by Robert C. Martin, and I’ve just dive into it and finished the book in 1 week. The book is very good, it covers topics about naming the functions/classes/variables correctly, keeping the logics encapsulated, how important is Unit Testing, the usage of comments (or the not usage of the comments) and so on.
The book is a must-read for every developer. After you read the book, you have more pleasure to write code, write clean code.
Programming Quotes #3
“Every line of code you don’t have to write is a line of code you don’t have to debug or maintain”
Robert Penner
I am at GitHub!
I reinstalled windows on my machine, and I forgot to make a backup of my as3 help-classes, for my lucky, I had a copy of my classes in my work. But, to make sure that this won’ t happen anymore, I decided do create an account at github to post all my classes, samples, personal projects, then, if I change my pc, I just have do download the classes from github. Besides that, I love opensource projects, and now I have the opportunity to give something back to the community.
You can checkout my profile here.
Unity3D will add suport for FlashPlayer / Molehill
This is an exciting news, it will be possible to export Unity3D content for Flash Player. The unity3D plugin won’t be a problem anymore, as most of the users have Flash Player plugin installed, Unity3D content will target a very big range of audience now.
You can see the details here.




