Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am frankely on github.
  • I am frankely (https://keybase.io/frankely) on keybase.
  • I have a public key ASCvAqVVziizhB2xuH47nJgtRyUM9WibQ-lvgkZvDz0snwo

To claim this, I am signing this object:

@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
@frankely
frankely / azure-pipelines-pulumi-az-webapi-deployment.yml
Last active July 24, 2020 20:08
Pulumi Azure DevOps Pipeline .Net Core WebApi Deployment
pool:
vmImage: 'ubuntu-latest'
trigger:
batch: true
branches:
include:
- master
- releases/*
paths:
{"error":{"code":null,"message":"Keyword not supported: 'provider'.","technicalDetail":" at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)\r\n at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)\r\n at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)\r\n at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)\r\n at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)\r\n at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)\r\n at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)\r\n at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,T
@frankely
frankely / EmployeeTypeController.cs
Created September 22, 2014 17:44
Employee Type
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Maven.Trakr.Models.Entities;
namespace Maven.Trakr.Api.Controllers
{
<changeSet id="" author="">
<comment></comment>
<sqlFile dbms="oracle"
encoding="utf8"
path=""
relativeToChangelogFile="true"
splitStatements="true"
endDelimiter="//"/>
</changeSet>
public class LoggerHelper {
private Logger logger;
private LoggerHelper(Class clazz) {
logger = Logger.getLogger(clazz);
}
public static LoggerHelper createLogger(Class clazz) {
return new LoggerHelper(clazz);
}
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