07 12 / 2011
Adventure of writing jQuery code with CoffeeScript
I wanted to give CoffeeScript a try and decided to give it a go on current jQuery project. Below is a sample of the code.
CoffeeScript Code
$ ->
###
--- Variables Init
###
menuStatus = false
newAlertsMenu = false
###
--- Show Main Menu
###
$("a.showMenu").live 'tap', ->
if !menuStatus then $(".ui-page-active").animate
marginLeft: "165px", 280, ->
menuStatus = true
return false
else
$(".ui-page-active").animate
marginLeft: "0px", 280, ->
mentuStatus = false
return false
return
###
--- Show New Alerts Panel
###
$("a.headerAlerts").live 'tap', ->
if !newAlertsMenu then $("body").addClass("activeMenu"); $("#newAlerts").css("display", "block"); $(".ui-page-active").animate
left: "-200px", 280, ->
newAlertsMenu = true
return false
else
$(".ui-page-active").animate
left: "0px", 280, ->
newAlertsMenu = false;
$("body").removeClass("activeMenu");
$("#newAlerts").css('display','none');
return false
return
Generated jQuery Code
$(function() {
/*
--- Variables Init
*/
var menuStatus, newAlertsMenu;
menuStatus = false;
newAlertsMenu = false;
/*
--- Show Main Menu
*/
$("a.showMenu").live('tap', function() {
if (!menuStatus) {
return $(".ui-page-active").animate({
marginLeft: "165px"
}, 280, function() {
menuStatus = true;
return false;
});
} else {
return $(".ui-page-active").animate({
marginLeft: "0px"
}, 280, function() {
var mentuStatus;
mentuStatus = false;
return false;
});
}
});
return;
/*
--- Show New Alerts Panel
*/
$("a.headerAlerts").live('tap', function() {
if (!newAlertsMenu) {
$("body").addClass("activeMenu");
$("#newAlerts").css("display", "block");
return $(".ui-page-active").animate({
left: "-200px"
}, 280, function() {
newAlertsMenu = true;
return false;
});
} else {
return $(".ui-page-active").animate({
left: "0px"
}, 280, function() {
newAlertsMenu = false;
$("body").removeClass("activeMenu");
$("#newAlerts").css('display', 'none');
return false;
});
}
});
});
Permalink 16 notes
16 11 / 2011
Tacofindr built on Sencha Touch using Yelp’s Api
I have been wanting to find something to build with Sencha Touch latest release which is till in preview mode. I decided to use Yelps API to find listings of taco places near you.

Demo (still a work in progress)
25 5 / 2011
Mobile Design/Development Resources
Here is a collection of resources for anything to do with mobile design and development:
- 10 Awesome jQuery Mobile Plugin
- Useful HTML-, CSS- and JavaScript Tools and Libraries
- jQuery & JavaScript Articles For The Community
- CSS Sprite Generator
- jQuery.spritely is a jQuery plugin for creating dynamic character and background animation in pure HTML and JavaScript.
- JSON Editor (http://jsoneditor.appspot.com/)
- Get Latitude and Longitude (http://www.getlatlon.com/)
- A Beautiful Boilerplate for Responsive, Mobile-Friendly Development
Github Resources:
- TouchScroll is a JavaScript- and CSS 3-based scroller for devices using Webkit Mobile (jQuery Plugin)
- Zepto.js is a minimalist inlinable framework for mobile WebKit browsers
Permalink 7 notes