Skip to content

Instantly share code, notes, and snippets.

@frankely
frankely / app.js
Created April 28, 2022 18:21 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
public void selectedRowsCount(ActionEvent actionEvent)
{
UIComponent comp = actionEvent.getComponent();
RichTable table = (RichTable)comp.getAttributes().get("tableInstance");
RowKeySet rks = table.getSelectedRowKeys();
System.out.println(String.format("The table with id='%s' have %d selected rows", table.getId(), rks.getSize()));
}
@frankely
frankely / 0_reuse_code.js
Created February 13, 2014 04:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console