Sticker.js – js lib for creating Sticker Effect

Sticker.js
Sticker.js is a Javascript library that allows you to create a Sticker Effect. Good thing with this libraty is that there is no dependency on any other libraries link jQuery. So, this can be used independently. It is released under MIT License. Inspiration for this project came from
Sanghee Cho’s Heroes Project. Continue reading “Sticker.js – js lib for creating Sticker Effect”

Typing effect mimicking human behavior using TheatreJS

TheaterJS is a typing effect mimicking human behavior. This is an open source project and hosted on GitHub. Everything that is in this is demonstrated and explained in this codepen. The demo is also available on the TheaterJS page.
Usage:

var theater = new TheaterJS();
  theater
    .describe("Vader", .8, "#vader")
    .describe("Luke", .6, "#luke");
  theater
    .write("Vader:Luke.", 600)
    .write("Luke:What?", 400)
    .write("Vader:I am...", 400, " your father.");
  theater
    .on("say:start, erase:start", function () {
      // add blinking caret
    })
    .on("say:end, erase:end", function () {
      // remove blinking caret
    })
    .on("*", function () {
      // do something
    });

Documentation – https://github.com/Zhouzi/TheaterJS#documentation
GitHub – https://github.com/Zhouzi/TheaterJS

Using Array.prototype.filter() with arguments

In JavaScript, the filter() method is used to search for array items which satisfy the condition that is passed to it. Technically this method creates a new array with all elements that pass the test implemented by the provided function. But there is a confusion around how to use it with arguments. For example, we want to search for an employee with id = 101 in an array of employee objects.
Let us see the typical use of Array.prototype.filter().
function isBigEnough(element) {
return element >= 10;
}
var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
// filtered is [12, 130, 44]

Now, we shall see how to implement it with arguments.

function GetEmployee(EmpId) {
    return function(element) {
        if(element.ID === EmpId)
        {
             return element;
        }
    }
}
employeeArray.filter(GetEmployee(101));

Simple, yet useful tip. Happy Coding!

Resources: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

Hello.js – A JavaScript SDK for Authentication

Hello.js is a client-side Javascript SDK for authenticating with OAuth2 (and OAuth1 with a oauth proxy) web services and querying their REST API’s. HelloJS standardizes paths and responses to common API’s like Google Data Services, Facebook Graph and Windows Live Connect. It’s modular, so that list is growing. No more spaghetti code!

Hello.js

Homepage: http://adodson.com/hello.js/#hellojs
GitHub: https://github.com/MrSwitch/hello.js

Parallax.js: Create layouts that react to a device orientation

Parallax.js helps you create layouts that react to the orientation and movement of your smart device (or mouse cursor if no gyroscope or motion detection hardware is detected). You can create layers that interact in different ways depending on their depth in a scene. This is a collaboration project of Matthew Wagerfield and Claudio Guglieri.

 Parallax JS
Continue reading “Parallax.js: Create layouts that react to a device orientation”

JSLint – a JavaScript syntax checker and validator

JSLint is a code quality tool which looks for problems in Javascript programs. It is developed by Douglas Crockford and comes with a funny warning ‘JSLint will hurt your feelings‘ 🙂

The background for JSLint in Crockford’s words –

When C was a young programming language, there were several common programming errors that were not caught by the primitive compilers, so an accessory program called lint was developed that would scan a source file, looking for problems.
As the language matured, the definition of the language was strengthened to eliminate some insecurities, and compilers got better at issuing warnings. Lint is no longer needed.

Continue reading “JSLint – a JavaScript syntax checker and validator”