Skip to content

Instantly share code, notes, and snippets.

View bittersweetryan's full-sized avatar

Ryan Anklam bittersweetryan

View GitHub Profile
app.ContactCollection = Backbone.Collection.extend({
model : Contact,
initialize : function(){
var self = this;
this.fetch({
success : function(){
self.trigger("load");
}
var obj = {
a : function(){
//do something
$(this).trigger("done");
}
}
$(obj).on("done",b);
$.when(a())
.then(b);
var a = function(){
return $.Deferred(function(dfd){
//do something
dfd.resolve;
}).promise();
}
a(); //a makes an async call like an ajax request
b();
@bittersweetryan
bittersweetryan / AMD.sublime-snippet
Created July 25, 2012 19:27
create AMD module with jquery and backbone
<snippet>
<content><![CDATA[
define([
'jQuery',
'Underscore',
'Backbone'${2:,}
${1:''
}], function(\$, _, Backbone${4:, }${3: })\{
$0
\});
$("#once").one('click',function(){
console.log("click once");
});
$("#once").one('mousedown mouseup click',function(){
console.log("click once");
});
$("#once").one('click', { color: 'blue', size : 'xxl' }, function(e){
console.log('click once you ' + e.data.size + ' ' + e.data.color + ' rabbit.');
});
});
$("ul").one('click','li',function(
$(this).css('text-decoration','line-through');
});

##Bio

Ryan Anklam is a Technical Solutions Architect at IDL Solutions which is a large enterprise and government focused technology company based in Milwaukee, WI. He has been doing web development using numerous platforms since 1996. Ryan is currently focused on developing large scale, single page applications using JavaScript and ColdFusion. He is passionate about code quality, unit testing, continous learning, and sharing code on GitHub. When he's not writing code he's either coaching basketball, riding his mountain bike, or spending time with his family.

##The Art Of JavaScript: Level Up Your Skills In 50 Minutes

>JavaScript is one of the most popular and fastest growing programming languages in the world. Many developers are introduced to JavaScript programming through one of the many frameworks such as jQuery, Dojo, or Sencha. While these frameworks allow developers to quickly be productive, they also create an environment where developers tend to overlook the fundamentals of the underlying JavaSc