This file contains 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
toJSON: function() { | |
var obj = this.toObject(); | |
delete obj.password; | |
delete obj.credentials; | |
delete obj.email; | |
delete obj.identifier; | |
return obj; | |
}, |
This file contains 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
- (void) socketIODidConnect:(SocketIO *)socket | |
{ | |
NSLog(@"socket.io connected."); | |
SocketIOCallback cb = ^(id argsData) { | |
NSDictionary *response = argsData; | |
NSLog(@"%@",response); |
This file contains 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
/** | |
* sails.io.js | |
* | |
* This file is completely optional, and merely here for your convenience. | |
* | |
* It reduces the amount of browser code necessary to send and receive messages | |
* to & from Sails by simulating a REST client interface on top of socket.io. | |
* It models its API after the pattern in jQuery you might be familiar with. | |
* | |
* So to switch from using AJAX to Socket.io, instead of: |
This file contains 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
angular.module('BBPlnkr').factory 'Widget', ($templateCache, Restangular) -> | |
_baseWidgets | |
_baseWidgets = Restangular.all('api/widgets') | |
widget = { | |
name: 'someWidget' #This needs to fuck off | |
} | |
#Added extra param to saveWidget | |
saveWidget: (snippets, fileName) -> | |
//or whatever | |
widget.file_name = fileName |
This file contains 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
/** | |
* Module dependencies | |
*/ | |
var util = require('util'); | |
/** | |
* Find Records | |
* |
This file contains 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
blas.queryAndGroup = function (permissions) { | |
var deferred = $q.defer() | |
// load accounts from backend and group by owner | |
var foobar = $resource( | |
'/api/accounts', { | |
}, { | |
query: { | |
method: 'GET', |
This file contains 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 user = User.get({userId:123},shitWentRight,shitWentWrong); | |
function shitWentRight(){} | |
function shitWentWrong(){} |
This file contains 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
//1st way | |
module.exports.foo = function(){ | |
console.log('foo!') | |
} | |
module.exports.bar = function(){ | |
console.log('bar!') | |
} |
This file contains 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
function getFoos(){ | |
//create your promise here | |
var myPromise = $q.defer() | |
//do something async | |
$http.get('/foos').then(function(response){ | |
//if successful | |
if(response.data){ |
This file contains 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
beforeUpdate: function(values, next) { | |
if (values.password) { | |
hashPassword(values, next); | |
} | |
else { | |
User.findOne(values.id).done(function(err, user) { | |
if (err) { | |
next(err); | |
} | |
else { |
OlderNewer