Skip to content

Instantly share code, notes, and snippets.

View pynej's full-sized avatar

Jeremy Pyne pynej

View GitHub Profile
@pynej
pynej / jquery.ensure.js
Created January 29, 2015 22:19
jQuery Promise for recurring checks/dom existence.
/* Add $().exists() helper method.
Usage:
$(selector).exists()
*/
jQuery.fn.exists = function(){return this.length>0;}
/* Add $().ensure() helper method that ensures conditions pass before executing.
This will re-check the conditions untill they are meet or the limit is reached.
Usage:
@pynej
pynej / SampleMarketoCode.cs
Last active August 29, 2015 14:04
Sample Marketo Soap integration in C#.
UpdateModel(model, HttpContext.Current.Request.Form);
// Get the lead.
var lead = MarketoWs.Instance.getLead();
// Update fields.
lead[ApiFields.FirstName] = model.FirstName;
lead[ApiFields.LastName] = model.LastName;
lead[ApiFields.Company] = model.Company;
lead[ApiFields.Phone] = model.Phone;