Skip to content

Instantly share code, notes, and snippets.

@philipimperato
philipimperato / useCommentFind.ts
Last active February 4, 2023 18:03
Simple `useFind` that will preload data, allow for loading more & reseting
import { Ref, ComputedRef } from 'vue'
interface ICommentFindOptions {
increment: number,
initialSize?: number
}
interface ICommentFindResult {
data: ComputedRef<Comment[]>
hasMoreComments: ComputedRef<boolean>
@philipimperato
philipimperato / feathers-pinia-casl.md
Last active February 12, 2024 18:15
Using feather-casl with feathers-pinia, nuxt 3, and feathersjs (Dove)

Using feathers-casl with feathers-pinia and feathers Dove

Resources

  • [How to define CASL rules]
  • [Feathers-CASL Dove release v1.0.1]
  • [Feathers-CASL Feathers-vuex documentation] (most of this comes from here)

Feathers Dove + feathers-casl API

Required packages

casl @casl/ability@5 feathers-casl@pre

@philipimperato
philipimperato / gist:d91595917c59ff8376be1b6ea795706a
Created August 29, 2018 21:36
the route with the most H12 timeouts
routeConfig.post('/Dashboard/Index', repos.DashboardRepository.getRangeData(repos), (req, res) => {
let queries = [],
sess = req.userSession,
filter = req.rangeFilter;
queries.push(repos.PromotionRepository.getAgencyPromotions(sess.agencyId, 'all'));
queries.push(repos.DashboardRepository.getIndex(repos, filter, sess));
queries.push(repos.PolicyRepository.getPolicies(filter, true));
Promise.all(queries)
/* this is the first route hit */
routeConfig.all('/*', (req, res, next) => {
req.sessionStore.get(req.session.id, (err, sess) => {
/* sess.user is set on login */
if (sess && sess.user) {
/* logged in */
} else {
/* not logged in */
}
@philipimperato
philipimperato / 0_reuse_code.js
Created July 13, 2016 19:43
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