Skip to content

Instantly share code, notes, and snippets.

@KellyRice
KellyRice / naive.js
Created January 31, 2012 17:35
Mark code 1
// User ID
var _id;
// Facebook ready
window.fbAsyncInit = function() {
FB.init({ appId: 'XXX' });
// Do we have a user?
FB.getLoginStatus(function(response) {
if('connected' === response.status) {
// User ID
var _id;
// Facebook ready
window.fbAsyncInit = function() {
FB.init({ appId: 'XXX' });
// Do we have a user?
FB.getLoginStatus(function(response) {
if('connected' === response.status) {
// User ID
var _id;
// Dependency handlers
var dep = [];
var depDone = (function() {
var i = 0;//# dependencies
return function() {
i += 1;
if(dep.length === i) {//all dependencies are done
@KellyRice
KellyRice / fireAtWill.js
Created January 31, 2012 17:55
Mark code 4
// User ID
var _id;
// Handler to be executed when all dependencies are done
document.addEventListener('appready', function() {
kinvey.user.fetch(_id, function(user) {
// User found, go ahead and render page
});
}, false);
public class UploadVideoActivity extends Activity {
private KCSClient sharedClient;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the shared instance of the Kinvey Service client
sharedClient = ((KinveyVidUploadApp) getApplication()).getKinveyService();
// We use a separate function rather than defining this
// twice: once for the Model, and once for the Collection
kinveyAuthenticatedSync = (method, model, options) ->
// Before we send the request ...
options.beforeSend = (jqXHR) ->
// Add the Basic Authentication header
jqXHR.setRequestHeader(
'Authorization',
filterOnEnter: (e) ->
if e.keyCode is 13
Todos.filterString = @$("#filter-string").val()
Todos.fetch()
addAll: =>
// make sure to clear the list first!
@$("#todo-list").empty()
Todos.each(@addOne)
auth = $.base64.encode( "#{kinvey_app_key}:#{kinvey_master_secret}" ")
jqueryXHR.setRequestHeader("Authorization", "Basic #{auth}")
idAttribute: '_id'