Skip to content

Instantly share code, notes, and snippets.

@ilianaza
ilianaza / lb-hide-by-name-alt.js
Last active August 29, 2015 14:08
loopback: hide/disable individual api methods
module.exports = function(Lesson) {
// POST /lessons
Lesson.sharedClass.find("create", true).shared = false;
// GET /lessons
Lesson.sharedClass.find("find", true).shared = false;
// PUT /lessons
Lesson.sharedClass.find("upsert", true).shared = false;
@ilianaza
ilianaza / lb-hide-by-http-verb.js
Last active August 29, 2015 14:08
loopback: hide/disable api methods by http verb
module.exports = function(Lesson) {
/*
"get":
GET /lessons
GET /lessons/{id}
GET /lessons/findOne
GET /lessons/count
"post":
POST /lessons
@ilianaza
ilianaza / lb-hide-by-name.js
Last active August 29, 2015 14:08
loopback: hide/disable api methods by name
module.exports = function(Lesson) {
// Hide methods by method name
var hideMethods = [
"create", // POST /lessons
"find", // GET /lessons
"upsert", // PUT /lessons
"updateAttributes", // PUT /lessons/{id}
"exists", // HEAD /lessons/{id} or GET /lessons/{id}/exists
"findById", // GET /lessons/{id}
@ilianaza
ilianaza / angular: partition filter.md
Last active August 29, 2015 14:04
AngularJS "partition" or "split" filter for ng-repeat directive

ng-repeat filter that splits data into multiple sorted columns

It breaks or splits an array of elements into multidimensional array where data is sorted either horizontally (by row) or vertically (by column).

partitionFilter(array, columns, vsort), where
array   - input array
columns - number of columns or partition size
vsort   - boolean value for vertical sort (default "true"), 
 if set to false then data sorted horizontally