This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async.waterfall [ | |
(next) -> | |
users = red back.createHash 'facebook_uids' | |
console.log '1' | |
next null, users | |
, (users, next) -> | |
console.log '2' | |
users.get fbMetadata.uid, (err, reply) -> | |
console.log "3 = #{ reply }" | |
next null, reply |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Declaration | |
findFBUser: (fbMetadata, callback) -> | |
users = redback.createHash "facebook_uids" | |
users.get fbMetadata.uid, (err, reply) -> | |
callback reply | |
# Usage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mongorito = require 'mongorito' | |
Mongorito.connect ['127.0.0.1:27017/databaseName'] | |
class User | |
keys: ['email', 'api_token'] | |
afterCreate: -> | |
@api_token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var albums = new Chute.API.Albums({ oauth_token: 'OAUTH_TOKEN' }); | |
albums.fetch({ success: function(){ | |
_(albums.models).forEach(function(album){ | |
// album is an instance of Chute.API.Album | |
}); | |
}, error: function(){ | |
// something wrong happened | |
}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var album = new Chute.API.Album({ album: 'ALBUM_SHORTCUT' }); | |
album.fetch({ success: function(){ | |
var name = album.get('name'); // get album's name | |
}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var album = new Chute.API.Album({ album: 'ALBUM_SHORTCUT' }); | |
album.assets({ success: function(assets){ | |
_(assets).forEach(function(asset){ | |
// asset is an instance of Chute.API.Asset | |
}); | |
}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assets = new Chute.API.Assets({ album: 'ALBUM_SHORTCUT' }); | |
assets.fetch({ success: function(){ | |
_(assets.models).forEach(function(asset){ | |
// asset is an instance of Chute.API.Asset | |
}); | |
}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assets = new Chute.API.Assets({ album: 'ALBUM_SHORTCUT', username: 'steve' }); // fetching only assets of user 'steve' | |
assets.fetch({ success: function(){ | |
_(assets.models).forEach(function(asset){ | |
// asset is an instance of Chute.API.Asset | |
}); | |
}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var asset = new Chute.API.Asset({ album: 'ALBUM_SHORTCUT', asset: 'ASSET_SHORTCUT' }); | |
asset.fetch({ success: function(){ | |
var url = asset.get('url'); // getting asset's URL | |
}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var asset = new Chute.API.Asset({ album: 'ALBUM_SHORTCUT', asset: 'ASSET_SHORTCUT' }); | |
if(asset.hearted() == false) { // use hearted() method to check if asset was already hearted by this client before | |
asset.heart({ success: function(){ | |
// asset hearted | |
}}); | |
} else { | |
asset.unheart({ success: function(){ | |
// asset unhearted | |
}}); |
OlderNewer