Skip to content

Instantly share code, notes, and snippets.

events:
"keypress #filter-string" : "filterOnEnter"
class Todo extends KinveyModel
class TodoList extends KinveyCollection
class Todo extends Backbone.Model
class TodoList extends Backbone.Collection
url: "http://test.kinvey.com/appdata/APPKEY/todos"
class Todo extends Backbone.Model
class TodoList extends Backbone.Collection
class TodoList extends KinveyCollection
url: "http://test.kinvey.com/appdata/#{kinvey_app_key}/todos"
class Todos extends KinveyCollection
url: ->
url = "http://test.kinvey.com/appdata/#{kinvey_app_key}/todos"
// if there is a filter string
if @filterString
// build the regex query - queries are JSON objects
query = JSON.stringify( content: { $regex: @filterString } )
// make sure we URI encode the query!
url += "?query=#{encodeURIComponent( query )}"
// Return the final result
@KellyRice
KellyRice / kinvey_login_with_facebook
Created August 30, 2012 19:22
kinvey_login_with_facebook
NSString* accessToken = [FBSession activeSession].accessToken;
[KCSUser loginWithFacebookAccessToken:accessToken withCompletionBlock:^(KCSUser *user, NSError *errorOrNil, KCSUserActionResult result) {
if (errorOrNil) {
//handle error
}
}];
@KellyRice
KellyRice / Kinvey-Save-Entity
Created September 14, 2012 14:58
Kinvey Save Related Entities
// Create an author and book entity.
var author = new Kinvey.Entity({ name: 'Joanne Rowling' }, 'authors');
var book = new Kinvey.Entity({ title: 'Harry Potter and the half-blood Prince', author: author }, 'books');
// Save both.
book.save({
success: function(book) {
// book is the book entity instance.
// book.get('author') is the author entity instance.
},
@KellyRice
KellyRice / Kinvey-load-author-entity
Created September 14, 2012 15:00
Kinvey Load Related Entities
var book = new Kinvey.Entity({}, 'books');
book.load('my-book-id', {
resolve: ['author'],
success: function(book) {
// book is the book entity instance.
// book.get('author') is the author entity instance.
},
error: function() {
// An error occurred.
}