Skip to content

Instantly share code, notes, and snippets.

View emboh's full-sized avatar
🏠
Working from home

Hans Maatita emboh

🏠
Working from home
  • Sydney
  • 07:50 (UTC +11:00)
View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active September 25, 2025 20:44
Minimal APIs at a glance
export function magicMethods (clazz) {
// A toggle switch for the __isset method
// Needed to control "prop in instance" inside of getters
let issetEnabled = true
const classHandler = Object.create(null)
// Trap for class instantiation
classHandler.construct = (target, args, receiver) => {
// Wrapped class instance
@stalniy
stalniy / abilities.js
Created January 5, 2018 20:58
CASL Vue routes
import { AbilityBuilder, Ability } from 'casl'
// Alternatively this data can be retrieved from server
export default function defineAbilitiesFor(user) {
const { rules, can } = AbilityBuilder.extract()
can('read', 'User')
can('update', 'User', { id: user.id })
if (user.role === 'doctor') {