Skip to content

Instantly share code, notes, and snippets.

View mikeolivieri's full-sized avatar

Mike Olivieri mikeolivieri

View GitHub Profile
var ts = azure.createTableService(accountName, accountKey);
var query = new azure.TableQuery().top(500).where('PartitionKey eq ?', 'elearning');
var nextContinuationToken = null;
var count = 0;
function getScreencasts(token) {
ts.queryEntities('Screencasts',query, nextContinuationToken, function(error, result, response) {
if (error) console.log(error);
[
{
"name": "Doug Stamper",
"sex": "male",
"age": 50,
"birthday": "4/1/1964",
"address": {
"street": "77 Main St",
"city": "Washington",
"state": "DC",
@mikeolivieri
mikeolivieri / validation.js
Created September 11, 2011 16:08
Backbone Model Validation
_.extend(Backbone.Model.prototype, Backbone.Events, {
errors: [],
validate: function (attrs) {
//reset
this.errors = [];
var model = this;
@mikeolivieri
mikeolivieri / parseError.js
Created September 8, 2011 18:30
Parse result as JSON on $.ajax error
$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
if (options.parseError) {
$.Deferred(function (defer) {
jqXHR.done(defer.resolve)
.fail(function (jqXHR, statusText, errorMsg) {
var parsed = $.parseJSON(jqXHR.responseText);
defer.rejectWith(this, [jqXHR, statusText, parsed]);
});
}).promise(jqXHR);
jqXHR.success = jqXHR.done;