Skip to content

Instantly share code, notes, and snippets.

View elijahmanor's full-sized avatar
😀

Elijah Manor elijahmanor

😀
View GitHub Profile
@elijahmanor
elijahmanor / fiddle.js
Created August 20, 2012 21:47
Serialize Form Into Object
//Uses jQuery's serialize form method & then transforms data into an object
var data = {};
$.each( $( "#Form" ).serialize().split( "&" ), function( index, item ) {
var keyValue = item.split( "=" );
data[ keyValue[ 0 ] ] = decodeURIComponent( keyValue[ 1 ] ).replace( /\+/g, " " );
});
console.log( JSON.stringify( data, null, 4 ) );
@elijahmanor
elijahmanor / console.js
Created August 24, 2012 03:27
Custom JSBin Settings
jsbin.settings.editor.theme = "monokai";
jsbin.settings.editor.indentUnit = 4;
jsbin.settings.editor.smartIndent = true;
jsbin.settings.editor.tabSize = 4;
jsbin.settings.editor.indentWithTabs = true;
jsbin.settings.editor.autoClearEmptyLines = true;
jsbin.settings.editor.lineWrapping = true;
jsbin.settings.editor.lineNumbers = true;
jsbin.settings.editor.matchBrackets = true;
@elijahmanor
elijahmanor / readme.md
Created August 30, 2012 13:59
Exterminating Common jQuery Bugs

Exterminating Common jQuery Bugs

Links

The following are links to information about this presentation. I've recorded the talk previously at aspConf that you can watch or share. The HTML slides are provided below and are based on a multipart blog series. If you are interested in digging into each point of the talk I've put together a hands on Lab that is unit test based with instructions to help you walk through fixing each bug.

function deferredRequest( resource, data ) {
return $.Deferred(function( dfd ) {
amplify.request({
resourceId: resource,
data: data,
success: dfd.resolve,
error: dfd.reject
});
}).promise();
}
@elijahmanor
elijahmanor / helper.js
Created September 20, 2012 03:05
AmplifyJS Request Deferreds
function deferredRequest( resource, data ) {
return $.Deferred(function( dfd ) {
amplify.request({
resourceId: resource,
data: data,
success: dfd.resolve,
error: dfd.reject
});
}).promise();
}
@elijahmanor
elijahmanor / gist:3759520
Created September 21, 2012 03:03
Cow Art
/; ;\
__ \\____//
/{_\_/ `'\____
\___ (o) (o }
_____________________________/ :--' DRINKA
,-,'`@@@@@@@@ @@@@@@ \_ `__\
;:( @@@@@@@@@ @@@ \___(o'o)
:: ) @@@@ @@@@@@ ,'@@( `====' PINTA
:: : @@@@@: @@@@ `@@@:
:: \ @@@@@: @@@@@@@) ( '@@@'
@elijahmanor
elijahmanor / maxcomplexity.js
Created September 21, 2012 18:36
JSHint Function Complexity
{
"globals": {
"console": false,
"jQuery": false,
"_": false
},
"maxparams": 5,
"maxdepth": 5,
"maxstatements": 25,
"maxcomplexity": 10,
@elijahmanor
elijahmanor / request.define.js
Created September 26, 2012 04:41
AmplifyJS Request Netflix Example
amplify.request.define( "getMovies", "ajax", {
url: "http://odata.netflix.com/Catalog/Titles?$filter=substringof('{criteria}',Name)&$callback=?&$format=json",
dataType: "jsonp",
cache: 1000,
decoder: function ( data, status, xhr, success, error ) {
if ( status === "success" ) {
success( data.d.results );
} else if ( status === "fail" || status === "error" ) {
error( data.message, data.status );
} else {
@elijahmanor
elijahmanor / request.define.js
Created September 27, 2012 01:21
AmplifyJS Request Twitter Example
// Define what a getTweets request looks like... url, dataType, etc
amplify.request.define( "getTweets", "ajax", {
url: "http://twitter.com/status/user_timeline/{userName}.json",
dataType: "jsonp",
type: "GET"
});