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
/** | |
* Created by Simon on 6/23/14. | |
*/ | |
// parsable url example parse?limit=2&offset=2&sort=grpId%20DESC&filter={"grpId":{">":"1"}} | |
// in api/services | |
exports.parseGetParams = function (params) { | |
var query = { | |
limit : 10, |
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
current: function (req, res){ | |
return User.findOne(req.session.user) | |
.then(function (user) { | |
if (!user) return {msg:'User not found.'}; | |
var today = new Date(); | |
var hash = user.fullName + today.getDay(); | |
return [{ | |
fullName: user.fullName, | |
role: user.role, | |
id: user.id, |
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
app.factory('CacheDB', ['$http', 'API', | |
function ($http, API) { | |
var db = new PouchDB('cachedb'); | |
return { | |
put: function (obj, id) { | |
db.put(obj, id) | |
.then(function (r) { | |
return r; | |
}); | |
}, |
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
// Enter the nodes. | |
// set different colors for task status | |
var nodeEnter = node.enter().append("g") | |
.attr("class", function (d) { | |
return "node" + " " + d.status; | |
}) | |
.attr("transform", function(d) { | |
return "translate(" + d.y + "," + d.x + ")"; }); | |
nodeEnter.append("circle") |
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
ng-repeat="task in tasks | orderBy: '-createdAt'" |
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
/** | |
* Directive to focus autocomplete popover when it shown | |
* @author Mirolim Mirzakhmedov mirolim777 at gmail dot com | |
*/ | |
app.directive('focusPopover', function($timeout) { | |
return function(scope, element) { | |
$timeout(function() { | |
element.focus(); | |
}); | |
} |
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
/** | |
* Caching service via pouchDb | |
* @link http://pouchdb.com/ | |
* @author Mirolim Mirzakhmedov mirolim777 at gmail.com | |
* @date 03.07.2014 | |
*/ | |
app.factory('CacheDB', ['$http', 'API', | |
function ($http, API) { | |
var db = new PouchDB('cachedb'); |
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
// DEFINE cache _ID in one place | |
// like for update, create, last disconnect and so on | |
// add children collection to task model | |
children:{ | |
collection: 'task', | |
via: 'parentTaskId' | |
// fix problem with sails crash (waterline) when model send with extra fields | |
// clean obj before so sails will not crash, should be cleaned in TaskController actions update and create |
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
if ( window.location !== window.parent.location ) { | |
// The page is in an iframe | |
} else { | |
// The page is not in an iframe | |
} |
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
package main | |
import ( | |
"fmt" | |
"flag" | |
//"errors" | |
//"os" | |
//"strings" | |
"strconv" | |
"math/rand" |
OlderNewer